Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions crates/pbs/src/mev_boost/get_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,22 +398,22 @@ fn validate_header(
return Err(ValidationError::BidTooLow { min: minimum_bid_wei, got: value });
}

if expected_relay_pubkey != received_relay_pubkey {
return Err(ValidationError::PubkeyMismatch {
expected: expected_relay_pubkey,
got: received_relay_pubkey,
});
}

let expected_timestamp = timestamp_of_slot_start_sec(slot, chain);
if expected_timestamp != signed_header.message.header.timestamp {
return Err(ValidationError::TimestampMismatch {
expected: expected_timestamp,
got: signed_header.message.header.timestamp,
})
});
}

if !skip_sig_verify {
if expected_relay_pubkey != received_relay_pubkey {
return Err(ValidationError::PubkeyMismatch {
expected: expected_relay_pubkey,
got: received_relay_pubkey,
});
}

verify_signed_message(
chain,
&received_relay_pubkey,
Expand Down Expand Up @@ -545,6 +545,13 @@ mod tests {

mock_header.message.value = U256::from(11);

let expected = timestamp_of_slot_start_sec(slot, chain);
assert_eq!(
validate_header(&mock_header, chain, pubkey, parent_hash, false, min_bid, slot,),
Err(ValidationError::TimestampMismatch { expected, got: 0 })
);

mock_header.message.header.timestamp = expected;
mock_header.message.pubkey = pubkey;

assert_eq!(
Expand All @@ -560,14 +567,6 @@ mod tests {
Err(ValidationError::PubkeyMismatch { expected: BlsPublicKey::default(), got: pubkey })
);

let expected = timestamp_of_slot_start_sec(slot, chain);
assert_eq!(
validate_header(&mock_header, chain, pubkey, parent_hash, false, min_bid, slot,),
Err(ValidationError::TimestampMismatch { expected, got: 0 })
);

mock_header.message.header.timestamp = expected;

assert!(matches!(
validate_header(&mock_header, chain, pubkey, parent_hash, false, min_bid, slot),
Err(ValidationError::Sigverify(_))
Expand All @@ -580,6 +579,6 @@ mod tests {

assert!(
validate_header(&mock_header, chain, pubkey, parent_hash, false, min_bid, slot).is_ok()
)
);
}
}
Loading