KIP 239: EXTCODEHASH opcode for Kaia
Author | Lewis |
---|---|
Discussions-To | https://github.com/kaiachain/kips/issues/38 |
Status | Draft |
Type | Core |
Created | 2024-12-27 |
Simple Summary
Clarifies and aligns the implementation of EXTCODEHASH
opcode with EIP-1052 and EIP-2929.
Abstract
This KIP explains the historical implementation differences of EXTCODEHASH
in Kaia compared to Ethereum. It also specifies the complete alignment with EIPs starting from the Prague hardfork.
Motivation
The EXTCODEHASH
opcode in Kaia has had implementation differences from EIPs. These difference was fixed in the Cancun hardfork but require further alignment, particularly regarding gas costs after the Prague hardfork. This KIP aims to provide clear explanation of the changes and ensure complete compatibility with EIPs.
Specification
Parameters
Parameter | Value |
---|---|
ZERO_CODE_HASH |
0x0000000000000000000000000000000000000000000000000000000000000000 |
EMPTY_CODE_HASH |
0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 |
EIP-1052
The EXTCODEHASH
opcode according to EIP-1052 should return:
- For non-existent accounts:
ZERO_CODE_HASH
- For accounts with no code:
EMPTY_CODE_HASH
In Kaia, the EXTCODEHASH
opcode returns:
Hardfork | Non-existent | No code | Note |
---|---|---|---|
Before Cancun | EMPTY_CODE_HASH |
EMPTY_CODE_HASH |
Wrong EIP-1052 implementation for non-existent accounts. |
Cancun | ZERO_CODE_HASH |
EMPTY_CODE_HASH |
Fully compatible with EIP-1052. |
Prague | ZERO_CODE_HASH |
EMPTY_CODE_HASH |
EIP-2929
The constant gas cost for EXTCODEHASH
opcode, which is same as WarmStorageReadCostEIP2929
, should be 100 after the Kore hardfork which introduced EIP-2929.
In Kaia, the EXTCODEHASH
opcode has the following gas costs:
Hardfork | Constant gas cost | Note |
---|---|---|
Before Kore | 400 | ExtcodeHashGasConstantinople |
Kore | 100 | Brought EIP-2929. |
Cancun | 400 | Fixed EXTCODEHASH , but accidentally shadowed EIP-2929. |
Prague | 100 | Fully compatible with EIP-2929. |
Backwards Compatibility
The fix of gas cost for EXTCODEHASH
opcode is backwards incompatible since the Prague hardfork. Note that the EIP-1052 implementation was already fixed in the Cancun hardfork.
References
Copyright
Copyright and related rights waived via CC0.