Skip to content
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

Add new tracing API #11100

Merged
merged 25 commits into from
Aug 30, 2023
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1b0f54a
Add new tracing API
fridrik01 Jul 24, 2023
c1eaa2f
Translate call input/output into Solidity ABI
fridrik01 Aug 1, 2023
2c902db
Handle more edge cases
fridrik01 Aug 3, 2023
392ef1b
Handle delegatecall
fridrik01 Aug 3, 2023
abeb842
Address lint errors
fridrik01 Aug 4, 2023
fd69f8b
Check all errors
fridrik01 Aug 8, 2023
7f99d15
Small refactor and cleanup
fridrik01 Aug 8, 2023
ba1ee60
Refactor eth.go
fridrik01 Aug 16, 2023
ebb54bc
fix naming lint
fridrik01 Aug 21, 2023
4068e07
Do not return interface{} from trace api methods
fridrik01 Aug 22, 2023
a1b890c
return wrapped errors
fridrik01 Aug 22, 2023
ef7bcfe
Do not compute message index as traces should be in message execution…
fridrik01 Aug 22, 2023
8d8891a
Moved tracing types to ethtypes to address circular dependencies
fridrik01 Aug 22, 2023
cb5e6e0
The From/To address should be in eth format
fridrik01 Aug 23, 2023
cf25512
Decode eth param/return values and change them to ethbytes type
fridrik01 Aug 24, 2023
ee3cdf0
Fix use filecoin addr + other small refactor
fridrik01 Aug 25, 2023
10a5480
Decode output using top level trace
fridrik01 Aug 25, 2023
029a4a7
Address most recent comments
fridrik01 Aug 25, 2023
ed40768
Parse input/output for delegate call + other smaller things
fridrik01 Aug 25, 2023
aef0ecf
Run make gen
fridrik01 Aug 28, 2023
57e8259
Update FFI
fridrik01 Aug 28, 2023
930e9b9
fix lint
fridrik01 Aug 28, 2023
13e1b4b
Added todo to support native actors calling another when created
fridrik01 Aug 29, 2023
144bbdf
Added trace api as experimental feature to changelog
fridrik01 Aug 29, 2023
0096d52
fix decoding toplevel output in trace_replayBlockTransactions
fridrik01 Aug 29, 2023
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
Prev Previous commit
Next Next commit
Handle delegatecall
  • Loading branch information
fridrik01 committed Aug 28, 2023
commit 392ef1beb7db78b3c01a68524a9c32dafad0d3e4
19 changes: 12 additions & 7 deletions node/impl/full/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type Action struct {
Input string `json:"input"`
Value ethtypes.EthBigInt `json:"value"`

// TODO: remove these fields from json output
Method abi.MethodNum `json:"method"`
CodeCid cid.Cid `json:"codeCid"`
}
Expand Down Expand Up @@ -326,6 +327,8 @@ func buildTraces(traces *[]*Trace, parent *Trace, addr []int, et types.Execution
}

trace.setCallType("call")

// TODO: is it OK to check this here or is this only specific to certain edge case (evm to evm)?
if et.Msg.ReadOnly {
trace.setCallType("staticcall")
}
Expand Down Expand Up @@ -398,12 +401,7 @@ func buildTraces(traces *[]*Trace, parent *Trace, addr []int, et types.Execution
// and should be dropped from the trace.
if builtinactors.IsEvmActor(parent.Action.CodeCid) && et.Msg.Method > 0 && et.Msg.Method <= 1023 {
log.Infof("found outbound call from an EVM actor on method 1-1023 method:%d, code:%s, height:%d", et.Msg.Method, et.Msg.CodeCid.String(), height)

for i, call := range et.Subcalls {
buildTraces(traces, trace, append(addr, i), call, height)
}

return
// TODO: if I handle this case and drop this call from the trace then I am not able to detect delegate calls
}

// EVM -> EVM calls
Expand All @@ -422,7 +420,14 @@ func buildTraces(traces *[]*Trace, parent *Trace, addr []int, et types.Execution
// 1) Look for from an EVM actor to itself on InvokeContractDelegate, method 6.
// 2) Search backwards in the trace for a call to another actor (A) on method 3 (GetBytecode)
// 3) Treat this as a delegate call to actor A.
// TODO: implement this
if trace.Action.From == trace.Action.To && trace.Action.Method == builtin2.MethodsEVM.InvokeContractDelegate && len(*traces) > 0 {
// the previous trace should be the GetBytecode call
prev := (*traces)[len(*traces)-1]
if prev.Action.From == trace.Action.From && prev.Action.Method == builtin2.MethodsEVM.GetBytecode {
trace.setCallType("delegatecall")
trace.Action.To = prev.Action.To
}
}
}

*traces = append(*traces, trace)
Expand Down