mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 21:27:12 +00:00
Merge remote-tracking branch 'origin/unstable' into tree-states
This commit is contained in:
@@ -2,18 +2,12 @@ use beacon_chain::{
|
||||
test_utils::{AttestationStrategy, BlockStrategy},
|
||||
GossipVerifiedBlock, IntoGossipVerifiedBlockContents,
|
||||
};
|
||||
use eth2::types::{
|
||||
BroadcastValidation, SignedBeaconBlock, SignedBlindedBeaconBlock, SignedBlockContents,
|
||||
SignedBlockContentsTuple,
|
||||
};
|
||||
use eth2::types::{BroadcastValidation, PublishBlockRequest, SignedBeaconBlock};
|
||||
use http_api::test_utils::InteractiveTester;
|
||||
use http_api::{publish_blinded_block, publish_block, reconstruct_block, ProvenancedBlock};
|
||||
use std::sync::Arc;
|
||||
use tree_hash::TreeHash;
|
||||
use types::{
|
||||
BlindedBlobSidecar, BlindedPayload, BlobSidecar, FullPayload, Hash256, MainnetEthSpec,
|
||||
SignedSidecarList, Slot,
|
||||
};
|
||||
use types::{Hash256, MainnetEthSpec, Slot};
|
||||
use warp::Rejection;
|
||||
use warp_utils::reject::CustomBadRequest;
|
||||
|
||||
@@ -80,7 +74,7 @@ pub async fn gossip_invalid() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.post_beacon_blocks_v2(&PublishBlockRequest::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -131,7 +125,7 @@ pub async fn gossip_partial_pass() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.post_beacon_blocks_v2(&PublishBlockRequest::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -174,7 +168,7 @@ pub async fn gossip_full_pass() {
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block.clone(), blobs),
|
||||
&PublishBlockRequest::new(block.clone(), blobs),
|
||||
validation_level,
|
||||
)
|
||||
.await;
|
||||
@@ -266,7 +260,7 @@ pub async fn consensus_invalid() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.post_beacon_blocks_v2(&PublishBlockRequest::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -315,7 +309,7 @@ pub async fn consensus_gossip() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.post_beacon_blocks_v2(&PublishBlockRequest::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -358,10 +352,8 @@ pub async fn consensus_partial_pass_only_consensus() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let ((block_a, _), state_after_a): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a.clone(), slot_b).await;
|
||||
let ((block_b, blobs_b), state_after_b): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a, slot_b).await;
|
||||
let ((block_a, _), state_after_a) = tester.harness.make_block(state_a.clone(), slot_b).await;
|
||||
let ((block_b, blobs_b), state_after_b) = tester.harness.make_block(state_a, slot_b).await;
|
||||
let block_b_root = block_b.canonical_root();
|
||||
|
||||
/* check for `make_block` curios */
|
||||
@@ -369,7 +361,7 @@ pub async fn consensus_partial_pass_only_consensus() {
|
||||
assert_eq!(block_b.state_root(), state_after_b.tree_hash_root());
|
||||
assert_ne!(block_a.state_root(), block_b.state_root());
|
||||
|
||||
let gossip_block_contents_b = SignedBlockContents::new(block_b, blobs_b)
|
||||
let gossip_block_contents_b = PublishBlockRequest::new(block_b, blobs_b)
|
||||
.into_gossip_verified_block(&tester.harness.chain);
|
||||
assert!(gossip_block_contents_b.is_ok());
|
||||
let gossip_block_a = GossipVerifiedBlock::new(block_a.clone().into(), &tester.harness.chain);
|
||||
@@ -430,7 +422,7 @@ pub async fn consensus_full_pass() {
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block.clone(), blobs),
|
||||
&PublishBlockRequest::new(block.clone(), blobs),
|
||||
validation_level,
|
||||
)
|
||||
.await;
|
||||
@@ -481,7 +473,7 @@ pub async fn equivocation_invalid() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.post_beacon_blocks_v2(&PublishBlockRequest::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -538,7 +530,7 @@ pub async fn equivocation_consensus_early_equivocation() {
|
||||
assert!(tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block_a.clone(), blobs_a),
|
||||
&PublishBlockRequest::new(block_a.clone(), blobs_a),
|
||||
validation_level
|
||||
)
|
||||
.await
|
||||
@@ -552,7 +544,7 @@ pub async fn equivocation_consensus_early_equivocation() {
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block_b.clone(), blobs_b),
|
||||
&PublishBlockRequest::new(block_b.clone(), blobs_b),
|
||||
validation_level,
|
||||
)
|
||||
.await;
|
||||
@@ -603,7 +595,7 @@ pub async fn equivocation_gossip() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.post_beacon_blocks_v2(&PublishBlockRequest::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -661,10 +653,10 @@ pub async fn equivocation_consensus_late_equivocation() {
|
||||
assert_eq!(block_b.state_root(), state_after_b.tree_hash_root());
|
||||
assert_ne!(block_a.state_root(), block_b.state_root());
|
||||
|
||||
let gossip_block_contents_b = SignedBlockContents::new(block_b, blobs_b)
|
||||
let gossip_block_contents_b = PublishBlockRequest::new(block_b, blobs_b)
|
||||
.into_gossip_verified_block(&tester.harness.chain);
|
||||
assert!(gossip_block_contents_b.is_ok());
|
||||
let gossip_block_contents_a = SignedBlockContents::new(block_a, blobs_a)
|
||||
let gossip_block_contents_a = PublishBlockRequest::new(block_a, blobs_a)
|
||||
.into_gossip_verified_block(&tester.harness.chain);
|
||||
assert!(gossip_block_contents_a.is_err());
|
||||
|
||||
@@ -728,7 +720,7 @@ pub async fn equivocation_full_pass() {
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block.clone(), blobs),
|
||||
&PublishBlockRequest::new(block.clone(), blobs),
|
||||
validation_level,
|
||||
)
|
||||
.await;
|
||||
@@ -776,11 +768,9 @@ pub async fn blinded_gossip_invalid() {
|
||||
})
|
||||
.await;
|
||||
|
||||
let blinded_block_contents = into_signed_blinded_block_contents(block_contents_tuple);
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&blinded_block_contents, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&block_contents_tuple.0.clone_as_blinded(), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -829,11 +819,9 @@ pub async fn blinded_gossip_partial_pass() {
|
||||
})
|
||||
.await;
|
||||
|
||||
let blinded_block_contents = into_signed_blinded_block_contents(block_contents_tuple);
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&blinded_block_contents, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&block_contents_tuple.0.clone_as_blinded(), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -870,18 +858,17 @@ pub async fn blinded_gossip_full_pass() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block_contents_tuple, _) = tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
let block_contents = block_contents_tuple.into();
|
||||
let (blinded_block, _) = tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&block_contents, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&blinded_block, validation_level)
|
||||
.await;
|
||||
|
||||
assert!(response.is_ok());
|
||||
assert!(tester
|
||||
.harness
|
||||
.chain
|
||||
.block_is_known_to_fork_choice(&block_contents.signed_block().canonical_root()));
|
||||
.block_is_known_to_fork_choice(&blinded_block.canonical_root()));
|
||||
}
|
||||
|
||||
// This test checks that a block that is valid from both a gossip and consensus perspective is accepted when using `broadcast_validation=gossip`.
|
||||
@@ -912,19 +899,18 @@ pub async fn blinded_gossip_full_pass_ssz() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block_contents_tuple, _) = tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
let block_contents = block_contents_tuple.into();
|
||||
let (blinded_block, _) = tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2_ssz(&block_contents, validation_level)
|
||||
.post_beacon_blinded_blocks_v2_ssz(&blinded_block, validation_level)
|
||||
.await;
|
||||
|
||||
assert!(response.is_ok());
|
||||
assert!(tester
|
||||
.harness
|
||||
.chain
|
||||
.block_is_known_to_fork_choice(&block_contents.signed_block().canonical_root()));
|
||||
.block_is_known_to_fork_choice(&blinded_block.canonical_root()));
|
||||
}
|
||||
|
||||
/// This test checks that a block that is **invalid** from a gossip perspective gets rejected when using `broadcast_validation=consensus`.
|
||||
@@ -963,11 +949,9 @@ pub async fn blinded_consensus_invalid() {
|
||||
})
|
||||
.await;
|
||||
|
||||
let blinded_block_contents = into_signed_blinded_block_contents(block_contents_tuple);
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&blinded_block_contents, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&block_contents_tuple.0.clone_as_blinded(), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -1014,11 +998,9 @@ pub async fn blinded_consensus_gossip() {
|
||||
.make_block_with_modifier(state_a, slot_b, |b| *b.state_root_mut() = Hash256::zero())
|
||||
.await;
|
||||
|
||||
let blinded_block_contents = into_signed_blinded_block_contents(block_contents_tuple);
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&blinded_block_contents, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&block_contents_tuple.0.clone_as_blinded(), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -1060,19 +1042,18 @@ pub async fn blinded_consensus_full_pass() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block_contents_tuple, _) = tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
let (blinded_block, _) = tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
let block_contents = block_contents_tuple.into();
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&block_contents, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&blinded_block, validation_level)
|
||||
.await;
|
||||
|
||||
assert!(response.is_ok());
|
||||
assert!(tester
|
||||
.harness
|
||||
.chain
|
||||
.block_is_known_to_fork_choice(&block_contents.signed_block().canonical_root()));
|
||||
.block_is_known_to_fork_choice(&blinded_block.canonical_root()));
|
||||
}
|
||||
|
||||
/// This test checks that a block that is **invalid** from a gossip perspective gets rejected when using `broadcast_validation=consensus_and_equivocation`.
|
||||
@@ -1112,11 +1093,9 @@ pub async fn blinded_equivocation_invalid() {
|
||||
})
|
||||
.await;
|
||||
|
||||
let blinded_block_contents = into_signed_blinded_block_contents(block_contents_tuple);
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&blinded_block_contents, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&block_contents_tuple.0.clone_as_blinded(), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -1159,18 +1138,13 @@ pub async fn blinded_equivocation_consensus_early_equivocation() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block_contents_tuple_a, state_after_a) = tester
|
||||
let (block_a, state_after_a) = tester
|
||||
.harness
|
||||
.make_blinded_block(state_a.clone(), slot_b)
|
||||
.await;
|
||||
let (block_contents_tuple_b, state_after_b) =
|
||||
tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
let (block_b, state_after_b) = tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
/* check for `make_blinded_block` curios */
|
||||
let block_contents_a: SignedBlockContents<E, BlindedPayload<E>> = block_contents_tuple_a.into();
|
||||
let block_contents_b: SignedBlockContents<E, BlindedPayload<E>> = block_contents_tuple_b.into();
|
||||
let block_a = block_contents_a.signed_block();
|
||||
let block_b = block_contents_b.signed_block();
|
||||
assert_eq!(block_a.state_root(), state_after_a.tree_hash_root());
|
||||
assert_eq!(block_b.state_root(), state_after_b.tree_hash_root());
|
||||
assert_ne!(block_a.state_root(), block_b.state_root());
|
||||
@@ -1178,7 +1152,7 @@ pub async fn blinded_equivocation_consensus_early_equivocation() {
|
||||
/* submit `block_a` as valid */
|
||||
assert!(tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&block_contents_a, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&block_a, validation_level)
|
||||
.await
|
||||
.is_ok());
|
||||
assert!(tester
|
||||
@@ -1189,7 +1163,7 @@ pub async fn blinded_equivocation_consensus_early_equivocation() {
|
||||
/* submit `block_b` which should induce equivocation */
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&block_contents_b, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&block_b, validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -1236,11 +1210,9 @@ pub async fn blinded_equivocation_gossip() {
|
||||
.make_block_with_modifier(state_a, slot_b, |b| *b.state_root_mut() = Hash256::zero())
|
||||
.await;
|
||||
|
||||
let blinded_block_contents = into_signed_blinded_block_contents(block_contents_tuple);
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blinded_blocks_v2(&blinded_block_contents, validation_level)
|
||||
.post_beacon_blinded_blocks_v2(&block_contents_tuple.0.clone_as_blinded(), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -1286,12 +1258,11 @@ pub async fn blinded_equivocation_consensus_late_equivocation() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let ((block_a, blobs_a), state_after_a): ((SignedBlindedBeaconBlock<E>, _), _) = tester
|
||||
let (block_a, state_after_a) = tester
|
||||
.harness
|
||||
.make_blinded_block(state_a.clone(), slot_b)
|
||||
.await;
|
||||
let ((block_b, blobs_b), state_after_b): ((SignedBlindedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
let (block_b, state_after_b) = tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
/* check for `make_blinded_block` curios */
|
||||
assert_eq!(block_a.state_root(), state_after_a.tree_hash_root());
|
||||
@@ -1301,7 +1272,7 @@ pub async fn blinded_equivocation_consensus_late_equivocation() {
|
||||
let unblinded_block_a = reconstruct_block(
|
||||
tester.harness.chain.clone(),
|
||||
block_a.canonical_root(),
|
||||
SignedBlockContents::new(block_a, blobs_a),
|
||||
block_a,
|
||||
test_logger.clone(),
|
||||
)
|
||||
.await
|
||||
@@ -1309,7 +1280,7 @@ pub async fn blinded_equivocation_consensus_late_equivocation() {
|
||||
let unblinded_block_b = reconstruct_block(
|
||||
tester.harness.chain.clone(),
|
||||
block_b.canonical_root(),
|
||||
SignedBlockContents::new(block_b.clone(), blobs_b.clone()),
|
||||
block_b.clone(),
|
||||
test_logger.clone(),
|
||||
)
|
||||
.await
|
||||
@@ -1338,7 +1309,7 @@ pub async fn blinded_equivocation_consensus_late_equivocation() {
|
||||
let channel = tokio::sync::mpsc::unbounded_channel();
|
||||
|
||||
let publication_result = publish_blinded_block(
|
||||
SignedBlockContents::new(block_b, blobs_b),
|
||||
block_b,
|
||||
tester.harness.chain,
|
||||
&channel.0,
|
||||
test_logger,
|
||||
@@ -1383,15 +1354,11 @@ pub async fn blinded_equivocation_full_pass() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let ((block, blobs), _): ((SignedBlindedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
let (block, _) = tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block.clone(), blobs),
|
||||
validation_level,
|
||||
)
|
||||
.post_beacon_blinded_blocks_v2(&block, validation_level)
|
||||
.await;
|
||||
|
||||
assert!(response.is_ok());
|
||||
@@ -1400,20 +1367,3 @@ pub async fn blinded_equivocation_full_pass() {
|
||||
.chain
|
||||
.block_is_known_to_fork_choice(&block.canonical_root()));
|
||||
}
|
||||
|
||||
fn into_signed_blinded_block_contents(
|
||||
block_contents_tuple: SignedBlockContentsTuple<E, FullPayload<E>>,
|
||||
) -> SignedBlockContents<E, BlindedPayload<E>> {
|
||||
let (block, maybe_blobs) = block_contents_tuple;
|
||||
SignedBlockContents::new(block.into(), maybe_blobs.map(into_blinded_blob_sidecars))
|
||||
}
|
||||
|
||||
fn into_blinded_blob_sidecars(
|
||||
blobs: SignedSidecarList<E, BlobSidecar<E>>,
|
||||
) -> SignedSidecarList<E, BlindedBlobSidecar> {
|
||||
blobs
|
||||
.into_iter()
|
||||
.map(|blob| blob.into())
|
||||
.collect::<Vec<_>>()
|
||||
.into()
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tree_hash::TreeHash;
|
||||
use types::{
|
||||
Address, Epoch, EthSpec, ExecPayload, ExecutionBlockHash, ForkName, FullPayload,
|
||||
MainnetEthSpec, MinimalEthSpec, ProposerPreparationData, Slot,
|
||||
Address, Epoch, EthSpec, ExecPayload, ExecutionBlockHash, ForkName, MainnetEthSpec,
|
||||
MinimalEthSpec, ProposerPreparationData, Slot,
|
||||
};
|
||||
|
||||
use eth2::types::ForkVersionedBeaconBlockType::{Blinded, Full};
|
||||
@@ -641,13 +641,9 @@ pub async fn proposer_boost_re_org_test(
|
||||
assert_eq!(block_c.parent_root(), block_b_root);
|
||||
}
|
||||
|
||||
// Sign blobs.
|
||||
let block_c_signed_blobs =
|
||||
block_c_blobs.map(|blobs| harness.sign_blobs(blobs, &state_b, proposer_index));
|
||||
|
||||
// Applying block C should cause it to become head regardless (re-org or continuation).
|
||||
let block_root_c = harness
|
||||
.process_block_result((block_c.clone(), block_c_signed_blobs))
|
||||
.process_block_result((block_c.clone(), block_c_blobs))
|
||||
.await
|
||||
.unwrap()
|
||||
.into();
|
||||
@@ -828,7 +824,7 @@ pub async fn fork_choice_before_proposal() {
|
||||
.into();
|
||||
let block_d = tester
|
||||
.client
|
||||
.get_validator_blocks::<E, FullPayload<E>>(slot_d, &randao_reveal, None)
|
||||
.get_validator_blocks::<E>(slot_d, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
|
||||
@@ -64,8 +64,8 @@ struct ApiTester {
|
||||
harness: Arc<BeaconChainHarness<EphemeralHarnessType<E>>>,
|
||||
chain: Arc<BeaconChain<EphemeralHarnessType<E>>>,
|
||||
client: BeaconNodeHttpClient,
|
||||
next_block: SignedBlockContents<E>,
|
||||
reorg_block: SignedBlockContents<E>,
|
||||
next_block: PublishBlockRequest<E>,
|
||||
reorg_block: PublishBlockRequest<E>,
|
||||
attestations: Vec<Attestation<E>>,
|
||||
contribution_and_proofs: Vec<SignedContributionAndProof<E>>,
|
||||
attester_slashing: AttesterSlashing<E>,
|
||||
@@ -173,13 +173,13 @@ impl ApiTester {
|
||||
let (next_block, _next_state) = harness
|
||||
.make_block(head.beacon_state.clone(), harness.chain.slot().unwrap())
|
||||
.await;
|
||||
let next_block = SignedBlockContents::from(next_block);
|
||||
let next_block = PublishBlockRequest::from(next_block);
|
||||
|
||||
// `make_block` adds random graffiti, so this will produce an alternate block
|
||||
let (reorg_block, _reorg_state) = harness
|
||||
.make_block(head.beacon_state.clone(), harness.chain.slot().unwrap() + 1)
|
||||
.await;
|
||||
let reorg_block = SignedBlockContents::from(reorg_block);
|
||||
let reorg_block = PublishBlockRequest::from(reorg_block);
|
||||
|
||||
let head_state_root = head.beacon_state_root();
|
||||
let attestations = harness
|
||||
@@ -314,13 +314,13 @@ impl ApiTester {
|
||||
let (next_block, _next_state) = harness
|
||||
.make_block(head.beacon_state.clone(), harness.chain.slot().unwrap())
|
||||
.await;
|
||||
let next_block = SignedBlockContents::from(next_block);
|
||||
let next_block = PublishBlockRequest::from(next_block);
|
||||
|
||||
// `make_block` adds random graffiti, so this will produce an alternate block
|
||||
let (reorg_block, _reorg_state) = harness
|
||||
.make_block(head.beacon_state.clone(), harness.chain.slot().unwrap())
|
||||
.await;
|
||||
let reorg_block = SignedBlockContents::from(reorg_block);
|
||||
let reorg_block = PublishBlockRequest::from(reorg_block);
|
||||
|
||||
let head_state_root = head.beacon_state_root();
|
||||
let attestations = harness
|
||||
@@ -850,6 +850,18 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.map(|res| res.data);
|
||||
let result_post_index_ids = self
|
||||
.client
|
||||
.post_beacon_states_validator_balances(state_id.0, validator_index_ids)
|
||||
.await
|
||||
.unwrap()
|
||||
.map(|res| res.data);
|
||||
let result_post_pubkey_ids = self
|
||||
.client
|
||||
.post_beacon_states_validator_balances(state_id.0, validator_pubkey_ids)
|
||||
.await
|
||||
.unwrap()
|
||||
.map(|res| res.data);
|
||||
|
||||
let expected = state_opt.map(|(state, _execution_optimistic, _finalized)| {
|
||||
let mut validators = Vec::with_capacity(validator_indices.len());
|
||||
@@ -868,6 +880,8 @@ impl ApiTester {
|
||||
|
||||
assert_eq!(result_index_ids, expected, "{:?}", state_id);
|
||||
assert_eq!(result_pubkey_ids, expected, "{:?}", state_id);
|
||||
assert_eq!(result_post_index_ids, expected, "{:?}", state_id);
|
||||
assert_eq!(result_post_pubkey_ids, expected, "{:?}", state_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -913,7 +927,6 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.map(|res| res.data);
|
||||
|
||||
let result_pubkey_ids = self
|
||||
.client
|
||||
.get_beacon_states_validators(
|
||||
@@ -924,6 +937,18 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.map(|res| res.data);
|
||||
let post_result_index_ids = self
|
||||
.client
|
||||
.post_beacon_states_validators(state_id.0, Some(validator_index_ids), None)
|
||||
.await
|
||||
.unwrap()
|
||||
.map(|res| res.data);
|
||||
let post_result_pubkey_ids = self
|
||||
.client
|
||||
.post_beacon_states_validators(state_id.0, Some(validator_pubkey_ids), None)
|
||||
.await
|
||||
.unwrap()
|
||||
.map(|res| res.data);
|
||||
|
||||
let expected = state_opt.map(|state| {
|
||||
let epoch = state.current_epoch();
|
||||
@@ -959,6 +984,8 @@ impl ApiTester {
|
||||
|
||||
assert_eq!(result_index_ids, expected, "{:?}", state_id);
|
||||
assert_eq!(result_pubkey_ids, expected, "{:?}", state_id);
|
||||
assert_eq!(post_result_index_ids, expected, "{:?}", state_id);
|
||||
assert_eq!(post_result_pubkey_ids, expected, "{:?}", state_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1301,7 +1328,7 @@ impl ApiTester {
|
||||
|
||||
assert!(self
|
||||
.client
|
||||
.post_beacon_blocks(&SignedBlockContents::from(block))
|
||||
.post_beacon_blocks(&PublishBlockRequest::from(block))
|
||||
.await
|
||||
.is_err());
|
||||
|
||||
@@ -1328,7 +1355,7 @@ impl ApiTester {
|
||||
|
||||
assert!(self
|
||||
.client
|
||||
.post_beacon_blocks_ssz(&SignedBlockContents::from(block))
|
||||
.post_beacon_blocks_ssz(&PublishBlockRequest::from(block))
|
||||
.await
|
||||
.is_err());
|
||||
|
||||
@@ -1357,7 +1384,8 @@ impl ApiTester {
|
||||
.await
|
||||
.is_ok());
|
||||
|
||||
let blinded_block_contents = block_contents.clone_as_blinded();
|
||||
// Blinded deneb block contents is just the blinded block
|
||||
let blinded_block_contents = block_contents.signed_block().clone_as_blinded();
|
||||
|
||||
// Test all the POST methods in sequence, they should all behave the same.
|
||||
let responses = vec![
|
||||
@@ -2567,7 +2595,7 @@ impl ApiTester {
|
||||
|
||||
let block = self
|
||||
.client
|
||||
.get_validator_blocks::<E, FullPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
@@ -2576,7 +2604,7 @@ impl ApiTester {
|
||||
|
||||
let signed_block = block.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
let signed_block_contents =
|
||||
SignedBlockContents::try_from(signed_block.clone()).unwrap();
|
||||
PublishBlockRequest::try_from(signed_block.clone()).unwrap();
|
||||
|
||||
self.client
|
||||
.post_beacon_blocks(&signed_block_contents)
|
||||
@@ -2631,13 +2659,13 @@ impl ApiTester {
|
||||
|
||||
let block_bytes = self
|
||||
.client
|
||||
.get_validator_blocks_ssz::<E, FullPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blocks_ssz::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.expect("block bytes");
|
||||
|
||||
let block_contents =
|
||||
BlockContents::<E, FullPayload<E>>::from_ssz_bytes(&block_bytes, &self.chain.spec)
|
||||
FullBlockContents::<E>::from_ssz_bytes(&block_bytes, &self.chain.spec)
|
||||
.expect("block contents bytes can be decoded");
|
||||
|
||||
let signed_block_contents =
|
||||
@@ -2704,28 +2732,26 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
if is_blinded_payload {
|
||||
let block_contents = <BlockContents<E, BlindedPayload<E>>>::from_ssz_bytes(
|
||||
let blinded_block = <BlindedBeaconBlock<E>>::from_ssz_bytes(
|
||||
&fork_version_response_bytes.unwrap(),
|
||||
&self.chain.spec,
|
||||
)
|
||||
.expect("block contents bytes can be decoded");
|
||||
|
||||
let signed_block_contents =
|
||||
block_contents.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
let signed_blinded_block =
|
||||
blinded_block.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
|
||||
self.client
|
||||
.post_beacon_blocks_ssz(&signed_block_contents)
|
||||
.post_beacon_blinded_blocks_ssz(&signed_blinded_block)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// This converts the generic `Payload` to a concrete type for comparison.
|
||||
let signed_block = signed_block_contents.deconstruct().0;
|
||||
let head_block = SignedBeaconBlock::from(signed_block.clone());
|
||||
assert_eq!(head_block, signed_block);
|
||||
let head_block = self.chain.head_beacon_block().clone_as_blinded();
|
||||
assert_eq!(head_block, signed_blinded_block);
|
||||
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
} else {
|
||||
let block_contents = <BlockContents<E, FullPayload<E>>>::from_ssz_bytes(
|
||||
let block_contents = <FullBlockContents<E>>::from_ssz_bytes(
|
||||
&fork_version_response_bytes.unwrap(),
|
||||
&self.chain.spec,
|
||||
)
|
||||
@@ -2757,7 +2783,7 @@ impl ApiTester {
|
||||
|
||||
let block = self
|
||||
.client
|
||||
.get_validator_blocks_modular::<E, FullPayload<E>>(
|
||||
.get_validator_blocks_modular::<E>(
|
||||
slot,
|
||||
&Signature::infinity().unwrap().into(),
|
||||
None,
|
||||
@@ -2815,13 +2841,13 @@ impl ApiTester {
|
||||
|
||||
// Check failure with no `skip_randao_verification` passed.
|
||||
self.client
|
||||
.get_validator_blocks::<E, FullPayload<E>>(slot, &bad_randao_reveal, None)
|
||||
.get_validator_blocks::<E>(slot, &bad_randao_reveal, None)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
||||
// Check failure with `skip_randao_verification` (requires infinity sig).
|
||||
self.client
|
||||
.get_validator_blocks_modular::<E, FullPayload<E>>(
|
||||
.get_validator_blocks_modular::<E>(
|
||||
slot,
|
||||
&bad_randao_reveal,
|
||||
None,
|
||||
@@ -2836,7 +2862,7 @@ impl ApiTester {
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn test_blinded_block_production<Payload: AbstractExecPayload<E>>(&self) {
|
||||
pub async fn test_blinded_block_production(&self) {
|
||||
let fork = self.chain.canonical_head.cached_head().head_fork();
|
||||
let genesis_validators_root = self.chain.genesis_validators_root;
|
||||
|
||||
@@ -2876,29 +2902,33 @@ impl ApiTester {
|
||||
|
||||
let block = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, Payload>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
|
||||
let signed_block_contents =
|
||||
block.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
let signed_block = block.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
|
||||
self.client
|
||||
.post_beacon_blinded_blocks(&signed_block_contents)
|
||||
.post_beacon_blinded_blocks(&signed_block)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// This converts the generic `Payload` to a concrete type for comparison.
|
||||
let signed_block = signed_block_contents.deconstruct().0;
|
||||
let head_block = SignedBeaconBlock::from(signed_block.clone());
|
||||
assert_eq!(head_block, signed_block);
|
||||
let head_block = self
|
||||
.client
|
||||
.get_beacon_blocks(CoreBlockId::Head)
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.data;
|
||||
|
||||
assert_eq!(head_block.clone_as_blinded(), signed_block);
|
||||
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn test_blinded_block_production_ssz<Payload: AbstractExecPayload<E>>(&self) {
|
||||
pub async fn test_blinded_block_production_ssz(&self) {
|
||||
let fork = self.chain.canonical_head.cached_head().head_fork();
|
||||
let genesis_validators_root = self.chain.genesis_validators_root;
|
||||
|
||||
@@ -2938,43 +2968,47 @@ impl ApiTester {
|
||||
|
||||
let block_contents_bytes = self
|
||||
.client
|
||||
.get_validator_blinded_blocks_ssz::<E, Payload>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks_ssz::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.expect("block bytes");
|
||||
|
||||
let block_contents = BlockContents::<E, Payload>::from_ssz_bytes(
|
||||
&block_contents_bytes,
|
||||
&self.chain.spec,
|
||||
)
|
||||
.expect("block contents bytes can be decoded");
|
||||
let block_contents =
|
||||
FullBlockContents::<E>::from_ssz_bytes(&block_contents_bytes, &self.chain.spec)
|
||||
.expect("block contents bytes can be decoded");
|
||||
|
||||
let signed_block_contents =
|
||||
block_contents.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
|
||||
self.client
|
||||
.post_beacon_blinded_blocks_ssz(&signed_block_contents)
|
||||
.post_beacon_blinded_blocks_ssz(
|
||||
&signed_block_contents.signed_block().clone_as_blinded(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
// This converts the generic `Payload` to a concrete type for comparison.
|
||||
let signed_block = signed_block_contents.deconstruct().0;
|
||||
let head_block = SignedBeaconBlock::from(signed_block.clone());
|
||||
assert_eq!(head_block, signed_block);
|
||||
let head_block = self
|
||||
.client
|
||||
.get_beacon_blocks(CoreBlockId::Head)
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.data;
|
||||
|
||||
let signed_block = signed_block_contents.signed_block();
|
||||
assert_eq!(&head_block, signed_block);
|
||||
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn test_blinded_block_production_no_verify_randao<Payload: AbstractExecPayload<E>>(
|
||||
self,
|
||||
) -> Self {
|
||||
pub async fn test_blinded_block_production_no_verify_randao(self) -> Self {
|
||||
for _ in 0..E::slots_per_epoch() {
|
||||
let slot = self.chain.slot().unwrap();
|
||||
|
||||
let block_contents = self
|
||||
let blinded_block = self
|
||||
.client
|
||||
.get_validator_blinded_blocks_modular::<E, Payload>(
|
||||
.get_validator_blinded_blocks_modular::<E>(
|
||||
slot,
|
||||
&Signature::infinity().unwrap().into(),
|
||||
None,
|
||||
@@ -2983,18 +3017,14 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
assert_eq!(block_contents.block().slot(), slot);
|
||||
assert_eq!(blinded_block.slot(), slot);
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
}
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn test_blinded_block_production_verify_randao_invalid<
|
||||
Payload: AbstractExecPayload<E>,
|
||||
>(
|
||||
self,
|
||||
) -> Self {
|
||||
pub async fn test_blinded_block_production_verify_randao_invalid(self) -> Self {
|
||||
let fork = self.chain.canonical_head.cached_head().head_fork();
|
||||
let genesis_validators_root = self.chain.genesis_validators_root;
|
||||
|
||||
@@ -3034,13 +3064,13 @@ impl ApiTester {
|
||||
|
||||
// Check failure with full randao verification enabled.
|
||||
self.client
|
||||
.get_validator_blinded_blocks::<E, Payload>(slot, &bad_randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &bad_randao_reveal, None)
|
||||
.await
|
||||
.unwrap_err();
|
||||
|
||||
// Check failure with `skip_randao_verification` (requires infinity sig).
|
||||
self.client
|
||||
.get_validator_blinded_blocks_modular::<E, Payload>(
|
||||
.get_validator_blinded_blocks_modular::<E>(
|
||||
slot,
|
||||
&bad_randao_reveal,
|
||||
None,
|
||||
@@ -3520,13 +3550,7 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
let payload: BlindedPayload<E> = match payload_type {
|
||||
Blinded(payload) => payload
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.into(),
|
||||
Blinded(payload) => payload.data.body().execution_payload().unwrap().into(),
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
@@ -3545,11 +3569,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -3586,11 +3609,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -3630,13 +3652,7 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
let payload: BlindedPayload<E> = match payload_type {
|
||||
Blinded(payload) => payload
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.into(),
|
||||
Blinded(payload) => payload.data.body().execution_payload().unwrap().into(),
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
@@ -3665,11 +3681,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -3711,13 +3726,7 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
let payload: BlindedPayload<E> = match payload_type {
|
||||
Blinded(payload) => payload
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.into(),
|
||||
Blinded(payload) => payload.data.body().execution_payload().unwrap().into(),
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
@@ -3752,11 +3761,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -3845,11 +3853,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -3936,11 +3943,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4026,11 +4032,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4102,11 +4107,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4162,11 +4166,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4235,11 +4238,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4265,11 +4267,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4370,11 +4371,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4410,11 +4410,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(next_slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4524,11 +4523,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4608,11 +4606,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4673,11 +4670,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4738,11 +4734,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4803,11 +4798,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4867,11 +4861,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -4907,16 +4900,11 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let block_contents = match payload_type {
|
||||
let _block_contents = match payload_type {
|
||||
Blinded(payload) => payload.data,
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
let (_, maybe_sidecars) = block_contents.deconstruct();
|
||||
|
||||
// Response should contain blob sidecars
|
||||
assert!(maybe_sidecars.is_some());
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
@@ -4940,11 +4928,10 @@ impl ApiTester {
|
||||
|
||||
let payload: BlindedPayload<E> = self
|
||||
.client
|
||||
.get_validator_blinded_blocks::<E, BlindedPayload<E>>(slot, &randao_reveal, None)
|
||||
.get_validator_blinded_blocks::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap()
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
@@ -5892,17 +5879,14 @@ async fn block_production_v3_ssz_with_skip_slots() {
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn blinded_block_production_full_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_blinded_block_production::<FullPayload<_>>()
|
||||
.await;
|
||||
ApiTester::new().await.test_blinded_block_production().await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn blinded_block_production_ssz_full_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_blinded_block_production_ssz::<FullPayload<_>>()
|
||||
.test_blinded_block_production_ssz()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -5911,7 +5895,7 @@ async fn blinded_block_production_with_skip_slots_full_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_blinded_block_production::<FullPayload<_>>()
|
||||
.test_blinded_block_production()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -5920,7 +5904,7 @@ async fn blinded_block_production_ssz_with_skip_slots_full_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_blinded_block_production_ssz::<FullPayload<_>>()
|
||||
.test_blinded_block_production_ssz()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -5928,7 +5912,7 @@ async fn blinded_block_production_ssz_with_skip_slots_full_payload_premerge() {
|
||||
async fn blinded_block_production_no_verify_randao_full_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_blinded_block_production_no_verify_randao::<FullPayload<_>>()
|
||||
.test_blinded_block_production_no_verify_randao()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -5936,16 +5920,13 @@ async fn blinded_block_production_no_verify_randao_full_payload_premerge() {
|
||||
async fn blinded_block_production_verify_randao_invalid_full_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_blinded_block_production_verify_randao_invalid::<FullPayload<_>>()
|
||||
.test_blinded_block_production_verify_randao_invalid()
|
||||
.await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn blinded_block_production_blinded_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_blinded_block_production::<BlindedPayload<_>>()
|
||||
.await;
|
||||
ApiTester::new().await.test_blinded_block_production().await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
@@ -5953,7 +5934,7 @@ async fn blinded_block_production_with_skip_slots_blinded_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.skip_slots(E::slots_per_epoch() * 2)
|
||||
.test_blinded_block_production::<BlindedPayload<_>>()
|
||||
.test_blinded_block_production()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -5961,7 +5942,7 @@ async fn blinded_block_production_with_skip_slots_blinded_payload_premerge() {
|
||||
async fn blinded_block_production_no_verify_randao_blinded_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_blinded_block_production_no_verify_randao::<BlindedPayload<_>>()
|
||||
.test_blinded_block_production_no_verify_randao()
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -5969,7 +5950,7 @@ async fn blinded_block_production_no_verify_randao_blinded_payload_premerge() {
|
||||
async fn blinded_block_production_verify_randao_invalid_blinded_payload_premerge() {
|
||||
ApiTester::new()
|
||||
.await
|
||||
.test_blinded_block_production_verify_randao_invalid::<BlindedPayload<_>>()
|
||||
.test_blinded_block_production_verify_randao_invalid()
|
||||
.await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user