Skip to content

Commit

Permalink
chore: update boundary in test
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Nov 7, 2024
1 parent 2509e2f commit c6fc45a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
16 changes: 9 additions & 7 deletions l1-contracts/test/Rollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,18 @@ contract RollupTest is DecoderBase {
);
}

function testMissingProofSlashesBond(uint256 slotsToJump) public setUpFor("mixed_block_1") {
// @note, this gives a an overflow if bounding to type(uint256).max
// Tracked by https://github.com/AztecProtocol/aztec-packages/issues/9362
slotsToJump =
bound(slotsToJump, 2 * Constants.AZTEC_EPOCH_DURATION, 1e20 * Constants.AZTEC_EPOCH_DURATION);
function testMissingProofSlashesBond(uint256 _slotToHit) public setUpFor("mixed_block_1") {
Slot lower = rollup.getCurrentSlot() + Slot.wrap(2 * Constants.AZTEC_EPOCH_DURATION);
Slot upper = Slot.wrap(
(type(uint256).max - Timestamp.unwrap(rollup.GENESIS_TIME())) / rollup.SLOT_DURATION()
);
Slot slotToHit = Slot.wrap(bound(_slotToHit, lower.unwrap(), upper.unwrap()));

_testBlock("mixed_block_1", false, 1);
rollup.claimEpochProofRight(signedQuote);
warpToL2Slot(slotsToJump);
warpToL2Slot(slotToHit.unwrap());
rollup.prune();
_testBlock("mixed_block_1", true, slotsToJump);
_testBlock("mixed_block_1", true, slotToHit.unwrap());

assertEq(
proofCommitmentEscrow.deposits(quote.prover), 9 * quote.bondAmount, "Invalid escrow balance"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,20 @@ contract PushProposalTest is GovernanceProposerBase {
_;
}

function test_WhenRoundTooFarInPast(uint256 _slotsToJump)
function test_WhenRoundTooFarInPast(uint256 _slotToHit)
external
givenCanonicalInstanceHoldCode
whenRoundInPast
{
// it revert

uint256 lower = Timestamp.unwrap(
leonidas.getTimestampForSlot(
leonidas.getCurrentSlot()
+ Slot.wrap(governanceProposer.M() * governanceProposer.LIFETIME_IN_ROUNDS() + 1)
)
Slot lower = leonidas.getCurrentSlot()
+ Slot.wrap(governanceProposer.M() * governanceProposer.LIFETIME_IN_ROUNDS() + 1);
Slot upper = Slot.wrap(
(type(uint256).max - Timestamp.unwrap(leonidas.GENESIS_TIME())) / leonidas.SLOT_DURATION()
);
uint256 upper =
(type(uint256).max - Timestamp.unwrap(leonidas.GENESIS_TIME())) / leonidas.SLOT_DURATION();
uint256 time = bound(_slotsToJump, lower, upper);

vm.warp(time);
Slot slotToHit = Slot.wrap(bound(_slotToHit, lower.unwrap(), upper.unwrap()));
vm.warp(Timestamp.unwrap(leonidas.getTimestampForSlot(slotToHit)));

vm.expectRevert(
abi.encodeWithSelector(
Expand Down

0 comments on commit c6fc45a

Please sign in to comment.