Implement Electra spec v1.5.0-alpha.5 (#6305)

* Implement spec v1.5.0-alpha.5

* Merge remote-tracking branch 'origin/unstable' into spec-1.5.0-alpha.5

* Ignore broken Electra light client tests
This commit is contained in:
Michael Sproul
2024-08-26 21:43:35 +10:00
committed by GitHub
parent 4036da7cfd
commit e09fe5a372
3 changed files with 14 additions and 9 deletions

View File

@@ -811,6 +811,7 @@ impl PendingBalanceDepositsContext {
.deposit_balance_to_consume()? .deposit_balance_to_consume()?
.safe_add(state.get_activation_exit_churn_limit(spec)?)?; .safe_add(state.get_activation_exit_churn_limit(spec)?)?;
let current_epoch = state.current_epoch(); let current_epoch = state.current_epoch();
let next_epoch = state.next_epoch()?;
let mut processed_amount = 0; let mut processed_amount = 0;
let mut next_deposit_index = 0; let mut next_deposit_index = 0;
let mut validator_deposits_to_process = HashMap::new(); let mut validator_deposits_to_process = HashMap::new();
@@ -827,17 +828,20 @@ impl PendingBalanceDepositsContext {
// does not happen until after this (but in the spec happens before). However it's not // does not happen until after this (but in the spec happens before). However it's not
// hard to work out: we don't need to know exactly what value the `exit_epoch` will // hard to work out: we don't need to know exactly what value the `exit_epoch` will
// take, just whether it is non-default. Nor do we need to know the value of // take, just whether it is non-default. Nor do we need to know the value of
// `withdrawable_epoch`, because `current_epoch <= withdrawable_epoch` will evaluate to // `withdrawable_epoch`, because `next_epoch <= withdrawable_epoch` will evaluate to
// `true` both for the actual value & the default placeholder value (`FAR_FUTURE_EPOCH`). // `true` both for the actual value & the default placeholder value (`FAR_FUTURE_EPOCH`).
let validator = state.get_validator(deposit.index as usize)?; let validator = state.get_validator(deposit.index as usize)?;
let already_exited = validator.exit_epoch < spec.far_future_epoch; let already_exited = validator.exit_epoch < spec.far_future_epoch;
// In the spec process_registry_updates is called before process_pending_balance_deposits // In the spec process_registry_updates is called before process_pending_balance_deposits
// so we must account for process_registry_updates ejecting the validator for low balance // so we must account for process_registry_updates ejecting the validator for low balance
// and setting the exit_epoch to < far_future_epoch // and setting the exit_epoch to < far_future_epoch. Note that in the spec the effective
// balance update does not happen until *after* the registry update, so we don't need to
// account for changes to the effective balance that would push it below the ejection
// balance here.
let will_be_exited = validator.is_active_at(current_epoch) let will_be_exited = validator.is_active_at(current_epoch)
&& validator.effective_balance <= spec.ejection_balance; && validator.effective_balance <= spec.ejection_balance;
if already_exited || will_be_exited { if already_exited || will_be_exited {
if state.current_epoch() <= validator.withdrawable_epoch { if next_epoch <= validator.withdrawable_epoch {
deposits_to_postpone.push(deposit.clone()); deposits_to_postpone.push(deposit.clone());
} else { } else {
// Deposited balance will never become active. Increase balance but do not // Deposited balance will never become active. Increase balance but do not
@@ -906,7 +910,7 @@ fn process_pending_consolidations<E: EthSpec>(
spec: &ChainSpec, spec: &ChainSpec,
) -> Result<(), Error> { ) -> Result<(), Error> {
let mut next_pending_consolidation: usize = 0; let mut next_pending_consolidation: usize = 0;
let current_epoch = state.current_epoch(); let next_epoch = state.next_epoch()?;
let pending_consolidations = state.pending_consolidations()?.clone(); let pending_consolidations = state.pending_consolidations()?.clone();
let mut affected_validators = BTreeSet::new(); let mut affected_validators = BTreeSet::new();
@@ -919,7 +923,7 @@ fn process_pending_consolidations<E: EthSpec>(
next_pending_consolidation.safe_add_assign(1)?; next_pending_consolidation.safe_add_assign(1)?;
continue; continue;
} }
if source_validator.withdrawable_epoch > current_epoch { if source_validator.withdrawable_epoch > next_epoch {
break; break;
} }

View File

@@ -1,4 +1,4 @@
TESTS_TAG := v1.5.0-alpha.3 TESTS_TAG := v1.5.0-alpha.5
TESTS = general minimal mainnet TESTS = general minimal mainnet
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS)) TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))

View File

@@ -26,15 +26,15 @@ excluded_paths = [
"tests/.*/.*/ssz_static/Eth1Block/", "tests/.*/.*/ssz_static/Eth1Block/",
"tests/.*/.*/ssz_static/PowBlock/", "tests/.*/.*/ssz_static/PowBlock/",
# light_client # light_client
# "tests/.*/.*/light_client",
"tests/.*/.*/light_client/single_merkle_proof", "tests/.*/.*/light_client/single_merkle_proof",
"tests/.*/.*/light_client/sync", "tests/.*/.*/light_client/sync",
"tests/.*/electra/light_client/update_ranking",
# LightClientStore # LightClientStore
"tests/.*/.*/ssz_static/LightClientStore", "tests/.*/.*/ssz_static/LightClientStore",
# LightClientSnapshot # LightClientSnapshot
"tests/.*/.*/ssz_static/LightClientSnapshot", "tests/.*/.*/ssz_static/LightClientSnapshot",
# One of the EF researchers likes to pack the tarballs on a Mac # One of the EF researchers likes to pack the tarballs on a Mac
".*\.DS_Store.*", ".*\\.DS_Store.*",
# More Mac weirdness. # More Mac weirdness.
"tests/mainnet/bellatrix/operations/deposit/pyspec_tests/deposit_with_previous_fork_version__valid_ineffective/._meta.yaml", "tests/mainnet/bellatrix/operations/deposit/pyspec_tests/deposit_with_previous_fork_version__valid_ineffective/._meta.yaml",
# bls tests are moved to bls12-381-tests directory # bls tests are moved to bls12-381-tests directory
@@ -49,7 +49,8 @@ excluded_paths = [
# TODO(electra) re-enable once https://github.com/sigp/lighthouse/issues/6002 is resolved # TODO(electra) re-enable once https://github.com/sigp/lighthouse/issues/6002 is resolved
"tests/.*/electra/ssz_static/LightClientUpdate", "tests/.*/electra/ssz_static/LightClientUpdate",
"tests/.*/electra/ssz_static/LightClientFinalityUpdate", "tests/.*/electra/ssz_static/LightClientFinalityUpdate",
"tests/.*/electra/ssz_static/LightClientBootstrap" "tests/.*/electra/ssz_static/LightClientBootstrap",
"tests/.*/electra/merkle_proof",
] ]