Don't Reject all Builder Bids After Capella (#3940)
* Fix bug in Builder API Post-Capella * Fix Clippy Complaints
This commit is contained in:
parent
90b6ae62e6
commit
5b398b1990
@ -861,10 +861,10 @@ impl<T: EthSpec> ExecutionLayer<T> {
|
|||||||
match verify_builder_bid(
|
match verify_builder_bid(
|
||||||
&relay,
|
&relay,
|
||||||
parent_hash,
|
parent_hash,
|
||||||
payload_attributes.prev_randao(),
|
payload_attributes,
|
||||||
payload_attributes.timestamp(),
|
|
||||||
Some(local.payload().block_number()),
|
Some(local.payload().block_number()),
|
||||||
self.inner.builder_profit_threshold,
|
self.inner.builder_profit_threshold,
|
||||||
|
current_fork,
|
||||||
spec,
|
spec,
|
||||||
) {
|
) {
|
||||||
Ok(()) => Ok(ProvenancedPayload::Builder(
|
Ok(()) => Ok(ProvenancedPayload::Builder(
|
||||||
@ -915,10 +915,10 @@ impl<T: EthSpec> ExecutionLayer<T> {
|
|||||||
match verify_builder_bid(
|
match verify_builder_bid(
|
||||||
&relay,
|
&relay,
|
||||||
parent_hash,
|
parent_hash,
|
||||||
payload_attributes.prev_randao(),
|
payload_attributes,
|
||||||
payload_attributes.timestamp(),
|
|
||||||
None,
|
None,
|
||||||
self.inner.builder_profit_threshold,
|
self.inner.builder_profit_threshold,
|
||||||
|
current_fork,
|
||||||
spec,
|
spec,
|
||||||
) {
|
) {
|
||||||
Ok(()) => Ok(ProvenancedPayload::Builder(
|
Ok(()) => Ok(ProvenancedPayload::Builder(
|
||||||
@ -1875,6 +1875,11 @@ enum InvalidBuilderPayload {
|
|||||||
signature: Signature,
|
signature: Signature,
|
||||||
pubkey: PublicKeyBytes,
|
pubkey: PublicKeyBytes,
|
||||||
},
|
},
|
||||||
|
#[allow(dead_code)]
|
||||||
|
WithdrawalsRoot {
|
||||||
|
payload: Hash256,
|
||||||
|
expected: Hash256,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InvalidBuilderPayload {
|
impl InvalidBuilderPayload {
|
||||||
@ -1889,6 +1894,7 @@ impl InvalidBuilderPayload {
|
|||||||
InvalidBuilderPayload::BlockNumber { .. } => true,
|
InvalidBuilderPayload::BlockNumber { .. } => true,
|
||||||
InvalidBuilderPayload::Fork { .. } => true,
|
InvalidBuilderPayload::Fork { .. } => true,
|
||||||
InvalidBuilderPayload::Signature { .. } => true,
|
InvalidBuilderPayload::Signature { .. } => true,
|
||||||
|
InvalidBuilderPayload::WithdrawalsRoot { .. } => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1924,6 +1930,13 @@ impl fmt::Display for InvalidBuilderPayload {
|
|||||||
"invalid payload signature {} for pubkey {}",
|
"invalid payload signature {} for pubkey {}",
|
||||||
signature, pubkey
|
signature, pubkey
|
||||||
),
|
),
|
||||||
|
InvalidBuilderPayload::WithdrawalsRoot { payload, expected } => {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"payload withdrawals root was {} not {}",
|
||||||
|
payload, expected
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1932,10 +1945,10 @@ impl fmt::Display for InvalidBuilderPayload {
|
|||||||
fn verify_builder_bid<T: EthSpec, Payload: AbstractExecPayload<T>>(
|
fn verify_builder_bid<T: EthSpec, Payload: AbstractExecPayload<T>>(
|
||||||
bid: &ForkVersionedResponse<SignedBuilderBid<T, Payload>>,
|
bid: &ForkVersionedResponse<SignedBuilderBid<T, Payload>>,
|
||||||
parent_hash: ExecutionBlockHash,
|
parent_hash: ExecutionBlockHash,
|
||||||
prev_randao: Hash256,
|
payload_attributes: &PayloadAttributes,
|
||||||
timestamp: u64,
|
|
||||||
block_number: Option<u64>,
|
block_number: Option<u64>,
|
||||||
profit_threshold: Uint256,
|
profit_threshold: Uint256,
|
||||||
|
current_fork: ForkName,
|
||||||
spec: &ChainSpec,
|
spec: &ChainSpec,
|
||||||
) -> Result<(), Box<InvalidBuilderPayload>> {
|
) -> Result<(), Box<InvalidBuilderPayload>> {
|
||||||
let is_signature_valid = bid.data.verify_signature(spec);
|
let is_signature_valid = bid.data.verify_signature(spec);
|
||||||
@ -1962,29 +1975,25 @@ fn verify_builder_bid<T: EthSpec, Payload: AbstractExecPayload<T>>(
|
|||||||
payload: header.parent_hash(),
|
payload: header.parent_hash(),
|
||||||
expected: parent_hash,
|
expected: parent_hash,
|
||||||
}))
|
}))
|
||||||
} else if header.prev_randao() != prev_randao {
|
} else if header.prev_randao() != payload_attributes.prev_randao() {
|
||||||
Err(Box::new(InvalidBuilderPayload::PrevRandao {
|
Err(Box::new(InvalidBuilderPayload::PrevRandao {
|
||||||
payload: header.prev_randao(),
|
payload: header.prev_randao(),
|
||||||
expected: prev_randao,
|
expected: payload_attributes.prev_randao(),
|
||||||
}))
|
}))
|
||||||
} else if header.timestamp() != timestamp {
|
} else if header.timestamp() != payload_attributes.timestamp() {
|
||||||
Err(Box::new(InvalidBuilderPayload::Timestamp {
|
Err(Box::new(InvalidBuilderPayload::Timestamp {
|
||||||
payload: header.timestamp(),
|
payload: header.timestamp(),
|
||||||
expected: timestamp,
|
expected: payload_attributes.timestamp(),
|
||||||
}))
|
}))
|
||||||
} else if block_number.map_or(false, |n| n != header.block_number()) {
|
} else if block_number.map_or(false, |n| n != header.block_number()) {
|
||||||
Err(Box::new(InvalidBuilderPayload::BlockNumber {
|
Err(Box::new(InvalidBuilderPayload::BlockNumber {
|
||||||
payload: header.block_number(),
|
payload: header.block_number(),
|
||||||
expected: block_number,
|
expected: block_number,
|
||||||
}))
|
}))
|
||||||
} else if !matches!(bid.version, Some(ForkName::Merge)) {
|
} else if bid.version != Some(current_fork) {
|
||||||
// Once fork information is added to the payload, we will need to
|
|
||||||
// check that the local and relay payloads match. At this point, if
|
|
||||||
// we are requesting a payload at all, we have to assume this is
|
|
||||||
// the Bellatrix fork.
|
|
||||||
Err(Box::new(InvalidBuilderPayload::Fork {
|
Err(Box::new(InvalidBuilderPayload::Fork {
|
||||||
payload: bid.version,
|
payload: bid.version,
|
||||||
expected: ForkName::Merge,
|
expected: current_fork,
|
||||||
}))
|
}))
|
||||||
} else if !is_signature_valid {
|
} else if !is_signature_valid {
|
||||||
Err(Box::new(InvalidBuilderPayload::Signature {
|
Err(Box::new(InvalidBuilderPayload::Signature {
|
||||||
|
Loading…
Reference in New Issue
Block a user