mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
update tests
This commit is contained in:
@@ -20,7 +20,7 @@ pub fn initiate_validator_exit<E: EthSpec>(
|
||||
|
||||
// Compute exit queue epoch
|
||||
let exit_queue_epoch = if state.fork_name_unchecked() >= ForkName::Electra {
|
||||
let effective_balance = state.get_validator(index)?.effective_balance;
|
||||
let effective_balance = state.get_effective_balance(index)?;
|
||||
state.compute_exit_epoch_and_update_churn(effective_balance, spec)?
|
||||
} else {
|
||||
let delayed_epoch = state.compute_activation_exit_epoch(state.current_epoch(), spec)?;
|
||||
|
||||
@@ -865,6 +865,14 @@ impl ChainSpec {
|
||||
electra_fork_epoch: None,
|
||||
max_pending_partials_per_withdrawals_sweep: u64::checked_pow(2, 0)
|
||||
.expect("pow does not overflow"),
|
||||
min_per_epoch_churn_limit_electra: option_wrapper(|| {
|
||||
u64::checked_pow(2, 6)?.checked_mul(u64::checked_pow(10, 9)?)
|
||||
})
|
||||
.expect("calculation does not overflow"),
|
||||
max_per_epoch_activation_exit_churn_limit: option_wrapper(|| {
|
||||
u64::checked_pow(2, 7)?.checked_mul(u64::checked_pow(10, 9)?)
|
||||
})
|
||||
.expect("calculation does not overflow"),
|
||||
// Other
|
||||
network_id: 2, // lighthouse testnet network id
|
||||
deposit_chain_id: 5,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
TESTS_TAG := v1.4.0-beta.6
|
||||
TESTS_TAG := v1.5.0-alpha.2
|
||||
TESTS = general minimal mainnet
|
||||
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, FullPayload<E>> {
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name != ForkName::Base && fork_name != ForkName::Altair
|
||||
fork_name >= ForkName::Bellatrix
|
||||
}
|
||||
|
||||
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
@@ -331,7 +331,7 @@ impl<E: EthSpec> Operation<E> for BeaconBlockBody<E, BlindedPayload<E>> {
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name != ForkName::Base && fork_name != ForkName::Altair
|
||||
fork_name >= ForkName::Bellatrix
|
||||
}
|
||||
|
||||
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
@@ -383,9 +383,7 @@ impl<E: EthSpec> Operation<E> for WithdrawalsPayload<E> {
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name != ForkName::Base
|
||||
&& fork_name != ForkName::Altair
|
||||
&& fork_name != ForkName::Bellatrix
|
||||
fork_name >= ForkName::Capella
|
||||
}
|
||||
|
||||
fn decode(path: &Path, fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
@@ -417,9 +415,7 @@ impl<E: EthSpec> Operation<E> for SignedBlsToExecutionChange {
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(fork_name: ForkName) -> bool {
|
||||
fork_name != ForkName::Base
|
||||
&& fork_name != ForkName::Altair
|
||||
&& fork_name != ForkName::Bellatrix
|
||||
fork_name >= ForkName::Capella
|
||||
}
|
||||
|
||||
fn decode(path: &Path, _fork_name: ForkName, _spec: &ChainSpec) -> Result<Self, Error> {
|
||||
|
||||
@@ -20,9 +20,8 @@ pub trait Handler {
|
||||
|
||||
// Add forks here to exclude them from EF spec testing. Helpful for adding future or
|
||||
// unspecified forks.
|
||||
// TODO(electra): Enable Electra once spec tests are available.
|
||||
fn disabled_forks(&self) -> Vec<ForkName> {
|
||||
vec![ForkName::Electra]
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
|
||||
@@ -245,6 +244,14 @@ impl<T, E> SszStaticHandler<T, E> {
|
||||
Self::for_forks(ForkName::list_all()[3..].to_vec())
|
||||
}
|
||||
|
||||
pub fn deneb_and_later() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[4..].to_vec())
|
||||
}
|
||||
|
||||
pub fn electra_and_later() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[5..].to_vec())
|
||||
}
|
||||
|
||||
pub fn pre_electra() -> Self {
|
||||
Self::for_forks(ForkName::list_all()[0..5].to_vec())
|
||||
}
|
||||
@@ -577,7 +584,7 @@ impl<E: EthSpec + TypeName> Handler for ForkChoiceHandler<E> {
|
||||
|
||||
// No FCU override tests prior to bellatrix.
|
||||
if self.handler_name == "should_override_forkchoice_update"
|
||||
&& (fork_name == ForkName::Base || fork_name == ForkName::Altair)
|
||||
&& fork_name >= ForkName::Bellatrix
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -613,9 +620,7 @@ impl<E: EthSpec + TypeName> Handler for OptimisticSyncHandler<E> {
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
|
||||
fork_name != ForkName::Base
|
||||
&& fork_name != ForkName::Altair
|
||||
&& cfg!(not(feature = "fake_crypto"))
|
||||
fork_name >= ForkName::Bellatrix && cfg!(not(feature = "fake_crypto"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -798,13 +803,12 @@ impl<E: EthSpec + TypeName> Handler for MerkleProofValidityHandler<E> {
|
||||
"single_merkle_proof".into()
|
||||
}
|
||||
|
||||
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
|
||||
fork_name != ForkName::Base
|
||||
// Test is skipped due to some changes in the Capella light client
|
||||
// spec.
|
||||
//
|
||||
// https://github.com/sigp/lighthouse/issues/4022
|
||||
&& fork_name != ForkName::Capella && fork_name != ForkName::Deneb
|
||||
fn is_enabled_for_fork(&self, _fork_name: ForkName) -> bool {
|
||||
// Test is skipped due to some changes in the Capella light client
|
||||
// spec.
|
||||
//
|
||||
// https://github.com/sigp/lighthouse/issues/4022
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -829,10 +833,7 @@ impl<E: EthSpec + TypeName> Handler for KzgInclusionMerkleProofValidityHandler<E
|
||||
|
||||
fn is_enabled_for_fork(&self, fork_name: ForkName) -> bool {
|
||||
// Enabled in Deneb
|
||||
fork_name != ForkName::Base
|
||||
&& fork_name != ForkName::Altair
|
||||
&& fork_name != ForkName::Bellatrix
|
||||
&& fork_name != ForkName::Capella
|
||||
fork_name >= ForkName::Deneb
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ fn check_typenum_values<E: EthSpec>() {
|
||||
E::SlotsPerEth1VotingPeriod::to_u64(),
|
||||
E::EpochsPerEth1VotingPeriod::to_u64() * E::SlotsPerEpoch::to_u64()
|
||||
);
|
||||
assert_eq!(
|
||||
E::MaxValidatorsPerSlot::to_u64(),
|
||||
E::MaxCommitteesPerSlot::to_u64() * E::MaxValidatorsPerCommittee::to_u64()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -217,7 +221,11 @@ mod ssz_static {
|
||||
use ef_tests::{Handler, SszStaticHandler, SszStaticTHCHandler, SszStaticWithSpecHandler};
|
||||
use types::blob_sidecar::BlobIdentifier;
|
||||
use types::historical_summary::HistoricalSummary;
|
||||
use types::{AttesterSlashingBase, AttesterSlashingElectra, LightClientBootstrapAltair, *};
|
||||
use types::{
|
||||
AttesterSlashingBase, AttesterSlashingElectra, Consolidation, DepositReceipt,
|
||||
ExecutionLayerWithdrawalRequest, LightClientBootstrapAltair, PendingBalanceDeposit,
|
||||
PendingPartialWithdrawal, *,
|
||||
};
|
||||
|
||||
ssz_static_test!(attestation, Attestation<_>);
|
||||
ssz_static_test!(attestation_data, AttestationData);
|
||||
@@ -310,6 +318,10 @@ mod ssz_static {
|
||||
.run();
|
||||
SszStaticHandler::<BeaconBlockBodyDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
||||
.run();
|
||||
SszStaticHandler::<BeaconBlockBodyElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only()
|
||||
.run();
|
||||
SszStaticHandler::<BeaconBlockBodyElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
// Altair and later
|
||||
@@ -344,6 +356,10 @@ mod ssz_static {
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientBootstrapElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
// LightClientHeader has no internal indicator of which fork it is for, so we test it separately.
|
||||
@@ -369,35 +385,27 @@ mod ssz_static {
|
||||
.run();
|
||||
SszStaticHandler::<LightClientHeaderDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientHeaderElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientHeaderElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
// LightClientOptimisticUpdate has no internal indicator of which fork it is for, so we test it separately.
|
||||
#[test]
|
||||
fn light_client_optimistic_update() {
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::altair_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateCapella<MainnetEthSpec>, MainnetEthSpec>::capella_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateDeneb<MinimalEthSpec>, MinimalEthSpec>::deneb_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::altair_only().run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::altair_only().run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MinimalEthSpec>, MinimalEthSpec>::bellatrix_only().run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateAltair<MainnetEthSpec>, MainnetEthSpec>::bellatrix_only().run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateCapella<MinimalEthSpec>, MinimalEthSpec>::capella_only().run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateCapella<MainnetEthSpec>, MainnetEthSpec>::capella_only().run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateDeneb<MinimalEthSpec>, MinimalEthSpec>::deneb_only().run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only().run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only().run();
|
||||
SszStaticHandler::<LightClientOptimisticUpdateElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only().run();
|
||||
}
|
||||
|
||||
// LightClientFinalityUpdate has no internal indicator of which fork it is for, so we test it separately.
|
||||
@@ -427,6 +435,12 @@ mod ssz_static {
|
||||
SszStaticHandler::<LightClientFinalityUpdateDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientFinalityUpdateElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientFinalityUpdateElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
// LightClientUpdate has no internal indicator of which fork it is for, so we test it separately.
|
||||
@@ -450,6 +464,12 @@ mod ssz_static {
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
SszStaticHandler::<LightClientUpdateElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only(
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -503,6 +523,10 @@ mod ssz_static {
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionPayloadDeneb<MainnetEthSpec>, MainnetEthSpec>::deneb_only()
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionPayloadElectra<MinimalEthSpec>, MinimalEthSpec>::electra_only()
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionPayloadElectra<MainnetEthSpec>, MainnetEthSpec>::electra_only()
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -519,6 +543,10 @@ mod ssz_static {
|
||||
::deneb_only().run();
|
||||
SszStaticHandler::<ExecutionPayloadHeaderDeneb<MainnetEthSpec>, MainnetEthSpec>
|
||||
::deneb_only().run();
|
||||
SszStaticHandler::<ExecutionPayloadHeaderElectra<MinimalEthSpec>, MinimalEthSpec>
|
||||
::electra_only().run();
|
||||
SszStaticHandler::<ExecutionPayloadHeaderElectra<MainnetEthSpec>, MainnetEthSpec>
|
||||
::electra_only().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -541,14 +569,14 @@ mod ssz_static {
|
||||
|
||||
#[test]
|
||||
fn blob_sidecar() {
|
||||
SszStaticHandler::<BlobSidecar<MinimalEthSpec>, MinimalEthSpec>::deneb_only().run();
|
||||
SszStaticHandler::<BlobSidecar<MainnetEthSpec>, MainnetEthSpec>::deneb_only().run();
|
||||
SszStaticHandler::<BlobSidecar<MinimalEthSpec>, MinimalEthSpec>::deneb_and_later().run();
|
||||
SszStaticHandler::<BlobSidecar<MainnetEthSpec>, MainnetEthSpec>::deneb_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn blob_identifier() {
|
||||
SszStaticHandler::<BlobIdentifier, MinimalEthSpec>::deneb_only().run();
|
||||
SszStaticHandler::<BlobIdentifier, MainnetEthSpec>::deneb_only().run();
|
||||
SszStaticHandler::<BlobIdentifier, MinimalEthSpec>::deneb_and_later().run();
|
||||
SszStaticHandler::<BlobIdentifier, MainnetEthSpec>::deneb_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -556,6 +584,44 @@ mod ssz_static {
|
||||
SszStaticHandler::<HistoricalSummary, MinimalEthSpec>::capella_and_later().run();
|
||||
SszStaticHandler::<HistoricalSummary, MainnetEthSpec>::capella_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn consolidation() {
|
||||
SszStaticHandler::<Consolidation, MinimalEthSpec>::electra_and_later().run();
|
||||
SszStaticHandler::<Consolidation, MainnetEthSpec>::electra_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn deposit_receipt() {
|
||||
SszStaticHandler::<DepositReceipt, MinimalEthSpec>::electra_and_later().run();
|
||||
SszStaticHandler::<DepositReceipt, MainnetEthSpec>::electra_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn execution_layer_withdrawal_request() {
|
||||
SszStaticHandler::<ExecutionLayerWithdrawalRequest, MinimalEthSpec>::electra_and_later()
|
||||
.run();
|
||||
SszStaticHandler::<ExecutionLayerWithdrawalRequest, MainnetEthSpec>::electra_and_later()
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pending_balance_deposit() {
|
||||
SszStaticHandler::<PendingBalanceDeposit, MinimalEthSpec>::electra_and_later().run();
|
||||
SszStaticHandler::<PendingBalanceDeposit, MainnetEthSpec>::electra_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pending_consolidation() {
|
||||
SszStaticHandler::<PendingConsolidation, MinimalEthSpec>::electra_and_later().run();
|
||||
SszStaticHandler::<PendingConsolidation, MainnetEthSpec>::electra_and_later().run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pending_partial_withdrawal() {
|
||||
SszStaticHandler::<PendingPartialWithdrawal, MinimalEthSpec>::electra_and_later().run();
|
||||
SszStaticHandler::<PendingPartialWithdrawal, MainnetEthSpec>::electra_and_later().run();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user