From 537f24832fe1ee87cd0802ec3a7c6402a3cc50d4 Mon Sep 17 00:00:00 2001 From: Joseph Delong Date: Mon, 8 Jan 2024 14:52:39 -0600 Subject: [PATCH] fix: nonce incrementation, test runner broken --- .gas-snapshot | 238 +++++++++++++------------- .github/workflows/format_snapshot.yml | 4 +- .github/workflows/lint_test.yml | 4 +- .husky/pre-commit | 2 +- package.json | 2 +- src/Starport.sol | 2 +- test/unit-testing/TestStarport.sol | 2 +- 7 files changed, 128 insertions(+), 126 deletions(-) diff --git a/.gas-snapshot b/.gas-snapshot index 92ca76c7..c0d36750 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,152 +1,154 @@ -IntegrationTestCaveats:testInvalidCaveatLength() (gas: 130462) -IntegrationTestCaveats:testInvalidCaveats() (gas: 162492) -IntegrationTestCaveats:testOriginateUnapprovedFulfiller() (gas: 333065) -IntegrationTestCaveats:testOriginateWBorrowerApproval() (gas: 283734) -IntegrationTestCaveats:testOriginateWCaveatsAsBorrower() (gas: 307193) -IntegrationTestCaveats:testOriginateWCaveatsExpired() (gas: 159743) -IntegrationTestCaveats:testOriginateWCaveatsIncrementedNonce() (gas: 168532) -IntegrationTestCaveats:testOriginateWCaveatsInvalidSalt() (gas: 285255) -IntegrationTestCaveats:testOriginateWCaveatsInvalidSaltManual() (gas: 142384) -IntegrationTestCaveats:testOriginateWLenderApproval() (gas: 283854) -IntegrationTestCaveats:testRefinanceAsLender() (gas: 1054269) -IntegrationTestCaveats:testRefinanceCaveatFailure() (gas: 408850) -IntegrationTestCaveats:testRefinanceLoanStartAtBlockTimestampInvalidLoan() (gas: 348456) -IntegrationTestCaveats:testRefinanceUnapprovedFulfiller() (gas: 457486) -IntegrationTestCaveats:testRefinanceWCaveatsInvalidSalt() (gas: 378176) -IntegrationTestCaveats:testRefinanceWLenderApproval() (gas: 403428) -ModuleTesting:testFixedTermDutchAuctionSettlement() (gas: 438951) -ModuleTesting:testFixedTermDutchAuctionSettlementGetSettlementAuctionExpired() (gas: 441840) -ModuleTesting:testFixedTermDutchAuctionSettlementNotValid() (gas: 437963) -ModuleTesting:testFixedTermDutchAuctionSettlementValid() (gas: 438762) -ModuleTesting:testModuleValidation() (gas: 1275150) +IntegrationTestCaveats:testInvalidCaveatLength() (gas: 130019) +IntegrationTestCaveats:testInvalidCaveats() (gas: 162046) +IntegrationTestCaveats:testOriginateUnapprovedFulfiller() (gas: 332147) +IntegrationTestCaveats:testOriginateWBorrowerApproval() (gas: 283288) +IntegrationTestCaveats:testOriginateWCaveatsAsBorrower() (gas: 306526) +IntegrationTestCaveats:testOriginateWCaveatsExpired() (gas: 159299) +IntegrationTestCaveats:testOriginateWCaveatsIncrementedNonce() (gas: 168077) +IntegrationTestCaveats:testOriginateWCaveatsInvalidSalt() (gas: 284586) +IntegrationTestCaveats:testOriginateWCaveatsInvalidSaltManual() (gas: 141962) +IntegrationTestCaveats:testOriginateWLenderApproval() (gas: 283408) +IntegrationTestCaveats:testRefinanceAsLender() (gas: 1053605) +IntegrationTestCaveats:testRefinanceCaveatFailure() (gas: 407716) +IntegrationTestCaveats:testRefinanceLoanStartAtBlockTimestampInvalidLoan() (gas: 347568) +IntegrationTestCaveats:testRefinanceUnapprovedFulfiller() (gas: 456374) +IntegrationTestCaveats:testRefinanceWCaveatsInvalidSalt() (gas: 377067) +IntegrationTestCaveats:testRefinanceWLenderApproval() (gas: 402764) +ModuleTesting:testFixedTermDutchAuctionSettlement() (gas: 438033) +ModuleTesting:testFixedTermDutchAuctionSettlementAuctionNotStarted() (gas: 441409) +ModuleTesting:testFixedTermDutchAuctionSettlementGetSettlementAuctionExpired() (gas: 440947) +ModuleTesting:testFixedTermDutchAuctionSettlementNotValid() (gas: 437045) +ModuleTesting:testFixedTermDutchAuctionSettlementValid() (gas: 437844) +ModuleTesting:testModuleValidation() (gas: 1274232) PausableNonReentrantImpl:test() (gas: 2464) PausableNonReentrantImpl:testReentrancy() (gas: 2757) TestBorrowerEnforcer:testBERevertAdditionalTransfersFromBorrower() (gas: 76462) TestBorrowerEnforcer:testBERevertInvalidLoanTerms() (gas: 81160) TestBorrowerEnforcer:testBEValidLoanTerms() (gas: 72257) TestBorrowerEnforcer:testBEValidLoanTermsAnyIssuer() (gas: 72321) -TestCustodian:testCannotLazyMintTwice() (gas: 78716) -TestCustodian:testCannotMintInvalidLoanInvalidCustodian() (gas: 69119) -TestCustodian:testCannotMintInvalidLoanValidCustodian() (gas: 74497) -TestCustodian:testCustodySelector() (gas: 2881479) -TestCustodian:testDefaultCustodySelectorRevert() (gas: 72312) -TestCustodian:testGenerateOrderInvalidPostRepayment() (gas: 173121) -TestCustodian:testGenerateOrderInvalidPostSettlement() (gas: 163220) -TestCustodian:testGenerateOrderRepay() (gas: 177276) -TestCustodian:testGenerateOrderRepayAsRepayApprovedBorrower() (gas: 193762) -TestCustodian:testGenerateOrderRepayERC1155AndERC20() (gas: 876401) -TestCustodian:testGenerateOrderRepayERC1155AndERC20HandlerAuthorized() (gas: 805987) +TestCustodian:testCannotLazyMintTwice() (gas: 82131) +TestCustodian:testCannotMintInvalidLoanInvalidCustodian() (gas: 72437) +TestCustodian:testCannotMintInvalidLoanValidCustodian() (gas: 77947) +TestCustodian:testCustodianCannotBeAuthorized() (gas: 142196) +TestCustodian:testCustodySelector() (gas: 2697813) +TestCustodian:testDefaultCustodySelectorRevert() (gas: 72420) +TestCustodian:testGenerateOrderInvalidPostRepayment() (gas: 173141) +TestCustodian:testGenerateOrderInvalidPostSettlement() (gas: 163282) +TestCustodian:testGenerateOrderRepay() (gas: 177299) +TestCustodian:testGenerateOrderRepayAsRepayApprovedBorrower() (gas: 193763) +TestCustodian:testGenerateOrderRepayERC1155AndERC20() (gas: 875091) +TestCustodian:testGenerateOrderRepayERC1155AndERC20HandlerAuthorized() (gas: 804777) TestCustodian:testGenerateOrderRepayInvalidHookAddress() (gas: 97653) TestCustodian:testGenerateOrderRepayInvalidHookReturnType() (gas: 92014) -TestCustodian:testGenerateOrderRepayNotBorrower() (gas: 106933) -TestCustodian:testGenerateOrderSettlement() (gas: 154953) -TestCustodian:testGenerateOrderSettlementHandlerAuthorized() (gas: 160350) -TestCustodian:testGenerateOrderSettlementNoActiveLoan() (gas: 163420) -TestCustodian:testGenerateOrderSettlementUnauthorized() (gas: 101861) -TestCustodian:testGenerateOrdersWithLoanStartAtBlockTimestampInvalidLoan() (gas: 462318) -TestCustodian:testGetBorrower() (gas: 78643) -TestCustodian:testInvalidAction() (gas: 173340) -TestCustodian:testInvalidActionRepayInActiveLoan() (gas: 130184) -TestCustodian:testInvalidActionSettleActiveLoan() (gas: 130144) +TestCustodian:testGenerateOrderRepayNotBorrower() (gas: 106914) +TestCustodian:testGenerateOrderSettlement() (gas: 155015) +TestCustodian:testGenerateOrderSettlementHandlerAuthorized() (gas: 160412) +TestCustodian:testGenerateOrderSettlementNoActiveLoan() (gas: 163460) +TestCustodian:testGenerateOrderSettlementUnauthorized() (gas: 101879) +TestCustodian:testGenerateOrdersWithLoanStartAtBlockTimestampInvalidLoan() (gas: 461629) +TestCustodian:testGetBorrower() (gas: 78621) +TestCustodian:testInvalidAction() (gas: 173362) +TestCustodian:testInvalidActionRepayInActiveLoan() (gas: 130206) +TestCustodian:testInvalidActionSettleActiveLoan() (gas: 130166) TestCustodian:testInvalidEncodedData() (gas: 26170) -TestCustodian:testMintWithApprovalSetAsBorrower() (gas: 363996) -TestCustodian:testMintWithApprovalSetAsBorrowerInvalidLoan() (gas: 60792) -TestCustodian:testMintWithApprovalSetNotAuthorized() (gas: 76701) -TestCustodian:testName() (gas: 7121) +TestCustodian:testMintWithApprovalSetAsBorrower() (gas: 366745) +TestCustodian:testMintWithApprovalSetAsBorrowerInvalidLoan() (gas: 64632) +TestCustodian:testMintWithApprovalSetNotAuthorized() (gas: 66873) +TestCustodian:testName() (gas: 7099) TestCustodian:testNonPayableFunctions() (gas: 215173) TestCustodian:testOnlySeaport() (gas: 17918) TestCustodian:testPreviewOrderNoActiveLoan() (gas: 105759) -TestCustodian:testPreviewOrderRepay() (gas: 230291) -TestCustodian:testPreviewOrderSettlement() (gas: 191935) -TestCustodian:testPreviewOrderSettlementInvalidFufliller() (gas: 108280) +TestCustodian:testPreviewOrderRepay() (gas: 230309) +TestCustodian:testPreviewOrderSettlement() (gas: 192037) +TestCustodian:testPreviewOrderSettlementInvalidFufliller() (gas: 108320) TestCustodian:testPreviewOrderSettlementInvalidRepayer() (gas: 117031) -TestCustodian:testRatifyOrder() (gas: 184097) -TestCustodian:testSeaportMetadata() (gas: 8666) +TestCustodian:testRatifyOrder() (gas: 184120) +TestCustodian:testSeaportMetadata() (gas: 8644) TestCustodian:testSupportsInterface() (gas: 9428) -TestCustodian:testSymbol() (gas: 7127) -TestCustodian:testTokenURI() (gas: 84152) +TestCustodian:testSymbol() (gas: 7216) +TestCustodian:testTokenURI() (gas: 84130) TestCustodian:testTokenURIInvalidLoan() (gas: 13157) TestLenderEnforcer:testLERevertAdditionalTransfersFromLender() (gas: 76455) TestLenderEnforcer:testLERevertInvalidLoanTerms() (gas: 81096) TestLenderEnforcer:testLEValidLoanTerms() (gas: 72169) TestLenderEnforcer:testLEValidLoanTermsAnyBorrower() (gas: 72323) TestLenderEnforcer:testLEValidLoanTermsWithAdditionalTransfers() (gas: 73525) -TestLoanCombinations:testLoan20For721SimpleInterestDutchFixedRepay() (gas: 592848) -TestLoanCombinations:testLoan20for20SimpleInterestDutchFixedRepay() (gas: 600039) -TestLoanCombinations:testLoan721for20SimpleInterestDutchFixedRepay() (gas: 591288) -TestLoanCombinations:testLoanAstariaSettlementRepay() (gas: 581172) -TestNewLoan:testBuyNowPayLater() (gas: 2874813) +TestLoanCombinations:testLoan20For721SimpleInterestDutchFixedRepay() (gas: 591976) +TestLoanCombinations:testLoan20for20SimpleInterestDutchFixedRepay() (gas: 599167) +TestLoanCombinations:testLoan721for20SimpleInterestDutchFixedRepay() (gas: 590438) +TestLoanCombinations:testLoanAstariaSettlementRepay() (gas: 580300) +TestNewLoan:testBuyNowPayLater() (gas: 2873894) TestNewLoan:testInvalidSenderBNPL() (gas: 1613098) TestNewLoan:testInvalidUserDataHashBNPL() (gas: 1615699) -TestNewLoan:testNewLoanAs1271ProxyAccountSender() (gas: 874782) -TestNewLoan:testNewLoanAs1271ProxyAccountThirdPartyFiller() (gas: 886047) -TestNewLoan:testNewLoanERC721CollateralDefaultTerms2() (gas: 430463) -TestNewLoan:testNewLoanRefinance() (gas: 591211) -TestNewLoan:testNewLoanViaOriginatorBorrowerApprovalAndLenderApproval() (gas: 325552) -TestNewLoan:testNewLoanViaOriginatorLenderApproval() (gas: 384794) -TestNewLoan:testSettleLoan() (gas: 642220) +TestNewLoan:testNewLoanAs1271ProxyAccountSender() (gas: 874115) +TestNewLoan:testNewLoanAs1271ProxyAccountThirdPartyFiller() (gas: 885129) +TestNewLoan:testNewLoanERC721CollateralDefaultTerms2() (gas: 429545) +TestNewLoan:testNewLoanRefinance() (gas: 590031) +TestNewLoan:testNewLoanViaOriginatorBorrowerApprovalAndLenderApproval() (gas: 325574) +TestNewLoan:testNewLoanViaOriginatorLenderApproval() (gas: 384348) +TestNewLoan:testSettleLoan() (gas: 642171) TestPausableNonReentrant:testNotOwner() (gas: 21254) TestPausableNonReentrant:testPauseAndUnpause() (gas: 22621) TestPausableNonReentrant:testReentrancy() (gas: 15404) TestPausableNonReentrant:testUnpauseWhenNotPaused() (gas: 12582) -TestRepayLoan:testRepayLoanApprovedRepayer() (gas: 664607) -TestRepayLoan:testRepayLoanBase() (gas: 600831) -TestRepayLoan:testRepayLoanGenerateOrderNotSeaport() (gas: 439605) -TestRepayLoan:testRepayLoanInSettlement() (gas: 586342) -TestRepayLoan:testRepayLoanInvalidRepayer() (gas: 604879) -TestRepayLoan:testRepayLoanThatDoesNotExist() (gas: 859630) -TestSimpleInterestPricing:test_calculateInterest() (gas: 899536) -TestSimpleInterestPricing:test_getPaymentConsideration() (gas: 946746) -TestSimpleInterestPricing:test_getRefinanceConsideration() (gas: 937602) +TestRepayLoan:testRepayLoanApprovedRepayer() (gas: 667169) +TestRepayLoan:testRepayLoanBase() (gas: 599955) +TestRepayLoan:testRepayLoanGenerateOrderNotSeaport() (gas: 438687) +TestRepayLoan:testRepayLoanInSettlement() (gas: 585895) +TestRepayLoan:testRepayLoanInvalidRepayer() (gas: 603988) +TestRepayLoan:testRepayLoanThatDoesNotExist() (gas: 858823) +TestSimpleInterestPricing:test_calculateInterest() (gas: 881296) +TestSimpleInterestPricing:test_getPaymentConsideration() (gas: 928510) +TestSimpleInterestPricing:test_getRefinanceConsideration() (gas: 919314) TestStarport:testAcquireTokensFail() (gas: 60430) TestStarport:testAcquireTokensSuccess() (gas: 162977) -TestStarport:testActive() (gas: 69291) -TestStarport:testAdditionalTransfers() (gas: 301168) -TestStarport:testAdditionalTransfersOriginate() (gas: 275864) -TestStarport:testAdditionalTransfersRefinance() (gas: 218277) -TestStarport:testApplyRefinanceConsiderationToLoanMalformed() (gas: 129820) -TestStarport:testCannotIssueSameLoanTwice() (gas: 364949) -TestStarport:testCannotOriginateWhilePaused() (gas: 73545) -TestStarport:testCannotSettleInvalidLoan() (gas: 74881) -TestStarport:testCannotSettleUnlessValidCustodian() (gas: 70941) -TestStarport:testCaveatEnforcerRevert() (gas: 100726) -TestStarport:testDefaultFeeRake1() (gas: 388604) -TestStarport:testDefaultFeeRakeExoticDebt() (gas: 398431) -TestStarport:testEIP712Signing() (gas: 83377) -TestStarport:testExoticDebtWithCustomPricingAndRepayment() (gas: 1238218) -TestStarport:testExoticDebtWithCustomPricingAndSettlement() (gas: 1693177) -TestStarport:testExoticDebtWithNoCaveatsNotAsBorrower() (gas: 377266) -TestStarport:testIncrementCaveatNonce() (gas: 35316) -TestStarport:testInitializedFlagSetProperly() (gas: 67416) -TestStarport:testInvalidAdditionalTransfersOriginate() (gas: 230839) -TestStarport:testInvalidAdditionalTransfersRefinance() (gas: 170859) -TestStarport:testInvalidAmountCollateral() (gas: 166358) -TestStarport:testInvalidAmountCollateral721() (gas: 166358) -TestStarport:testInvalidItemType() (gas: 152306) -TestStarport:testInvalidTransferLengthCollateral() (gas: 154596) -TestStarport:testInvalidTransferLengthDebt() (gas: 176395) -TestStarport:testInvalidateCaveatSalt() (gas: 33428) -TestStarport:testNonDefaultCustodianCustodyCallFails() (gas: 264679) -TestStarport:testNonDefaultCustodianCustodyCallSuccess() (gas: 290826) -TestStarport:testNonPayableFunctions() (gas: 112450) -TestStarport:testOverrideFeeRake() (gas: 384850) -TestStarport:testPause() (gas: 18215) -TestStarport:testRefinancePostRepaymentFails() (gas: 128036) +TestStarport:testActive() (gas: 69313) +TestStarport:testAdditionalTransfers() (gas: 300721) +TestStarport:testAdditionalTransfersOriginate() (gas: 275417) +TestStarport:testAdditionalTransfersRefinance() (gas: 218214) +TestStarport:testApplyRefinanceConsiderationToLoanMalformed() (gas: 129974) +TestStarport:testCannotIssueSameLoanTwice() (gas: 364057) +TestStarport:testCannotOriginateWhilePaused() (gas: 73567) +TestStarport:testCannotSettleInvalidLoan() (gas: 74903) +TestStarport:testCannotSettleUnlessValidCustodian() (gas: 70963) +TestStarport:testCaveatEnforcerRevert() (gas: 100284) +TestStarport:testDefaultFeeRake1() (gas: 387780) +TestStarport:testDefaultFeeRakeExoticDebt() (gas: 397608) +TestStarport:testEIP712Signing() (gas: 83067) +TestStarport:testExoticDebtWithCustomPricingAndRepayment() (gas: 1237817) +TestStarport:testExoticDebtWithCustomPricingAndSettlement() (gas: 1692860) +TestStarport:testExoticDebtWithNoCaveatsNotAsBorrower() (gas: 376819) +TestStarport:testIncrementCaveatNonce() (gas: 35292) +TestStarport:testInitializedFlagSetProperly() (gas: 67438) +TestStarport:testInvalidAdditionalTransfersOriginate() (gas: 230392) +TestStarport:testInvalidAdditionalTransfersRefinance() (gas: 170796) +TestStarport:testInvalidAmountCollateral() (gas: 165912) +TestStarport:testInvalidAmountCollateral721() (gas: 165912) +TestStarport:testInvalidItemType() (gas: 151860) +TestStarport:testInvalidTransferLengthCollateral() (gas: 154151) +TestStarport:testInvalidTransferLengthDebt() (gas: 175950) +TestStarport:testInvalidateCaveatSalt() (gas: 33450) +TestStarport:testNonDefaultCustodianCustodyCallFails() (gas: 264233) +TestStarport:testNonDefaultCustodianCustodyCallSuccess() (gas: 290380) +TestStarport:testNonPayableFunctions() (gas: 112229) +TestStarport:testOverrideFeeRake() (gas: 384026) +TestStarport:testPause() (gas: 18237) +TestStarport:testRefinancePostRepaymentFails() (gas: 127973) TestStarport:testStargateGetOwner() (gas: 8808) -TestStarport:testTokenNoCodeCollateral() (gas: 151141) -TestStarport:testTokenNoCodeDebt() (gas: 181392) -TestStarport:testUnpause() (gas: 17297) +TestStarport:testTokenNoCodeCollateral() (gas: 150695) +TestStarport:testTokenNoCodeDebt() (gas: 180946) +TestStarport:testUnpause() (gas: 17341) TestStrategistOriginator:testEncodeWithAccountCounter() (gas: 12307) TestStrategistOriginator:testGetStrategistData() (gas: 1511582) TestStrategistOriginator:testIncrementCounterAsStrategist() (gas: 18676) TestStrategistOriginator:testIncrementCounterNotAuthorized() (gas: 13401) -TestStrategistOriginator:testInvalidCollateral() (gas: 210724) -TestStrategistOriginator:testInvalidDeadline() (gas: 216403) -TestStrategistOriginator:testInvalidDebt() (gas: 212384) -TestStrategistOriginator:testInvalidDebtAmountAskingMoreThanOffered() (gas: 212723) -TestStrategistOriginator:testInvalidDebtAmountOfferingZero() (gas: 213044) -TestStrategistOriginator:testInvalidDebtAmountRequestingZero() (gas: 212976) -TestStrategistOriginator:testInvalidDebtLength() (gas: 211651) -TestStrategistOriginator:testInvalidOffer() (gas: 427136) -TestStrategistOriginator:testInvalidSigner() (gas: 214830) +TestStrategistOriginator:testInvalidCollateral() (gas: 210503) +TestStrategistOriginator:testInvalidDeadline() (gas: 216182) +TestStrategistOriginator:testInvalidDebt() (gas: 212163) +TestStrategistOriginator:testInvalidDebtAmountAskingMoreThanOffered() (gas: 212502) +TestStrategistOriginator:testInvalidDebtAmountOfferingZero() (gas: 212823) +TestStrategistOriginator:testInvalidDebtAmountRequestingZero() (gas: 212755) +TestStrategistOriginator:testInvalidDebtLength() (gas: 211430) +TestStrategistOriginator:testInvalidOffer() (gas: 426690) +TestStrategistOriginator:testInvalidSigner() (gas: 214609) TestStrategistOriginator:testSetStrategist() (gas: 17774) \ No newline at end of file diff --git a/.github/workflows/format_snapshot.yml b/.github/workflows/format_snapshot.yml index d306a546..2f272a22 100644 --- a/.github/workflows/format_snapshot.yml +++ b/.github/workflows/format_snapshot.yml @@ -27,10 +27,10 @@ jobs: run: forge fmt - name: Snapshot - run: forge snapshot --no-match-path '*fuzz*' + run: forge snapshot --ffi --no-match-path '*fuzz*' - name: Test - run: forge test -vvv + run: forge test -vvv --ffi - uses: stefanzweifel/git-auto-commit-action@v4 with: diff --git a/.github/workflows/lint_test.yml b/.github/workflows/lint_test.yml index c4726e00..3781cda8 100644 --- a/.github/workflows/lint_test.yml +++ b/.github/workflows/lint_test.yml @@ -26,7 +26,7 @@ jobs: run: forge fmt --check - name: Snapshot - run: forge snapshot --check --no-match-path '*fuzz*' + run: forge snapshot --ffi --check --no-match-path '*fuzz*' - name: Test - run: forge test -vvv + run: forge test -vvv --ffi diff --git a/.husky/pre-commit b/.husky/pre-commit index 2dec32ed..fb7ee0be 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,6 +2,6 @@ . "$(dirname -- "$0")/_/husky.sh" forge fmt --check -forge snapshot --no-match-path '*fuzz*' +forge snapshot --ffi --no-match-path '*fuzz*' git add .gas-snapshot diff --git a/package.json b/package.json index 361436be..c32d0cbd 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "scripts": { "prepare": "husky install", - "snapshot": "forge snapshot --no-match-path '*fuzz*'" + "snapshot": "forge snapshot --ffi --no-match-path '*fuzz*'" }, "devDependencies": { "husky": "^8.0.0", diff --git a/src/Starport.sol b/src/Starport.sol index f99749f6..5c24397d 100644 --- a/src/Starport.sol +++ b/src/Starport.sol @@ -320,7 +320,7 @@ contract Starport is PausableNonReentrant { * @dev Increments caveat nonce for sender and emits event */ function incrementCaveatNonce() external { - uint256 newNonce = caveatNonces[msg.sender] + uint256(blockhash(block.number - 1) >> 0x80); + uint256 newNonce = caveatNonces[msg.sender] + 1 + uint256(blockhash(block.number - 1) >> 0x80); caveatNonces[msg.sender] = newNonce; emit CaveatNonceIncremented(msg.sender, newNonce); } diff --git a/test/unit-testing/TestStarport.sol b/test/unit-testing/TestStarport.sol index 811737a8..90a6b103 100644 --- a/test/unit-testing/TestStarport.sol +++ b/test/unit-testing/TestStarport.sol @@ -347,7 +347,7 @@ contract TestStarport is StarportTest, DeepEq { function testIncrementCaveatNonce() public { vm.roll(5); - uint256 newNonce = SP.caveatNonces(address(this)) + uint256(blockhash(block.number - 1) << 0x80); + uint256 newNonce = SP.caveatNonces(address(this)) + 1 + uint256(blockhash(block.number - 1) >> 0x80); vm.expectEmit(); emit CaveatNonceIncremented(address(this), newNonce); SP.incrementCaveatNonce();