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

Align debug_traceBlock/Transaction with geth #8186

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

wurdum
Copy link

@wurdum wurdum commented Feb 10, 2025

Changes

Updates debug_traceBlock and debug_traceTransaction to have response structures aligned with geth

debug_traceBlock diffs (before and after)

Options: {"disableMemory": true, "disableStack": true, "disableStorage": true, "enableMemory": false}

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": [
    {
+      "result": {
        "failed": false,
-        "gas": "0xb51d",
+        "gas": 46365,
         "returnValue": "0x0000000000000000000000000000000000000000000000000000000000000001",
        "structLogs": []
      },
+      "txHash": "0x8ee5f8d441cffd2bfc1e26241471ae41a6909359dab2e5abf5bb3b2c5d01fc0a"
    }
  ]
}

Options: {"tracer": "4byteTracer"}

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": [
    {
+      "result": {
-        "41304fac-96": 1,
+        "0x41304fac-96": 1,
-        "ce0b63ce-96": 2,
+        "0xce0b63ce-96": 2,
-        "d479ceaf-288": 2,
+        "0xd479ceaf-288": 2,
-        "d7704bae-32": 2
+        "0xd7704bae-32": 2
      },
+      "txHash": "0x1fd6e3c0161a48d6f0564f9f01fbf0edcc19fb78426015105d92ce7147f47265"
    }
  ]
}

Options: {"tracer": "callTracer"}

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": [
    {
+     "result": {
        ...  
      },
+     "txHash": "0x1fd6e3c0161a48d6f0564f9f01fbf0edcc19fb78426015105d92ce7147f47265"
    }
  ]
}

Options: {"tracer": "prestateTracer"}

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": [
    {
+     "result": {
        ...  
      },
+     "txHash": "0x1fd6e3c0161a48d6f0564f9f01fbf0edcc19fb78426015105d92ce7147f47265"
    }
  ]
}

Options: {"tracer": "{gasUsed: [], step: function(log) { this.gasUsed.push(log.getGas()); }, result: function() { return this.gasUsed; }, fault: function(){}}"}

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": [
    {
+     "result": {
        "0x000000000000000000636f6e736f6c652e6c6f67": {
          "balance": "0x38d7ea4c68000"
        },
        "0x0000006916a87b82333f4245046623b23794c65c": {
          "balance": "0x1d36beb9aefa6113e0671",
          "nonce": 8
        }
      },
+     "txHash": "0x8ee5f8d441cffd2bfc1e26241471ae41a6909359dab2e5abf5bb3b2c5d01fc0a"
    }
  ]
}

debug_traceTransaction diffs (before and after)

Options: {"disableMemory": false, "disableStack": false, "disableStorage": false, "enableMemory": false}

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": {
    "failed": false,
-   "gas": "0x150bd",
+   "gas": 86205,
    "returnValue": "0x",
    "structLogs": [
      {
        "depth": 1,
        "error": null,
        "gas": 25022,
        "gasCost": 0,
        "op": "RETURN",
        "pc": 353,
        "stack": [
          "0xc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c",
          "0xc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c",
          "0xdf5605a7b946b60609ad0ab1774807ac71753f87",
          "0x1",
          "0x1",
          "0x0",
          "0x0"
        ],
        "storage": {}
      }
    ]
  }
}

Options: {"tracer": "4byteTracer"}

{
  "id": 0,
  "jsonrpc": "2.0",
  "result": {
-    "41304fac-96": 1,
+    "0x41304fac-96": 1,
-    "ce0b63ce-96": 2,
+    "0xce0b63ce-96": 2,
-    "d479ceaf-288": 2,
+    "0xd479ceaf-288": 2,
-    "d7704bae-32": 2
+    "0xd7704bae-32": 2
  }
}

Options: {"tracer": "callTracer"}
No changes required.

Options: {"tracer": "prestateTracer"}
No changes required.

Options: {"tracer": "{gasUsed: [], step: function(log) { this.gasUsed.push(log.getGas()); }, result: function() { return this.gasUsed; }, fault: function(){}}"}
No changes required.

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No

Theses are breaking changes so we need to mention it in release notes.

@wurdum wurdum changed the title Fix/align contracts with geth Align debug_traceBlock/Transaction with geth Feb 10, 2025
@wurdum wurdum force-pushed the fix/align-contracts-with-geth branch from a196b11 to 80a464d Compare February 10, 2025 14:05
@wurdum wurdum force-pushed the fix/align-contracts-with-geth branch 7 times, most recently from 719e15e to 0566de5 Compare February 12, 2025 13:41
@wurdum wurdum marked this pull request as ready for review February 12, 2025 14:07
@flcl42
Copy link
Contributor

flcl42 commented Feb 16, 2025

"returnValue": "0000000000000000000000000000000000000000000000000000000000000001",

Why does geth think we do not need hex prefix?

@wurdum
Copy link
Author

wurdum commented Feb 17, 2025

"returnValue": "0000000000000000000000000000000000000000000000000000000000000001",

Why does geth think we do not need hex prefix?

I don't have an answer, but I've asked Geth folks in their Discord. Will come back when they respond.

@wurdum
Copy link
Author

wurdum commented Feb 19, 2025

"returnValue": "0000000000000000000000000000000000000000000000000000000000000001",

Why does geth think we do not need hex prefix?

I don't have an answer, but I've asked Geth folks in their Discord. Will come back when they respond.

Geth triaged it as a bug and committed to fixing it. I'll update this PR to return 0x hex prefix back.

@wurdum wurdum force-pushed the fix/align-contracts-with-geth branch 2 times, most recently from 5e111e3 to 3433f96 Compare February 21, 2025 09:56
@wurdum wurdum force-pushed the fix/align-contracts-with-geth branch from 3433f96 to 860a90c Compare March 2, 2025 15:49
@wurdum wurdum force-pushed the fix/align-contracts-with-geth branch from 860a90c to 922c1ff Compare March 6, 2025 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants