core: Implement eip-7954 increase Maximum Contract Size#33832
Conversation
|
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 ! |
|
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"
}
]
|
|
Should I run blockchain tests fixtures too against this PR ? , One more thing, in order to avoid I had to add Amsterdam fork on |
|
This will part of a different PR, so I would prefer to keep this clean to avoid merge conflicts |
Looks like one test is failing |
|
will work on it and push with fix ! |
68bd04f
|
The test cc: @rjl493456442 |
…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)
…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)
…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)
…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)
Implement EIP - 7954 , This PR raises the maximum contract code size 32KiB and initcode size 64KiB , following https://eips.ethereum.org/EIPS/eip-7954