Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/beacon-node/test/spec/specTestVersioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {DownloadTestsOptions} from "@lodestar/spec-test-util/downloadTests";
const __dirname = path.dirname(fileURLToPath(import.meta.url));

export const ethereumConsensusSpecsTests: DownloadTestsOptions = {
specVersion: "v1.5.0-alpha.3",
specVersion: "v1.5.0-alpha.5",
// Target directory is the host package root: 'packages/*/spec-tests'
outputDir: path.join(__dirname, "../../spec-tests"),
specTestsRepoUrl: "https://github.com/ethereum/consensus-spec-tests",
Expand Down
1 change: 1 addition & 0 deletions packages/beacon-node/test/spec/utils/specTestIterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const defaultSkipOpts: SkipOpts = {
skippedTestSuites: [
/^capella\/light_client\/single_merkle_proof\/BeaconBlockBody.*/,
/^deneb\/light_client\/single_merkle_proof\/BeaconBlockBody.*/,
/^electra\/light_client\/.*/,
],
// TODO Electra: Review this test in the next spec test release
skippedTests: [/incorrect_not_enough_consolidation_churn_available/],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {FAR_FUTURE_EPOCH} from "@lodestar/params";
import {CachedBeaconStateElectra, EpochTransitionCache} from "../types.js";
import {increaseBalance} from "../util/balance.js";
import {getActivationExitChurnLimit} from "../util/validator.js";
import {getCurrentEpoch} from "../util/epoch.js";

/**
* Starting from Electra:
Expand All @@ -14,8 +13,8 @@ import {getCurrentEpoch} from "../util/epoch.js";
* TODO Electra: Update ssz library to support batch push to `pendingBalanceDeposits`
*/
export function processPendingBalanceDeposits(state: CachedBeaconStateElectra, cache: EpochTransitionCache): void {
const nextEpoch = state.epochCtx.epoch + 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the name upcomingEpoch made by @matthewkeil for processEpoch code in his async shuffling PR #6938

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea name is good but i think good to be closer to naming used in specs, though not a strong opinion

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on following spec naming, I think we should have a good reason if we wanna deviate from terms used in spec.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, if we really have a problem with the naming, we should aim to update it in the spec instead. Deviating off standards create more context loss for new people reading our code IMO.

const availableForProcessing = state.depositBalanceToConsume + BigInt(getActivationExitChurnLimit(state.epochCtx));
const currentEpoch = getCurrentEpoch(state);
let processedAmount = 0n;
let nextDepositIndex = 0;
const depositsToPostpone = [];
Expand All @@ -28,7 +27,7 @@ export function processPendingBalanceDeposits(state: CachedBeaconStateElectra, c

// Validator is exiting, postpone the deposit until after withdrawable epoch
if (validator.exitEpoch < FAR_FUTURE_EPOCH) {
if (currentEpoch <= validator.withdrawableEpoch) {
if (nextEpoch <= validator.withdrawableEpoch) {
depositsToPostpone.push(deposit);
} else {
// Deposited balance will never become active. Increase balance but do not consume churn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {switchToCompoundingValidator} from "../util/electra.js";
*
*/
export function processPendingConsolidations(state: CachedBeaconStateElectra, cache: EpochTransitionCache): void {
const nextEpoch = state.epochCtx.epoch + 1;
let nextPendingConsolidation = 0;
const validators = state.validators;
const cachedBalances = cache.balances;
Expand All @@ -32,7 +33,7 @@ export function processPendingConsolidations(state: CachedBeaconStateElectra, ca
continue;
}

if (sourceValidator.withdrawableEpoch > state.epochCtx.epoch) {
if (sourceValidator.withdrawableEpoch > nextEpoch) {
break;
}
// Churn any target excess active balance of target and raise its max
Expand Down