Skip to content

Commit f0a38a3

Browse files
committed
Create header from VM in opcode test
It was being hard-coded, which failed when testing against a LondonVM, because the wrong type of header was at genesis.
1 parent 860dc77 commit f0a38a3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/core/opcodes/test_opcodes.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@
6565
CANONICAL_ADDRESS_B = to_canonical_address("0xcd1722f3947def4cf144679da39c4c32bdc35681")
6666
CANONICAL_ADDRESS_C = b'\xee' * 20
6767
CANONICAL_ZERO_ADDRESS = b'\0' * 20
68-
GENESIS_HEADER = BlockHeader(
69-
difficulty=constants.GENESIS_DIFFICULTY,
70-
block_number=constants.GENESIS_BLOCK_NUMBER,
71-
gas_limit=constants.GENESIS_GAS_LIMIT,
72-
)
7368

7469

7570
def assemble(*codes):
@@ -82,7 +77,11 @@ def assemble(*codes):
8277
def setup_vm(vm_class, chain_id=None):
8378
db = AtomicDB()
8479
chain_context = ChainContext(chain_id)
85-
return vm_class(GENESIS_HEADER, ChainDB(db), chain_context, ConsensusContext(db))
80+
genesis_header = vm_class.create_genesis_header(
81+
difficulty=constants.GENESIS_DIFFICULTY,
82+
timestamp=0,
83+
)
84+
return vm_class(genesis_header, ChainDB(db), chain_context, ConsensusContext(db))
8685

8786

8887
def run_computation(

0 commit comments

Comments
 (0)