@@ -119,25 +119,27 @@ class FixtureHeader(CamelModel):
119119 We combine the `Environment` and `Result` contents to create this model.
120120 """
121121
122- parent_hash : Hash
122+ parent_hash : Hash = Hash ( 0 )
123123 ommers_hash : Hash = Field (Hash (EmptyOmmersRoot ), alias = "uncleHash" )
124124 fee_recipient : Address = Field (
125125 ..., alias = "coinbase" , validation_alias = AliasChoices ("coinbase" , "miner" )
126126 )
127127 state_root : Hash
128128 transactions_trie : Hash = Field (
129- validation_alias = AliasChoices ("transactionsTrie" , "transactionsRoot" )
129+ Hash ( EmptyTrieRoot ), validation_alias = AliasChoices ("transactionsTrie" , "transactionsRoot" )
130130 )
131131 receipts_root : Hash = Field (
132- ..., alias = "receiptTrie" , validation_alias = AliasChoices ("receiptTrie" , "receiptsRoot" )
132+ Hash (EmptyTrieRoot ),
133+ alias = "receiptTrie" ,
134+ validation_alias = AliasChoices ("receiptTrie" , "receiptsRoot" ),
133135 )
134136 logs_bloom : Bloom = Field (
135- ... , alias = "bloom" , validation_alias = AliasChoices ("bloom" , "logsBloom" )
137+ Bloom ( 0 ) , alias = "bloom" , validation_alias = AliasChoices ("bloom" , "logsBloom" )
136138 )
137139 difficulty : ZeroPaddedHexNumber = ZeroPaddedHexNumber (0 )
138140 number : ZeroPaddedHexNumber
139141 gas_limit : ZeroPaddedHexNumber
140- gas_used : ZeroPaddedHexNumber
142+ gas_used : ZeroPaddedHexNumber = ZeroPaddedHexNumber ( 0 )
141143 timestamp : ZeroPaddedHexNumber
142144 extra_data : Bytes
143145 prev_randao : Hash = Field (Hash (0 ), alias = "mixHash" )
@@ -219,32 +221,16 @@ def block_hash(self) -> Hash:
219221 @classmethod
220222 def genesis (cls , fork : Fork , env : Environment , state_root : Hash ) -> "FixtureHeader" :
221223 """Get the genesis header for the given fork."""
222- return FixtureHeader (
223- parent_hash = 0 ,
224- ommers_hash = EmptyOmmersRoot ,
225- fee_recipient = env .fee_recipient ,
226- state_root = state_root ,
227- transactions_trie = EmptyTrieRoot ,
228- receipts_root = EmptyTrieRoot ,
229- logs_bloom = 0 ,
230- difficulty = env .difficulty ,
231- number = env .number ,
232- gas_limit = env .gas_limit ,
233- gas_used = 0 ,
234- timestamp = env .timestamp ,
235- extra_data = env .extra_data ,
236- prev_randao = env .prev_randao ,
237- nonce = 0 ,
238- base_fee_per_gas = env .base_fee_per_gas ,
239- blob_gas_used = env .blob_gas_used ,
240- excess_blob_gas = env .excess_blob_gas ,
241- withdrawals_root = (
242- Withdrawal .list_root (env .withdrawals ) if env .withdrawals is not None else None
243- ),
244- parent_beacon_block_root = env .parent_beacon_block_root ,
245- requests_hash = Requests () if fork .header_requests_required (0 , 0 ) else None ,
246- fork = fork ,
247- )
224+ environment_values = env .model_dump (exclude_none = True , exclude = {"withdrawals" })
225+ if env .withdrawals is not None :
226+ environment_values ["withdrawals_root" ] = Withdrawal .list_root (env .withdrawals )
227+ environment_values ["extra_data" ] = env .extra_data
228+ extras = {
229+ "state_root" : state_root ,
230+ "requests_hash" : Requests () if fork .header_requests_required (0 , 0 ) else None ,
231+ "fork" : fork ,
232+ }
233+ return FixtureHeader (** environment_values , ** extras )
248234
249235
250236class FixtureExecutionPayload (CamelModel ):
0 commit comments