Skip to content

Commit

Permalink
Update tests to ensure correct epoch is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Oct 2, 2023
1 parent eb53e4d commit eaf74cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/validator/test/unit/services/doppelganger.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,14 @@ describe("doppelganger service", () => {
indicesService.pubkey2index.set(pubkeyHex, index);

// Initial epoch must be > 0 else doppelganger detection is skipped due to pre-genesis
const initialEpoch = 1;
const initialEpoch = 10;
const clock = new ClockMockMsToSlot(initialEpoch);

const slashingProtection = new SlashingProtectionMock();
// Attestation from previous epoch exists in slashing protection db
slashingProtection.hasAttestedInEpoch = async () => true;
slashingProtection.hasAttestedInEpoch = async (_, epoch: Epoch) => {
return epoch === initialEpoch - 1;
};

const doppelganger = new DoppelgangerService(
logger,
Expand Down
3 changes: 2 additions & 1 deletion packages/validator/test/utils/slashingProtectionMock.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {BLSPubkey, Epoch} from "@lodestar/types";
import {ISlashingProtection} from "../../src/index.js";

/**
Expand All @@ -10,7 +11,7 @@ export class SlashingProtectionMock implements ISlashingProtection {
async checkAndInsertAttestation(): Promise<void> {
//
}
async hasAttestedInEpoch(): Promise<boolean> {
async hasAttestedInEpoch(_p: BLSPubkey, _e: Epoch): Promise<boolean> {
return false;
}
async importInterchange(): Promise<void> {
Expand Down

0 comments on commit eaf74cd

Please sign in to comment.