-
Notifications
You must be signed in to change notification settings - Fork 185
Add support for the Filecoin.EthGetCode V2 #6490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a v2 RPC endpoint Filecoin.EthGetCode (EthGetCodeV2), centralizes bytecode retrieval into a shared async helper used by both EthGetCode variants, and adds tests plus snapshots for the new v2 endpoint. Changes
Sequence Diagram(s)sequenceDiagram
rect rgba(52,152,219,0.5)
participant Client
end
rect rgba(46,204,113,0.5)
participant RPC
end
rect rgba(241,196,15,0.5)
participant TipsetResolver
end
rect rgba(155,89,182,0.5)
participant MessageSystem
end
rect rgba(231,76,60,0.5)
participant SystemActor
end
Client->>RPC: EthGetCodeV2(address, block)
RPC->>TipsetResolver: resolve block (ExtBlockNumberOrHash)
TipsetResolver-->>RPC: tipset
RPC->>MessageSystem: invoke GetByteCode(to: address, tipset)
MessageSystem->>SystemActor: system.GetByteCode invocation
SystemActor-->>MessageSystem: return bytecode CID / failure
MessageSystem-->>RPC: delivery receipt / result
RPC-->>Client: bytecode (or null / error)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/rpc/methods/eth.rs`:
- Around line 2443-2497: In eth_get_code: before attempting to decode
msg_rct.return_data() (and before calling fvm_ipld_encoding::from_slice /
constructing GetBytecodeReturn), explicitly check msg_rct.exit_code() for
success (e.g., ExitCode::OK) and return an error if it indicates failure; this
mirrors the EthGetStorageAt pattern and prevents decoding invalid return data
from api_invoc_result/msg_rct when the receipt failed despite
api_invoc_result.error being empty.
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 7 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/rpc/methods/eth.rs`:
- Around line 2451-2472: The code currently calls
ctx.state_manager.get_required_actor(&to_address, *ts.parent_state()) which
fails for non-existent addresses and misses actors created in the tipset;
instead, first obtain the post-state using the existing
ctx.state_manager.tipset_state(ts, StateLookupPolicy::Enabled).await? result
(the state variable), then resolve the actor from that post-state (use the state
lookup API instead of get_required_actor) and treat a missing actor as “no code”
by returning Ok(Default::default()). Only call is_evm_actor(&actor.code) when
the actor exists. Ensure the actor lookup and the empty-code return replace the
current get_required_actor call so EthGetCode uses the same post-state as
call_on_state.
🧹 Nitpick comments (1)
src/rpc/methods/eth.rs (1)
2419-2441: Add rustdoc for the new public RPC type.
EthGetCodeV2is public but undocumented—please add a brief rustdoc comment.♻️ Suggested doc comment
+/// Returns the contract code at a given address for the v2 API. pub enum EthGetCodeV2 {}As per coding guidelines: Document all public functions and structs with rustdoc comments.
Summary of changes
Changes introduced in this pull request:
Filecoin.EthGetCodeV2 and added test.Reference issue to close (if applicable)
Closes #6299
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.