Skip to content

Commit

Permalink
Implement Electra spec v1.5.0-alpha.5 (sigp#6305)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
michaelsproul authored and AgeManning committed Sep 3, 2024
1 parent 4af6e0c commit 388ec32
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ impl PendingBalanceDepositsContext {
.deposit_balance_to_consume()?
.safe_add(state.get_activation_exit_churn_limit(spec)?)?;
let current_epoch = state.current_epoch();
let next_epoch = state.next_epoch()?;
let mut processed_amount = 0;
let mut next_deposit_index = 0;
let mut validator_deposits_to_process = HashMap::new();
Expand All @@ -827,17 +828,20 @@ impl PendingBalanceDepositsContext {
// 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
// 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`).
let validator = state.get_validator(deposit.index as usize)?;
let already_exited = validator.exit_epoch < spec.far_future_epoch;
// 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
// 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)
&& validator.effective_balance <= spec.ejection_balance;
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());
} else {
// Deposited balance will never become active. Increase balance but do not
Expand Down Expand Up @@ -906,7 +910,7 @@ fn process_pending_consolidations<E: EthSpec>(
spec: &ChainSpec,
) -> Result<(), Error> {
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 mut affected_validators = BTreeSet::new();
Expand All @@ -919,7 +923,7 @@ fn process_pending_consolidations<E: EthSpec>(
next_pending_consolidation.safe_add_assign(1)?;
continue;
}
if source_validator.withdrawable_epoch > current_epoch {
if source_validator.withdrawable_epoch > next_epoch {
break;
}

Expand Down
2 changes: 1 addition & 1 deletion testing/ef_tests/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TESTS_TAG := v1.5.0-alpha.3
TESTS_TAG := v1.5.0-alpha.5
TESTS = general minimal mainnet
TARBALLS = $(patsubst %,%-$(TESTS_TAG).tar.gz,$(TESTS))

Expand Down
7 changes: 4 additions & 3 deletions testing/ef_tests/check_all_files_accessed.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
"tests/.*/.*/ssz_static/Eth1Block/",
"tests/.*/.*/ssz_static/PowBlock/",
# light_client
# "tests/.*/.*/light_client",
"tests/.*/.*/light_client/single_merkle_proof",
"tests/.*/.*/light_client/sync",
"tests/.*/electra/light_client/update_ranking",
# LightClientStore
"tests/.*/.*/ssz_static/LightClientStore",
# LightClientSnapshot
"tests/.*/.*/ssz_static/LightClientSnapshot",
# One of the EF researchers likes to pack the tarballs on a Mac
".*\.DS_Store.*",
".*\\.DS_Store.*",
# More Mac weirdness.
"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
Expand All @@ -49,7 +49,8 @@
# TODO(electra) re-enable once https://github.com/sigp/lighthouse/issues/6002 is resolved
"tests/.*/electra/ssz_static/LightClientUpdate",
"tests/.*/electra/ssz_static/LightClientFinalityUpdate",
"tests/.*/electra/ssz_static/LightClientBootstrap"
"tests/.*/electra/ssz_static/LightClientBootstrap",
"tests/.*/electra/merkle_proof",
]


Expand Down

0 comments on commit 388ec32

Please sign in to comment.