feat(rpc): Add support for the EthTraceReplayBlockTransactions V2 API#6444
feat(rpc): Add support for the EthTraceReplayBlockTransactions V2 API#6444akaladarshi merged 6 commits intomainfrom
EthTraceReplayBlockTransactions V2 API#6444Conversation
WalkthroughAdds a V2 RPC method Changes
Sequence Diagram(s)mermaid Client->>RPC: EthTraceReplayBlockTransactions request 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 |
62d9e13 to
1b2504a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 9 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
|
||
| let state = StateTree::new_from_root(ctx.store_owned(), &state_root)?; | ||
| pub enum EthTraceReplayBlockTransactionsV2 {} | ||
| impl RpcMethod<2> for EthTraceReplayBlockTransactionsV2 { |
There was a problem hiding this comment.
I didn't notice this earlier that some of the other API's also doesn't have a Description, I will create an issue for this so we can add in all API's.
There was a problem hiding this comment.
@coderabbitai create a issue for the adding Description to all the API's available in the forest.
There was a problem hiding this comment.
🧩 Analysis chain
@akaladarshi I'll create a GitHub issue to track adding DESCRIPTION fields to all RPC methods in Forest.
🏁 Script executed:
#!/bin/bash
# Create a GitHub issue for adding DESCRIPTION to all RPC methods
gh issue create \
--repo ChainSafe/forest \
--title "Add DESCRIPTION to all RPC methods" \
--body "## Background
Many RPC method implementations in Forest are missing the \`DESCRIPTION\` constant, which should provide documentation about what each method does.
## Task
Add the \`DESCRIPTION\` field to all RPC method implementations throughout the codebase. This will improve API documentation and help users understand what each method does.
## Example
\`\`\`rust
impl RpcMethod<2> for EthTraceReplayBlockTransactions {
const NAME: &'static str = \"Filecoin.EthTraceReplayBlockTransactions\";
const NAME_ALIAS: Option<&'static str> = Some(\"trace_replayBlockTransactions\");
const DESCRIPTION: Option<&'static str> = Some(
\"Replays all transactions in a block returning the requested traces for each transaction.\",
);
// ...
}
\`\`\`
## Context
Related PR: `#6444`
Related comment: https://github.com/ChainSafe/forest/pull/6444#discussion_r2709084181
cc: `@akaladarshi`" \
--assignee akaladarshi
Length of output: 47
@akaladarshi I've created issue #6460 to track adding DESCRIPTION fields to all RPC methods in Forest. The issue has been assigned to you and includes the context from this PR discussion.
| ctx: Ctx<impl Blockstore + Send + Sync + 'static>, | ||
| (block_param, trace_types): Self::Params, | ||
| ) -> Result<Self::Ok, ServerError> { | ||
| if trace_types.as_slice() != ["trace"] { |
There was a problem hiding this comment.
is there a point in using anyhow here? Seems to me it'd be easier to define a new method on ServerError, e.g., ServerError::unsupported_params. It'd be cheaper.
There was a problem hiding this comment.
I guess we can use the ServerError::invalid_params("only 'trace' is supported", None)
6cbc78a to
505c6f5
Compare
| #[serde(rename_all = "camelCase")] | ||
| pub struct EthReplayBlockTransactionTrace { | ||
| pub output: EthBytes, | ||
| #[serde(skip_serializing_if = "Option::is_none")] |
There was a problem hiding this comment.
what's the struct in Lotus?
There was a problem hiding this comment.
Here is the lotus struct for this, and yeah I saw in the lotus snapshot response that the fields are set to null.
There was a problem hiding this comment.
What's the Lotus snapshot response?
There was a problem hiding this comment.
Lotus returns something like this:
"lotus_response": {
"Ok": [
{
"output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
"stateDiff": null,
"trace": [
{
"action": {
"callType": "call",
"from": "0xff00000000000000000000000000000000021cc9",
"gas": "0xbdf9c",
"input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
"to": "0x0f96b5f075e13c3a552c1481a1ae00f9c042d58b",
"value": "0x917bd023e0703660"
},
"result": {
"gasUsed": "0x12d48f",
"output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
},
"subtraces": 0,
"traceAddress": [],
"type": "call"
}
],
"transactionHash": "0x77b925676c49edbc6096d6b67002202a11f8c0160cbba1fe40f4162cb734e598",
"vmTrace": null
},
Summary of changes
Changes introduced in this pull request:
EthTraceReplayBlockTransactionsV2 APIEthTraceReplayBlockTransactionsresponseReference issue to close (if applicable)
Closes #6308
Other information and links
Change checklist
Summary by CodeRabbit
New Features
Changes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.