Skip to content

Commit

Permalink
fix: timestamp invariant to reject old/stale certs - update to use re…
Browse files Browse the repository at this point in the history
…ference block #
  • Loading branch information
EthenNotEthan committed Aug 24, 2024
1 parent 43fc622 commit 595cd5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/bridge/SequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,10 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
// Verify that the certificate is less than 2 epochs old from the L1 reference block number
// This is to prevent timing attacks where the sequencer could submit an expired or close to expired
// certificate which could impact liveness of full nodes as well as the safety of the bridge
if ((cert.blobVerificationProof.batchMetadata.confirmationBlockNumber + 64) < block.number) {
if (
(cert.blobVerificationProof.batchMetadata.batchHeader.referenceBlockNumber + 64) <
block.number
) {
revert ExpiredEigenDACert(
block.number,
cert.blobVerificationProof.batchMetadata.confirmationBlockNumber + 64
Expand Down
7 changes: 2 additions & 5 deletions test/foundry/SequencerInbox.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -593,13 +593,11 @@ contract SequencerInboxTest is Test {

cert.blobVerificationProof.batchMetadata.batchHeader.referenceBlockNumber = 0;

bytes memory data = bytes.concat(hex"ed", abi.encode(cert));

uint256 subMessageCount = bridge.sequencerReportedSubMessageCount();
uint256 sequenceNumber = bridge.sequencerMessageCount();
uint256 delayedMessagesRead = bridge.delayedMessageCount();

vm.roll(10000000);
vm.roll(65);
vm.prank(tx.origin);

vm.expectRevert();
Expand All @@ -613,7 +611,7 @@ contract SequencerInboxTest is Test {
);
}

function testAddSequencerL2BatchFromEigenDA() public {
function testAddSequencerL2BatchFromEigenDA() public {
DummyEigenDABlobVerifier rollupManagerImpl = new DummyEigenDABlobVerifier();
(SequencerInbox seqInbox, Bridge bridge) = deployRollup(false);
// update the dummyEigenDAServiceManager to use the holesky serviceManager contract
Expand Down Expand Up @@ -659,7 +657,6 @@ contract SequencerInboxTest is Test {
);
}


// TODO: put these in jsons later
// create illegal commitment
BN254.G1Point illegalCommitment =
Expand Down

0 comments on commit 595cd5a

Please sign in to comment.