mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-02 04:03:35 +00:00
Add payload attestation to op pool and pack into block (#9180)
Store gossip-verified `PayloadAttestationMessage`s in the operation pool and pack them into the block body at during block production. Built on top of #9145. Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com>
This commit is contained in:
@@ -140,11 +140,6 @@ struct RejectedAggregate<E: EthSpec> {
|
||||
error: AttnError,
|
||||
}
|
||||
|
||||
struct RejectedPayloadAttestation {
|
||||
payload_attestation_message: Box<PayloadAttestationMessage>,
|
||||
error: PayloadAttestationError,
|
||||
}
|
||||
|
||||
/// Data for an aggregated or unaggregated attestation that failed verification.
|
||||
enum FailedAtt<E: EthSpec> {
|
||||
Unaggregate {
|
||||
@@ -4111,25 +4106,20 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
peer_id: PeerId,
|
||||
payload_attestation_message: Box<PayloadAttestationMessage>,
|
||||
) {
|
||||
let result = match self
|
||||
let message_slot = payload_attestation_message.data.slot;
|
||||
let result = self
|
||||
.chain
|
||||
.verify_payload_attestation_message_for_gossip(*payload_attestation_message.clone())
|
||||
{
|
||||
Ok(verified) => Ok(verified),
|
||||
Err(error) => Err(RejectedPayloadAttestation {
|
||||
payload_attestation_message: payload_attestation_message.clone(),
|
||||
error,
|
||||
}),
|
||||
};
|
||||
.verify_payload_attestation_message_for_gossip(*payload_attestation_message);
|
||||
|
||||
self.process_gossip_payload_attestation_result(result, message_id, peer_id);
|
||||
self.process_gossip_payload_attestation_result(result, message_id, peer_id, message_slot);
|
||||
}
|
||||
|
||||
fn process_gossip_payload_attestation_result(
|
||||
self: &Arc<Self>,
|
||||
result: Result<VerifiedPayloadAttestationMessage<T>, RejectedPayloadAttestation>,
|
||||
result: Result<VerifiedPayloadAttestationMessage<T>, PayloadAttestationError>,
|
||||
message_id: MessageId,
|
||||
peer_id: PeerId,
|
||||
message_slot: Slot,
|
||||
) {
|
||||
match result {
|
||||
Ok(verified) => {
|
||||
@@ -4156,16 +4146,21 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(e) = self.chain.add_payload_attestation_to_pool(&verified) {
|
||||
warn!(
|
||||
reason = ?e,
|
||||
%peer_id,
|
||||
"Failed to add payload attestation to pool"
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(RejectedPayloadAttestation {
|
||||
payload_attestation_message,
|
||||
error,
|
||||
}) => {
|
||||
Err(error) => {
|
||||
self.handle_payload_attestation_verification_failure(
|
||||
peer_id,
|
||||
message_id,
|
||||
error,
|
||||
payload_attestation_message.data.slot,
|
||||
message_slot,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user