mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-31 21:27:12 +00:00
Resolve merge conflicts
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# To download/extract nightly tests, run:
|
||||
# CONSENSUS_SPECS_TEST_VERSION=nightly make
|
||||
CONSENSUS_SPECS_TEST_VERSION ?= v1.7.0-alpha.1
|
||||
CONSENSUS_SPECS_TEST_VERSION ?= v1.7.0-alpha.2
|
||||
REPO_NAME := consensus-spec-tests
|
||||
OUTPUT_DIR := ./$(REPO_NAME)
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ excluded_paths = [
|
||||
# Ignore full epoch tests for now (just test the sub-transitions).
|
||||
"tests/.*/.*/epoch_processing/.*/pre_epoch.ssz_snappy",
|
||||
"tests/.*/.*/epoch_processing/.*/post_epoch.ssz_snappy",
|
||||
# Ignore inactivity_scores tests for now (should implement soon).
|
||||
"tests/.*/.*/rewards/inactivity_scores/.*",
|
||||
# Ignore gloas tests for now
|
||||
"tests/.*/gloas/.*",
|
||||
# Ignore KZG tests that target internal kzg library functions
|
||||
|
||||
@@ -488,7 +488,7 @@ impl<E: EthSpec> Tester<E> {
|
||||
let since_genesis = tick
|
||||
.checked_sub(genesis_time)
|
||||
.ok_or_else(|| Error::FailedToParseTest("tick is prior to genesis".into()))?;
|
||||
let slots_since_genesis = since_genesis / self.spec.seconds_per_slot;
|
||||
let slots_since_genesis = since_genesis / self.spec.get_slot_duration().as_secs();
|
||||
Ok(self.spec.genesis_slot + slots_since_genesis)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ use state_processing::{
|
||||
altair_deneb, base, process_attester_slashings, process_bls_to_execution_changes,
|
||||
process_deposits, process_exits, process_proposer_slashings,
|
||||
},
|
||||
process_sync_aggregate, process_withdrawals,
|
||||
process_sync_aggregate, withdrawals,
|
||||
},
|
||||
};
|
||||
use std::fmt::Debug;
|
||||
@@ -45,7 +45,7 @@ struct ExecutionMetadata {
|
||||
/// Newtype for testing withdrawals.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct WithdrawalsPayload<E: EthSpec> {
|
||||
payload: FullPayload<E>,
|
||||
payload: Option<ExecutionPayload<E>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -405,12 +405,17 @@ impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
|
||||
}
|
||||
|
||||
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
ssz_decode_file_with(path, |bytes| {
|
||||
ExecutionPayload::from_ssz_bytes_by_fork(bytes, fork_name)
|
||||
})
|
||||
.map(|payload| WithdrawalsPayload {
|
||||
payload: payload.into(),
|
||||
})
|
||||
if fork_name.gloas_enabled() {
|
||||
// No payload present or required for Gloas tests.
|
||||
Ok(WithdrawalsPayload { payload: None })
|
||||
} else {
|
||||
ssz_decode_file_with(path, |bytes| {
|
||||
ExecutionPayload::from_ssz_bytes_by_fork(bytes, fork_name)
|
||||
})
|
||||
.map(|payload| WithdrawalsPayload {
|
||||
payload: Some(payload),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_to(
|
||||
@@ -419,8 +424,16 @@ impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
|
||||
spec: &ChainSpec,
|
||||
_: &Operations<E, Self>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
// TODO(EIP-7732): implement separate gloas and non-gloas variants of process_withdrawals
|
||||
process_withdrawals::<_, FullPayload<_>>(state, self.payload.to_ref(), spec)
|
||||
if state.fork_name_unchecked().gloas_enabled() {
|
||||
withdrawals::gloas::process_withdrawals(state, spec)
|
||||
} else {
|
||||
let full_payload = FullPayload::from(self.payload.clone().unwrap());
|
||||
withdrawals::capella_electra::process_withdrawals::<_, FullPayload<_>>(
|
||||
state,
|
||||
full_payload.to_ref(),
|
||||
spec,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -333,6 +333,10 @@ impl<T, E> SszStaticHandler<T, E> {
|
||||
Self::for_forks(ForkName::list_all()[6..].to_vec())
|
||||
}
|
||||
|
||||
pub fn gloas_and_later() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[7..].to_vec())
|
||||
}
|
||||
|
||||
pub fn pre_electra() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[0..5].to_vec())
|
||||
}
|
||||
@@ -397,10 +401,7 @@ where
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
|
||||
// TODO(gloas): DataColumnSidecar tests are disabled until we update the DataColumnSidecar
|
||||
// type.
|
||||
self.supported_forks.contains(&fork_name)
|
||||
&& !(fork_name == ForkName::Gloas && T::name() == "DataColumnSidecar")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1117,6 +1118,17 @@ impl<E: EthSpec + TypeName, O: Operation<E>> Handler for OperationsHandler<E, O>
|
||||
fn handler_name(&self) -> String {
|
||||
O::handler_name()
|
||||
}
|
||||
|
||||
fn disabled_forks(&self) -> Vec<ForkName> {
|
||||
// TODO(gloas): Can be removed once we enable Gloas on all tests
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
|
||||
// TODO(gloas): So far only withdrawals tests are enabled for Gloas.
|
||||
Self::Case::is_enabled_for_fork(fork_name)
|
||||
&& (!fork_name.gloas_enabled() || self.handler_name() == "withdrawals")
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Educe)]
|
||||
|
||||
@@ -55,6 +55,7 @@ type_name_generic!(BeaconBlockBodyCapella, "BeaconBlockBody");
|
||||
type_name_generic!(BeaconBlockBodyDeneb, "BeaconBlockBody");
|
||||
type_name_generic!(BeaconBlockBodyElectra, "BeaconBlockBody");
|
||||
type_name_generic!(BeaconBlockBodyFulu, "BeaconBlockBody");
|
||||
type_name_generic!(BeaconBlockBodyGloas, "BeaconBlockBody");
|
||||
type_name!(BeaconBlockHeader);
|
||||
type_name_generic!(BeaconState);
|
||||
type_name!(BlobIdentifier);
|
||||
@@ -78,6 +79,7 @@ type_name_generic!(ExecutionPayloadCapella, "ExecutionPayload");
|
||||
type_name_generic!(ExecutionPayloadDeneb, "ExecutionPayload");
|
||||
type_name_generic!(ExecutionPayloadElectra, "ExecutionPayload");
|
||||
type_name_generic!(ExecutionPayloadFulu, "ExecutionPayload");
|
||||
type_name_generic!(ExecutionPayloadGloas, "ExecutionPayload");
|
||||
type_name_generic!(FullPayload, "ExecutionPayload");
|
||||
type_name_generic!(ExecutionPayloadHeader);
|
||||
type_name_generic!(ExecutionPayloadHeaderBellatrix, "ExecutionPayloadHeader");
|
||||
@@ -85,6 +87,8 @@ type_name_generic!(ExecutionPayloadHeaderCapella, "ExecutionPayloadHeader");
|
||||
type_name_generic!(ExecutionPayloadHeaderDeneb, "ExecutionPayloadHeader");
|
||||
type_name_generic!(ExecutionPayloadHeaderElectra, "ExecutionPayloadHeader");
|
||||
type_name_generic!(ExecutionPayloadHeaderFulu, "ExecutionPayloadHeader");
|
||||
type_name_generic!(ExecutionPayloadBid);
|
||||
type_name_generic!(SignedExecutionPayloadBid);
|
||||
type_name_generic!(ExecutionRequests);
|
||||
type_name_generic!(BlindedPayload, "ExecutionPayloadHeader");
|
||||
type_name!(Fork);
|
||||
|
||||
@@ -369,6 +369,10 @@ mod ssz_static {
|
||||
.run();
|
||||
SszStaticHandler::<BeaconBlockBodyFulu<MinimalEthSpec>, MinimalEthSpec>::fulu_only().run();
|
||||
SszStaticHandler::<BeaconBlockBodyFulu<MainnetEthSpec>, MainnetEthSpec>::fulu_only().run();
|
||||
SszStaticHandler::<BeaconBlockBodyGloas<MinimalEthSpec>, MinimalEthSpec>::gloas_only()
|
||||
.run();
|
||||
SszStaticHandler::<BeaconBlockBodyGloas<MainnetEthSpec>, MainnetEthSpec>::gloas_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
// Altair and later
|
||||
@@ -596,6 +600,10 @@ mod ssz_static {
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionPayloadFulu<MinimalEthSpec>, MinimalEthSpec>::fulu_only().run();
|
||||
SszStaticHandler::<ExecutionPayloadFulu<MainnetEthSpec>, MainnetEthSpec>::fulu_only().run();
|
||||
SszStaticHandler::<ExecutionPayloadGloas<MainnetEthSpec>, MainnetEthSpec>::gloas_only()
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionPayloadGloas<MainnetEthSpec>, MainnetEthSpec>::gloas_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -622,6 +630,20 @@ mod ssz_static {
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn execution_payload_bid() {
|
||||
SszStaticHandler::<ExecutionPayloadBid<MinimalEthSpec>, MinimalEthSpec>::gloas_and_later()
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionPayloadBid<MainnetEthSpec>, MainnetEthSpec>::gloas_and_later()
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn signed_execution_payload_bid() {
|
||||
SszStaticHandler::<SignedExecutionPayloadBid<MinimalEthSpec>, MinimalEthSpec>::gloas_and_later().run();
|
||||
SszStaticHandler::<SignedExecutionPayloadBid<MainnetEthSpec>, MainnetEthSpec>::gloas_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn withdrawal() {
|
||||
SszStaticHandler::<Withdrawal, MinimalEthSpec>::capella_and_later().run();
|
||||
|
||||
@@ -14,7 +14,6 @@ use rayon::prelude::*;
|
||||
use std::cmp::max;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use environment::tracing_common;
|
||||
use tracing_subscriber::prelude::*;
|
||||
@@ -175,8 +174,11 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
|
||||
let latest_fork_version = spec.electra_fork_version;
|
||||
let latest_fork_start_epoch = ELECTRA_FORK_EPOCH;
|
||||
|
||||
spec.seconds_per_slot /= speed_up_factor;
|
||||
spec.seconds_per_slot = max(1, spec.seconds_per_slot);
|
||||
let mut slot_duration_ms = spec.get_slot_duration().as_millis() as u64;
|
||||
slot_duration_ms /= speed_up_factor;
|
||||
slot_duration_ms = max(1_000, slot_duration_ms);
|
||||
spec = spec.set_slot_duration_ms::<MinimalEthSpec>(slot_duration_ms);
|
||||
|
||||
spec.genesis_delay = genesis_delay;
|
||||
spec.min_genesis_time = 0;
|
||||
spec.min_genesis_active_validator_count = total_validator_count as u64;
|
||||
@@ -188,7 +190,7 @@ pub fn run_basic_sim(matches: &ArgMatches) -> Result<(), String> {
|
||||
let spec = Arc::new(spec);
|
||||
env.eth2_config.spec = spec.clone();
|
||||
|
||||
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
|
||||
let slot_duration = spec.get_slot_duration();
|
||||
let slots_per_epoch = MinimalEthSpec::slots_per_epoch();
|
||||
let initial_validator_count = spec.min_genesis_active_validator_count as usize;
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ use rayon::prelude::*;
|
||||
use std::cmp::max;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::time::sleep;
|
||||
use tracing::Level;
|
||||
use tracing_subscriber::prelude::*;
|
||||
use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitExt};
|
||||
use types::{Epoch, EthSpec, MinimalEthSpec};
|
||||
|
||||
const END_EPOCH: u64 = 16;
|
||||
const GENESIS_DELAY: u64 = 38;
|
||||
const ALTAIR_FORK_EPOCH: u64 = 0;
|
||||
@@ -179,8 +179,11 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
|
||||
|
||||
let genesis_delay = GENESIS_DELAY;
|
||||
|
||||
spec.seconds_per_slot /= speed_up_factor;
|
||||
spec.seconds_per_slot = max(1, spec.seconds_per_slot);
|
||||
let mut slot_duration_ms = spec.get_slot_duration().as_millis() as u64;
|
||||
slot_duration_ms /= speed_up_factor;
|
||||
slot_duration_ms = max(1_000, slot_duration_ms);
|
||||
spec = spec.set_slot_duration_ms::<MinimalEthSpec>(slot_duration_ms);
|
||||
|
||||
spec.genesis_delay = genesis_delay;
|
||||
spec.min_genesis_time = 0;
|
||||
spec.min_genesis_active_validator_count = total_validator_count as u64;
|
||||
@@ -193,7 +196,7 @@ pub fn run_fallback_sim(matches: &ArgMatches) -> Result<(), String> {
|
||||
let spec = Arc::new(spec);
|
||||
env.eth2_config.spec = spec.clone();
|
||||
|
||||
let slot_duration = Duration::from_secs(spec.seconds_per_slot);
|
||||
let slot_duration = spec.get_slot_duration();
|
||||
let slots_per_epoch = MinimalEthSpec::slots_per_epoch();
|
||||
|
||||
let disconnection_epoch = 1;
|
||||
|
||||
@@ -73,23 +73,33 @@ fn default_mock_execution_config<E: EthSpec>(
|
||||
if let Some(capella_fork_epoch) = spec.capella_fork_epoch {
|
||||
mock_execution_config.shanghai_time = Some(
|
||||
genesis_time
|
||||
+ spec.seconds_per_slot * E::slots_per_epoch() * capella_fork_epoch.as_u64(),
|
||||
+ (spec.get_slot_duration().as_secs())
|
||||
* E::slots_per_epoch()
|
||||
* capella_fork_epoch.as_u64(),
|
||||
)
|
||||
}
|
||||
if let Some(deneb_fork_epoch) = spec.deneb_fork_epoch {
|
||||
mock_execution_config.cancun_time = Some(
|
||||
genesis_time + spec.seconds_per_slot * E::slots_per_epoch() * deneb_fork_epoch.as_u64(),
|
||||
genesis_time
|
||||
+ (spec.get_slot_duration().as_secs())
|
||||
* E::slots_per_epoch()
|
||||
* deneb_fork_epoch.as_u64(),
|
||||
)
|
||||
}
|
||||
if let Some(electra_fork_epoch) = spec.electra_fork_epoch {
|
||||
mock_execution_config.prague_time = Some(
|
||||
genesis_time
|
||||
+ spec.seconds_per_slot * E::slots_per_epoch() * electra_fork_epoch.as_u64(),
|
||||
+ (spec.get_slot_duration().as_secs())
|
||||
* E::slots_per_epoch()
|
||||
* electra_fork_epoch.as_u64(),
|
||||
)
|
||||
}
|
||||
if let Some(fulu_fork_epoch) = spec.fulu_fork_epoch {
|
||||
mock_execution_config.osaka_time = Some(
|
||||
genesis_time + spec.seconds_per_slot * E::slots_per_epoch() * fulu_fork_epoch.as_u64(),
|
||||
genesis_time
|
||||
+ (spec.get_slot_duration().as_secs())
|
||||
* E::slots_per_epoch()
|
||||
* fulu_fork_epoch.as_u64(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user