mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 04:37:13 +00:00
Resolve merge confklicts
This commit is contained in:
@@ -7,6 +7,7 @@ use crate::version::{
|
||||
execution_optimistic_finalized_beacon_response,
|
||||
};
|
||||
use beacon_chain::data_column_verification::{GossipDataColumnError, GossipVerifiedDataColumn};
|
||||
use beacon_chain::payload_envelope_verification::EnvelopeError;
|
||||
use beacon_chain::{BeaconChain, BeaconChainTypes, NotifyExecutionLayer};
|
||||
use bytes::Bytes;
|
||||
use eth2::types as api_types;
|
||||
@@ -154,7 +155,7 @@ pub async fn publish_execution_payload_envelope<T: BeaconChainTypes>(
|
||||
PubsubMessage::ExecutionPayload(Box::new(envelope_for_gossip)),
|
||||
)
|
||||
.map_err(|_| {
|
||||
beacon_chain::payload_envelope_verification::EnvelopeError::BeaconChainError(Arc::new(
|
||||
EnvelopeError::BeaconChainError(Arc::new(
|
||||
beacon_chain::BeaconChainError::UnableToPublish,
|
||||
))
|
||||
})
|
||||
@@ -278,7 +279,7 @@ fn build_gloas_data_columns<T: BeaconChainTypes>(
|
||||
let index = *col.index();
|
||||
match GossipVerifiedDataColumn::new_for_block_publishing(col, chain) {
|
||||
Ok(verified) => Some(verified),
|
||||
Err(GossipDataColumnError::PriorKnownUnpublished) => None,
|
||||
Err(GossipDataColumnError::PriorKnown { .. }) => None,
|
||||
Err(e) => {
|
||||
warn!(
|
||||
%slot,
|
||||
|
||||
@@ -2,8 +2,9 @@ use crate::{
|
||||
build_block_contents,
|
||||
version::{
|
||||
ResponseIncludesVersion, add_consensus_block_value_header, add_consensus_version_header,
|
||||
add_execution_payload_blinded_header, add_execution_payload_value_header,
|
||||
add_ssz_content_type_header, beacon_response, inconsistent_fork_rejection,
|
||||
add_execution_payload_blinded_header, add_execution_payload_included_header,
|
||||
add_execution_payload_value_header, add_ssz_content_type_header, beacon_response,
|
||||
inconsistent_fork_rejection,
|
||||
},
|
||||
};
|
||||
use beacon_chain::graffiti_calculator::GraffitiSettings;
|
||||
@@ -83,7 +84,16 @@ pub async fn produce_block_v4<T: BeaconChainTypes>(
|
||||
warp_utils::reject::custom_bad_request(format!("failed to fetch a block: {:?}", e))
|
||||
})?;
|
||||
|
||||
build_response_v4::<T>(block, consensus_block_value, accept_header, &chain.spec)
|
||||
// TODO(gloas): wire up for stateless mode (#8828).
|
||||
let execution_payload_included = false;
|
||||
|
||||
build_response_v4::<T>(
|
||||
block,
|
||||
consensus_block_value,
|
||||
execution_payload_included,
|
||||
accept_header,
|
||||
&chain.spec,
|
||||
)
|
||||
}
|
||||
|
||||
#[instrument(
|
||||
@@ -133,6 +143,7 @@ pub async fn produce_block_v3<T: BeaconChainTypes>(
|
||||
pub fn build_response_v4<T: BeaconChainTypes>(
|
||||
block: BeaconBlock<T::EthSpec, FullPayload<T::EthSpec>>,
|
||||
consensus_block_value: u64,
|
||||
execution_payload_included: bool,
|
||||
accept_header: Option<api_types::Accept>,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<Response<Body>, warp::Rejection> {
|
||||
@@ -146,6 +157,7 @@ pub fn build_response_v4<T: BeaconChainTypes>(
|
||||
let metadata = ProduceBlockV4Metadata {
|
||||
consensus_version: fork_name,
|
||||
consensus_block_value: consensus_block_value_wei,
|
||||
execution_payload_included,
|
||||
};
|
||||
|
||||
match accept_header {
|
||||
@@ -155,6 +167,7 @@ pub fn build_response_v4<T: BeaconChainTypes>(
|
||||
.map(|res: Response<Body>| add_ssz_content_type_header(res))
|
||||
.map(|res: Response<Body>| add_consensus_version_header(res, fork_name))
|
||||
.map(|res| add_consensus_block_value_header(res, consensus_block_value_wei))
|
||||
.map(|res| add_execution_payload_included_header(res, execution_payload_included))
|
||||
.map_err(|e| -> warp::Rejection {
|
||||
warp_utils::reject::custom_server_error(format!("failed to create response: {}", e))
|
||||
}),
|
||||
@@ -165,7 +178,8 @@ pub fn build_response_v4<T: BeaconChainTypes>(
|
||||
})
|
||||
.into_response())
|
||||
.map(|res| add_consensus_version_header(res, fork_name))
|
||||
.map(|res| add_consensus_block_value_header(res, consensus_block_value_wei)),
|
||||
.map(|res| add_consensus_block_value_header(res, consensus_block_value_wei))
|
||||
.map(|res| add_execution_payload_included_header(res, execution_payload_included)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ pub async fn publish_block<T: BeaconChainTypes, B: IntoGossipVerifiedBlock<T>>(
|
||||
if let Err(e) =
|
||||
Box::pin(chain.process_gossip_data_columns(sampling_columns, publish_fn)).await
|
||||
{
|
||||
let msg = format!("Invalid data column: {e}");
|
||||
let msg = format!("Invalid data column: {e:?}");
|
||||
return if let BroadcastValidation::Gossip = validation_level {
|
||||
Err(warp_utils::reject::broadcast_without_import(msg))
|
||||
} else {
|
||||
|
||||
@@ -12,7 +12,7 @@ use types::Slot;
|
||||
use warp::http::Response;
|
||||
use warp::{Filter, Rejection};
|
||||
|
||||
// GET validator/execution_payload_envelope/{slot}/{builder_index}
|
||||
// GET validator/execution_payload_envelope/{slot}
|
||||
pub fn get_validator_execution_payload_envelope<T: BeaconChainTypes>(
|
||||
eth_v1: EthV1Filter,
|
||||
chain_filter: ChainFilter<T>,
|
||||
@@ -27,11 +27,6 @@ pub fn get_validator_execution_payload_envelope<T: BeaconChainTypes>(
|
||||
"Invalid slot".to_string(),
|
||||
))
|
||||
}))
|
||||
.and(warp::path::param::<u64>().or_else(|_| async {
|
||||
Err(warp_utils::reject::custom_bad_request(
|
||||
"Invalid builder_index".to_string(),
|
||||
))
|
||||
}))
|
||||
.and(warp::path::end())
|
||||
.and(warp::header::optional::<Accept>("accept"))
|
||||
.and(not_while_syncing_filter)
|
||||
@@ -39,10 +34,6 @@ pub fn get_validator_execution_payload_envelope<T: BeaconChainTypes>(
|
||||
.and(chain_filter)
|
||||
.then(
|
||||
|slot: Slot,
|
||||
// TODO(gloas) we're only doing local building
|
||||
// we'll need to implement builder index logic
|
||||
// eventually.
|
||||
_builder_index: u64,
|
||||
accept_header: Option<Accept>,
|
||||
not_synced_filter: Result<(), Rejection>,
|
||||
task_spawner: TaskSpawner<T::EthSpec>,
|
||||
|
||||
@@ -5,7 +5,8 @@ use eth2::beacon_response::{
|
||||
};
|
||||
use eth2::{
|
||||
CONSENSUS_BLOCK_VALUE_HEADER, CONSENSUS_VERSION_HEADER, CONTENT_TYPE_HEADER,
|
||||
EXECUTION_PAYLOAD_BLINDED_HEADER, EXECUTION_PAYLOAD_VALUE_HEADER, SSZ_CONTENT_TYPE_HEADER,
|
||||
EXECUTION_PAYLOAD_BLINDED_HEADER, EXECUTION_PAYLOAD_INCLUDED_HEADER,
|
||||
EXECUTION_PAYLOAD_VALUE_HEADER, SSZ_CONTENT_TYPE_HEADER,
|
||||
};
|
||||
use serde::Serialize;
|
||||
use types::{ForkName, InconsistentFork, Uint256};
|
||||
@@ -88,6 +89,19 @@ pub fn add_execution_payload_blinded_header<T: Reply>(
|
||||
.into_response()
|
||||
}
|
||||
|
||||
/// Add the `Eth-Execution-Payload-Included` header to a response.
|
||||
pub fn add_execution_payload_included_header<T: Reply>(
|
||||
reply: T,
|
||||
execution_payload_included: bool,
|
||||
) -> Response {
|
||||
reply::with_header(
|
||||
reply,
|
||||
EXECUTION_PAYLOAD_INCLUDED_HEADER,
|
||||
execution_payload_included.to_string(),
|
||||
)
|
||||
.into_response()
|
||||
}
|
||||
|
||||
/// Add the `Eth-Execution-Payload-Value` header to a response.
|
||||
pub fn add_execution_payload_value_header<T: Reply>(
|
||||
reply: T,
|
||||
|
||||
@@ -57,14 +57,9 @@ async fn sync_committee_duties_across_fork() {
|
||||
// If there's a skip slot at the fork slot, the endpoint should return duties, even
|
||||
// though the head state hasn't transitioned yet.
|
||||
let fork_slot = fork_epoch.start_slot(E::slots_per_epoch());
|
||||
let (genesis_state, genesis_state_root) = harness.get_current_state_and_root();
|
||||
let (_, mut state) = harness
|
||||
.add_attested_block_at_slot(
|
||||
fork_slot - 1,
|
||||
genesis_state,
|
||||
genesis_state_root,
|
||||
&all_validators,
|
||||
)
|
||||
let genesis_state = harness.get_current_state();
|
||||
let (_, state) = harness
|
||||
.add_attested_block_at_slot(fork_slot - 1, genesis_state, &all_validators)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -79,9 +74,8 @@ async fn sync_committee_duties_across_fork() {
|
||||
assert_eq!(sync_duties.len(), E::sync_committee_size());
|
||||
|
||||
// After applying a block at the fork slot the duties should remain unchanged.
|
||||
let state_root = state.canonical_root().unwrap();
|
||||
harness
|
||||
.add_attested_block_at_slot(fork_slot, state, state_root, &all_validators)
|
||||
.add_attested_block_at_slot(fork_slot, state, &all_validators)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -295,14 +289,9 @@ async fn sync_committee_indices_across_fork() {
|
||||
// If there's a skip slot at the fork slot, the endpoint will return a 400 until a block is
|
||||
// applied.
|
||||
let fork_slot = fork_epoch.start_slot(E::slots_per_epoch());
|
||||
let (genesis_state, genesis_state_root) = harness.get_current_state_and_root();
|
||||
let (_, mut state) = harness
|
||||
.add_attested_block_at_slot(
|
||||
fork_slot - 1,
|
||||
genesis_state,
|
||||
genesis_state_root,
|
||||
&all_validators,
|
||||
)
|
||||
let genesis_state = harness.get_current_state();
|
||||
let (_, state) = harness
|
||||
.add_attested_block_at_slot(fork_slot - 1, genesis_state, &all_validators)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -334,9 +323,8 @@ async fn sync_committee_indices_across_fork() {
|
||||
|
||||
// Once the head is updated it should be useable for requests, including in the next sync
|
||||
// committee period.
|
||||
let state_root = state.canonical_root().unwrap();
|
||||
harness
|
||||
.add_attested_block_at_slot(fork_slot + 1, state, state_root, &all_validators)
|
||||
.add_attested_block_at_slot(fork_slot + 1, state, &all_validators)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
|
||||
@@ -4302,6 +4302,7 @@ impl ApiTester {
|
||||
);
|
||||
// TODO(gloas): check why consensus block value is 0
|
||||
// assert!(!metadata.consensus_block_value.is_zero());
|
||||
assert!(!metadata.execution_payload_included);
|
||||
|
||||
let block_root = block.tree_hash_root();
|
||||
let envelope = self
|
||||
@@ -4384,7 +4385,7 @@ impl ApiTester {
|
||||
|
||||
let (response, metadata) = self
|
||||
.client
|
||||
.get_validator_blocks_v4::<E>(slot, &randao_reveal, None, None, None)
|
||||
.get_validator_blocks_v4::<E>(slot, &randao_reveal, None, None, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
let block = response.data;
|
||||
@@ -4393,7 +4394,7 @@ impl ApiTester {
|
||||
|
||||
let envelope = self
|
||||
.client
|
||||
.get_validator_execution_payload_envelope::<E>(slot, BUILDER_INDEX_SELF_BUILD)
|
||||
.get_validator_execution_payload_envelope::<E>(slot)
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
@@ -4447,7 +4448,7 @@ impl ApiTester {
|
||||
|
||||
let (block, metadata) = self
|
||||
.client
|
||||
.get_validator_blocks_v4_ssz::<E>(slot, &randao_reveal, None, None, None)
|
||||
.get_validator_blocks_v4_ssz::<E>(slot, &randao_reveal, None, None, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -4455,11 +4456,7 @@ impl ApiTester {
|
||||
|
||||
let envelope = self
|
||||
.client
|
||||
.get_validator_execution_payload_envelope_ssz::<E>(
|
||||
slot,
|
||||
BUILDER_INDEX_SELF_BUILD,
|
||||
self.chain.spec.fork_name_at_slot::<E>(slot),
|
||||
)
|
||||
.get_validator_execution_payload_envelope_ssz::<E>(slot, fork_name)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@@ -4889,7 +4886,7 @@ impl ApiTester {
|
||||
// Produce and publish a block.
|
||||
let (response, _metadata) = self
|
||||
.client
|
||||
.get_validator_blocks_v4::<E>(slot, &randao_reveal, None, None, None)
|
||||
.get_validator_blocks_v4::<E>(slot, &randao_reveal, None, None, None, None)
|
||||
.await
|
||||
.unwrap();
|
||||
let block = response.data;
|
||||
@@ -4906,7 +4903,7 @@ impl ApiTester {
|
||||
// Retrieve and publish the envelope.
|
||||
let envelope = self
|
||||
.client
|
||||
.get_validator_execution_payload_envelope::<E>(slot, BUILDER_INDEX_SELF_BUILD)
|
||||
.get_validator_execution_payload_envelope::<E>(slot)
|
||||
.await
|
||||
.unwrap()
|
||||
.data;
|
||||
|
||||
Reference in New Issue
Block a user