Skip to content

Commit

Permalink
Merge pull request #50 from jsign/jsign/fixextcodehash
Browse files Browse the repository at this point in the history
verkle: fix extcodehash tests
  • Loading branch information
spencer-tb authored Sep 5, 2024
2 parents 83f55ad + 3ce3876 commit 2303fe0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 11 additions & 4 deletions tests/verkle/eip4762_verkle_gas_witness/test_extcodehash.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
WitnessCheck,
)
from ethereum_test_tools.vm.opcode import Opcodes as Op
from ethereum_test_types.verkle.types import Hash as HashVerkle

# TODO(verkle): Update reference spec version
REFERENCE_SPEC_GIT_PATH = "EIPS/eip-4762.md"
Expand Down Expand Up @@ -61,11 +62,15 @@ def test_extcodehash(blockchain_test: BlockchainTestFiller, fork: str, target):
"""
witness_check_extra = WitnessCheck()
if target == ExampleAddress:
witness_check_extra.add_account_full(ExampleAddress, ExampleAccount)
witness_check_extra.add_account_codehash(
ExampleAddress, HashVerkle(keccak256(ExampleAccount.code))
)
elif target == TestAddress:
witness_check_extra.add_account_basic_data(TestAddress, TestAccount)
witness_check_extra.add_account_codehash(
TestAddress, HashVerkle(keccak256(TestAccount.code))
)
elif target == EmptyAddress:
witness_check_extra.add_account_basic_data(EmptyAddress, None)
witness_check_extra.add_account_codehash(EmptyAddress, None)
# For precompile or system contract, we don't need to add any witness.
_extcodehash(blockchain_test, target, witness_check_extra)

Expand All @@ -77,7 +82,9 @@ def test_extcodehash_warm(blockchain_test: BlockchainTestFiller):
Test EXTCODEHASH with WARM cost.
"""
witness_check_extra = WitnessCheck()
witness_check_extra.add_account_full(ExampleAddress, ExampleAccount)
witness_check_extra.add_account_codehash(
ExampleAddress, HashVerkle(keccak256(ExampleAccount.code))
)

_extcodehash(blockchain_test, ExampleAddress, witness_check_extra, warm=True)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
BlockchainTestFiller,
Environment,
Bytecode,
Initcode,
TestAddress,
TestAddress2,
Transaction,
Expand Down

0 comments on commit 2303fe0

Please sign in to comment.