-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: ETH TRACE API: Trace installed bytecode in the Ethereum JSON-RPC trace_block output #11984
Conversation
@Stebalien Does this look correct ? |
if deployedCode != nil { | ||
var getBytecodeReturn evm12.GetBytecodeReturn | ||
if err := getBytecodeReturn.UnmarshalCBOR(bytes.NewReader(et.MsgRct.Return)); err == nil && getBytecodeReturn.Cid != nil { | ||
deployedCode[abi.ActorID(id)] = getBytecodeReturn.Cid |
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.
@Stebalien This is not correct. How do I get the byte code of the contract here ?
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 I need to make a call to the GetBytecode
method of the contract Actor ?
Looks like none of the trace types we here have the byte code in them.
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.
Sorry, I missed this question. You can actually just read the bytecode from the EVM actor state (load the actor and call GetBytecode
using the actor shims.
However, you have to do this after building the trace (see #11984 (comment))
cc @eshon this PR should fix the issue you brought up in our 1:1! |
All checks have completed |
var deployed map[abi.ActorID]*cid.Cid | ||
if ir.MsgRct.ExitCode.IsSuccess() { | ||
deployed = deployedCode | ||
} |
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 need to do this per sub-trace. The top-level message can succeed while sub-messages cain fail.
Basically, move this into buildTraces
and, if the receipt of the currently processed message has a non-zero exit code, set this to nil for the sub-call.
for _, trace := range allTraces { | ||
switch r := trace.Result.(type) { |
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.
This isn't correct, we want to update the last one only. The idea was to record a pointer to r.Code
in deployedCode
, so we could set it without even having to look at the traces. That is:
deployedCode := make(map[abi.ActorID]*EthBytes)
Then, inside the buildTraces
logic, we'd record deployedCode[receiverID] = &r.Code
.
Finally, we'd iterate over deployedCode
and set *deployedCode[receiverID] = loadByteCode(receiverID)
, as long as the receiver is still live.
@aarshkshah1992 : I'm moving this back to draft given it hasn't been updated for a few months and I'm not aware of it being a priority currently. |
@BigLep Closing this as Im not sure if this is correct and it needs engagement from Steb if we get to it again. |
Related Issues
Closes #11635.
Proposed Changes
Additional Info
Checklist
Before you mark the PR ready for review, please make sure that:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, testarea
, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps