Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(spec): fix attestors slashing specs for electra fork #6758

Merged
merged 5 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 1 addition & 2 deletions packages/beacon-node/test/spec/utils/specTestIterator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ export const defaultSkipOpts: SkipOpts = {
skippedTestSuites: [
/^capella\/light_client\/single_merkle_proof\/BeaconBlockBody.*/,
/^deneb\/light_client\/single_merkle_proof\/BeaconBlockBody.*/,
// /^electra\/(?!operations\/attestations)(?!operations\/attester_slashing)/,
/^electra\/(?!operations\/attestation)/,
/^electra\/(?!operations\/attestations)(?!operations\/attester_slashing)/,
],
skippedTests: [],
skippedRunners: ["merkle_proof", "networking"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params";
import {ForkSeq, MAX_COMMITTEES_PER_SLOT, MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params";
import {phase0} from "@lodestar/types";
import {CachedBeaconStateAllForks} from "../types.js";
import {verifySignatureSet} from "../util/index.js";
Expand Down Expand Up @@ -44,7 +44,11 @@ export function isValidIndexedAttestationBigint(
*/
export function isValidIndexedAttestationIndices(state: CachedBeaconStateAllForks, indices: number[]): boolean {
// verify max number of indices
if (!(indices.length > 0 && indices.length <= MAX_VALIDATORS_PER_COMMITTEE)) {
const maxIndices =
state.config.getForkSeq(state.slot) >= ForkSeq.electra
? MAX_VALIDATORS_PER_COMMITTEE * MAX_COMMITTEES_PER_SLOT
: MAX_VALIDATORS_PER_COMMITTEE;
if (!(indices.length > 0 && indices.length <= maxIndices)) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/state-transition/src/util/epoch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function computeExitEpochAndUpdateChurn(state: CachedBeaconStateElectra,
// Exit doesn't fit in the current earliest epoch.
if (exitBalance > exitBalanceToConsume) {
const balanceToProcess = Number(exitBalance) - exitBalanceToConsume;
const additionalEpochs = Math.floor((balanceToProcess - 1) / (perEpochChurn + 1));
const additionalEpochs = Math.floor((balanceToProcess - 1) / perEpochChurn) + 1;
earliestExitEpoch += additionalEpochs;
exitBalanceToConsume += additionalEpochs * perEpochChurn;
}
Expand Down
Loading