Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update boundary in test #9728

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading