Skip to content

Commit

Permalink
Merge branch 'main' into ud/2408/eth-rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine committed Sep 12, 2024
2 parents f92de5e + 6ba79bb commit 121287d
Show file tree
Hide file tree
Showing 6 changed files with 313 additions and 104 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#2022](https://github.com/NibiruChain/nibiru/pull/2022) - feat(evm): debug_traceCall method implemented
- [#2023](https://github.com/NibiruChain/nibiru/pull/2023) - fix(evm)!: adjusted generation and parsing of the block bloom events
- [#2030](https://github.com/NibiruChain/nibiru/pull/2030) - fix(eth/rpc): test and fix eth_getTransactionByHash and eth_getLogs. This is meant to address a bug where the EVMIndexer has a discrepenacy during tx search depending on how the "eth_getTransactionByHash" request is sent. Additionally, this change adjusts the `testnetwork` full node setup to mirror production more closely and expose the structs for the Ethereum JSON-RPC API.
- [#2031](https://github.com/NibiruChain/nibiru/pull/2031) - fix(evm): debug calls with custom tracer and tracer options

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

Expand Down
3 changes: 3 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ import (
"github.com/prometheus/client_golang/prometheus"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"

// force call init() of the geth tracers
_ "github.com/ethereum/go-ethereum/eth/tracers/native"
)

const (
Expand Down
35 changes: 29 additions & 6 deletions e2e/evm/test/debug_queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,36 @@ describe("debug queries", () => {
it("debug_traceBlockByNumber", async () => {
const traceResult = await provider.send("debug_traceBlockByNumber", [
blockNumber,
{
tracer: "callTracer",
timeout: "3000s",
tracerConfig: { onlyTopCall: false },
},
])
expectTrace(traceResult)
})

it("debug_traceBlockByHash", async () => {
const traceResult = await provider.send("debug_traceBlockByHash", [
blockHash,
{
tracer: "callTracer",
timeout: "3000s",
tracerConfig: { onlyTopCall: false },
},
])
expectTrace(traceResult)
})

it("debug_traceTransaction", async () => {
// it.skip("debug_traceTransaction", async () => {
const traceResult = await provider.send("debug_traceTransaction", [txHash])
const traceResult = await provider.send("debug_traceTransaction", [
txHash,
{
tracer: "callTracer",
timeout: "3000s",
tracerConfig: { onlyTopCall: false },
},
])
expectTrace([{ result: traceResult }])
})

Expand All @@ -60,7 +76,11 @@ describe("debug queries", () => {
const traceResult = await provider.send("debug_traceCall", [
tx,
"latest",
{},
{
tracer: "callTracer",
timeout: "3000s",
tracerConfig: { onlyTopCall: false },
},
])
expectTrace([{ result: traceResult }])
})
Expand Down Expand Up @@ -103,8 +123,11 @@ const expectTrace = (traceResult: any[]) => {
expect(traceResult.length).toBeGreaterThan(0)

const trace = traceResult[0]["result"]
expect(trace).toHaveProperty("failed", false)
expect(trace).toHaveProperty("from")
expect(trace).toHaveProperty("to")
expect(trace).toHaveProperty("gas")
expect(trace).toHaveProperty("returnValue")
expect(trace).toHaveProperty("structLogs")
expect(trace).toHaveProperty("gasUsed")
expect(trace).toHaveProperty("input")
expect(trace).toHaveProperty("output")
expect(trace).toHaveProperty("type", "CALL")
}
9 changes: 7 additions & 2 deletions proto/eth/evm/v1/evm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ message AccessTuple {
repeated string storage_keys = 2 [ (gogoproto.jsontag) = "storageKeys" ];
}

// TracerConfig stores additional tracer args. For geth it's only one attr: onlyTopCall
message TracerConfig {
bool only_top_call = 1 [ (gogoproto.jsontag) = "onlyTopCall" ];
}

// TraceConfig holds extra parameters to trace functions.
message TraceConfig {
// DEPRECATED: DisableMemory and DisableReturnData have been renamed to
Expand Down Expand Up @@ -173,6 +178,6 @@ message TraceConfig {
bool enable_memory = 11 [ (gogoproto.jsontag) = "enableMemory" ];
// enable_return_data switches the capture of return data
bool enable_return_data = 12 [ (gogoproto.jsontag) = "enableReturnData" ];
// tracer_json_config configures the tracer using a JSON string
string tracer_json_config = 13 [ (gogoproto.jsontag) = "tracerConfig" ];
// tracer_config configures the tracer options
TracerConfig tracer_config = 13 [ (gogoproto.jsontag) = "tracerConfig" ];
}
Loading

0 comments on commit 121287d

Please sign in to comment.