mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-23 15:58:26 +00:00
Clean up blockv3 metadata and client (#5015)
* Improve block production v3 client * Delete wayward line * Overhaul JSON endpoint as well * Rename timeout param * Update tests * I broke everything * Ah this is an insane fix * Remove unnecessary optionals * Doc fix
This commit is contained in:
@@ -77,12 +77,12 @@ use tokio_stream::{
|
||||
StreamExt,
|
||||
};
|
||||
use types::{
|
||||
Attestation, AttestationData, AttestationShufflingId, AttesterSlashing, BeaconStateError,
|
||||
CommitteeCache, ConfigAndPreset, Epoch, EthSpec, ForkName, ForkVersionedResponse, Hash256,
|
||||
ProposerPreparationData, ProposerSlashing, RelativeEpoch, SignedAggregateAndProof,
|
||||
SignedBlindedBeaconBlock, SignedBlsToExecutionChange, SignedContributionAndProof,
|
||||
SignedValidatorRegistrationData, SignedVoluntaryExit, Slot, SyncCommitteeMessage,
|
||||
SyncContributionData,
|
||||
fork_versioned_response::EmptyMetadata, Attestation, AttestationData, AttestationShufflingId,
|
||||
AttesterSlashing, BeaconStateError, CommitteeCache, ConfigAndPreset, Epoch, EthSpec, ForkName,
|
||||
ForkVersionedResponse, Hash256, ProposerPreparationData, ProposerSlashing, RelativeEpoch,
|
||||
SignedAggregateAndProof, SignedBlindedBeaconBlock, SignedBlsToExecutionChange,
|
||||
SignedContributionAndProof, SignedValidatorRegistrationData, SignedVoluntaryExit, Slot,
|
||||
SyncCommitteeMessage, SyncContributionData,
|
||||
};
|
||||
use validator::pubkey_to_validator_index;
|
||||
use version::{
|
||||
@@ -2399,6 +2399,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
}),
|
||||
_ => Ok(warp::reply::json(&ForkVersionedResponse {
|
||||
version: Some(fork_name),
|
||||
metadata: EmptyMetadata {},
|
||||
data: bootstrap,
|
||||
})
|
||||
.into_response()),
|
||||
@@ -2446,6 +2447,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
}),
|
||||
_ => Ok(warp::reply::json(&ForkVersionedResponse {
|
||||
version: Some(fork_name),
|
||||
metadata: EmptyMetadata {},
|
||||
data: update,
|
||||
})
|
||||
.into_response()),
|
||||
@@ -2493,6 +2495,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
}),
|
||||
_ => Ok(warp::reply::json(&ForkVersionedResponse {
|
||||
version: Some(fork_name),
|
||||
metadata: EmptyMetadata {},
|
||||
data: update,
|
||||
})
|
||||
.into_response()),
|
||||
@@ -3193,7 +3196,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
);
|
||||
|
||||
if endpoint_version == V3 {
|
||||
produce_block_v3(endpoint_version, accept_header, chain, slot, query).await
|
||||
produce_block_v3(accept_header, chain, slot, query).await
|
||||
} else {
|
||||
produce_block_v2(endpoint_version, accept_header, chain, slot, query).await
|
||||
}
|
||||
|
||||
@@ -1,17 +1,3 @@
|
||||
use bytes::Bytes;
|
||||
use std::sync::Arc;
|
||||
use types::{payload::BlockProductionVersion, *};
|
||||
|
||||
use beacon_chain::{
|
||||
BeaconBlockResponseWrapper, BeaconChain, BeaconChainTypes, ProduceBlockVerification,
|
||||
};
|
||||
use eth2::types::{self as api_types, EndpointVersion, SkipRandaoVerification};
|
||||
use ssz::Encode;
|
||||
use warp::{
|
||||
hyper::{Body, Response},
|
||||
Reply,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
build_block_contents,
|
||||
version::{
|
||||
@@ -20,6 +6,20 @@ use crate::{
|
||||
fork_versioned_response, inconsistent_fork_rejection,
|
||||
},
|
||||
};
|
||||
use beacon_chain::{
|
||||
BeaconBlockResponseWrapper, BeaconChain, BeaconChainTypes, ProduceBlockVerification,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use eth2::types::{
|
||||
self as api_types, EndpointVersion, ProduceBlockV3Metadata, SkipRandaoVerification,
|
||||
};
|
||||
use ssz::Encode;
|
||||
use std::sync::Arc;
|
||||
use types::{payload::BlockProductionVersion, *};
|
||||
use warp::{
|
||||
hyper::{Body, Response},
|
||||
Reply,
|
||||
};
|
||||
|
||||
pub fn get_randao_verification(
|
||||
query: &api_types::ValidatorBlocksQuery,
|
||||
@@ -40,7 +40,6 @@ pub fn get_randao_verification(
|
||||
}
|
||||
|
||||
pub async fn produce_block_v3<T: BeaconChainTypes>(
|
||||
endpoint_version: EndpointVersion,
|
||||
accept_header: Option<api_types::Accept>,
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
slot: Slot,
|
||||
@@ -68,13 +67,12 @@ pub async fn produce_block_v3<T: BeaconChainTypes>(
|
||||
warp_utils::reject::custom_bad_request(format!("failed to fetch a block: {:?}", e))
|
||||
})?;
|
||||
|
||||
build_response_v3(chain, block_response_type, endpoint_version, accept_header)
|
||||
build_response_v3(chain, block_response_type, accept_header)
|
||||
}
|
||||
|
||||
pub fn build_response_v3<T: BeaconChainTypes>(
|
||||
chain: Arc<BeaconChain<T>>,
|
||||
block_response: BeaconBlockResponseWrapper<T::EthSpec>,
|
||||
endpoint_version: EndpointVersion,
|
||||
accept_header: Option<api_types::Accept>,
|
||||
) -> Result<Response<Body>, warp::Rejection> {
|
||||
let fork_name = block_response
|
||||
@@ -84,6 +82,13 @@ pub fn build_response_v3<T: BeaconChainTypes>(
|
||||
let consensus_block_value = block_response.consensus_block_value();
|
||||
let execution_payload_blinded = block_response.is_blinded();
|
||||
|
||||
let metadata = ProduceBlockV3Metadata {
|
||||
consensus_version: fork_name,
|
||||
execution_payload_blinded,
|
||||
execution_payload_value,
|
||||
consensus_block_value,
|
||||
};
|
||||
|
||||
let block_contents = build_block_contents::build_block_contents(fork_name, block_response)?;
|
||||
|
||||
match accept_header {
|
||||
@@ -100,12 +105,17 @@ pub fn build_response_v3<T: BeaconChainTypes>(
|
||||
.map_err(|e| -> warp::Rejection {
|
||||
warp_utils::reject::custom_server_error(format!("failed to create response: {}", e))
|
||||
}),
|
||||
_ => fork_versioned_response(endpoint_version, fork_name, block_contents)
|
||||
.map(|response| warp::reply::json(&response).into_response())
|
||||
.map(|res| add_consensus_version_header(res, fork_name))
|
||||
.map(|res| add_execution_payload_blinded_header(res, execution_payload_blinded))
|
||||
.map(|res| add_execution_payload_value_header(res, execution_payload_value))
|
||||
.map(|res| add_consensus_block_value_header(res, consensus_block_value)),
|
||||
_ => Ok(warp::reply::json(&ForkVersionedResponse {
|
||||
version: Some(fork_name),
|
||||
metadata,
|
||||
data: block_contents,
|
||||
})
|
||||
.into_response())
|
||||
.map(|res| res.into_response())
|
||||
.map(|res| add_consensus_version_header(res, fork_name))
|
||||
.map(|res| add_execution_payload_blinded_header(res, execution_payload_blinded))
|
||||
.map(|res| add_execution_payload_value_header(res, execution_payload_value))
|
||||
.map(|res| add_consensus_block_value_header(res, consensus_block_value)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
use crate::api_types::fork_versioned_response::ExecutionOptimisticFinalizedForkVersionedResponse;
|
||||
use crate::api_types::EndpointVersion;
|
||||
use eth2::{
|
||||
CONSENSUS_BLOCK_VALUE_HEADER, CONSENSUS_VERSION_HEADER, EXECUTION_PAYLOAD_BLINDED_HEADER,
|
||||
EXECUTION_PAYLOAD_VALUE_HEADER,
|
||||
};
|
||||
use serde::Serialize;
|
||||
use types::{ForkName, ForkVersionedResponse, InconsistentFork, Uint256};
|
||||
use types::{
|
||||
fork_versioned_response::{
|
||||
ExecutionOptimisticFinalizedForkVersionedResponse, ExecutionOptimisticFinalizedMetadata,
|
||||
},
|
||||
ForkName, ForkVersionedResponse, InconsistentFork, Uint256,
|
||||
};
|
||||
use warp::reply::{self, Reply, Response};
|
||||
|
||||
pub const V1: EndpointVersion = EndpointVersion(1);
|
||||
@@ -26,6 +30,7 @@ pub fn fork_versioned_response<T: Serialize>(
|
||||
};
|
||||
Ok(ForkVersionedResponse {
|
||||
version: fork_name,
|
||||
metadata: Default::default(),
|
||||
data,
|
||||
})
|
||||
}
|
||||
@@ -46,8 +51,10 @@ pub fn execution_optimistic_finalized_fork_versioned_response<T: Serialize>(
|
||||
};
|
||||
Ok(ExecutionOptimisticFinalizedForkVersionedResponse {
|
||||
version: fork_name,
|
||||
execution_optimistic: Some(execution_optimistic),
|
||||
finalized: Some(finalized),
|
||||
metadata: ExecutionOptimisticFinalizedMetadata {
|
||||
execution_optimistic: Some(execution_optimistic),
|
||||
finalized: Some(finalized),
|
||||
},
|
||||
data,
|
||||
})
|
||||
}
|
||||
@@ -73,12 +80,12 @@ pub fn add_execution_payload_blinded_header<T: Reply>(
|
||||
/// Add the `Eth-Execution-Payload-Value` header to a response.
|
||||
pub fn add_execution_payload_value_header<T: Reply>(
|
||||
reply: T,
|
||||
execution_payload_value: Option<Uint256>,
|
||||
execution_payload_value: Uint256,
|
||||
) -> Response {
|
||||
reply::with_header(
|
||||
reply,
|
||||
EXECUTION_PAYLOAD_VALUE_HEADER,
|
||||
execution_payload_value.unwrap_or_default().to_string(),
|
||||
execution_payload_value.to_string(),
|
||||
)
|
||||
.into_response()
|
||||
}
|
||||
@@ -86,12 +93,12 @@ pub fn add_execution_payload_value_header<T: Reply>(
|
||||
/// Add the `Eth-Consensus-Block-Value` header to a response.
|
||||
pub fn add_consensus_block_value_header<T: Reply>(
|
||||
reply: T,
|
||||
consensus_payload_value: Option<u64>,
|
||||
consensus_payload_value: u64,
|
||||
) -> Response {
|
||||
reply::with_header(
|
||||
reply,
|
||||
CONSENSUS_BLOCK_VALUE_HEADER,
|
||||
consensus_payload_value.unwrap_or_default().to_string(),
|
||||
consensus_payload_value.to_string(),
|
||||
)
|
||||
.into_response()
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ use beacon_chain::{
|
||||
test_utils::{AttestationStrategy, BlockStrategy, SyncCommitteeStrategy},
|
||||
ChainConfig,
|
||||
};
|
||||
use eth2::types::ProduceBlockV3Response;
|
||||
use eth2::types::{DepositContractData, StateId};
|
||||
use execution_layer::{ForkchoiceState, PayloadAttributes};
|
||||
use http_api::test_utils::InteractiveTester;
|
||||
@@ -21,8 +22,6 @@ use types::{
|
||||
MinimalEthSpec, ProposerPreparationData, Slot,
|
||||
};
|
||||
|
||||
use eth2::types::ForkVersionedBeaconBlockType::{Blinded, Full};
|
||||
|
||||
type E = MainnetEthSpec;
|
||||
|
||||
// Test that the deposit_contract endpoint returns the correct chain_id and address.
|
||||
@@ -113,8 +112,8 @@ async fn state_by_root_pruned_from_fork_choice() {
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
|
||||
assert!(response.finalized.unwrap());
|
||||
assert!(!response.execution_optimistic.unwrap());
|
||||
assert!(response.metadata.finalized.unwrap());
|
||||
assert!(!response.metadata.execution_optimistic.unwrap());
|
||||
|
||||
let mut state = response.data;
|
||||
assert_eq!(state.update_tree_hash_cache().unwrap(), state_root);
|
||||
@@ -619,15 +618,17 @@ pub async fn proposer_boost_re_org_test(
|
||||
let randao_reveal = harness
|
||||
.sign_randao_reveal(&state_b, proposer_index, slot_c)
|
||||
.into();
|
||||
let unsigned_block_type = tester
|
||||
let (unsigned_block_type, _) = tester
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot_c, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let (unsigned_block_c, block_c_blobs) = match unsigned_block_type {
|
||||
Full(unsigned_block_contents_c) => unsigned_block_contents_c.data.deconstruct(),
|
||||
Blinded(_) => {
|
||||
let (unsigned_block_c, block_c_blobs) = match unsigned_block_type.data {
|
||||
ProduceBlockV3Response::Full(unsigned_block_contents_c) => {
|
||||
unsigned_block_contents_c.deconstruct()
|
||||
}
|
||||
ProduceBlockV3Response::Blinded(_) => {
|
||||
panic!("Should not be a blinded block");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,7 +7,9 @@ use environment::null_logger;
|
||||
use eth2::{
|
||||
mixin::{RequestAccept, ResponseForkName, ResponseOptional},
|
||||
reqwest::RequestBuilder,
|
||||
types::{BlockId as CoreBlockId, ForkChoiceNode, StateId as CoreStateId, *},
|
||||
types::{
|
||||
BlockId as CoreBlockId, ForkChoiceNode, ProduceBlockV3Response, StateId as CoreStateId, *,
|
||||
},
|
||||
BeaconNodeHttpClient, Error, StatusCode, Timeouts,
|
||||
};
|
||||
use execution_layer::test_utils::{
|
||||
@@ -38,8 +40,6 @@ use types::{
|
||||
MainnetEthSpec, RelativeEpoch, SelectionProof, SignedRoot, Slot,
|
||||
};
|
||||
|
||||
use eth2::types::ForkVersionedBeaconBlockType::{Blinded, Full};
|
||||
|
||||
type E = MainnetEthSpec;
|
||||
|
||||
const SECONDS_PER_SLOT: u64 = 12;
|
||||
@@ -655,6 +655,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.metadata
|
||||
.finalized
|
||||
.unwrap();
|
||||
|
||||
@@ -691,6 +692,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.metadata
|
||||
.finalized
|
||||
.unwrap();
|
||||
|
||||
@@ -728,6 +730,7 @@ impl ApiTester {
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.metadata
|
||||
.finalized
|
||||
.unwrap();
|
||||
|
||||
@@ -2725,52 +2728,57 @@ impl ApiTester {
|
||||
sk.sign(message).into()
|
||||
};
|
||||
|
||||
let (fork_version_response_bytes, is_blinded_payload) = self
|
||||
let (response, metadata) = self
|
||||
.client
|
||||
.get_validator_blocks_v3_ssz::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
if is_blinded_payload {
|
||||
let blinded_block = <BlindedBeaconBlock<E>>::from_ssz_bytes(
|
||||
&fork_version_response_bytes.unwrap(),
|
||||
&self.chain.spec,
|
||||
)
|
||||
.expect("block contents bytes can be decoded");
|
||||
match response {
|
||||
ProduceBlockV3Response::Blinded(blinded_block) => {
|
||||
assert!(metadata.execution_payload_blinded);
|
||||
assert_eq!(
|
||||
metadata.consensus_version,
|
||||
blinded_block.to_ref().fork_name(&self.chain.spec).unwrap()
|
||||
);
|
||||
let signed_blinded_block =
|
||||
blinded_block.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_blinded_blocks_ssz(&signed_blinded_block)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
self.client
|
||||
.post_beacon_blinded_blocks_ssz(&signed_blinded_block)
|
||||
.await
|
||||
.unwrap();
|
||||
let head_block = self.chain.head_beacon_block().clone_as_blinded();
|
||||
assert_eq!(head_block, signed_blinded_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);
|
||||
}
|
||||
ProduceBlockV3Response::Full(block_contents) => {
|
||||
assert!(!metadata.execution_payload_blinded);
|
||||
assert_eq!(
|
||||
metadata.consensus_version,
|
||||
block_contents
|
||||
.block()
|
||||
.to_ref()
|
||||
.fork_name(&self.chain.spec)
|
||||
.unwrap()
|
||||
);
|
||||
let signed_block_contents =
|
||||
block_contents.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
} else {
|
||||
let block_contents = <FullBlockContents<E>>::from_ssz_bytes(
|
||||
&fork_version_response_bytes.unwrap(),
|
||||
&self.chain.spec,
|
||||
)
|
||||
.expect("block contents bytes can be decoded");
|
||||
self.client
|
||||
.post_beacon_blocks_ssz(&signed_block_contents)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let signed_block_contents =
|
||||
block_contents.sign(&sk, &fork, genesis_validators_root, &self.chain.spec);
|
||||
assert_eq!(
|
||||
self.chain.head_beacon_block().as_ref(),
|
||||
signed_block_contents.signed_block()
|
||||
);
|
||||
|
||||
self.client
|
||||
.post_beacon_blocks_ssz(&signed_block_contents)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(
|
||||
self.chain.head_beacon_block().as_ref(),
|
||||
signed_block_contents.signed_block()
|
||||
);
|
||||
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
self.chain.slot_clock.set_slot(slot.as_u64() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3543,15 +3551,17 @@ impl ApiTester {
|
||||
|
||||
let (proposer_index, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let payload: BlindedPayload<E> = match payload_type {
|
||||
Blinded(payload) => payload.data.body().execution_payload().unwrap().into(),
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
let payload: BlindedPayload<E> = match payload_type.data {
|
||||
ProduceBlockV3Response::Blinded(payload) => {
|
||||
payload.body().execution_payload().unwrap().into()
|
||||
}
|
||||
ProduceBlockV3Response::Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
let expected_fee_recipient = Address::from_low_u64_be(proposer_index as u64);
|
||||
@@ -3645,15 +3655,17 @@ impl ApiTester {
|
||||
|
||||
let (proposer_index, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let payload: BlindedPayload<E> = match payload_type {
|
||||
Blinded(payload) => payload.data.body().execution_payload().unwrap().into(),
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
let payload: BlindedPayload<E> = match payload_type.data {
|
||||
ProduceBlockV3Response::Blinded(payload) => {
|
||||
payload.body().execution_payload().unwrap().into()
|
||||
}
|
||||
ProduceBlockV3Response::Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
let expected_fee_recipient = Address::from_low_u64_be(proposer_index as u64);
|
||||
@@ -3719,15 +3731,17 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let payload: BlindedPayload<E> = match payload_type {
|
||||
Blinded(payload) => payload.data.body().execution_payload().unwrap().into(),
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
let payload: BlindedPayload<E> = match payload_type.data {
|
||||
ProduceBlockV3Response::Blinded(payload) => {
|
||||
payload.body().execution_payload().unwrap().into()
|
||||
}
|
||||
ProduceBlockV3Response::Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
assert_eq!(payload.fee_recipient(), test_fee_recipient);
|
||||
@@ -3807,21 +3821,17 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let payload: FullPayload<E> = match payload_type {
|
||||
Full(payload) => payload
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.into(),
|
||||
Blinded(_) => panic!("Expecting a blinded payload"),
|
||||
let payload: FullPayload<E> = match payload_type.data {
|
||||
ProduceBlockV3Response::Full(payload) => {
|
||||
payload.block().body().execution_payload().unwrap().into()
|
||||
}
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
assert_eq!(payload.parent_hash(), expected_parent_hash);
|
||||
@@ -3897,21 +3907,17 @@ impl ApiTester {
|
||||
.unwrap();
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let payload: FullPayload<E> = match payload_type {
|
||||
Full(payload) => payload
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.into(),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
let payload: FullPayload<E> = match payload_type.data {
|
||||
ProduceBlockV3Response::Full(payload) => {
|
||||
payload.block().body().execution_payload().unwrap().into()
|
||||
}
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
assert_eq!(payload.prev_randao(), expected_prev_randao);
|
||||
@@ -3987,21 +3993,17 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let payload: FullPayload<E> = match payload_type {
|
||||
Full(payload) => payload
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.into(),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
let payload: FullPayload<E> = match payload_type.data {
|
||||
ProduceBlockV3Response::Full(payload) => {
|
||||
payload.block().body().execution_payload().unwrap().into()
|
||||
}
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
assert_eq!(payload.block_number(), expected_block_number);
|
||||
@@ -4075,21 +4077,17 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let payload: FullPayload<E> = match payload_type {
|
||||
Full(payload) => payload
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.into(),
|
||||
Blinded(_) => panic!("Expecting a blinded payload"),
|
||||
let payload: FullPayload<E> = match payload_type.data {
|
||||
ProduceBlockV3Response::Full(payload) => {
|
||||
payload.block().body().execution_payload().unwrap().into()
|
||||
}
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
assert!(payload.timestamp() > min_expected_timestamp);
|
||||
@@ -4135,15 +4133,15 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Full(_) => (),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Full(_) => (),
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
self
|
||||
@@ -4201,15 +4199,15 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Full(_) => (),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Full(_) => (),
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
self
|
||||
@@ -4309,15 +4307,15 @@ impl ApiTester {
|
||||
.get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch()))
|
||||
.await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Blinded(_) => (),
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Blinded(_) => (),
|
||||
ProduceBlockV3Response::Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
// Without proposing, advance into the next slot, this should make us cross the threshold
|
||||
@@ -4329,15 +4327,15 @@ impl ApiTester {
|
||||
.get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch()))
|
||||
.await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Full(_) => (),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Full(_) => (),
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
self
|
||||
@@ -4457,15 +4455,15 @@ impl ApiTester {
|
||||
.get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch()))
|
||||
.await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Full(_) => (),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Full(_) => (),
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
// Fill another epoch with blocks, should be enough to finalize. (Sneaky plus 1 because this
|
||||
@@ -4487,15 +4485,15 @@ impl ApiTester {
|
||||
.get_test_randao(next_slot, next_slot.epoch(E::slots_per_epoch()))
|
||||
.await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(next_slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Blinded(_) => (),
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Blinded(_) => (),
|
||||
ProduceBlockV3Response::Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
self
|
||||
@@ -4567,21 +4565,17 @@ impl ApiTester {
|
||||
|
||||
let (proposer_index, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let payload: FullPayload<E> = match payload_type {
|
||||
Full(payload) => payload
|
||||
.data
|
||||
.block()
|
||||
.body()
|
||||
.execution_payload()
|
||||
.unwrap()
|
||||
.into(),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
let payload: FullPayload<E> = match payload_type.data {
|
||||
ProduceBlockV3Response::Full(payload) => {
|
||||
payload.block().body().execution_payload().unwrap().into()
|
||||
}
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
let expected_fee_recipient = Address::from_low_u64_be(proposer_index as u64);
|
||||
@@ -4640,15 +4634,15 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Full(_) => (),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Full(_) => (),
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
self
|
||||
@@ -4704,15 +4698,15 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Blinded(_) => (),
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Blinded(_) => (),
|
||||
ProduceBlockV3Response::Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
self
|
||||
@@ -4768,15 +4762,15 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Full(_) => (),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Full(_) => (),
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
self
|
||||
@@ -4832,15 +4826,15 @@ impl ApiTester {
|
||||
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Full(_) => (),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Full(_) => (),
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
self
|
||||
@@ -4894,15 +4888,15 @@ impl ApiTester {
|
||||
let epoch = self.chain.epoch().unwrap();
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
let _block_contents = match payload_type {
|
||||
Blinded(payload) => payload.data,
|
||||
Full(_) => panic!("Expecting a blinded payload"),
|
||||
let _block_contents = match payload_type.data {
|
||||
ProduceBlockV3Response::Blinded(payload) => payload,
|
||||
ProduceBlockV3Response::Full(_) => panic!("Expecting a blinded payload"),
|
||||
};
|
||||
|
||||
self
|
||||
@@ -4966,15 +4960,15 @@ impl ApiTester {
|
||||
let epoch = self.chain.epoch().unwrap();
|
||||
let (_, randao_reveal) = self.get_test_randao(slot, epoch).await;
|
||||
|
||||
let payload_type = self
|
||||
let (payload_type, _) = self
|
||||
.client
|
||||
.get_validator_blocks_v3::<E>(slot, &randao_reveal, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
match payload_type {
|
||||
Full(_) => (),
|
||||
Blinded(_) => panic!("Expecting a full payload"),
|
||||
match payload_type.data {
|
||||
ProduceBlockV3Response::Full(_) => (),
|
||||
ProduceBlockV3Response::Blinded(_) => panic!("Expecting a full payload"),
|
||||
};
|
||||
|
||||
self
|
||||
|
||||
Reference in New Issue
Block a user