Skip to content

Commit

Permalink
Update consensus-spec-tests to v1.5.0-alpha.4
Browse files Browse the repository at this point in the history
  • Loading branch information
povi committed Aug 16, 2024
1 parent 2687c17 commit 5974afc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 24 deletions.
2 changes: 1 addition & 1 deletion consensus-spec-tests
15 changes: 2 additions & 13 deletions helper_functions/src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ use types::{
consts::DOMAIN_BLOB_SIDECAR,
containers::{BeaconBlock as DenebBeaconBlock, BlobSidecar},
},
electra::{
consts::DOMAIN_CONSOLIDATION,
containers::{
AggregateAndProof as ElectraAggregateAndProof, BeaconBlock as ElectraBeaconBlock,
ConsolidationRequest,
},
electra::containers::{
AggregateAndProof as ElectraAggregateAndProof, BeaconBlock as ElectraBeaconBlock,
},
phase0::{
consts::{
Expand Down Expand Up @@ -371,13 +367,6 @@ impl<P: Preset> SignForSingleFork<P> for BlobSidecar<P> {
}
}

// TODO: change specs
// <https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.1/specs/electra/beacon-chain.md#new-process_consolidation>
impl<P: Preset> SignForAllForksWithGenesis<P> for ConsolidationRequest {
const DOMAIN_TYPE: DomainType = DOMAIN_CONSOLIDATION;
const SIGNATURE_KIND: SignatureKind = SignatureKind::Consolidation;
}

/// <https://github.com/ethereum/consensus-specs/blob/v1.1.1/specs/altair/validator.md#broadcast-sync-committee-contribution>
impl<P: Preset> SignForSingleFork<P> for ContributionAndProof<P> {
const DOMAIN_TYPE: DomainType = DOMAIN_CONTRIBUTION_AND_PROOF;
Expand Down
7 changes: 4 additions & 3 deletions transition_functions/src/electra/epoch_processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ fn process_pending_balance_deposits<P: Preset>(
config: &Config,
state: &mut impl PostElectraBeaconState<P>,
) -> Result<()> {
let next_epoch = get_current_epoch(state) + 1;
let available_for_processing =
state.deposit_balance_to_consume() + get_activation_exit_churn_limit(config, state);

Expand All @@ -219,7 +220,7 @@ fn process_pending_balance_deposits<P: Preset>(

// > Validator is exiting, postpone the deposit until after withdrawable epoch
if validator.exit_epoch < FAR_FUTURE_EPOCH {
if get_current_epoch(state) <= validator.withdrawable_epoch {
if next_epoch <= validator.withdrawable_epoch {
deposits_to_postpone.push(*deposit);
} else {
// > Deposited balance will never become active. Increase balance but do not consume churn
Expand Down Expand Up @@ -268,7 +269,7 @@ fn process_pending_balance_deposits<P: Preset>(
fn process_pending_consolidations<P: Preset>(
state: &mut impl PostElectraBeaconState<P>,
) -> Result<()> {
let current_epoch = get_current_epoch(state);
let next_epoch = get_current_epoch(state) + 1;
let mut next_pending_consolidation = 0;

for pending_consolidation in &state.pending_consolidations().clone() {
Expand All @@ -279,7 +280,7 @@ fn process_pending_consolidations<P: Preset>(
continue;
}

if source_validator.withdrawable_epoch > current_epoch {
if source_validator.withdrawable_epoch > next_epoch {
break;
}

Expand Down
2 changes: 1 addition & 1 deletion types/src/electra/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub type FinalizedRootIndex = ConcatGeneralizedIndices<
/// │ └11┬22┬44┬─88 BeaconState.latest_execution_payload_header
/// │ │ │ └─89 BeaconState.next_withdrawal_index
/// │ │ └45┬─90 BeaconState.next_withdrawal_validator_index
/// │ │ └─91 BeaconState.deposit_receipts_start_index
/// │ │ └─91 BeaconState.deposit_requests_start_index
/// │ └23┬46┬─92 BeaconState.historical_summaries
/// │ │ └─93 BeaconState.deposit_balance_to_consume
/// │ └47┬─94 BeaconState.exit_balance_to_consume
Expand Down
6 changes: 0 additions & 6 deletions types/src/electra/spec_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,6 @@ tests_for_type! {
"consensus-spec-tests/tests/minimal/electra/ssz_static/SignedBLSToExecutionChange/*/*",
}

// tests_for_type! {
// SignedConsolidation,
// "consensus-spec-tests/tests/mainnet/electra/ssz_static/SignedConsolidation/*/*",
// "consensus-spec-tests/tests/minimal/electra/ssz_static/SignedConsolidation/*/*",
// }

tests_for_type! {
SignedContributionAndProof<_>,
"consensus-spec-tests/tests/mainnet/electra/ssz_static/SignedContributionAndProof/*/*",
Expand Down

0 comments on commit 5974afc

Please sign in to comment.