Add payload attestation validator duty

This commit is contained in:
Eitan Seri-Levi
2026-04-27 08:48:06 +02:00
parent 80f1b4b521
commit 0fe60af63a
10 changed files with 396 additions and 13 deletions

View File

@@ -17,8 +17,9 @@ use std::sync::Arc;
use tokio::sync::mpsc::UnboundedSender;
use tracing::{debug, info, warn};
use types::{
Attestation, AttestationData, AttesterSlashing, ForkName, ProposerSlashing,
SignedBlsToExecutionChange, SignedVoluntaryExit, SingleAttestation, SyncCommitteeMessage,
Attestation, AttestationData, AttesterSlashing, ForkName, PayloadAttestationMessage,
ProposerSlashing, SignedBlsToExecutionChange, SignedVoluntaryExit, SingleAttestation,
SyncCommitteeMessage,
};
use warp::filters::BoxedFilter;
use warp::{Filter, Reply};
@@ -520,3 +521,34 @@ pub fn post_beacon_pool_attestations_v2<T: BeaconChainTypes>(
)
.boxed()
}
/// POST beacon/pool/payload_attestations
pub fn post_beacon_pool_payload_attestations<T: BeaconChainTypes>(
network_tx_filter: &NetworkTxFilter<T>,
beacon_pool_path: &BeaconPoolPathFilter<T>,
) -> ResponseFilter {
beacon_pool_path
.clone()
.and(warp::path("payload_attestations"))
.and(warp::path::end())
.and(warp_utils::json::json())
.and(network_tx_filter.clone())
.then(
|task_spawner: TaskSpawner<T::EthSpec>,
_chain: Arc<BeaconChain<T>>,
messages: Vec<PayloadAttestationMessage>,
network_tx: UnboundedSender<NetworkMessage<T::EthSpec>>| {
task_spawner.blocking_json_task(Priority::P0, move || {
// TODO(gloas): add proper verification once payload_attestation_verification is implemented
for message in messages {
utils::publish_pubsub_message(
&network_tx,
PubsubMessage::PayloadAttestation(Box::new(message)),
)?;
}
Ok(())
})
},
)
.boxed()
}

View File

@@ -1487,6 +1487,10 @@ pub fn serve<T: BeaconChainTypes>(
let post_beacon_pool_sync_committees =
post_beacon_pool_sync_committees(&network_tx_filter, &beacon_pool_path);
// POST beacon/pool/payload_attestations
let post_beacon_pool_payload_attestations =
post_beacon_pool_payload_attestations(&network_tx_filter, &beacon_pool_path);
// GET beacon/pool/bls_to_execution_changes
let get_beacon_pool_bls_to_execution_changes =
get_beacon_pool_bls_to_execution_changes(&beacon_pool_path);
@@ -3411,6 +3415,7 @@ pub fn serve<T: BeaconChainTypes>(
.uor(post_beacon_pool_proposer_slashings)
.uor(post_beacon_pool_voluntary_exits)
.uor(post_beacon_pool_sync_committees)
.uor(post_beacon_pool_payload_attestations)
.uor(post_beacon_pool_bls_to_execution_changes)
.uor(post_beacon_execution_payload_envelope)
.uor(post_beacon_state_validators)