mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
POST /eth/v2/beacon/pool/attestations bugfixes (#6867)
This commit is contained in:
@@ -5,6 +5,7 @@ use beacon_chain::{
|
||||
ChainConfig,
|
||||
};
|
||||
use beacon_processor::work_reprocessing_queue::ReprocessQueueMessage;
|
||||
use either::Either;
|
||||
use eth2::types::ProduceBlockV3Response;
|
||||
use eth2::types::{DepositContractData, StateId};
|
||||
use execution_layer::{ForkchoiceState, PayloadAttributes};
|
||||
@@ -906,9 +907,11 @@ async fn queue_attestations_from_http() {
|
||||
.flat_map(|attestations| attestations.into_iter().map(|(att, _subnet)| att))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let attestations = Either::Right(single_attestations);
|
||||
|
||||
tokio::spawn(async move {
|
||||
client
|
||||
.post_beacon_pool_attestations_v2(&single_attestations, fork_name)
|
||||
.post_beacon_pool_attestations_v2::<E>(attestations, fork_name)
|
||||
.await
|
||||
.expect("attestations should be processed successfully")
|
||||
})
|
||||
|
||||
@@ -3,6 +3,7 @@ use beacon_chain::{
|
||||
test_utils::{AttestationStrategy, BeaconChainHarness, BlockStrategy, EphemeralHarnessType},
|
||||
BeaconChain, ChainConfig, StateSkipConfig, WhenSlotSkipped,
|
||||
};
|
||||
use either::Either;
|
||||
use eth2::{
|
||||
mixin::{RequestAccept, ResponseForkName, ResponseOptional},
|
||||
reqwest::RequestBuilder,
|
||||
@@ -1810,12 +1811,25 @@ impl ApiTester {
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn test_post_beacon_pool_attestations_valid_v1(mut self) -> Self {
|
||||
pub async fn test_post_beacon_pool_attestations_valid(mut self) -> Self {
|
||||
self.client
|
||||
.post_beacon_pool_attestations_v1(self.attestations.as_slice())
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let fork_name = self
|
||||
.attestations
|
||||
.first()
|
||||
.map(|att| self.chain.spec.fork_name_at_slot::<E>(att.data().slot))
|
||||
.unwrap();
|
||||
|
||||
let attestations = Either::Left(self.attestations.clone());
|
||||
|
||||
self.client
|
||||
.post_beacon_pool_attestations_v2::<E>(attestations, fork_name)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(
|
||||
self.network_rx.network_recv.recv().await.is_some(),
|
||||
"valid attestation should be sent to network"
|
||||
@@ -1833,8 +1847,10 @@ impl ApiTester {
|
||||
.first()
|
||||
.map(|att| self.chain.spec.fork_name_at_slot::<E>(att.data.slot))
|
||||
.unwrap();
|
||||
|
||||
let attestations = Either::Right(self.single_attestations.clone());
|
||||
self.client
|
||||
.post_beacon_pool_attestations_v2(self.single_attestations.as_slice(), fork_name)
|
||||
.post_beacon_pool_attestations_v2::<E>(attestations, fork_name)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(
|
||||
@@ -1900,10 +1916,10 @@ impl ApiTester {
|
||||
.first()
|
||||
.map(|att| self.chain.spec.fork_name_at_slot::<E>(att.data().slot))
|
||||
.unwrap();
|
||||
|
||||
let attestations = Either::Right(attestations);
|
||||
let err_v2 = self
|
||||
.client
|
||||
.post_beacon_pool_attestations_v2(attestations.as_slice(), fork_name)
|
||||
.post_beacon_pool_attestations_v2::<E>(attestations, fork_name)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
||||
@@ -6054,9 +6070,9 @@ impl ApiTester {
|
||||
.chain
|
||||
.spec
|
||||
.fork_name_at_slot::<E>(self.chain.slot().unwrap());
|
||||
|
||||
let attestations = Either::Right(self.single_attestations.clone());
|
||||
self.client
|
||||
.post_beacon_pool_attestations_v2(&self.single_attestations, fork_name)
|
||||
.post_beacon_pool_attestations_v2::<E>(attestations, fork_name)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -6375,10 +6391,10 @@ async fn post_beacon_blocks_duplicate() {
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn beacon_pools_post_attestations_valid_v1() {
|
||||
async fn beacon_pools_post_attestations_valid() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_post_beacon_pool_attestations_valid_v1()
|
||||
.test_post_beacon_pool_attestations_valid()
|
||||
.await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user