@@ -54,23 +54,22 @@ def make_genesis(
5454 self ,
5555 t8n : TransitionTool ,
5656 fork : Fork ,
57- ) -> Tuple [Bytes , FixtureHeader ]:
57+ ) -> Tuple [Alloc , Bytes , FixtureHeader ]:
5858 """
5959 Create a genesis block from the state test definition.
6060 """
6161 env = self .genesis_environment .set_fork_requirements (fork )
6262
63+ new_alloc , state_root = t8n .calc_state_root (
64+ alloc = to_json (Alloc (self .pre )),
65+ fork = fork ,
66+ debug_output_path = self .get_next_transition_tool_output_path (),
67+ )
6368 genesis = FixtureHeader (
6469 parent_hash = Hash (0 ),
6570 ommers_hash = Hash (EmptyOmmersRoot ),
6671 coinbase = Address (0 ),
67- state_root = Hash (
68- t8n .calc_state_root (
69- alloc = to_json (Alloc (self .pre )),
70- fork = fork ,
71- debug_output_path = self .get_next_transition_tool_output_path (),
72- )
73- ),
72+ state_root = Hash (state_root ),
7473 transactions_root = Hash (EmptyTrieRoot ),
7574 receipt_root = Hash (EmptyTrieRoot ),
7675 bloom = Bloom (0 ),
@@ -103,7 +102,7 @@ def make_genesis(
103102 withdrawals = env .withdrawals ,
104103 )
105104
106- return genesis_rlp , genesis
105+ return Alloc ( new_alloc ), genesis_rlp , genesis
107106
108107 def make_block (
109108 self ,
@@ -256,6 +255,7 @@ def make_blocks(
256255 self ,
257256 t8n : TransitionTool ,
258257 genesis : FixtureHeader ,
258+ pre : Alloc ,
259259 fork : Fork ,
260260 chain_id = 1 ,
261261 eips : Optional [List [int ]] = None ,
@@ -265,7 +265,7 @@ def make_blocks(
265265 Performs checks against the expected behavior of the test.
266266 Raises exception on invalid test behavior.
267267 """
268- alloc = to_json (Alloc ( self . pre ) )
268+ alloc = to_json (pre )
269269 env = Environment .from_parent_header (genesis )
270270 blocks : List [FixtureBlock ] = []
271271 head = genesis .hash if genesis .hash is not None else Hash (0 )
0 commit comments