diff --git a/.gas-snapshot b/.gas-snapshot index a3546a744..0902507ff 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,12 +1,12 @@ DeveloperDeployTest:testUp() (gas: 24279) ETHPriceIsRightTest:testAnyoneCanChangeGuessBeforeEnd() (gas: 131807) ETHPriceIsRightTest:testAnyoneCanEnterGuessBeforeEnd() (gas: 127341) -ETHPriceIsRightTest:testFailCannotEnterGuessAfterTime() (gas: 11629) +ETHPriceIsRightTest:test_RevertWhen_CannotEnterGuessAfterTime() (gas: 11629) ETHPriceIsRightTest:testGuessCalculations() (gas: 156151) ETHPriceIsRightTest:testUp() (gas: 16852) EngenCreditsTest:testCanBurnAfterSettingFlag() (gas: 70853) EngenCreditsTest:testCanTransferAfterSettingFlag() (gas: 100027) -EngenCreditsTest:testFailOthersCannotUpgrade() (gas: 2102028) +EngenCreditsTest:test_RevertWhen_OthersCannotUpgrade() (gas: 2102028) EngenCreditsTest:testNobodyCanBurn() (gas: 70679) EngenCreditsTest:testNobodyCanTransfer() (gas: 71888) EngenCreditsTest:testOthersCannotMint() (gas: 25978) @@ -18,12 +18,12 @@ EngenCreditsTest:testWalletCanGetPointsWithOverride() (gas: 657489) EngenCreditsTest:testWalletCannotGetPointsTwice() (gas: 718288) FaucetTest:testClaim() (gas: 81023) FaucetTest:testClaimOnBehalf() (gas: 115966) -FaucetTest:testFailIfClaimedTwice() (gas: 77198) -FaucetTest:testFailOwnerCannotStartWithoutAmount() (gas: 19407) -FaucetTest:testFailStartFaucetByOthers() (gas: 16870) +FaucetTest:test_RevertWhen_IfClaimedTwice() (gas: 77198) +FaucetTest:test_RevertWhen_OwnerCannotStartWithoutAmount() (gas: 19407) +FaucetTest:test_RevertWhen_StartFaucetByOthers() (gas: 16870) FaucetTest:testOwnerCanStartFaucet() (gas: 42651) FaucetTest:testUp() (gas: 6294) -KYCViewerTest:testFailOthersCannotUpgradeFactory() (gas: 1029248) +KYCViewerTest:test_RevertWhen_OthersCannotUpgradeFactory() (gas: 1029248) KYCViewerTest:testIsKYCBothOwnerAndWallet() (gas: 82707) KYCViewerTest:testOwnerCanUpgradeViewer() (gas: 1065414) KYCViewerTest:testUp() (gas: 40633) @@ -34,14 +34,14 @@ KintoIDTest:testBurnFailsWithoutMinting() (gas: 26911) KintoIDTest:testBurnKYC() (gas: 250194) KintoIDTest:testBurningTwiceFails() (gas: 254209) KintoIDTest:testDappSignature() (gas: 166) -KintoIDTest:testFailOnlyProviderCanMonitor() (gas: 48382) -KintoIDTest:testFailOthersCannotUpgrade() (gas: 3885070) -KintoIDTest:testFailProviderCanAddTraitUnknownUser() (gas: 22719) -KintoIDTest:testFailTransfersAreDisabled() (gas: 297354) -KintoIDTest:testFailUserCannotAddSanction() (gas: 47795) -KintoIDTest:testFailUserCannotAddTrait() (gas: 47797) -KintoIDTest:testFailUserCannotRemoveSanction() (gas: 22608) -KintoIDTest:testFailUserCannotRemoveTrait() (gas: 326993) +KintoIDTest:test_RevertWhen_OnlyProviderCanMonitor() (gas: 48382) +KintoIDTest:test_RevertWhen_OthersCannotUpgrade() (gas: 3885070) +KintoIDTest:test_RevertWhen_ProviderCanAddTraitUnknownUser() (gas: 22719) +KintoIDTest:test_RevertWhen_TransfersAreDisabled() (gas: 297354) +KintoIDTest:test_RevertWhen_UserCannotAddSanction() (gas: 47795) +KintoIDTest:test_RevertWhen_UserCannotAddTrait() (gas: 47797) +KintoIDTest:test_RevertWhen_UserCannotRemoveSanction() (gas: 22608) +KintoIDTest:test_RevertWhen_UserCannotRemoveTrait() (gas: 326993) KintoIDTest:testIsSanctionsMonitored() (gas: 28227) KintoIDTest:testMintCompanyKYC() (gas: 284477) KintoIDTest:testMintIndividualKYC() (gas: 282508) @@ -60,9 +60,9 @@ KintoIDTest:testSettingTraitsAndSanctions() (gas: 317512) KintoIDTest:testUp() (gas: 17956) KintoWalletFactoryTest:testAllWalletsUpgrade() (gas: 3517833) KintoWalletFactoryTest:testDeployCustomContract() (gas: 136473) -KintoWalletFactoryTest:testFailCreateWalletThroughDeploy() (gas: 51285) -KintoWalletFactoryTest:testFailOthersCannotUpgradeFactory() (gas: 2636897) -KintoWalletFactoryTest:testFailOthersCannotUpgradeWallets() (gas: 3498853) +KintoWalletFactoryTest:test_RevertWhen_CreateWalletThroughDeploy() (gas: 51285) +KintoWalletFactoryTest:test_RevertWhen_OthersCannotUpgradeFactory() (gas: 2636897) +KintoWalletFactoryTest:test_RevertWhen_OthersCannotUpgradeWallets() (gas: 3498853) KintoWalletFactoryTest:testOwnerCanUpgradeFactory() (gas: 2673030) KintoWalletFactoryTest:testRandomSignerCannotFundWallet() (gas: 77154) KintoWalletFactoryTest:testSignerCanFundWallet() (gas: 71109) @@ -76,26 +76,26 @@ KintoWalletTest:testApproveAndRevokeTokens() (gas: 580610) KintoWalletTest:testApproveTokens() (gas: 530958) KintoWalletTest:testChangingPolicyWithThreeSigners() (gas: 442028) KintoWalletTest:testChangingPolicyWithTwoSigners() (gas: 413114) -KintoWalletTest:testFailApproveTokensWithoutWhitelist() (gas: 157159) -KintoWalletTest:testFailCallingApproveDirectly() (gas: 625818) -KintoWalletTest:testFailChangingPolicyWithoutRightSigners() (gas: 174419) -KintoWalletTest:testFailDirectCall() (gas: 65568) -KintoWalletTest:testFailMultipleTransactionsExecuteBatchPaymasterRefuses() (gas: 363188) -KintoWalletTest:testFailMultisigTransaction() (gas: 605529) -KintoWalletTest:testFailMultisigTransactionWhen2OutOf3Signers() (gas: 620528) -KintoWalletTest:testFailOthersCannotUpgrade() (gas: 3151175) -KintoWalletTest:testFailOwnerCannotUpgrade() (gas: 3467167) -KintoWalletTest:testFailRecoverNotEnoughTime() (gas: 430100) -KintoWalletTest:testFailRecoverNotRecoverer() (gas: 79216) -KintoWalletTest:testFailRecoverWithoutBurningOldOwner() (gas: 368060) -KintoWalletTest:testFailRecoverWithoutMintingNewOwner() (gas: 218345) -KintoWalletTest:testFailSendingTransactionDirectly() (gas: 184911) -KintoWalletTest:testFailSettingAppKeyNoWhitelist() (gas: 389794) -KintoWalletTest:testFailTransactionViaPaymasterNoapproval() (gas: 457146) -KintoWalletTest:testFailWithDuplicateSigner() (gas: 379042) -KintoWalletTest:testFailWithEmptyArray() (gas: 383567) -KintoWalletTest:testFailWithManyOwners() (gas: 379274) -KintoWalletTest:testFailWithoutKYCSigner() (gas: 377318) +KintoWalletTest:test_RevertWhen_ApproveTokensWithoutWhitelist() (gas: 157159) +KintoWalletTest:test_RevertWhen_CallingApproveDirectly() (gas: 625818) +KintoWalletTest:test_RevertWhen_ChangingPolicyWithoutRightSigners() (gas: 174419) +KintoWalletTest:test_RevertWhen_DirectCall() (gas: 65568) +KintoWalletTest:test_RevertWhen_MultipleTransactionsExecuteBatchPaymasterRefuses() (gas: 363188) +KintoWalletTest:test_RevertWhen_MultisigTransaction() (gas: 605529) +KintoWalletTest:test_RevertWhen_MultisigTransactionWhen2OutOf3Signers() (gas: 620528) +KintoWalletTest:test_RevertWhen_OthersCannotUpgrade() (gas: 3151175) +KintoWalletTest:test_RevertWhen_OwnerCannotUpgrade() (gas: 3467167) +KintoWalletTest:test_RevertWhen_RecoverNotEnoughTime() (gas: 430100) +KintoWalletTest:test_RevertWhen_RecoverNotRecoverer() (gas: 79216) +KintoWalletTest:test_RevertWhen_RecoverWithoutBurningOldOwner() (gas: 368060) +KintoWalletTest:test_RevertWhen_RecoverWithoutMintingNewOwner() (gas: 218345) +KintoWalletTest:test_RevertWhen_SendingTransactionDirectly() (gas: 184911) +KintoWalletTest:test_RevertWhen_SettingAppKeyNoWhitelist() (gas: 389794) +KintoWalletTest:test_RevertWhen_TransactionViaPaymasterNoapproval() (gas: 457146) +KintoWalletTest:test_RevertWhen_WithDuplicateSigner() (gas: 379042) +KintoWalletTest:test_RevertWhen_WithEmptyArray() (gas: 383567) +KintoWalletTest:test_RevertWhen_WithManyOwners() (gas: 379274) +KintoWalletTest:test_RevertWhen_WithoutKYCSigner() (gas: 377318) KintoWalletTest:testMultipleTransactionsExecuteBatchPaymaster() (gas: 534232) KintoWalletTest:testMultipleTransactionsViaPaymaster() (gas: 756771) KintoWalletTest:testMultisigTransaction() (gas: 859779) @@ -108,9 +108,9 @@ KintoWalletTest:testTransactionViaPaymaster() (gas: 694244) KintoWalletTest:testUp() (gas: 32038) KintoWalletTest:testWalletOwnersAreWhitelisted() (gas: 39988) SponsorPaymasterExploitTest:testExploit() (gas: 283756) -SponsorPaymasterTest:testFailOthersCannotUpgrade() (gas: 2205926) -SponsorPaymasterTest:testFailUserCanDepositStakeAndWithdrawWithoutRoll() (gas: 129377) -SponsorPaymasterTest:testFailUserCanWithdrawAllInEmergency() (gas: 137198) +SponsorPaymasterTest:test_RevertWhen_OthersCannotUpgrade() (gas: 2205926) +SponsorPaymasterTest:test_RevertWhen_UserCanDepositStakeAndWithdrawWithoutRoll() (gas: 129377) +SponsorPaymasterTest:test_RevertWhen_UserCanWithdrawAllInEmergency() (gas: 137198) SponsorPaymasterTest:testOwnerCanDepositStakeAndWithdraw() (gas: 95286) SponsorPaymasterTest:testOwnerCanUpgrade() (gas: 2242110) SponsorPaymasterTest:testOwnerCanWithdrawAllInEmergency() (gas: 123988) diff --git a/src/wallet/KintoWallet.sol b/src/wallet/KintoWallet.sol index c2c8991ee..ced6dd4d5 100644 --- a/src/wallet/KintoWallet.sol +++ b/src/wallet/KintoWallet.sol @@ -121,7 +121,7 @@ contract KintoWallet is Initializable, BaseAccount, TokenCallbackHandler, IKinto /* ============ Signer Management ============ */ /** - * @dev Change the signer policy + * @dev Change signer policy * @param policy new policy */ function setSignerPolicy(uint8 policy) public override onlySelf { @@ -132,11 +132,11 @@ contract KintoWallet is Initializable, BaseAccount, TokenCallbackHandler, IKinto } /** - * @dev Changed the signers + * @dev Change signers and policy (if new) * @param newSigners new signers array */ function resetSigners(address[] calldata newSigners, uint8 policy) external override onlySelf { - require(newSigners[0] == owners[0], "KW-rs: first signer must same unless recovery"); + require(newSigners[0] == owners[0], "KW-rs: first signer must be the same unless recovery"); _resetSigners(newSigners, policy); } @@ -220,7 +220,7 @@ contract KintoWallet is Initializable, BaseAccount, TokenCallbackHandler, IKinto } /** - * @dev Allos the wallet to transact with a specific app + * @dev Allows the wallet to transact with a specific app * @param apps apps array * @param flags whether to allow or disallow the app */ diff --git a/test/ETHPriceIsRight.t.sol b/test/ETHPriceIsRight.t.sol index 4f1d3e9cc..5fc6597ad 100644 --- a/test/ETHPriceIsRight.t.sol +++ b/test/ETHPriceIsRight.t.sol @@ -63,9 +63,11 @@ contract ETHPriceIsRightTest is Test { assertEq(_priceIsRight.avgGuess(), 3000 ether); } - function testFailCannotEnterGuessAfterTime() public { + function test_RevertWhen_CannotEnterGuessAfterTime() public { vm.startPrank(_user); vm.warp(_priceIsRight.END_ENTER_TIMESTAMP() + 1); + + vm.expectRevert("You cannot enter guesses anymore"); _priceIsRight.enterGuess(2000 ether); vm.stopPrank(); } diff --git a/test/SponsorPaymaster.t.sol b/test/SponsorPaymaster.t.sol index 67b1e4462..b68e6ff8e 100644 --- a/test/SponsorPaymaster.t.sol +++ b/test/SponsorPaymaster.t.sol @@ -74,7 +74,7 @@ contract SponsorPaymasterTest is KYCSignature { vm.stopPrank(); } - function testFailOthersCannotUpgrade() public { + function test_RevertWhen_OthersCannotUpgrade() public { SponsorPaymasterV2 _implementationV2 = new SponsorPaymasterV2(_entryPoint, _owner); _paymaster.upgradeTo(address(_implementationV2)); // re-wrap the _proxy @@ -108,7 +108,7 @@ contract SponsorPaymasterTest is KYCSignature { vm.stopPrank(); } - function testFailUserCanDepositStakeAndWithdrawWithoutRoll() public { + function test_RevertWhen_UserCanDepositStakeAndWithdrawWithoutRoll() public { vm.startPrank(_user); uint256 balance = address(_user).balance; _paymaster.addDepositFor{value: 5e18}(address(_user)); @@ -131,7 +131,7 @@ contract SponsorPaymasterTest is KYCSignature { vm.stopPrank(); } - function testFailUserCanWithdrawAllInEmergency() public { + function test_RevertWhen_UserCanWithdrawAllInEmergency() public { vm.startPrank(_owner); _paymaster.addDepositFor{value: 5e18}(address(_owner)); vm.startPrank(_user);