-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Archiver does not jump the gun on epoch completed (#10801)
Archiver's isEpochComplete would return `true` when the first L1 block of the last epoch L2 slot was mined, ignoring the fact that the L2 block could be posted on a later L1 slot. This fixes the check so it reports the epoch as completed only once the last L1 block of the last L2 slot of the epoch is mined. Fixes #10800
- Loading branch information
1 parent
b721253
commit 51d82aa
Showing
5 changed files
with
158 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
yarn-project/circuit-types/src/epoch-helpers/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { type EpochConstants, getTimestampRangeForEpoch } from './index.js'; | ||
|
||
describe('EpochHelpers', () => { | ||
let constants: EpochConstants; | ||
const l1GenesisTime = 1734440000n; | ||
|
||
beforeEach(() => { | ||
constants = { | ||
l1GenesisBlock: 10n, | ||
l1GenesisTime: l1GenesisTime, | ||
epochDuration: 4, | ||
slotDuration: 24, | ||
ethereumSlotDuration: 12, | ||
}; | ||
}); | ||
|
||
it('returns timestamp range for initial epoch', () => { | ||
const [start, end] = getTimestampRangeForEpoch(0n, constants); | ||
expect(start).toEqual(l1GenesisTime); | ||
expect(end).toEqual(l1GenesisTime + BigInt(24 * 3 + 12)); | ||
}); | ||
|
||
it('returns timestamp range for second epoch', () => { | ||
const [start, end] = getTimestampRangeForEpoch(1n, constants); | ||
expect(start).toEqual(l1GenesisTime + BigInt(24 * 4)); | ||
expect(end).toEqual(l1GenesisTime + BigInt(24 * 4) + BigInt(24 * 3 + 12)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters