-
Notifications
You must be signed in to change notification settings - Fork 159
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
feat(rpc) Implement Filecoin.EthTraceBlock
#4991
Conversation
src/shim/error.rs
Outdated
code if code > ExitCode_latest::SYS_MISSING_RETURN.value() | ||
&& code < ExitCode_latest::FIRST_USER_EXIT_CODE => | ||
{ | ||
write!(f, "SysErrReserved{}({})", code - 10, code) |
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.
Why subtract 10?
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.
We want to align errors with Lotus display, so code - 10
does that.
Maybe using SYS_ASSERTION_FAILED
code instead? (it equals to 10).
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.
Do you know why Lotus subtracts 10? I'm okay with having it as well. Just please comment in the code the reason for this so the magic number is less magical.
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.
Sure, I will explain in a comment the rational behind this.
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.
I think there is a better, cleaner and more correct solution to match Lotus exit codes.
We just need to create a PR in ref-fvm to uncomment those dead lines:
https://github.com/filecoin-project/ref-fvm/blob/master/shared/src/error/mod.rs#L64
https://github.com/filecoin-project/ref-fvm/blob/master/shared/src/error/mod.rs#L74
https://github.com/filecoin-project/ref-fvm/blob/master/shared/src/error/mod.rs#L81-L84
And add those constants to our match expression in forest/src/shim/error.rs
.
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.
Let's address that in a subsequent PR.
src/rpc/methods/eth/trace.rs
Outdated
use fil_actor_eam_state::v12 as eam12; | ||
use fil_actor_evm_state::v15 as evm12; | ||
use fil_actor_init_state::v12::ExecReturn; | ||
use fil_actor_init_state::v15::Method as InitMethod; | ||
use fvm_ipld_blockstore::Blockstore; | ||
use fvm_shared4::{error::ExitCode as ExitCodeV4, METHOD_CONSTRUCTOR}; |
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.
Do we have to lock the actor version and the FVM version here? It would be great to avoid it and work through actor interface and shims.
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.
I can have a look.
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.
In general, does Lotus have a more extensive suite for this tracing? If so, could we migrate some of those tests?
Unfortunately, no. They have very few tests. I've already migrated the one that tests |
Well, then, fortunately, I'm a man of great faith. 🙏 |
Summary of changes
Changes introduced in this pull request:
Filecoin.EthTraceBlock
eth::decode_payload
and add unit testsReference issue to close (if applicable)
Closes #4708
Other information and links
Change checklist