Normalise rpc debug trace format
Which issue does this PR close?
- Closes #783
Changes
- Moved normalisation that Hardhat does on debug trace into EDR.
- Added new types
RpcDebugTraceResultandRpcDebugTraceLogItemthat conform to expected structure. - Added tests to validate trace structure against expected normalised structure.
How was this tested?
- Compared trace manually with output from Geth.
- Wrote test to validate normalised structure.
- Ran tests and verified all tests pass including old ones.
🦋 Changeset detected
Latest commit: 090729a2ab3f1369d2a795cbc595b1bd0e4d93f7
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @nomicfoundation/edr | Minor |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
@nebasuke This is my PR for the issue. I am available anytime to make the necessary changes.
Great, thank you @AmosAidoo, we appreciate the effort!
It will probably be @Wodann or @agostbiro that can take a look.
cd hardhat-tests && pnpm test:ci
Noticed I missed these tests. I'm taking a look.
Noticed I missed these tests. I'm taking a look.
Great, thanks! I'll re-run CI when needed.
the tests still expect the pass, gasUsed and opName fields so I added them in addition to the new format. Also, the tests still assume the memory and storage strings will have the leading 0x string.
So I guess this PR will need a follow-up issue after this is integrated into Hardhat. The hardhat tests will then have to be updated afterwards.
Great, thanks! I'll re-run CI when needed.
You can re-run the CI
Can you kindly re-run
Thank you for taking a stab at this. I left some requests to try and move the changes into
edr_provideras the current approach goes through multiple steps of serialization and deserialization.
Perfect, thank you for the review. I'll make the changes.
I made the necessary changes. Tests pass when I run them locally. Could you kindly re-trigger the ci.
Seems to be looking good so far regarding the tests. Looks like the remaining failures are because of environmental variables not set as I am an external contributor.
I have made some changes and replied to the questions
I added some information to the original issue on how to create test vectors for your code. You can essentially use geth to create some expected output formats and do string comparison between your generated output and the expected output.
Most of the info about
debug_traceCallis here, but note that they use a js lib, not the raw rpc, in the snippets. To be able to port it with confidence, we should create a few test cases using geth, and making sure we match their format.
Noted. Thank you
I added some information to the original issue on how to create test vectors for your code. You can essentially use geth to create some expected output formats and do string comparison between your generated output and the expected output.
Most of the info about
debug_traceCallis here, but note that they use a js lib, not the raw rpc, in the snippets. To be able to port it with confidence, we should create a few test cases using geth, and making sure we match their format.
@Wodann is it sufficient to use geth in dev mode to generate the test cases?
I added some information to the original issue on how to create test vectors for your code. You can essentially use geth to create some expected output formats and do string comparison between your generated output and the expected output.
Most of the info about
debug_traceCallis here, but note that they use a js lib, not the raw rpc, in the snippets. To be able to port it with confidence, we should create a few test cases using geth, and making sure we match their format.@Wodann is it sufficient to use geth in dev mode to generate the test cases?
I don't see why not; as long as the generated output conforms to the JSON-RPC spec.