EIP-3541: Reject new contract code starting with the 0xEF byte (#1003)

* EIP-3541: Reject new contract code starting with the 0xEF byte

* Panic instead

* PR feedback
This commit is contained in:
wborgeaud 2023-04-24 07:55:04 +02:00 committed by GitHub
parent 472face2a5
commit a4b714e64d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -137,9 +137,11 @@ after_constructor:
// stack: new_ctx, leftover_gas, success, address, kexit_info
POP
// TODO: EIP-3541: Reject new contract code starting with the 0xEF byte
// TODO: Skip blocks below if success is false.
// EIP-3541: Reject new contract code starting with the 0xEF byte
PUSH 0 %mload_current(@SEGMENT_RETURNDATA) %eq_const(0xEF) %jumpi(fault_exception)
// Charge gas for the code size.
SWAP3
// stack: kexit_info, success, address, leftover_gas

View File

@ -144,6 +144,10 @@ process_contract_creation_txn_after_code_loaded:
global process_contract_creation_txn_after_constructor:
// stack: success, leftover_gas, new_ctx, address, retdest
POP // TODO: Success will go into the receipt when we support that.
// EIP-3541: Reject new contract code starting with the 0xEF byte
PUSH 0 %mload_current(@SEGMENT_RETURNDATA) %eq_const(0xEF) %assert_zero // TODO: need to revert changes here.
// stack: leftover_gas, new_ctx, address, retdest
%returndatasize // Size of the code.
// stack: code_size, leftover_gas, new_ctx, address, retdest