-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
fix: use right slot number for future epoch of proposers duties #6545
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -105,18 +105,25 @@ vi.mock("../../src/chain/chain.js", async (importActual) => { | |||
const BeaconChain = vi.fn().mockImplementation(({clock, genesisTime, config}: MockedBeaconChainOptions) => { | ||||
const logger = getMockedLogger(); | ||||
|
||||
const clk = | ||||
clock === "real" | ||||
? new Clock({config, genesisTime: 0, signal: new AbortController().signal}) | ||||
: { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Introducing a small utility function to create this dummy There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should probably look into reusing
|
||||
get currentSlot() { | ||||
return 0; | ||||
}, | ||||
get currentEpoch() { | ||||
return 0; | ||||
}, | ||||
currentSlotWithGossipDisparity: undefined, | ||||
isCurrentSlotGivenGossipDisparity: vi.fn(), | ||||
}; | ||||
|
||||
return { | ||||
config, | ||||
opts: {}, | ||||
genesisTime, | ||||
clock: | ||||
clock === "real" | ||||
? new Clock({config, genesisTime: 0, signal: new AbortController().signal}) | ||||
: { | ||||
currentSlot: undefined, | ||||
currentSlotWithGossipDisparity: undefined, | ||||
isCurrentSlotGivenGossipDisparity: vi.fn(), | ||||
}, | ||||
clock: clk, | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick: could we possibly rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe |
||||
forkChoice: getMockedForkChoice(), | ||||
executionEngine: { | ||||
notifyForkchoiceUpdate: vi.fn(), | ||||
|
@@ -162,7 +169,7 @@ vi.mock("../../src/chain/chain.js", async (importActual) => { | |||
}; | ||||
}); | ||||
|
||||
type MockedBeaconChainOptions = { | ||||
export type MockedBeaconChainOptions = { | ||||
clock: "real" | "fake"; | ||||
genesisTime: number; | ||||
config: ChainForkConfig; | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix, right? Maybe it would be worth adding a comment clarifying what is done here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous code would have deserved a comment on why we use the stateEpoch instead of actual requested epoch which didn't make sense of course. But it makes sense now, shouldn't require a comment imo