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

debug_traceBlockBy{Number,Hash} outputs new opcodes for pre-fork blocks #29464

Open
bearpebble opened this issue Apr 5, 2024 · 0 comments
Open
Labels

Comments

@bearpebble
Copy link

System information

Geth version: geth version 1.13.14-stable-2bd6bd01
CL client & version: none
OS & Version: Linux

Expected behaviour

The output of debug_traceBlockByNumber should contain invalid for cancun opcodes in pre-cancun blocks (or any other fork that introduces new opcodes).

Actual behaviour

The trace contains the new opcodes BLOBHASH, BLOBBASEFEE, TLOAD, TSTORE, MCOPY despite these not being active yet.

Steps to reproduce the behaviour

Make sure cancun is not active

geth --dev dumpgenesis | jq ".config"
{
  "chainId": 1337,
  "homesteadBlock": 0,
  "eip150Block": 0,
  "eip155Block": 0,
  "eip158Block": 0,
  "byzantiumBlock": 0,
  "constantinopleBlock": 0,
  "petersburgBlock": 0,
  "istanbulBlock": 0,
  "muirGlacierBlock": 0,
  "berlinBlock": 0,
  "londonBlock": 0,
  "arrowGlacierBlock": 0,
  "grayGlacierBlock": 0,
  "shanghaiTime": 0,
  "terminalTotalDifficulty": 0,
  "terminalTotalDifficultyPassed": true
}

Start geth and fund the test account

geth --http --http.port 8545 --dev --http.api eth,web3,net,debug --gcmode=archive &
sleep 10
geth attach --exec 'eth.sendTransaction({from: eth.coinbase, to: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", value: web3.toWei(50, "ether")})' /tmp/geth.ipc

Send a transaction that uses BLOBHASH, specifically PUSH0, PUSH0, BLOBHASH, PUSH0, PUSH0.

cast send --rpc-url http://localhost:8545 --mnemonic "test test test test test test test test test test test junk" --gas-limit 500000 --create 0x5f5f495f5f
cast rpc debug_traceBlockByNumber $(cast block-number | cast to-hex) --rpc-url http://localhost:8545 | jq

Output of the trace will contain BLOBHASH as the last opcode despite the opcode being interpreted as invalid opcode.

[
  {
    "txHash": "0x5c0990c1793ac3bafc8c298766225ad544eb984c53535e004e9f06f01b1c8aae",
    "result": {
      "gas": 500000,
      "failed": true,
      "returnValue": "",
      "structLogs": [
        {
          "pc": 0,
          "op": "PUSH0",
          "gas": 446918,
          "gasCost": 2,
          "depth": 1,
          "stack": []
        },
        {
          "pc": 1,
          "op": "PUSH0",
          "gas": 446916,
          "gasCost": 2,
          "depth": 1,
          "stack": [
            "0x0"
          ]
        },
        {
          "pc": 2,
          "op": "BLOBHASH",
          "gas": 446914,
          "gasCost": 0,
          "depth": 1,
          "stack": [
            "0x0",
            "0x0"
          ]
        }
      ]
    }
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant