Skip to content

core: Implement eip-7954 increase Maximum Contract Size#33832

Merged
rjl493456442 merged 4 commits into
ethereum:masterfrom
0xjvn:f/eip-7954
Mar 12, 2026
Merged

core: Implement eip-7954 increase Maximum Contract Size#33832
rjl493456442 merged 4 commits into
ethereum:masterfrom
0xjvn:f/eip-7954

Conversation

@0xjvn
Copy link
Copy Markdown
Contributor

@0xjvn 0xjvn commented Feb 12, 2026

Implement EIP - 7954 , This PR raises the maximum contract code size 32KiB and initcode size 64KiB , following https://eips.ethereum.org/EIPS/eip-7954

@0xjvn
Copy link
Copy Markdown
Contributor Author

0xjvn commented Feb 12, 2026

Context: Attended ACDE ,as part of it EIP - 7954 was CFI'd fro bal-devnet-3 , Searched IN EELS for reference impl couldnt find any but EIP was relatively shorter to implement so thought of give it a go. Not sure if master is the right branch to give PR.

There might be some changes more when BAL is included here but in master I couldnt find majority of its code , So if any changes to this wrt to BAL will implement that too. Let me know for any changes and will add tests if required Thanks !

Copy link
Copy Markdown
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

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

LGTM

@0xjvn
Copy link
Copy Markdown
Contributor Author

0xjvn commented Mar 2, 2026

FYI: Ran State Test against the Spec which was merged ethereum/execution-specs#2276 , state tests is passing ,

jvn@jvn:~/work/go-eth-jvn$ find ~/work/execution-specs/fixtures/state_tests -path "*eip7954*" -name "*.json" | xargs -I {} ./build/bin/evm statetest {}
{"stateRoot": "0xffdc968dd42577e21daca7a2423d05d11824bc48e4f07e04e4a8c301f5eb66df"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_with_max_initcode[fork_Amsterdam-state_test]",
    "pass": true,
    "stateRoot": "0xffdc968dd42577e21daca7a2423d05d11824bc48e4f07e04e4a8c301f5eb66df",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0x505fc1f46da67323978b78f6aa58a6fa1a23e1c6f468b460f7ec8e67742f504b"}
{"stateRoot": "0x4cfa5ae727466b802026179876d96ecd1104b4d851f84acc1050f02cee262638"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size[fork_Amsterdam-state_test-at_max]",
    "pass": true,
    "stateRoot": "0x505fc1f46da67323978b78f6aa58a6fa1a23e1c6f468b460f7ec8e67742f504b",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size[fork_Amsterdam-state_test-over_max]",
    "pass": true,
    "stateRoot": "0x4cfa5ae727466b802026179876d96ecd1104b4d851f84acc1050f02cee262638",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0x5c081d6dfe70e84e33077b06b0f09f138969702a1eef62cab03231ba0145a2e6"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_external_opcodes[fork_Amsterdam-state_test]",
    "pass": true,
    "stateRoot": "0x5c081d6dfe70e84e33077b06b0f09f138969702a1eef62cab03231ba0145a2e6",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0x505fc1f46da67323978b78f6aa58a6fa1a23e1c6f468b460f7ec8e67742f504b"}
{"stateRoot": "0x4102181dfb4a1c53b502b844317e67140739008a72a97d5baef5cd8a083b88a9"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_deposit_gas[fork_Amsterdam-state_test-exact_gas]",
    "pass": true,
    "stateRoot": "0x505fc1f46da67323978b78f6aa58a6fa1a23e1c6f468b460f7ec8e67742f504b",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_deposit_gas[fork_Amsterdam-state_test-short_one_gas]",
    "pass": true,
    "stateRoot": "0x4102181dfb4a1c53b502b844317e67140739008a72a97d5baef5cd8a083b88a9",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0xacf55b1369eaa198d80069b2c295f2f9e4dfe00657d905b9720a987d3ccf4eeb"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_self_opcodes[fork_Amsterdam-state_test]",
    "pass": true,
    "stateRoot": "0xacf55b1369eaa198d80069b2c295f2f9e4dfe00657d905b9720a987d3ccf4eeb",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0xe524a2d122e3c581956bd5dc1a14f3a351ebd039cf185977bb1b764d969db590"}
{"stateRoot": "0x08755eef39fe7ee2fef7534bf6bdd2bb8bffa0771fd390c16bca1f2f2ee33130"}
{"stateRoot": "0x22b198d3ab33d6ef7d60166ca5476eabea153b08d494b3d24af1c757d4ab01a1"}
{"stateRoot": "0x30305e086af086c2353ac65759913e792fd6f96d57e4f4762002a0913408e925"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_via_create[fork_Amsterdam-create_opcode_CREATE2-state_test-at_max]",
    "pass": true,
    "stateRoot": "0xe524a2d122e3c581956bd5dc1a14f3a351ebd039cf185977bb1b764d969db590",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_via_create[fork_Amsterdam-create_opcode_CREATE2-state_test-over_max]",
    "pass": true,
    "stateRoot": "0x08755eef39fe7ee2fef7534bf6bdd2bb8bffa0771fd390c16bca1f2f2ee33130",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_via_create[fork_Amsterdam-create_opcode_CREATE-state_test-at_max]",
    "pass": true,
    "stateRoot": "0x22b198d3ab33d6ef7d60166ca5476eabea153b08d494b3d24af1c757d4ab01a1",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_code_size.py::test_max_code_size_via_create[fork_Amsterdam-create_opcode_CREATE-state_test-over_max]",
    "pass": true,
    "stateRoot": "0x30305e086af086c2353ac65759913e792fd6f96d57e4f4762002a0913408e925",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0xa0f178f064d40f485bcf39fbd0c035fa4e264690844ce0de2c928cb3cdb87ae4"}
{"stateRoot": "0x27f6fca41f7ba9600d6763d99ebe9ca64eafd584212dfb1cd6347cb9745a5ce4"}
{"stateRoot": "0x2c5070afd83d169e9d01b07b82331cf1c6e6e0d057f82a33271558af71d6e3e6"}
{"stateRoot": "0xee4bd69ad54339c6a7b083d4708958e7c68309a023354fe13f3aa0fd696890a2"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_gas_metering_via_create[fork_Amsterdam-create_opcode_CREATE2-state_test-exact_gas]",
    "pass": true,
    "stateRoot": "0xa0f178f064d40f485bcf39fbd0c035fa4e264690844ce0de2c928cb3cdb87ae4",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_gas_metering_via_create[fork_Amsterdam-create_opcode_CREATE2-state_test-short_one_gas]",
    "pass": true,
    "stateRoot": "0x27f6fca41f7ba9600d6763d99ebe9ca64eafd584212dfb1cd6347cb9745a5ce4",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_gas_metering_via_create[fork_Amsterdam-create_opcode_CREATE-state_test-exact_gas]",
    "pass": true,
    "stateRoot": "0x2c5070afd83d169e9d01b07b82331cf1c6e6e0d057f82a33271558af71d6e3e6",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_gas_metering_via_create[fork_Amsterdam-create_opcode_CREATE-state_test-short_one_gas]",
    "pass": true,
    "stateRoot": "0xee4bd69ad54339c6a7b083d4708958e7c68309a023354fe13f3aa0fd696890a2",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0xa15ea9fea5f1a5172a986fd3312c2b25ebf8d92111088f6398e1a5507c9cb3d3"}
{"stateRoot": "0x8f6ffb141a5d8703b5731728d7bccabdc7bd2ba6eb751603d43603ec5be982fb"}
{"stateRoot": "0xc0bb7227053a3c0d31c843992638f9318b50df87de4fa63573b50b694e4cbbbf"}
{"stateRoot": "0x72b6cb2b3bb01cb9869e32c9b7f0698a355597cb9400b29085f9a027f3284f8c"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_via_create[fork_Amsterdam-create_opcode_CREATE2-state_test-over_max]",
    "pass": true,
    "stateRoot": "0xa15ea9fea5f1a5172a986fd3312c2b25ebf8d92111088f6398e1a5507c9cb3d3",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_via_create[fork_Amsterdam-create_opcode_CREATE-state_test-at_max]",
    "pass": true,
    "stateRoot": "0x8f6ffb141a5d8703b5731728d7bccabdc7bd2ba6eb751603d43603ec5be982fb",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_via_create[fork_Amsterdam-create_opcode_CREATE-state_test-over_max]",
    "pass": true,
    "stateRoot": "0xc0bb7227053a3c0d31c843992638f9318b50df87de4fa63573b50b694e4cbbbf",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_via_create[fork_Amsterdam-create_opcode_CREATE2-state_test-at_max]",
    "pass": true,
    "stateRoot": "0x72b6cb2b3bb01cb9869e32c9b7f0698a355597cb9400b29085f9a027f3284f8c",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0x188a6f9fbb0112e291a76e56adacefd8c71070d8ade3c186f29914a9fb93e435"}
{"stateRoot": "0x4b555d9d75fa8b4e5f0bec2ff06c8fca800d261b6840bc7a516ab1c6282999a9"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size[fork_Amsterdam-state_test-at_max]",
    "pass": true,
    "stateRoot": "0x188a6f9fbb0112e291a76e56adacefd8c71070d8ade3c186f29914a9fb93e435",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size[fork_Amsterdam-state_test-over_max]",
    "pass": true,
    "stateRoot": "0x4b555d9d75fa8b4e5f0bec2ff06c8fca800d261b6840bc7a516ab1c6282999a9",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0x188a6f9fbb0112e291a76e56adacefd8c71070d8ade3c186f29914a9fb93e435"}
{"stateRoot": "0x4b555d9d75fa8b4e5f0bec2ff06c8fca800d261b6840bc7a516ab1c6282999a9"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_gas_metering[fork_Amsterdam-state_test-exact_gas]",
    "pass": true,
    "stateRoot": "0x188a6f9fbb0112e291a76e56adacefd8c71070d8ade3c186f29914a9fb93e435",
    "fork": "Amsterdam"
  },
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_max_initcode_size.py::test_max_initcode_size_gas_metering[fork_Amsterdam-state_test-short_one_gas]",
    "pass": true,
    "stateRoot": "0x4b555d9d75fa8b4e5f0bec2ff06c8fca800d261b6840bc7a516ab1c6282999a9",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0x4cfa5ae727466b802026179876d96ecd1104b4d851f84acc1050f02cee262638"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_eip_mainnet.py::test_over_max_code_size_mainnet[fork_Amsterdam-state_test]",
    "pass": true,
    "stateRoot": "0x4cfa5ae727466b802026179876d96ecd1104b4d851f84acc1050f02cee262638",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0x5c081d6dfe70e84e33077b06b0f09f138969702a1eef62cab03231ba0145a2e6"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_eip_mainnet.py::test_max_code_size_with_max_initcode_mainnet[fork_Amsterdam-state_test]",
    "pass": true,
    "stateRoot": "0x5c081d6dfe70e84e33077b06b0f09f138969702a1eef62cab03231ba0145a2e6",
    "fork": "Amsterdam"
  }
]
{"stateRoot": "0x4b555d9d75fa8b4e5f0bec2ff06c8fca800d261b6840bc7a516ab1c6282999a9"}
[
  {
    "name": "tests/amsterdam/eip7954_increase_max_contract_size/test_eip_mainnet.py::test_over_max_initcode_size_mainnet[fork_Amsterdam-state_test]",
    "pass": true,
    "stateRoot": "0x4b555d9d75fa8b4e5f0bec2ff06c8fca800d261b6840bc7a516ab1c6282999a9",
    "fork": "Amsterdam"
  }
]

@0xjvn
Copy link
Copy Markdown
Contributor Author

0xjvn commented Mar 2, 2026

Should I run blockchain tests fixtures too against this PR ? , One more thing, in order to avoid

    "error": "unexpected error: unsupported fork \"Amsterdam\""

I had to add Amsterdam fork on tests/init.go and tests/transaction_test_util.go , Wanted to know If I should push these changes here, Or will it be added as part of some other PR. Thanks !

@MariusVanDerWijden
Copy link
Copy Markdown
Member

This will part of a different PR, so I would prefer to keep this clean to avoid merge conflicts

Comment thread core/vm/common.go
@jwasinger jwasinger mentioned this pull request Mar 3, 2026
rjl493456442
rjl493456442 previously approved these changes Mar 9, 2026
@rjl493456442
Copy link
Copy Markdown
Member

--- FAIL: TestCreateGas (0.01s)
    gas_table_test.go:173: test 3: min gas error, want 100000, have 53545
FAIL

Looks like one test is failing

@0xjvn
Copy link
Copy Markdown
Contributor Author

0xjvn commented Mar 9, 2026

will work on it and push with fix !

@0xjvn 0xjvn dismissed stale reviews from rjl493456442 and MariusVanDerWijden via 68bd04f March 9, 2026 11:43
@0xjvn
Copy link
Copy Markdown
Contributor Author

0xjvn commented Mar 9, 2026

The test TestCreateGas had a subtle bug where Shanghai was not properly activated, but passed coincidentally because the old gasCreate2Eip3860 had an unconditional size check regardless of fork. Fixed it pls review

cc: @rjl493456442

@0xjvn 0xjvn requested a review from rjl493456442 March 9, 2026 12:08
Comment thread core/vm/common.go Outdated
@rjl493456442 rjl493456442 merged commit 95b9a2e into ethereum:master Mar 12, 2026
15 of 18 checks passed
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Mar 21, 2026
…m#33832

- add Osaka contract size limits: MaxCodeSizeOsaka=32768 and MaxInitCodeSizeOsaka=65536
- centralize size checks in vm helpers (CheckMaxCodeSize / CheckMaxInitCodeSize) and reuse in state transition, txpool, EVM and CREATE/CREATE2 gas paths
- map max-initcode-size RPC validation errors to vm.ErrMaxInitCodeSizeExceeded
- remove obsolete core.ErrMaxInitCodeSizeExceeded sentinel
- update create gas tests to validate post-Osaka behavior and explicit over-limit cases (0x10001)
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Mar 22, 2026
…m#33832

- add Osaka contract size limits: MaxCodeSizeOsaka=32768 and MaxInitCodeSizeOsaka=65536
- centralize size checks in vm helpers (CheckMaxCodeSize / CheckMaxInitCodeSize) and reuse in state transition, txpool, EVM and CREATE/CREATE2 gas paths
- map max-initcode-size RPC validation errors to vm.ErrMaxInitCodeSizeExceeded
- remove obsolete core.ErrMaxInitCodeSizeExceeded sentinel
- update create gas tests to validate post-Osaka behavior and explicit over-limit cases (0x10001)
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Mar 24, 2026
…m#33832

- add Osaka contract size limits: MaxCodeSizeOsaka=32768 and MaxInitCodeSizeOsaka=65536
- centralize size checks in vm helpers (CheckMaxCodeSize / CheckMaxInitCodeSize) and reuse in state transition, txpool, EVM and CREATE/CREATE2 gas paths
- map max-initcode-size RPC validation errors to vm.ErrMaxInitCodeSizeExceeded
- remove obsolete core.ErrMaxInitCodeSizeExceeded sentinel
- update create gas tests to validate post-Osaka behavior and explicit over-limit cases (0x10001)
AnilChinchawale pushed a commit to XinFinOrg/XDPoSChain that referenced this pull request Mar 24, 2026
…m#33832 (#2222)

- add Osaka contract size limits: MaxCodeSizeOsaka=32768 and MaxInitCodeSizeOsaka=65536
- centralize size checks in vm helpers (CheckMaxCodeSize / CheckMaxInitCodeSize) and reuse in state transition, txpool, EVM and CREATE/CREATE2 gas paths
- map max-initcode-size RPC validation errors to vm.ErrMaxInitCodeSizeExceeded
- remove obsolete core.ErrMaxInitCodeSizeExceeded sentinel
- update create gas tests to validate post-Osaka behavior and explicit over-limit cases (0x10001)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants