From 8f88a4c8f01fd843de7e56637a6bcbc10272bd7b Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Wed, 13 Nov 2024 12:29:22 +0100 Subject: [PATCH] fix naming of tests --- contracts/gas-snapshots/shared.gas-snapshot | 31 ++++++------------- .../BurnMintERC20/BurnMintERC20.approve.t.sol | 4 +-- .../BurnMintERC20/BurnMintERC20.burn.t.sol | 8 ++--- .../BurnMintERC20.burnFrom.t.sol | 8 ++--- .../BurnMintERC20.burnFromAlias.t.sol | 8 ++--- .../BurnMintERC20.ccipGetAdmin.t.sol | 4 +-- .../BurnMintERC20.constructor.t.sol | 2 +- .../BurnMintERC20.grantMintAndBurnRoles.t.sol | 2 +- .../BurnMintERC20.supportsInterface.t.sol | 2 +- .../BurnMintERC20.transfer.t.sol | 4 +-- 10 files changed, 31 insertions(+), 42 deletions(-) diff --git a/contracts/gas-snapshots/shared.gas-snapshot b/contracts/gas-snapshots/shared.gas-snapshot index 53fa23695e1..b11d0da6636 100644 --- a/contracts/gas-snapshots/shared.gas-snapshot +++ b/contracts/gas-snapshots/shared.gas-snapshot @@ -7,28 +7,17 @@ AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 3 AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64413) AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64390) AuthorizedCallers_constructor:test_constructor_Success() (gas: 674931) -BurnMintERC20approve:test_approve_InvalidAddress_Reverts() (gas: 11280) -BurnMintERC20approve:test_approve_Success() (gas: 57653) -BurnMintERC20burn:test_BasicBurn_Success() (gas: 153605) -BurnMintERC20burn:test_burn_BurnFromZeroAddress_Reverts() (gas: 43836) -BurnMintERC20burn:test_burn_ExceedsBalance_Reverts() (gas: 21892) -BurnMintERC20burn:test_burn_SenderNotBurner_Reverts() (gas: 68104) -BurnMintERC20burnFrom:test_BurnFrom_Success() (gas: 58012) -BurnMintERC20burnFrom:test_burnFrom_ExceedsBalance_Reverts() (gas: 35864) -BurnMintERC20burnFrom:test_burnFrom_InsufficientAllowance_Reverts() (gas: 21858) -BurnMintERC20burnFrom:test_burnFrom_SenderNotBurner_Reverts() (gas: 68126) -BurnMintERC20burnFromAlias:test_burn_ExceedsBalance_Reverts() (gas: 35905) -BurnMintERC20burnFromAlias:test_burn_InsufficientAllowance_Reverts() (gas: 21889) -BurnMintERC20burnFromAlias:test_burn_SenderNotBurner_Reverts() (gas: 68157) -BurnMintERC20burnFromAlias:test_burn_Success() (gas: 58004) -BurnMintERC20constructor:test_Constructor_Success() (gas: 1694875) -BurnMintERC20getCCIPAdmin:test_getCCIPAdmin_Success() (gas: 10525) -BurnMintERC20getCCIPAdmin:test_setCCIPAdmin_Success() (gas: 21612) -BurnMintERC20grantMintAndBurnRoles:test_GrantMintAndBurnRoles_Success() (gas: 79120) +BurnMintERC20approve:test_approve() (gas: 57652) +BurnMintERC20burn:test_BasicBurn() (gas: 153607) +BurnMintERC20burnFrom:test_BurnFrom() (gas: 57995) +BurnMintERC20burnFromAlias:test_burn() (gas: 58039) +BurnMintERC20constructor:test_Constructor() (gas: 1694831) +BurnMintERC20getCCIPAdmin:test_getCCIPAdmin() (gas: 10548) +BurnMintERC20getCCIPAdmin:test_setCCIPAdmin() (gas: 21590) +BurnMintERC20grantMintAndBurnRoles:test_GrantMintAndBurnRoles() (gas: 79142) BurnMintERC20mint:test_mint() (gas: 101849) -BurnMintERC20supportsInterface:test_SupportsInterface_Success() (gas: 11217) -BurnMintERC20transfer:test_transfer_InvalidAddress_Reverts() (gas: 11301) -BurnMintERC20transfer:test_transfer_Success() (gas: 42316) +BurnMintERC20supportsInterface:test_SupportsInterface() (gas: 11218) +BurnMintERC20transfer:test_transfer() (gas: 42338) BurnMintERC677_approve:testApproveSuccess() (gas: 55512) BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10663) BurnMintERC677_burn:testBasicBurnSuccess() (gas: 172100) diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.approve.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.approve.t.sol index b5ff3c2184f..c11d7fb3c1c 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.approve.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.approve.t.sol @@ -5,7 +5,7 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol"; contract BurnMintERC20approve is BurnMintERC20Setup { - function test_approve_Success() public { + function test_approve() public { uint256 balancePre = s_burnMintERC20.balanceOf(STRANGER); uint256 sendingAmount = s_amount / 2; @@ -23,7 +23,7 @@ contract BurnMintERC20approve is BurnMintERC20Setup { // Reverts - function test_approve_InvalidAddress_Reverts() public { + function test_approve_RevertWhen_InvalidAddress() public { vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.InvalidRecipient.selector, address(s_burnMintERC20))); s_burnMintERC20.approve(address(s_burnMintERC20), s_amount); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol index dc60ce468ee..e42a57e6933 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol @@ -8,7 +8,7 @@ import {IERC20} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contrac import {Strings} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Strings.sol"; contract BurnMintERC20burn is BurnMintERC20Setup { - function test_BasicBurn_Success() public { + function test_BasicBurn() public { s_burnMintERC20.grantRole(s_burnMintERC20.BURNER_ROLE(), OWNER); deal(address(s_burnMintERC20), OWNER, s_amount); @@ -22,7 +22,7 @@ contract BurnMintERC20burn is BurnMintERC20Setup { // Revert - function test_burn_SenderNotBurner_Reverts() public { + function test_burn_RevertWhen_SenderNotBurner() public { // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful // and should be checked vm.expectRevert( @@ -37,7 +37,7 @@ contract BurnMintERC20burn is BurnMintERC20Setup { s_burnMintERC20.burnFrom(STRANGER, s_amount); } - function test_burn_ExceedsBalance_Reverts() public { + function test_burn_RevertWhen_ExceedsBalance() public { changePrank(s_mockPool); vm.expectRevert("ERC20: burn amount exceeds balance"); @@ -45,7 +45,7 @@ contract BurnMintERC20burn is BurnMintERC20Setup { s_burnMintERC20.burn(s_amount * 2); } - function test_burn_BurnFromZeroAddress_Reverts() public { + function test_burn_RevertWhen_BurnFromZeroAddress() public { s_burnMintERC20.grantRole(s_burnMintERC20.BURNER_ROLE(), address(0)); changePrank(address(0)); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol index afd5c432824..5212b926bbc 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol @@ -11,7 +11,7 @@ contract BurnMintERC20burnFrom is BurnMintERC20Setup { BurnMintERC20Setup.setUp(); } - function test_BurnFrom_Success() public { + function test_BurnFrom() public { s_burnMintERC20.approve(s_mockPool, s_amount); changePrank(s_mockPool); @@ -23,7 +23,7 @@ contract BurnMintERC20burnFrom is BurnMintERC20Setup { // Reverts - function test_burnFrom_SenderNotBurner_Reverts() public { + function test_burnFrom_RevertWhen_SenderNotBurner() public { // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful // and should be checked vm.expectRevert( @@ -38,7 +38,7 @@ contract BurnMintERC20burnFrom is BurnMintERC20Setup { s_burnMintERC20.burnFrom(OWNER, s_amount); } - function test_burnFrom_InsufficientAllowance_Reverts() public { + function test_burnFrom_RevertWhen_InsufficientAllowance() public { changePrank(s_mockPool); vm.expectRevert("ERC20: insufficient allowance"); @@ -46,7 +46,7 @@ contract BurnMintERC20burnFrom is BurnMintERC20Setup { s_burnMintERC20.burnFrom(OWNER, s_amount); } - function test_burnFrom_ExceedsBalance_Reverts() public { + function test_burnFrom_RevertWhen_ExceedsBalance() public { s_burnMintERC20.approve(s_mockPool, s_amount * 2); changePrank(s_mockPool); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol index d413e0c5ad8..4204f928cba 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol @@ -11,7 +11,7 @@ contract BurnMintERC20burnFromAlias is BurnMintERC20Setup { BurnMintERC20Setup.setUp(); } - function test_burn_Success() public { + function test_burn() public { s_burnMintERC20.approve(s_mockPool, s_amount); changePrank(s_mockPool); @@ -23,7 +23,7 @@ contract BurnMintERC20burnFromAlias is BurnMintERC20Setup { // Reverts - function test_burn_SenderNotBurner_Reverts() public { + function test_burn_RevertWhen_SenderNotBurner() public { // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful // and should be checked vm.expectRevert( @@ -38,7 +38,7 @@ contract BurnMintERC20burnFromAlias is BurnMintERC20Setup { s_burnMintERC20.burn(OWNER, s_amount); } - function test_burn_InsufficientAllowance_Reverts() public { + function test_burn_RevertWhen_InsufficientAllowance() public { changePrank(s_mockPool); vm.expectRevert("ERC20: insufficient allowance"); @@ -46,7 +46,7 @@ contract BurnMintERC20burnFromAlias is BurnMintERC20Setup { s_burnMintERC20.burn(OWNER, s_amount); } - function test_burn_ExceedsBalance_Reverts() public { + function test_burn_RevertWhen_ExceedsBalance() public { s_burnMintERC20.approve(s_mockPool, s_amount * 2); changePrank(s_mockPool); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.ccipGetAdmin.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.ccipGetAdmin.t.sol index 682670d5e69..302a5511007 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.ccipGetAdmin.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.ccipGetAdmin.t.sol @@ -5,11 +5,11 @@ import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol"; import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; contract BurnMintERC20getCCIPAdmin is BurnMintERC20Setup { - function test_getCCIPAdmin_Success() public view { + function test_getCCIPAdmin() public view { assertEq(OWNER, s_burnMintERC20.getCCIPAdmin()); } - function test_setCCIPAdmin_Success() public { + function test_setCCIPAdmin() public { address newAdmin = makeAddr("newAdmin"); vm.expectEmit(); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol index 4dc81317d77..1650de3e7f5 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol @@ -5,7 +5,7 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol"; contract BurnMintERC20constructor is BurnMintERC20Setup { - function test_Constructor_Success() public { + function test_Constructor() public { vm.startPrank(s_alice); string memory name = "Chainlink token v2"; diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.grantMintAndBurnRoles.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.grantMintAndBurnRoles.t.sol index 24f6f24254d..d8911d16607 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.grantMintAndBurnRoles.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.grantMintAndBurnRoles.t.sol @@ -7,7 +7,7 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {IAccessControl} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/access/IAccessControl.sol"; contract BurnMintERC20grantMintAndBurnRoles is BurnMintERC20Setup { - function test_GrantMintAndBurnRoles_Success() public { + function test_GrantMintAndBurnRoles() public { assertFalse(s_burnMintERC20.hasRole(s_burnMintERC20.MINTER_ROLE(), STRANGER)); assertFalse(s_burnMintERC20.hasRole(s_burnMintERC20.BURNER_ROLE(), STRANGER)); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.supportsInterface.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.supportsInterface.t.sol index d164d2108a5..dbff542d58a 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.supportsInterface.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.supportsInterface.t.sol @@ -9,7 +9,7 @@ import {IERC20} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contrac import {IERC165} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/introspection/IERC165.sol"; contract BurnMintERC20supportsInterface is BurnMintERC20Setup { - function test_SupportsInterface_Success() public view { + function test_SupportsInterface() public view { assertTrue(s_burnMintERC20.supportsInterface(type(IERC20).interfaceId)); assertTrue(s_burnMintERC20.supportsInterface(type(IBurnMintERC20).interfaceId)); assertTrue(s_burnMintERC20.supportsInterface(type(IERC165).interfaceId)); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.transfer.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.transfer.t.sol index ebaca4c18fc..0eb0b989125 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.transfer.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.transfer.t.sol @@ -5,7 +5,7 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol"; contract BurnMintERC20transfer is BurnMintERC20Setup { - function test_transfer_Success() public { + function test_transfer() public { uint256 balancePre = s_burnMintERC20.balanceOf(STRANGER); uint256 sendingAmount = s_amount / 2; @@ -16,7 +16,7 @@ contract BurnMintERC20transfer is BurnMintERC20Setup { // Reverts - function test_transfer_InvalidAddress_Reverts() public { + function test_transfer_RevertWhen_InvalidAddress() public { vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.InvalidRecipient.selector, address(s_burnMintERC20))); s_burnMintERC20.transfer(address(s_burnMintERC20), s_amount);