mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
fix compile
This commit is contained in:
@@ -3,8 +3,8 @@ use crate::metrics;
|
||||
use beacon_chain::blob_verification::BlockWrapper;
|
||||
use beacon_chain::validator_monitor::{get_block_delay_ms, timestamp_now};
|
||||
use beacon_chain::{
|
||||
AvailabilityProcessingStatus, BeaconChain, BeaconChainError, BeaconChainTypes, BlockError,IntoGossipVerifiedBlock,
|
||||
GossipVerifiedBlock, NotifyExecutionLayer,
|
||||
AvailabilityProcessingStatus, BeaconChain, BeaconChainError, BeaconChainTypes, BlockError,
|
||||
GossipVerifiedBlock, IntoGossipVerifiedBlock, NotifyExecutionLayer,
|
||||
};
|
||||
use eth2::types::BroadcastValidation;
|
||||
use eth2::types::SignedBlockContents;
|
||||
@@ -53,16 +53,11 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(
|
||||
) -> Result<(), Rejection> {
|
||||
let seen_timestamp = timestamp_now();
|
||||
|
||||
let (block, blobs_opt, is_locally_built_block) = match provenanced_block {
|
||||
ProvenancedBlock::Local(block_contents, _) => {
|
||||
let (block, maybe_blobs, ) = block_contents.deconstruct();
|
||||
(Arc::new(block), maybe_blobs, true)
|
||||
}
|
||||
ProvenancedBlock::Builder(block_contents, _) => {
|
||||
let (block, maybe_blobs) = block_contents.deconstruct();
|
||||
(Arc::new(block), maybe_blobs, false)
|
||||
}
|
||||
let (block_contents, is_locally_built_block) = match provenanced_block {
|
||||
ProvenancedBlock::Local(block_contents, _) => (block_contents, true),
|
||||
ProvenancedBlock::Builder(block_contents, _) => (block_contents, false),
|
||||
};
|
||||
let block = block_contents.inner();
|
||||
let delay = get_block_delay_ms(seen_timestamp, block.message(), &chain.slot_clock);
|
||||
debug!(log, "Signed block received in HTTP API"; "slot" => block.slot());
|
||||
|
||||
@@ -107,6 +102,15 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(
|
||||
Ok(())
|
||||
};
|
||||
|
||||
/* only publish if gossip- and consensus-valid and equivocation-free */
|
||||
let chain_clone = chain.clone();
|
||||
let slot = block.message().slot();
|
||||
let proposer_index = block.message().proposer_index();
|
||||
let sender_clone = network_tx.clone();
|
||||
let log_clone = log.clone();
|
||||
|
||||
let (block, blobs_opt) = block_contents.parts();
|
||||
|
||||
let mapped_blobs = blobs_opt.clone().map(|blobs| {
|
||||
VariableList::from(
|
||||
blobs
|
||||
@@ -116,17 +120,9 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(
|
||||
)
|
||||
});
|
||||
|
||||
/* only publish if gossip- and consensus-valid and equivocation-free */
|
||||
let chain_clone = chain.clone();
|
||||
let slot = block.message().slot();
|
||||
let block_clone = block.clone();
|
||||
let proposer_index = block.message().proposer_index();
|
||||
let sender_clone = network_tx.clone();
|
||||
let log_clone = log.clone();
|
||||
|
||||
/* if we can form a `GossipVerifiedBlock`, we've passed our basic gossip checks */
|
||||
let gossip_verified_block =
|
||||
BlockWrapper::new(block.clone(), mapped_blobs).into_gossip_verified_block(
|
||||
let gossip_verified_block = GossipVerifiedBlock::new(
|
||||
BlockWrapper::new(block.clone(), mapped_blobs),
|
||||
&chain,
|
||||
)
|
||||
.map_err(|e| {
|
||||
@@ -147,6 +143,8 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(
|
||||
.map_err(|_| warp_utils::reject::custom_server_error("unable to publish".into()))?;
|
||||
}
|
||||
|
||||
let block_clone = block.clone();
|
||||
|
||||
let publish_fn = move || match validation_level {
|
||||
BroadcastValidation::Gossip => Ok(()),
|
||||
BroadcastValidation::Consensus => publish_block(
|
||||
@@ -271,7 +269,8 @@ pub async fn publish_blinded_block<T: BeaconChainTypes>(
|
||||
validation_level: BroadcastValidation,
|
||||
) -> Result<(), Rejection> {
|
||||
let block_root = block.signed_block().canonical_root();
|
||||
let full_block: ProvenancedBlock<T, SignedBlockContents<T::EthSpec>> = reconstruct_block(chain.clone(), block_root, block, log.clone()).await?;
|
||||
let full_block: ProvenancedBlock<T, SignedBlockContents<T::EthSpec>> =
|
||||
reconstruct_block(chain.clone(), block_root, block, log.clone()).await?;
|
||||
publish_block::<T, _>(
|
||||
Some(block_root),
|
||||
full_block,
|
||||
@@ -291,7 +290,7 @@ pub async fn reconstruct_block<T: BeaconChainTypes>(
|
||||
block_root: Hash256,
|
||||
block: SignedBlockContents<T::EthSpec, BlindedPayload<T::EthSpec>>,
|
||||
log: Logger,
|
||||
) -> Result<ProvenancedBlock<T::EthSpec, SignedBlockContents<T::EthSpec>>, Rejection> {
|
||||
) -> Result<ProvenancedBlock<T, SignedBlockContents<T::EthSpec>>, Rejection> {
|
||||
let full_payload_opt = if let Ok(payload_header) =
|
||||
block.signed_block().message().body().execution_payload()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,9 @@ use beacon_chain::{
|
||||
test_utils::{AttestationStrategy, BlockStrategy},
|
||||
GossipVerifiedBlock,
|
||||
};
|
||||
use eth2::types::{BroadcastValidation, SignedBeaconBlock, SignedBlindedBeaconBlock};
|
||||
use eth2::types::{
|
||||
BroadcastValidation, SignedBeaconBlock, SignedBlindedBeaconBlock, SignedBlockContents,
|
||||
};
|
||||
use http_api::test_utils::InteractiveTester;
|
||||
use http_api::{publish_blinded_block, publish_block, reconstruct_block, ProvenancedBlock};
|
||||
use tree_hash::TreeHash;
|
||||
@@ -63,7 +65,7 @@ pub async fn gossip_invalid() {
|
||||
|
||||
tester.harness.advance_slot();
|
||||
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, blobs), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(chain_state_before, slot, |b| {
|
||||
*b.state_root_mut() = Hash256::zero();
|
||||
@@ -73,7 +75,7 @@ pub async fn gossip_invalid() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -115,7 +117,7 @@ pub async fn gossip_partial_pass() {
|
||||
|
||||
tester.harness.advance_slot();
|
||||
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, blobs), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(chain_state_before, slot, |b| {
|
||||
*b.state_root_mut() = Hash256::random()
|
||||
@@ -124,7 +126,7 @@ pub async fn gossip_partial_pass() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -161,11 +163,15 @@ pub async fn gossip_full_pass() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester.harness.make_block(state_a, slot_b).await;
|
||||
let ((block, blobs), _): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a, slot_b).await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block.clone(), blobs),
|
||||
validation_level,
|
||||
)
|
||||
.await;
|
||||
|
||||
assert!(response.is_ok());
|
||||
@@ -202,7 +208,7 @@ pub async fn consensus_invalid() {
|
||||
|
||||
tester.harness.advance_slot();
|
||||
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, blobs), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(chain_state_before, slot, |b| {
|
||||
*b.state_root_mut() = Hash256::zero();
|
||||
@@ -212,7 +218,7 @@ pub async fn consensus_invalid() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -254,14 +260,14 @@ pub async fn consensus_gossip() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, blobs), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(state_a, slot_b, |b| *b.state_root_mut() = Hash256::zero())
|
||||
.await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -304,9 +310,9 @@ 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>, _) =
|
||||
let ((block_a, _), state_after_a): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a.clone(), slot_b).await;
|
||||
let (block_b, state_after_b): (SignedBeaconBlock<E>, _) =
|
||||
let ((block_b, blobs_b), state_after_b): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a, slot_b).await;
|
||||
|
||||
/* check for `make_block` curios */
|
||||
@@ -324,7 +330,7 @@ pub async fn consensus_partial_pass_only_consensus() {
|
||||
|
||||
let publication_result: Result<(), Rejection> = publish_block(
|
||||
None,
|
||||
ProvenancedBlock::local(gossip_block_b.unwrap()),
|
||||
ProvenancedBlock::local((gossip_block_b.unwrap(), blobs_b)),
|
||||
tester.harness.chain.clone(),
|
||||
&channel.0,
|
||||
test_logger,
|
||||
@@ -367,11 +373,15 @@ pub async fn consensus_full_pass() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester.harness.make_block(state_a, slot_b).await;
|
||||
let ((block, blobs), _): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a, slot_b).await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block.clone(), blobs),
|
||||
validation_level,
|
||||
)
|
||||
.await;
|
||||
|
||||
assert!(response.is_ok());
|
||||
@@ -410,7 +420,7 @@ pub async fn equivocation_invalid() {
|
||||
|
||||
tester.harness.advance_slot();
|
||||
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, blobs), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(chain_state_before, slot, |b| {
|
||||
*b.state_root_mut() = Hash256::zero();
|
||||
@@ -420,7 +430,7 @@ pub async fn equivocation_invalid() {
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -463,9 +473,9 @@ pub async fn equivocation_consensus_early_equivocation() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block_a, state_after_a): (SignedBeaconBlock<E>, _) =
|
||||
let ((block_a, blobs_a), state_after_a): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a.clone(), slot_b).await;
|
||||
let (block_b, state_after_b): (SignedBeaconBlock<E>, _) =
|
||||
let ((block_b, blobs_b), state_after_b): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a, slot_b).await;
|
||||
|
||||
/* check for `make_block` curios */
|
||||
@@ -476,7 +486,10 @@ pub async fn equivocation_consensus_early_equivocation() {
|
||||
/* submit `block_a` as valid */
|
||||
assert!(tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block_a, validation_level)
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block_a.clone(), blobs_a),
|
||||
validation_level
|
||||
)
|
||||
.await
|
||||
.is_ok());
|
||||
assert!(tester
|
||||
@@ -487,7 +500,10 @@ pub async fn equivocation_consensus_early_equivocation() {
|
||||
/* submit `block_b` which should induce equivocation */
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block_b, validation_level)
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block_b.clone(), blobs_b),
|
||||
validation_level,
|
||||
)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -529,14 +545,14 @@ pub async fn equivocation_gossip() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, blobs), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(state_a, slot_b, |b| *b.state_root_mut() = Hash256::zero())
|
||||
.await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(&SignedBlockContents::new(block, blobs), validation_level)
|
||||
.await;
|
||||
assert!(response.is_err());
|
||||
|
||||
@@ -582,9 +598,9 @@ pub async fn equivocation_consensus_late_equivocation() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block_a, state_after_a): (SignedBeaconBlock<E>, _) =
|
||||
let ((block_a, _), state_after_a): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a.clone(), slot_b).await;
|
||||
let (block_b, state_after_b): (SignedBeaconBlock<E>, _) =
|
||||
let ((block_b, blobs_b), state_after_b): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a, slot_b).await;
|
||||
|
||||
/* check for `make_block` curios */
|
||||
@@ -601,7 +617,7 @@ pub async fn equivocation_consensus_late_equivocation() {
|
||||
|
||||
let publication_result: Result<(), Rejection> = publish_block(
|
||||
None,
|
||||
ProvenancedBlock::local(gossip_block_b.unwrap()),
|
||||
ProvenancedBlock::local((gossip_block_b.unwrap(), blobs_b)),
|
||||
tester.harness.chain,
|
||||
&channel.0,
|
||||
test_logger,
|
||||
@@ -650,11 +666,15 @@ pub async fn equivocation_full_pass() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester.harness.make_block(state_a, slot_b).await;
|
||||
let ((block, blobs), _): ((SignedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_block(state_a, slot_b).await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block.clone(), blobs),
|
||||
validation_level,
|
||||
)
|
||||
.await;
|
||||
|
||||
assert!(response.is_ok());
|
||||
@@ -692,7 +712,7 @@ pub async fn blinded_gossip_invalid() {
|
||||
|
||||
tester.harness.advance_slot();
|
||||
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, _), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(chain_state_before, slot, |b| {
|
||||
*b.state_root_mut() = Hash256::zero();
|
||||
@@ -746,7 +766,7 @@ pub async fn blinded_gossip_partial_pass() {
|
||||
|
||||
tester.harness.advance_slot();
|
||||
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, _), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(chain_state_before, slot, |b| {
|
||||
*b.state_root_mut() = Hash256::zero()
|
||||
@@ -794,7 +814,7 @@ pub async fn blinded_gossip_full_pass() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBlindedBeaconBlock<E>, _) =
|
||||
let ((block, _), _): ((SignedBlindedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
@@ -837,7 +857,7 @@ pub async fn blinded_consensus_invalid() {
|
||||
|
||||
tester.harness.advance_slot();
|
||||
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, _), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(chain_state_before, slot, |b| {
|
||||
*b.state_root_mut() = Hash256::zero();
|
||||
@@ -891,7 +911,7 @@ pub async fn blinded_consensus_gossip() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, _), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(state_a, slot_b, |b| *b.state_root_mut() = Hash256::zero())
|
||||
.await;
|
||||
@@ -942,7 +962,7 @@ pub async fn blinded_consensus_full_pass() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBlindedBeaconBlock<E>, _) =
|
||||
let ((block, _), _): ((SignedBlindedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
@@ -986,7 +1006,7 @@ pub async fn blinded_equivocation_invalid() {
|
||||
|
||||
tester.harness.advance_slot();
|
||||
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, _), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(chain_state_before, slot, |b| {
|
||||
*b.state_root_mut() = Hash256::zero();
|
||||
@@ -1041,11 +1061,11 @@ pub async fn blinded_equivocation_consensus_early_equivocation() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block_a, state_after_a): (SignedBlindedBeaconBlock<E>, _) = tester
|
||||
let ((block_a, _), state_after_a): ((SignedBlindedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_blinded_block(state_a.clone(), slot_b)
|
||||
.await;
|
||||
let (block_b, state_after_b): (SignedBlindedBeaconBlock<E>, _) =
|
||||
let ((block_b, _), state_after_b): ((SignedBlindedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
/* check for `make_blinded_block` curios */
|
||||
@@ -1109,7 +1129,7 @@ pub async fn blinded_equivocation_gossip() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBeaconBlock<E>, _) = tester
|
||||
let ((block, _), _): ((SignedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_block_with_modifier(state_a, slot_b, |b| *b.state_root_mut() = Hash256::zero())
|
||||
.await;
|
||||
@@ -1164,11 +1184,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, state_after_a): (SignedBlindedBeaconBlock<E>, _) = tester
|
||||
let ((block_a, blobs_a), state_after_a): ((SignedBlindedBeaconBlock<E>, _), _) = tester
|
||||
.harness
|
||||
.make_blinded_block(state_a.clone(), slot_b)
|
||||
.await;
|
||||
let (block_b, state_after_b): (SignedBlindedBeaconBlock<E>, _) =
|
||||
let ((block_b, blobs_b), state_after_b): ((SignedBlindedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
/* check for `make_blinded_block` curios */
|
||||
@@ -1178,16 +1198,16 @@ pub async fn blinded_equivocation_consensus_late_equivocation() {
|
||||
|
||||
let unblinded_block_a = reconstruct_block(
|
||||
tester.harness.chain.clone(),
|
||||
block_a.state_root(),
|
||||
block_a,
|
||||
block_a.canonical_root(),
|
||||
SignedBlockContents::new(block_a, blobs_a),
|
||||
test_logger.clone(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let unblinded_block_b = reconstruct_block(
|
||||
tester.harness.chain.clone(),
|
||||
block_b.clone().state_root(),
|
||||
block_b.clone(),
|
||||
block_b.canonical_root(),
|
||||
SignedBlockContents::new(block_b.clone(), blobs_b.clone()),
|
||||
test_logger.clone(),
|
||||
)
|
||||
.await
|
||||
@@ -1202,15 +1222,17 @@ pub async fn blinded_equivocation_consensus_late_equivocation() {
|
||||
ProvenancedBlock::Builder(b, _) => b,
|
||||
};
|
||||
|
||||
let gossip_block_b = GossipVerifiedBlock::new(inner_block_b, &tester.harness.chain);
|
||||
let gossip_block_b =
|
||||
GossipVerifiedBlock::new(inner_block_b.deconstruct().into(), &tester.harness.chain);
|
||||
assert!(gossip_block_b.is_ok());
|
||||
let gossip_block_a = GossipVerifiedBlock::new(inner_block_a, &tester.harness.chain);
|
||||
let gossip_block_a =
|
||||
GossipVerifiedBlock::new(inner_block_a.deconstruct().into(), &tester.harness.chain);
|
||||
assert!(gossip_block_a.is_err());
|
||||
|
||||
let channel = tokio::sync::mpsc::unbounded_channel();
|
||||
|
||||
let publication_result: Result<(), Rejection> = publish_blinded_block(
|
||||
block_b,
|
||||
SignedBlockContents::new(block_b, blobs_b),
|
||||
tester.harness.chain,
|
||||
&channel.0,
|
||||
test_logger,
|
||||
@@ -1254,12 +1276,15 @@ pub async fn blinded_equivocation_full_pass() {
|
||||
let slot_b = slot_a + 1;
|
||||
|
||||
let state_a = tester.harness.get_current_state();
|
||||
let (block, _): (SignedBlindedBeaconBlock<E>, _) =
|
||||
let ((block, blobs), _): ((SignedBlindedBeaconBlock<E>, _), _) =
|
||||
tester.harness.make_blinded_block(state_a, slot_b).await;
|
||||
|
||||
let response: Result<(), eth2::Error> = tester
|
||||
.client
|
||||
.post_beacon_blocks_v2(&block, validation_level)
|
||||
.post_beacon_blocks_v2(
|
||||
&SignedBlockContents::new(block.clone(), blobs),
|
||||
validation_level,
|
||||
)
|
||||
.await;
|
||||
|
||||
assert!(response.is_ok());
|
||||
|
||||
@@ -4157,7 +4157,7 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
|
||||
let expected_reorg = EventKind::ChainReorg(SseChainReorg {
|
||||
slot: self.reorg_block.slot(),
|
||||
slot: self.reorg_block.signed_block().slot(),
|
||||
depth: 1,
|
||||
old_head_block: self.next_block.signed_block().canonical_root(),
|
||||
old_head_state: self.next_block.signed_block().state_root(),
|
||||
|
||||
Reference in New Issue
Block a user