Skip to content

[evm-tracing-0-1] add debug e2e tests logic implementation#1575

Merged
dmitrylavrenov merged 1 commit intoevm-debug-tracefrom
evm-debug-e2e-logic
Aug 26, 2025
Merged

[evm-tracing-0-1] add debug e2e tests logic implementation#1575
dmitrylavrenov merged 1 commit intoevm-debug-tracefrom
evm-debug-e2e-logic

Conversation

@dmitrylavrenov
Copy link
Contributor

@dmitrylavrenov dmitrylavrenov commented Jul 21, 2025

The example list of different existing debug RPC methods for Ethereum:
- https://therpc.io/docs/ethereum/debug-methods/debug_traceCall
- https://www.chainnodes.org/docs/ethereum/debug_traceCall
- https://docs.chainstack.com/reference/ethereum-tracecall
- https://geth.ethereum.org/docs/interacting-with-geth/rpc/ns-debug#debugtracecall

The team has agreed on using moonbeam as a base code for implementing EVM tracing related tests.

The following basic tests have been implemented:

Tested over moonbeam-peer in dev mode with moonbase-runtime-3800-substitute-tracing.wasm overrides
Screenshot from 2025-08-07 14-21-22

@dmitrylavrenov
Copy link
Contributor Author

@MOZGIII Please, check the example list of debug RPCs for Ethereum in the PR's description. There are some differences between them in implementations: request/response types, supported tracers, even disable/enable terminology usage like disableMemory vs enableMemory.

The question is: should we take into account current Moonbeam implementation for e2e test logic to avoid "possible" incompatibility (otherwise, not sure if everything will work as expected without additional moonbeam ported code changes due to having different debug RPC implementations) ?

Another idea - just refer to geth source code and do everything according to this implementation later fixing moonbeam ported code if it would required.

@MOZGIII
Copy link
Contributor

MOZGIII commented Jul 22, 2025

For the E2E, let's try to write up a clear spec and test cases, with comments on what options are available and what we base them on; it is unclear as to what exact tracer format we'd want to use - so I suggest we simply use implement multiple E2E tests checking all variants.
Then, we would have a clear spec, with examples organized universally and all in once place. This would be a good thing to start from, as then we can check what moonbeam supports, and select an optimal strategy for our implementation. For instance, we could start with a simple port of moonbeam code first - with an clear understanding of what portion of our spec that will cover exactly (because we see the tests pass); then we may take some more time to alter the implementation and adjust our code.

In essence, the main differences are often at the RPC formats, and there's no reason why we couldn't do some smart translation at struct parsing to support all variants, as in disableMemory / enableMemory.

@MOZGIII
Copy link
Contributor

MOZGIII commented Jul 23, 2025

Essentially, the scope of the implementation for something like this should be defined here - at the test.

I propose the we cover the following basic APIs:

The idea would be to have this loosely - reasonably loosely - follow the geth implementation; pretty sure the is the same goal that moonbeam had for their design.

The way we can test this, in practice, in via a block explorer - like blockscout. This could be a good addition to the e2e tests - as essentially this is what we want to support (one of the main use-cases).

In the e2e tests, we should capture the request / response of the corresponding calls made to the geth node, and base our test scenarios on that (i.e. for the same contracts / calls the outputs should be the same, excluding things like block number, time and random stuff)

@MOZGIII
Copy link
Contributor

MOZGIII commented Jul 23, 2025

The question is: should we take into account current Moonbeam implementation for e2e test logic to avoid "possible" incompatibility (otherwise, not sure if everything will work as expected without additional moonbeam ported code changes due to having different debug RPC implementations) ?

We could borrow the moonbeam end-to-end test scenarios / scenario ideas if it is hard to make up our own. Whether we should take their request/response samples instead of creating our own - that's debatable. I wouldn't trust they did it correctly in the first place.

Another idea - just refer to geth source code and do everything according to this implementation later fixing moonbeam ported code if it would required.

I think we should look at both places, and everywhere else; but most of all - what the consumers of these APIs usually expect.
As in, blockscout actually depends on javascript support at tracing APIs - this is something that is not really supported at moonbeam afaik, but they hacked in the emulation if the support - they check if the requested javascript snippet matches the blockscout-used code, and if it does they run custom rust code to match what that javascript would do.
We should do the same.

