mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-30 19:23:50 +00:00
Spec v1.7.0-alpha.6 and Gloas genesis (#9190)
Co-Authored-By: Josh King <josh@sigmaprime.io> Co-Authored-By: Jimmy Chen <jchen.tc@gmail.com> Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
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.5
|
||||
CONSENSUS_SPECS_TEST_VERSION ?= v1.7.0-alpha.6
|
||||
REPO_NAME := consensus-spec-tests
|
||||
OUTPUT_DIR := ./$(REPO_NAME)
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ excluded_paths = [
|
||||
"tests/.*/.*/ssz_static/PartialDataColumn.*/.*",
|
||||
# TODO(gloas): Ignore Gloas light client stuff for now
|
||||
"tests/.*/gloas/ssz_static/LightClient.*/.*",
|
||||
"tests/.*/gloas/light_client",
|
||||
# Execution payload header is irrelevant after Gloas, this type will probably be deleted.
|
||||
"tests/.*/gloas/ssz_static/ExecutionPayloadHeader/.*",
|
||||
# ForkChoiceNode is internal to fork choice and probably doesn't need SSZ tests.
|
||||
|
||||
@@ -23,7 +23,7 @@ if [[ "$version" == "nightly" || "$version" =~ ^nightly-[0-9]+$ ]]; then
|
||||
|
||||
if [[ "$version" == "nightly" ]]; then
|
||||
run_id=$(curl --fail -s -H "${auth_header}" \
|
||||
"${api}/repos/${repo}/actions/workflows/nightly-reftests.yml/runs?branch=master&status=success&per_page=1" |
|
||||
"${api}/repos/${repo}/actions/workflows/tests.yml/runs?branch=master&status=success&per_page=1" |
|
||||
jq -r '.workflow_runs[0].id')
|
||||
else
|
||||
run_id="${version#nightly-}"
|
||||
|
||||
@@ -58,6 +58,8 @@ pub struct Eth1DataReset;
|
||||
#[derive(Debug)]
|
||||
pub struct PendingBalanceDeposits;
|
||||
#[derive(Debug)]
|
||||
pub struct PendingDepositsChurn;
|
||||
#[derive(Debug)]
|
||||
pub struct PendingConsolidations;
|
||||
#[derive(Debug)]
|
||||
pub struct EffectiveBalanceUpdates;
|
||||
@@ -93,6 +95,7 @@ type_name!(RegistryUpdates, "registry_updates");
|
||||
type_name!(Slashings, "slashings");
|
||||
type_name!(Eth1DataReset, "eth1_data_reset");
|
||||
type_name!(PendingBalanceDeposits, "pending_deposits");
|
||||
type_name!(PendingDepositsChurn, "pending_deposits_churn");
|
||||
type_name!(PendingConsolidations, "pending_consolidations");
|
||||
type_name!(EffectiveBalanceUpdates, "effective_balance_updates");
|
||||
type_name!(SlashingsReset, "slashings_reset");
|
||||
@@ -191,6 +194,20 @@ impl<E: EthSpec> EpochTransition<E> for PendingBalanceDeposits {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> EpochTransition<E> for PendingDepositsChurn {
|
||||
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
|
||||
process_epoch_single_pass(
|
||||
state,
|
||||
spec,
|
||||
SinglePassConfig {
|
||||
pending_deposits: true,
|
||||
..SinglePassConfig::disable_all()
|
||||
},
|
||||
)
|
||||
.map(|_| ())
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> EpochTransition<E> for PendingConsolidations {
|
||||
fn run(state: &mut BeaconState<E>, spec: &ChainSpec) -> Result<(), EpochProcessingError> {
|
||||
initialize_epoch_cache(state, spec)?;
|
||||
@@ -387,7 +404,9 @@ impl<E: EthSpec, T: EpochTransition<E>> Case for EpochProcessing<E, T> {
|
||||
}
|
||||
|
||||
if !fork_name.gloas_enabled()
|
||||
&& (T::name() == "builder_pending_payments" || T::name() == "ptc_window")
|
||||
&& (T::name() == "builder_pending_payments"
|
||||
|| T::name() == "ptc_window"
|
||||
|| T::name() == "pending_deposits_churn")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,15 @@ pub struct WithdrawalsPayload<E: EthSpec> {
|
||||
payload: Option<ExecutionPayload<E>>,
|
||||
}
|
||||
|
||||
/// Newtype for testing voluntary exit churn (Gloas+).
|
||||
///
|
||||
/// The test case applies the same `process_voluntary_exit` operation as the regular
|
||||
/// `voluntary_exit` test, but under the `voluntary_exit_churn` handler directory.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct VoluntaryExitChurn {
|
||||
exit: SignedVoluntaryExit,
|
||||
}
|
||||
|
||||
/// Newtype for testing execution payload bids.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct ExecutionPayloadBidBlock<E: EthSpec> {
|
||||
@@ -265,6 +274,40 @@ impl<E: EthSpec> Operation<E> for SignedVoluntaryExit {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Operation<E> for VoluntaryExitChurn {
|
||||
type Error = BlockProcessingError;
|
||||
|
||||
fn handler_name() -> String {
|
||||
"voluntary_exit_churn".into()
|
||||
}
|
||||
|
||||
fn filename() -> String {
|
||||
"voluntary_exit.ssz_snappy".into()
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name.gloas_enabled()
|
||||
}
|
||||
|
||||
fn decode(path: &Path, _fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
ssz_decode_file(path).map(|exit| VoluntaryExitChurn { exit })
|
||||
}
|
||||
|
||||
fn apply_to(
|
||||
&self,
|
||||
state: &mut BeaconState<E>,
|
||||
spec: &ChainSpec,
|
||||
_: &Operations<E, Self>,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
process_exits(
|
||||
state,
|
||||
std::slice::from_ref(&self.exit),
|
||||
VerifySignatures::True,
|
||||
spec,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> Operation<E> for BeaconBlock<E> {
|
||||
type Error = BlockProcessingError;
|
||||
|
||||
|
||||
@@ -340,6 +340,10 @@ impl<T, E> SszStaticHandler<T, E> {
|
||||
pub fn pre_electra() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[0..5].to_vec())
|
||||
}
|
||||
|
||||
pub fn pre_capella() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[0..3].to_vec())
|
||||
}
|
||||
}
|
||||
|
||||
/// Handler for SSZ types that implement `CachedTreeHash`.
|
||||
|
||||
@@ -3,9 +3,10 @@ pub use cases::{
|
||||
BuilderPendingPayments, Case, EffectiveBalanceUpdates, Eth1DataReset, ExecutionPayloadBidBlock,
|
||||
FeatureName, HistoricalRootsUpdate, HistoricalSummariesUpdate, InactivityUpdates,
|
||||
JustificationAndFinalization, ParentExecutionPayloadBlock, ParticipationFlagUpdates,
|
||||
ParticipationRecordUpdates, PendingBalanceDeposits, PendingConsolidations, ProposerLookahead,
|
||||
PtcWindow, RandaoMixesReset, RegistryUpdates, RewardsAndPenalties, Slashings, SlashingsReset,
|
||||
SyncCommitteeUpdates, WithdrawalsPayload,
|
||||
ParticipationRecordUpdates, PendingBalanceDeposits, PendingConsolidations,
|
||||
PendingDepositsChurn, ProposerLookahead, PtcWindow, RandaoMixesReset, RegistryUpdates,
|
||||
RewardsAndPenalties, Slashings, SlashingsReset, SyncCommitteeUpdates, VoluntaryExitChurn,
|
||||
WithdrawalsPayload,
|
||||
};
|
||||
pub use decode::log_file_access;
|
||||
pub use error::Error;
|
||||
|
||||
@@ -142,6 +142,12 @@ fn operations_bls_to_execution_change() {
|
||||
OperationsHandler::<MainnetEthSpec, SignedBlsToExecutionChange>::default().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn operations_voluntary_exit_churn() {
|
||||
OperationsHandler::<MinimalEthSpec, VoluntaryExitChurn>::default().run();
|
||||
OperationsHandler::<MainnetEthSpec, VoluntaryExitChurn>::default().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sanity_blocks() {
|
||||
SanityBlocksHandler::<MinimalEthSpec>::default().run();
|
||||
@@ -285,8 +291,19 @@ mod ssz_static {
|
||||
ssz_static_test!(eth1_data, Eth1Data);
|
||||
ssz_static_test!(fork, Fork);
|
||||
ssz_static_test!(fork_data, ForkData);
|
||||
ssz_static_test!(historical_batch, HistoricalBatch<_>);
|
||||
ssz_static_test!(pending_attestation, PendingAttestation<_>);
|
||||
// `HistoricalBatch` was removed in Capella, so test vectors only exist for Base,
|
||||
// Altair and Bellatrix.
|
||||
#[test]
|
||||
fn historical_batch() {
|
||||
SszStaticHandler::<HistoricalBatch<MinimalEthSpec>, MinimalEthSpec>::pre_capella().run();
|
||||
SszStaticHandler::<HistoricalBatch<MainnetEthSpec>, MainnetEthSpec>::pre_capella().run();
|
||||
}
|
||||
// `PendingAttestation` was removed in Altair, so test vectors only exist for Base.
|
||||
#[test]
|
||||
fn pending_attestation() {
|
||||
SszStaticHandler::<PendingAttestation<MinimalEthSpec>, MinimalEthSpec>::base_only().run();
|
||||
SszStaticHandler::<PendingAttestation<MainnetEthSpec>, MainnetEthSpec>::base_only().run();
|
||||
}
|
||||
ssz_static_test!(proposer_slashing, ProposerSlashing);
|
||||
ssz_static_test!(
|
||||
signed_beacon_block,
|
||||
@@ -899,6 +916,12 @@ fn epoch_processing_pending_balance_deposits() {
|
||||
EpochProcessingHandler::<MainnetEthSpec, PendingBalanceDeposits>::default().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn epoch_processing_pending_deposits_churn() {
|
||||
EpochProcessingHandler::<MinimalEthSpec, PendingDepositsChurn>::default().run();
|
||||
EpochProcessingHandler::<MainnetEthSpec, PendingDepositsChurn>::default().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn epoch_processing_pending_consolidations() {
|
||||
EpochProcessingHandler::<MinimalEthSpec, PendingConsolidations>::default().run();
|
||||
|
||||
Reference in New Issue
Block a user