Skip to content

Commit 94ee71f

Browse files
committed
test(fast-inbox): use the real 512 ring floor in the overwritten-hint test (A-1378)
1 parent f1ef905 commit 94ee71f

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

l1-contracts/test/rollup/ProposeInboxConsumption.t.sol

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import {TimeLib, Slot, Timestamp} from "@aztec/core/libraries/TimeLib.sol";
1515
import {Errors} from "@aztec/core/libraries/Errors.sol";
1616
import {DataStructures} from "@aztec/core/libraries/DataStructures.sol";
17+
import {MIN_BUCKET_RING_SIZE} from "@aztec/core/messagebridge/Inbox.sol";
1718
import {InboxHarness} from "../harnesses/InboxHarness.sol";
1819
import {TestConstants} from "../harnesses/TestConstants.sol";
1920

@@ -40,7 +41,6 @@ contract ProposeInboxConsumptionTest is Test {
4041
uint256 internal constant SLOT_DURATION = 36;
4142
uint256 internal constant EPOCH_DURATION = 32;
4243
uint256 internal constant HEIGHT = 10;
43-
uint256 internal constant SMALL_RING_SIZE = 4;
4444

4545
Slot internal constant SLOT = Slot.wrap(10);
4646

@@ -198,22 +198,23 @@ contract ProposeInboxConsumptionTest is Test {
198198
}
199199

200200
function testHintOnOverwrittenBucketRejected() public {
201-
InboxHarness smallRingInbox = _deployInbox(SMALL_RING_SIZE);
201+
InboxHarness ringInbox = _deployInbox(MIN_BUCKET_RING_SIZE);
202202

203-
uint256 timestamp = cutoff - 100;
204-
for (uint256 i = 1; i <= SMALL_RING_SIZE + 1; i++) {
203+
// One bucket per L1 block; after MIN_BUCKET_RING_SIZE + 1 buckets the ring has wrapped past bucket 1,
204+
// so a hint pointing at it must be rejected before any cutoff logic runs.
205+
for (uint256 i = 1; i <= MIN_BUCKET_RING_SIZE + 1; i++) {
205206
vm.roll(block.number + 1);
206-
vm.warp(timestamp + i);
207-
smallRingInbox.sendL2Message(
207+
vm.warp(block.timestamp + 1);
208+
ringInbox.sendL2Message(
208209
DataStructures.L2Actor({actor: bytes32(uint256(0x1000 + i)), version: version}),
209210
bytes32(uint256(0x2000 + i)),
210211
bytes32(uint256(0x3000 + i))
211212
);
212213
}
213214

214215
vm.warp(GENESIS_TIME + Slot.unwrap(SLOT) * SLOT_DURATION);
215-
vm.expectRevert(abi.encodeWithSelector(Errors.Inbox__BucketOutOfWindow.selector, 1, SMALL_RING_SIZE + 1));
216-
rollup.validateInboxConsumption(smallRingInbox, bytes32(0), 1, SLOT, 0);
216+
vm.expectRevert(abi.encodeWithSelector(Errors.Inbox__BucketOutOfWindow.selector, 1, MIN_BUCKET_RING_SIZE + 1));
217+
rollup.validateInboxConsumption(ringInbox, bytes32(0), 1, SLOT, 0);
217218
}
218219

219220
function testConsumeBackwardsReverts() public {

0 commit comments

Comments
 (0)