mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-18 22:49:34 +00:00
Add payload attestation validator duty
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user