Skip to content

Commit a755d43

Browse files
authored
feat: add the ability to skip the relayer public key check (#207)
* feat: add the ability to skip the relayer public key check * fix: nit
1 parent 7a22028 commit a755d43

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

config.example.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ timeout_get_payload_ms = 4000
3737
# Timeout in milliseconds for the `register_validator` call to relays.
3838
# OPTIONAL, DEFAULT: 3000
3939
timeout_register_validator_ms = 3000
40-
# Whether to skip signature verification of headers against the relay pubkey
40+
# Whether to skip signature verification of headers and pubkey matching against the relay pubkey
4141
# OPTIONAL, DEFAULT: false
4242
skip_sigverify = false
4343
# Minimum bid in ETH that will be accepted from `get_header`

crates/pbs/src/mev_boost/get_header.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -398,22 +398,22 @@ fn validate_header(
398398
return Err(ValidationError::BidTooLow { min: minimum_bid_wei, got: value });
399399
}
400400

401-
if expected_relay_pubkey != received_relay_pubkey {
402-
return Err(ValidationError::PubkeyMismatch {
403-
expected: expected_relay_pubkey,
404-
got: received_relay_pubkey,
405-
});
406-
}
407-
408401
let expected_timestamp = timestamp_of_slot_start_sec(slot, chain);
409402
if expected_timestamp != signed_header.message.header.timestamp {
410403
return Err(ValidationError::TimestampMismatch {
411404
expected: expected_timestamp,
412405
got: signed_header.message.header.timestamp,
413-
})
406+
});
414407
}
415408

416409
if !skip_sig_verify {
410+
if expected_relay_pubkey != received_relay_pubkey {
411+
return Err(ValidationError::PubkeyMismatch {
412+
expected: expected_relay_pubkey,
413+
got: received_relay_pubkey,
414+
});
415+
}
416+
417417
verify_signed_message(
418418
chain,
419419
&received_relay_pubkey,
@@ -545,6 +545,13 @@ mod tests {
545545

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

548+
let expected = timestamp_of_slot_start_sec(slot, chain);
549+
assert_eq!(
550+
validate_header(&mock_header, chain, pubkey, parent_hash, false, min_bid, slot,),
551+
Err(ValidationError::TimestampMismatch { expected, got: 0 })
552+
);
553+
554+
mock_header.message.header.timestamp = expected;
548555
mock_header.message.pubkey = pubkey;
549556

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

563-
let expected = timestamp_of_slot_start_sec(slot, chain);
564-
assert_eq!(
565-
validate_header(&mock_header, chain, pubkey, parent_hash, false, min_bid, slot,),
566-
Err(ValidationError::TimestampMismatch { expected, got: 0 })
567-
);
568-
569-
mock_header.message.header.timestamp = expected;
570-
571570
assert!(matches!(
572571
validate_header(&mock_header, chain, pubkey, parent_hash, false, min_bid, slot),
573572
Err(ValidationError::Sigverify(_))
@@ -580,6 +579,6 @@ mod tests {
580579

581580
assert!(
582581
validate_header(&mock_header, chain, pubkey, parent_hash, false, min_bid, slot).is_ok()
583-
)
582+
);
584583
}
585584
}

0 commit comments

Comments
 (0)