From ca062df3b448375347af34542b7382483e793f12 Mon Sep 17 00:00:00 2001 From: ericlee Date: Tue, 5 Mar 2024 10:24:50 +0800 Subject: [PATCH] fix: mpc can only commit one epoch once the consensus client has updated, and it doesn't allow to commit multipy epochs at a time --- contracts/SequencerSet.sol | 2 +- ts-src/test/SequencerSet.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/SequencerSet.sol b/contracts/SequencerSet.sol index 6c278fd..043095a 100644 --- a/contracts/SequencerSet.sol +++ b/contracts/SequencerSet.sol @@ -179,7 +179,7 @@ contract MetisSequencerSet is OwnableUpgradeable { "End block must be greater than start block" ); require( - (_endBlock - _startBlock + 1) % epochLength == 0, + _endBlock - _startBlock + 1 == epochLength, "Mismatch epoch length and block length" ); require( diff --git a/ts-src/test/SequencerSet.ts b/ts-src/test/SequencerSet.ts index df2a944..651cb34 100644 --- a/ts-src/test/SequencerSet.ts +++ b/ts-src/test/SequencerSet.ts @@ -126,7 +126,7 @@ describe("MetisSequencerSet", async () => { await mineUpTo(900); nextEpochNumber++; - await seqset.connect(mpc).commitEpoch(nextEpochNumber, 1000, 1999, seq1); + await seqset.connect(mpc).commitEpoch(nextEpochNumber, 1000, 1199, seq1); { const { number, startBlock, endBlock, signer } = await seqset.finalizedEpoch();