@@ -135,6 +135,17 @@ pub fn per_block_processing<T: EthSpec>(
135135 state. build_committee_cache ( RelativeEpoch :: Previous , spec) ?;
136136 state. build_committee_cache ( RelativeEpoch :: Current , spec) ?;
137137
138+ // The call to the `process_execution_payload` must happen before the call to the
139+ // `process_randao` as the former depends on the `randao_mix` computed with the reveal of the
140+ // previous block.
141+ if is_execution_enabled ( state, block. body ( ) ) {
142+ let payload = block
143+ . body ( )
144+ . execution_payload ( )
145+ . ok_or ( BlockProcessingError :: IncorrectStateType ) ?;
146+ process_execution_payload ( state, payload, spec) ?;
147+ }
148+
138149 process_randao ( state, block, verify_randao, spec) ?;
139150 process_eth1_data ( state, block. body ( ) . eth1_data ( ) ) ?;
140151 process_operations ( state, block. body ( ) , proposer_index, verify_signatures, spec) ?;
@@ -149,14 +160,6 @@ pub fn per_block_processing<T: EthSpec>(
149160 ) ?;
150161 }
151162
152- if is_execution_enabled ( state, block. body ( ) ) {
153- let payload = block
154- . body ( )
155- . execution_payload ( )
156- . ok_or ( BlockProcessingError :: IncorrectStateType ) ?;
157- process_execution_payload ( state, payload, spec) ?;
158- }
159-
160163 Ok ( ( ) )
161164}
162165
@@ -352,13 +355,6 @@ pub fn process_execution_payload<T: EthSpec>(
352355 found: payload. block_number,
353356 }
354357 ) ;
355- block_verify ! (
356- payload. random == * state. get_randao_mix( state. current_epoch( ) ) ?,
357- BlockProcessingError :: ExecutionRandaoMismatch {
358- expected: * state. get_randao_mix( state. current_epoch( ) ) ?,
359- found: payload. random,
360- }
361- ) ;
362358 block_verify ! (
363359 is_valid_gas_limit( payload, state. latest_execution_payload_header( ) ?) ?,
364360 BlockProcessingError :: ExecutionInvalidGasLimit {
@@ -367,6 +363,13 @@ pub fn process_execution_payload<T: EthSpec>(
367363 }
368364 ) ;
369365 }
366+ block_verify ! (
367+ payload. random == * state. get_randao_mix( state. current_epoch( ) ) ?,
368+ BlockProcessingError :: ExecutionRandaoMismatch {
369+ expected: * state. get_randao_mix( state. current_epoch( ) ) ?,
370+ found: payload. random,
371+ }
372+ ) ;
370373
371374 let timestamp = compute_timestamp_at_slot ( state, spec) ?;
372375 block_verify ! (
@@ -388,6 +391,7 @@ pub fn process_execution_payload<T: EthSpec>(
388391 gas_limit : payload. gas_limit ,
389392 gas_used : payload. gas_used ,
390393 timestamp : payload. timestamp ,
394+ extra_data : payload. extra_data . clone ( ) ,
391395 base_fee_per_gas : payload. base_fee_per_gas ,
392396 block_hash : payload. block_hash ,
393397 transactions_root : payload. transactions . tree_hash_root ( ) ,
0 commit comments