Skip to content

Test Ext Code Opcodes Gas

Documentation for tests/amsterdam/eip8038_state_access_gas_cost_increase/test_ext_code_opcodes_gas.py@26332146.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/amsterdam/eip8038_state_access_gas_cost_increase/test_ext_code_opcodes_gas.py --fork Amsterdam

Tests for EIP-8038: State Access Gas Cost Increase.

Covers the EIP-8038 EXT* "double-read" surcharge: EXTCODESIZE and EXTCODECOPY perform two database reads (the account leaf and then the code) and are therefore charged an extra WARM_ACCESS on top of the account-access cost, whereas BALANCE and EXTCODEHASH read only the account leaf and are charged the account-access cost alone.

Test Functions Overview

Name Type Cases (Amsterdam) Description
test_ext_code_double_read_empty_account state_test 4 Charge the EIP-8038 double-read surcharge on an empty target.
test_ext_code_opcode_gas state_test 8 Measure the exact gas of an external-code/account-access opcode and
test_extcodecopy_empty_account_composes_additively state_test 4 Compose the surcharge additively when copying from an empty account.
test_extcodecopy_nonzero_composes_additively state_test 4 Verify the EIP-8038 EXTCODECOPY surcharge composes additively.
test_extcodehash_empty_account state_test 2 Verify EXTCODEHASH of an empty account is priced without surcharge.
test_extcodesize_empty_account_returns_zero state_test 2 Pay the surcharge on an empty target while EXTCODESIZE returns 0.