@@ -7,7 +7,8 @@ use helper_functions::{
77 accessors:: {
88 self , attestation_epoch, get_attestation_participation_flags, get_base_reward,
99 get_base_reward_per_increment, get_beacon_proposer_index, get_current_epoch,
10- get_indexed_payload_attestation, get_previous_epoch, initialize_shuffled_indices,
10+ get_indexed_payload_attestation, get_previous_epoch, get_randao_mix,
11+ initialize_shuffled_indices,
1112 } ,
1213 electra:: {
1314 get_attesting_indices, get_indexed_attestation, is_fully_withdrawable_validator,
@@ -482,6 +483,7 @@ fn validate_execution_payload_bid<P: Preset>(
482483 slot,
483484 parent_block_hash,
484485 parent_block_root,
486+ prev_randao,
485487 ..
486488 } = signed_bid. message ;
487489 let builder = state. validators ( ) . get ( builder_index) ?;
@@ -511,6 +513,7 @@ fn validate_execution_payload_bid<P: Preset>(
511513 ) ;
512514 }
513515
516+ // > Check that the builder is active, non-slashed
514517 let current_epoch = get_current_epoch ( state) ;
515518 ensure ! (
516519 is_active_validator( builder, current_epoch) ,
@@ -527,7 +530,7 @@ fn validate_execution_payload_bid<P: Preset>(
527530 }
528531 ) ;
529532
530- // > Check that the builder is active, non-slashed, and has funds to cover the bid
533+ // > Check that builder has funds to cover the bid
531534 let builder_balance = * state. balances ( ) . get ( builder_index) ?;
532535 let pending_withdrawals = state
533536 . builder_pending_withdrawals ( )
@@ -579,6 +582,16 @@ fn validate_execution_payload_bid<P: Preset>(
579582 }
580583 ) ;
581584
585+ // > Verify prev_randao
586+ let in_state = get_randao_mix ( state, current_epoch) ;
587+ ensure ! (
588+ prev_randao == in_state,
589+ Error :: <P >:: BidPrevRandaoMismatch {
590+ in_bid: prev_randao,
591+ in_state,
592+ } ,
593+ ) ;
594+
582595 Ok ( ( ) )
583596}
584597
@@ -596,6 +609,7 @@ pub fn process_execution_payload_bid<P: Preset>(
596609 fee_recipient,
597610 ..
598611 } = signed_bid. message ;
612+
599613 validate_execution_payload_bid ( config, pubkey_cache, state, block) ?;
600614
601615 // > Record the pending payment if there is some payment
0 commit comments