Skip to content

Commit 6ba79bb

Browse files
authored
fix(evm): debug calls with custom tracer and tracer options (#2031)
1 parent 64beba7 commit 6ba79bb

File tree

6 files changed

+314
-105
lines changed

6 files changed

+314
-105
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
117117
- [#2020](https://github.com/NibiruChain/nibiru/pull/2020) - test(evm): e2e tests for debug namespace
118118
- [#2022](https://github.com/NibiruChain/nibiru/pull/2022) - feat(evm): debug_traceCall method implemented
119119
- [#2023](https://github.com/NibiruChain/nibiru/pull/2023) - fix(evm)!: adjusted generation and parsing of the block bloom events
120+
- [#2031](https://github.com/NibiruChain/nibiru/pull/2031) - fix(evm): debug calls with custom tracer and tracer options
120121

121122
#### Dapp modules: perp, spot, oracle, etc
122123

app/app.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ import (
5252
"github.com/prometheus/client_golang/prometheus"
5353
"github.com/rakyll/statik/fs"
5454
"github.com/spf13/cast"
55+
56+
// force call init() of the geth tracers
57+
_ "github.com/ethereum/go-ethereum/eth/tracers/native"
5558
)
5659

5760
const (

e2e/evm/test/debug_queries.test.ts

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ describe("debug queries", () => {
3232
it("debug_traceBlockByNumber", async () => {
3333
const traceResult = await provider.send("debug_traceBlockByNumber", [
3434
blockNumber,
35+
{
36+
tracer: "callTracer",
37+
timeout: "3000s",
38+
tracerConfig: { onlyTopCall: false },
39+
},
3540
])
3641
expectTrace(traceResult)
3742
})
@@ -40,13 +45,24 @@ describe("debug queries", () => {
4045
it("debug_traceBlockByHash", async () => {
4146
const traceResult = await provider.send("debug_traceBlockByHash", [
4247
blockHash,
48+
{
49+
tracer: "callTracer",
50+
timeout: "3000s",
51+
tracerConfig: { onlyTopCall: false },
52+
},
4353
])
4454
expectTrace(traceResult)
4555
})
4656

47-
// TODO: impl in EVM: remove skip
48-
it.skip("debug_traceTransaction", async () => {
49-
const traceResult = await provider.send("debug_traceTransaction", [txHash])
57+
it("debug_traceTransaction", async () => {
58+
const traceResult = await provider.send("debug_traceTransaction", [
59+
txHash,
60+
{
61+
tracer: "callTracer",
62+
timeout: "3000s",
63+
tracerConfig: { onlyTopCall: false },
64+
},
65+
])
5066
expectTrace([{ result: traceResult }])
5167
})
5268

@@ -61,7 +77,11 @@ describe("debug queries", () => {
6177
const traceResult = await provider.send("debug_traceCall", [
6278
tx,
6379
"latest",
64-
{},
80+
{
81+
tracer: "callTracer",
82+
timeout: "3000s",
83+
tracerConfig: { onlyTopCall: false },
84+
},
6585
])
6686
expectTrace([{ result: traceResult }])
6787
})
@@ -90,8 +110,11 @@ const expectTrace = (traceResult: any[]) => {
90110
expect(traceResult.length).toBeGreaterThan(0)
91111

92112
const trace = traceResult[0]["result"]
93-
expect(trace).toHaveProperty("failed", false)
113+
expect(trace).toHaveProperty("from")
114+
expect(trace).toHaveProperty("to")
94115
expect(trace).toHaveProperty("gas")
95-
expect(trace).toHaveProperty("returnValue")
96-
expect(trace).toHaveProperty("structLogs")
116+
expect(trace).toHaveProperty("gasUsed")
117+
expect(trace).toHaveProperty("input")
118+
expect(trace).toHaveProperty("output")
119+
expect(trace).toHaveProperty("type", "CALL")
97120
}

proto/eth/evm/v1/evm.proto

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ message AccessTuple {
145145
repeated string storage_keys = 2 [ (gogoproto.jsontag) = "storageKeys" ];
146146
}
147147

148+
// TracerConfig stores additional tracer args. For geth it's only one attr: onlyTopCall
149+
message TracerConfig {
150+
bool only_top_call = 1 [ (gogoproto.jsontag) = "onlyTopCall" ];
151+
}
152+
148153
// TraceConfig holds extra parameters to trace functions.
149154
message TraceConfig {
150155
// DEPRECATED: DisableMemory and DisableReturnData have been renamed to
@@ -173,6 +178,6 @@ message TraceConfig {
173178
bool enable_memory = 11 [ (gogoproto.jsontag) = "enableMemory" ];
174179
// enable_return_data switches the capture of return data
175180
bool enable_return_data = 12 [ (gogoproto.jsontag) = "enableReturnData" ];
176-
// tracer_json_config configures the tracer using a JSON string
177-
string tracer_json_config = 13 [ (gogoproto.jsontag) = "tracerConfig" ];
181+
// tracer_config configures the tracer options
182+
TracerConfig tracer_config = 13 [ (gogoproto.jsontag) = "tracerConfig" ];
178183
}

0 commit comments

Comments
 (0)