Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lotus_json/actor_states/evm_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct EVMStateLotusJson {
pub contract_state: Cid,

#[schemars(with = "LotusJson<Option<TransientData>>")]
#[serde(with = "crate::lotus_json", skip_serializing_if = "Option::is_none")]
#[serde(with = "crate::lotus_json")]
pub transient_data: Option<Option<TransientData>>, // only available in evm actor state v16
Comment on lines 24 to 26
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Don’t force TransientData on non-V16 states; keep skip_serializing_if to avoid regressions.

Without skip_serializing_if, Option::None serializes as null and the field is always present, which likely diverges from Lotus for versions where this field doesn’t exist. Keep the field omitted for non-V16 and explicitly include it (as null when absent) only for V16 via Some(None). This still fixes the parity failure while avoiding new ones.

Apply:

-    #[schemars(with = "LotusJson<Option<TransientData>>")]
-    #[serde(with = "crate::lotus_json")]
+    #[schemars(with = "LotusJson<Option<TransientData>>")]
+    #[serde(with = "crate::lotus_json", skip_serializing_if = "Option::is_none")]
     pub transient_data: Option<Option<TransientData>>, // only available in evm actor state v16
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[schemars(with = "LotusJson<Option<TransientData>>")]
#[serde(with = "crate::lotus_json", skip_serializing_if = "Option::is_none")]
#[serde(with = "crate::lotus_json")]
pub transient_data: Option<Option<TransientData>>, // only available in evm actor state v16
#[schemars(with = "LotusJson<Option<TransientData>>")]
#[serde(with = "crate::lotus_json", skip_serializing_if = "Option::is_none")]
pub transient_data: Option<Option<TransientData>>, // only available in evm actor state v16
🤖 Prompt for AI Agents
In src/lotus_json/actor_states/evm_state.rs around lines 24 to 26, the transien
t_data field currently serializes Option::None as null which forces the field to
always appear; add serde's skip_serializing_if on the outer Option so the field
is omitted for non-v16 states (i.e. #[serde(skip_serializing_if =
"Option::is_none")]) while preserving the type Option<Option<TransientData>> so
you can still represent v16 explicitly as Some(None) (serializes as null) and
earlier versions as None (omitted). Ensure the serde attribute is applied
alongside the existing crate::lotus_json attribute and keep the schemars line
unchanged.

💡 Verification agent

🧩 Analysis chain

Quick repository checks to prevent parity regressions.

Run to verify no accidental inclusions and catch the typo elsewhere.

Also applies to: 35-47, 76-83, 94-111


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# 1) Ensure only V16 paths set transient_data to Some(...)
rg -n -C2 'transient_data:\s*Option::from\(' src | cat

# 2) Verify common_evm_state_fields leaves transient_data as None for non-V16
rg -n -C2 'common_evm_state_fields!\(state,\s*V(1[0-9])\)' src | cat

# 3) Search for the typo anywhere else
rg -n '\borign\b' -C2

# 4) Grep snapshots mentioning TransientData to ensure expectations are explicit
rg -nP '"transient_data"\s*:\s*null' -C2

Length of output: 616


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== evm_state.rs (first 300 lines) ==="
sed -n '1,300p' src/lotus_json/actor_states/evm_state.rs || true

echo
echo "=== All occurrences of 'transient_data' in src ==="
rg -n --hidden --no-ignore-vcs -C2 '\btransient_data\b' src || true

echo
echo "=== occurrences of 'transient_data: Option::from(' ==="
rg -n --hidden --no-ignore-vcs -C2 'transient_data:\s*Option::from\(' src || true

echo
echo "=== occurrences of 'Option::from(state.transient_data)' ==="
rg -n --hidden --no-ignore-vcs -C2 'Option::from\(state\.transient_data\)' src || true

echo
echo "=== occurrences of 'common_evm_state_fields!' ==="
rg -n --hidden --no-ignore-vcs -C2 'common_evm_state_fields!' src || true

echo
echo "=== Match arms 'State::V...' in evm_state.rs ==="
rg -n --hidden --no-ignore-vcs -C2 'State::V[0-9]+' src/lotus_json/actor_states/evm_state.rs || true

echo
echo "=== Search repo for typo 'orign' ==="
rg -n --hidden --no-ignore-vcs -C2 '\borign\b' || true

echo
echo "=== Search for JSON snapshots with '\"transient_data\": null' ==="
rg -n --hidden --no-ignore-vcs -C2 -P '"transient_data"\s*:\s*null' || true

Length of output: 12292


transient_data parity OK; rename tombstone 'orign' field

  • transient_data is only populated for State::V16 (src/lotus_json/actor_states/evm_state.rs:80); common_evm_state_fields defaults it to None for other versions (src/lotus_json/actor_states/evm_state.rs:44); snapshots/migrations reflect null/None.
  • Rename TombstoneLotusJson.pub orign → origin and update all uses: src/lotus_json/tombstone.rs (decl: line 12; mappings: lines 39, 47) and src/lotus_json/actor_states/evm_state.rs (use: line 106).
🤖 Prompt for AI Agents
In src/lotus_json/actor_states/evm_state.rs around lines 24 to 26 and referenced
uses at line 80, 44 and 106: transient_data parity is correct so leave the
Option<Option<TransientData>> as-is, but rename the TombstoneLotusJson field
from pub orign to pub origin and update all usages accordingly; specifically,
change the declaration in src/lotus_json/tombstone.rs (line ~12) to origin and
update the mapping keys/usages at lines ~39 and ~47, then update the use site in
src/lotus_json/actor_states/evm_state.rs (line ~106) to reference origin instead
of orign so all references compile and JSON mappings remain consistent.


pub nonce: u64,
Expand Down
Loading