What matters is that we make the API usable, in the sense that real users can rely on it. It's not our API design, it is a compatibility layer - so we don't have to design the interface, just implement (a subset of) it.

Base automatically changed from evm-debug-e2e-test to evm-debug-trace July 28, 2025 18:03
@dmitrylavrenov dmitrylavrenov force-pushed the evm-debug-e2e-logic branch 6 times, most recently from 7bc108b to 1d1e43a Compare July 30, 2025 09:41
@dmitrylavrenov dmitrylavrenov force-pushed the evm-debug-e2e-logic branch 13 times, most recently from 1e6df3f to 412f2ec Compare August 7, 2025 09:48
@dmitrylavrenov dmitrylavrenov requested a review from MOZGIII August 7, 2025 11:23
@dmitrylavrenov dmitrylavrenov marked this pull request as ready for review August 7, 2025 11:26
@MOZGIII MOZGIII changed the title [evm-tracing-0-1] add debug e2e logic implementation [evm-tracing-0-1] add debug e2e tests logic implementation Aug 13, 2025
Copy link
Contributor

@MOZGIII MOZGIII left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the hooks fail... I wonder why is that.

@dmitrylavrenov
Copy link
Contributor Author

Seems like the hooks fail... I wonder why is that.

What do you mean by the hooks fail? It should fail until we merge the rest PRs

@MOZGIII
Copy link
Contributor

MOZGIII commented Aug 18, 2025

Seems like the hooks fail... I wonder why is that.

The tests wait for a condition that never happens? Shouldn't they just fail immediately after an assertion fails? I.e. when an RPC request fails with an error?

@dmitrylavrenov
Copy link
Contributor Author

Seems like the hooks fail... I wonder why is that.

The tests wait for a condition that never happens? Shouldn't they just fail immediately after an assertion fails? I.e. when an RPC request fails with an error?

The tests wait for a condition that node is running. The current version doesn't have evm tracing related cli params. So, the node pid is not available to continue tests logic.

It happens with any tests if we pass invalid cli params. Maybe, we should restrict it somehow at e2e tests logic ?

@MOZGIII
Copy link
Contributor

MOZGIII commented Aug 18, 2025

I see; if we pass invalid cli args and the node crashes we probably should abort the test and mark it as crashed; I'll implement it

Copy link
Contributor

@quasiyoke quasiyoke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and ran tests. Took runtime overrides from the Docker image moonbeam-tracing. Node launch arguments had to be changed:

args: [
  ...
  "--wasm-runtime-overrides=<OVERRIDES_DIR>",
  "--public-addr=/ip4/0.0.0.0/tcp/9944",
],

Also changed the chain ID:

defineChain({
  id: 0x501,

Launched with the following command:

HUMANODE_PEER_PATH=<PATH> ./run-tests evm-tracing

Sources — LGTM.

@dmitrylavrenov dmitrylavrenov merged commit 1a7c611 into evm-debug-trace Aug 26, 2025
22 of 23 checks passed
@dmitrylavrenov dmitrylavrenov deleted the evm-debug-e2e-logic branch August 26, 2025 05:24
github-merge-queue bot pushed a commit that referenced this pull request Dec 4, 2025
* Add CI check for build with evm-tracing feature

* Add evm-tracing feature to humanode-runtime

* [evm-tracing-0] add evm-tracing test suite to e2e ts tests (#1574)

* Add build for evm-tracing at e2e code job

* Skip bash tests for evm-tracing test suite

* Add template for evm-tracing test suite

* [evm-tracing-0-1] add debug e2e tests logic implementation (#1575)

* [evm-tracing-1] runtime level implementation (#1544)

Runtime level implementation

* [evm-tracing-2] сlient-side implementation (#1565)

Client-side implementation

* [evm-tracing-3] implement RPC side (#1568)

Implement RPC side

* [evm-tracing-4] cli part implementation (#1572)

* [evm-tracing] Add more e2e tests (#1622)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants