From 3e6dd51ba567db3b971a5f651bf1912137bb0680 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Mon, 30 Jan 2023 14:36:00 -0500 Subject: [PATCH] maint(ctb): clean up various test files Cleans up various test files and updates them to the new format. --- packages/contracts-bedrock/.gas-snapshot | 182 +++++++++--------- .../contracts/test/MerkleTrie.t.sol | 2 +- .../contracts/test/MintManager.t.sol | 38 +++- .../contracts/test/RLPReader.t.sol | 8 +- .../contracts/test/RLPWriter.t.sol | 6 +- .../contracts/test/SafeCall.t.sol | 4 +- 6 files changed, 141 insertions(+), 99 deletions(-) diff --git a/packages/contracts-bedrock/.gas-snapshot b/packages/contracts-bedrock/.gas-snapshot index 5f542e814..c304d5b15 100644 --- a/packages/contracts-bedrock/.gas-snapshot +++ b/packages/contracts-bedrock/.gas-snapshot @@ -189,36 +189,36 @@ LegacyERC20ETH_Test:test_mint_doesNotExist_reverts() (gas: 10649) LegacyERC20ETH_Test:test_transferFrom_doesNotExist_reverts() (gas: 12890) LegacyERC20ETH_Test:test_transfer_doesNotExist_reverts() (gas: 10733) LegacyMessagePasser_Test:test_passMessageToL1_succeeds() (gas: 34518) -MerkleTrie_Test:test_get_corruptedProof_reverts() (gas: 5713) -MerkleTrie_Test:test_get_extraProofElements_reverts() (gas: 60653) -MerkleTrie_Test:test_get_invalidDataRemainder_reverts() (gas: 35852) -MerkleTrie_Test:test_get_invalidInternalNodeHash_reverts() (gas: 50810) -MerkleTrie_Test:test_get_nonexistentKey1_reverts() (gas: 59671) -MerkleTrie_Test:test_get_nonexistentKey2_reverts() (gas: 23385) -MerkleTrie_Test:test_get_smallerPathThanKey1_reverts() (gas: 53547) -MerkleTrie_Test:test_get_smallerPathThanKey2_reverts() (gas: 55006) -MerkleTrie_Test:test_get_validProof10_succeeds() (gas: 50593) -MerkleTrie_Test:test_get_validProof1_succeeds() (gas: 61666) -MerkleTrie_Test:test_get_validProof2_succeeds() (gas: 71601) -MerkleTrie_Test:test_get_validProof3_succeeds() (gas: 32827) -MerkleTrie_Test:test_get_validProof4_succeeds() (gas: 23623) -MerkleTrie_Test:test_get_validProof5_succeeds() (gas: 84262) -MerkleTrie_Test:test_get_validProof6_succeeds() (gas: 72998) -MerkleTrie_Test:test_get_validProof7_succeeds() (gas: 79653) -MerkleTrie_Test:test_get_validProof8_succeeds() (gas: 50550) -MerkleTrie_Test:test_get_validProof9_succeeds() (gas: 50593) -MerkleTrie_Test:test_get_wrongKeyProof_reverts() (gas: 53848) -MerkleTrie_Test:test_get_zeroBranchValueLength_reverts() (gas: 43270) -MerkleTrie_Test:test_get_zeroLengthKey_reverts() (gas: 3632) -MintManager_Test:test_constructor_succeeds() (gas: 10535) -MintManager_Test:test_mint_afterPeriodElapsed_succeeds() (gas: 148117) -MintManager_Test:test_mint_beforePeriodElapsed_reverts() (gas: 140455) -MintManager_Test:test_mint_fromNotOwner_reverts() (gas: 10987) -MintManager_Test:test_mint_fromOwner_succeeds() (gas: 137241) -MintManager_Test:test_mint_moreThanCap_reverts() (gas: 142523) -MintManager_Test:test_upgrade_fromNotOwner_reverts() (gas: 10974) -MintManager_Test:test_upgrade_fromOwner_succeeds() (gas: 23463) -MintManager_Test:test_upgrade_toZeroAddress_reverts() (gas: 11003) +MerkleTrie_get_Test:test_get_corruptedProof_reverts() (gas: 5713) +MerkleTrie_get_Test:test_get_extraProofElements_reverts() (gas: 60653) +MerkleTrie_get_Test:test_get_invalidDataRemainder_reverts() (gas: 35852) +MerkleTrie_get_Test:test_get_invalidInternalNodeHash_reverts() (gas: 50810) +MerkleTrie_get_Test:test_get_nonexistentKey1_reverts() (gas: 59671) +MerkleTrie_get_Test:test_get_nonexistentKey2_reverts() (gas: 23385) +MerkleTrie_get_Test:test_get_smallerPathThanKey1_reverts() (gas: 53547) +MerkleTrie_get_Test:test_get_smallerPathThanKey2_reverts() (gas: 55006) +MerkleTrie_get_Test:test_get_validProof10_succeeds() (gas: 50593) +MerkleTrie_get_Test:test_get_validProof1_succeeds() (gas: 61666) +MerkleTrie_get_Test:test_get_validProof2_succeeds() (gas: 71601) +MerkleTrie_get_Test:test_get_validProof3_succeeds() (gas: 32827) +MerkleTrie_get_Test:test_get_validProof4_succeeds() (gas: 23623) +MerkleTrie_get_Test:test_get_validProof5_succeeds() (gas: 84262) +MerkleTrie_get_Test:test_get_validProof6_succeeds() (gas: 72998) +MerkleTrie_get_Test:test_get_validProof7_succeeds() (gas: 79653) +MerkleTrie_get_Test:test_get_validProof8_succeeds() (gas: 50550) +MerkleTrie_get_Test:test_get_validProof9_succeeds() (gas: 50593) +MerkleTrie_get_Test:test_get_wrongKeyProof_reverts() (gas: 53848) +MerkleTrie_get_Test:test_get_zeroBranchValueLength_reverts() (gas: 43270) +MerkleTrie_get_Test:test_get_zeroLengthKey_reverts() (gas: 3632) +MintManager_constructor_Test:test_constructor_succeeds() (gas: 10512) +MintManager_mint_Test:test_mint_afterPeriodElapsed_succeeds() (gas: 148139) +MintManager_mint_Test:test_mint_beforePeriodElapsed_reverts() (gas: 140433) +MintManager_mint_Test:test_mint_fromNotOwner_reverts() (gas: 10943) +MintManager_mint_Test:test_mint_fromOwner_succeeds() (gas: 137219) +MintManager_mint_Test:test_mint_moreThanCap_reverts() (gas: 142478) +MintManager_upgrade_Test:test_upgrade_fromNotOwner_reverts() (gas: 10929) +MintManager_upgrade_Test:test_upgrade_fromOwner_succeeds() (gas: 23411) +MintManager_upgrade_Test:test_upgrade_toZeroAddress_reverts() (gas: 10958) OptimismMintableERC20_Test:test_bridge_succeeds() (gas: 7643) OptimismMintableERC20_Test:test_burn_notBridge_reverts() (gas: 11165) OptimismMintableERC20_Test:test_burn_succeeds() (gas: 51013) @@ -310,67 +310,67 @@ ProxyAdmin_Test:test_setAddressManager_notOwner_reverts() (gas: 10600) ProxyAdmin_Test:test_setImplementationName_notOwner_reverts() (gas: 11156) ProxyAdmin_Test:test_setImplementationName_succeeds() (gas: 38945) ProxyAdmin_Test:test_setProxyType_notOwner_reverts() (gas: 10814) -RLPReader_Test:test_readBytes_bytestring00_succeeds() (gas: 1857) -RLPReader_Test:test_readBytes_bytestring01_succeeds() (gas: 1900) -RLPReader_Test:test_readBytes_bytestring7f_succeeds() (gas: 1898) -RLPReader_Test:test_readBytes_invalidListLength_reverts() (gas: 3925) -RLPReader_Test:test_readBytes_invalidPrefix_reverts() (gas: 3983) -RLPReader_Test:test_readBytes_invalidRemainder_reverts() (gas: 4177) -RLPReader_Test:test_readBytes_invalidStringLength_reverts() (gas: 3880) -RLPReader_Test:test_readBytes_revertListItem_reverts() (gas: 4043) -RLPReader_Test:test_readList_dictTest1_succeeds() (gas: 23202) -RLPReader_Test:test_readList_empty_succeeds() (gas: 4613) -RLPReader_Test:test_readList_incorrectLengthInArray_reverts() (gas: 3954) -RLPReader_Test:test_readList_int32Overflow2_reverts() (gas: 4117) -RLPReader_Test:test_readList_int32Overflow_reverts() (gas: 4116) -RLPReader_Test:test_readList_invalidRemainder_reverts() (gas: 4158) -RLPReader_Test:test_readList_invalidShortList_reverts() (gas: 3967) -RLPReader_Test:test_readList_invalidValue_reverts() (gas: 3879) -RLPReader_Test:test_readList_leadingZerosInLongLengthArray1_reverts() (gas: 3982) -RLPReader_Test:test_readList_leadingZerosInLongLengthArray2_reverts() (gas: 3968) -RLPReader_Test:test_readList_leadingZerosInLongLengthList1_reverts() (gas: 4007) -RLPReader_Test:test_readList_listLongerThan32Elements_reverts() (gas: 38571) -RLPReader_Test:test_readList_listOfLists2_succeeds() (gas: 12169) -RLPReader_Test:test_readList_listOfLists_succeeds() (gas: 9482) -RLPReader_Test:test_readList_longList1_succeeds() (gas: 28417) -RLPReader_Test:test_readList_longList2_succeeds() (gas: 196855) -RLPReader_Test:test_readList_longListLessThan56Bytes_reverts() (gas: 4046) -RLPReader_Test:test_readList_longStringLength_reverts() (gas: 3924) -RLPReader_Test:test_readList_longStringLessThan56Bytes_reverts() (gas: 3998) -RLPReader_Test:test_readList_multiList_succeeds() (gas: 11784) -RLPReader_Test:test_readList_nonOptimalLongLengthArray1_reverts() (gas: 3999) -RLPReader_Test:test_readList_nonOptimalLongLengthArray2_reverts() (gas: 4000) -RLPReader_Test:test_readList_notEnoughContentForList1_reverts() (gas: 4138) -RLPReader_Test:test_readList_notEnoughContentForList2_reverts() (gas: 4139) -RLPReader_Test:test_readList_notEnoughContentForString1_reverts() (gas: 4094) -RLPReader_Test:test_readList_notEnoughContentForString2_reverts() (gas: 4138) -RLPReader_Test:test_readList_notLongEnough_reverts() (gas: 3933) -RLPReader_Test:test_readList_shortListMax1_succeeds() (gas: 39747) -RLPWriter_Test:test_writeList_dictTest1_succeeds() (gas: 37112) -RLPWriter_Test:test_writeList_empty_succeeds() (gas: 1743) -RLPWriter_Test:test_writeList_listoflists2_succeeds() (gas: 16656) -RLPWriter_Test:test_writeList_listoflists_succeeds() (gas: 10857) -RLPWriter_Test:test_writeList_longlist1_succeeds() (gas: 40467) -RLPWriter_Test:test_writeList_longlist2_succeeds() (gas: 281281) -RLPWriter_Test:test_writeList_multiList_succeeds() (gas: 22566) -RLPWriter_Test:test_writeList_shortListMax1_succeeds() (gas: 36918) -RLPWriter_Test:test_writeList_stringList_succeeds() (gas: 10742) -RLPWriter_Test:test_writeString_bytestring00_succeeds() (gas: 977) -RLPWriter_Test:test_writeString_bytestring01_succeeds() (gas: 998) -RLPWriter_Test:test_writeString_bytestring7f_succeeds() (gas: 1019) -RLPWriter_Test:test_writeString_empty_succeeds() (gas: 1644) -RLPWriter_Test:test_writeString_longstring2_succeeds() (gas: 258779) -RLPWriter_Test:test_writeString_longstring_succeeds() (gas: 16994) -RLPWriter_Test:test_writeString_shortstring2_succeeds() (gas: 15409) -RLPWriter_Test:test_writeString_shortstring_succeeds() (gas: 2480) -RLPWriter_Test:test_writeUint_mediumint2_succeeds() (gas: 8702) -RLPWriter_Test:test_writeUint_mediumint3_succeeds() (gas: 9123) -RLPWriter_Test:test_writeUint_mediumint_succeeds() (gas: 8405) -RLPWriter_Test:test_writeUint_smallint2_succeeds() (gas: 7290) -RLPWriter_Test:test_writeUint_smallint3_succeeds() (gas: 7311) -RLPWriter_Test:test_writeUint_smallint4_succeeds() (gas: 7312) -RLPWriter_Test:test_writeUint_smallint_succeeds() (gas: 7290) -RLPWriter_Test:test_writeUint_zero_succeeds() (gas: 7802) +RLPReader_readBytes_Test:test_readBytes_bytestring00_succeeds() (gas: 1834) +RLPReader_readBytes_Test:test_readBytes_bytestring01_succeeds() (gas: 1833) +RLPReader_readBytes_Test:test_readBytes_bytestring7f_succeeds() (gas: 1854) +RLPReader_readBytes_Test:test_readBytes_invalidListLength_reverts() (gas: 3924) +RLPReader_readBytes_Test:test_readBytes_invalidPrefix_reverts() (gas: 3939) +RLPReader_readBytes_Test:test_readBytes_invalidRemainder_reverts() (gas: 4133) +RLPReader_readBytes_Test:test_readBytes_invalidStringLength_reverts() (gas: 3857) +RLPReader_readBytes_Test:test_readBytes_revertListItem_reverts() (gas: 3976) +RLPReader_readList_Test:test_readList_dictTest1_succeeds() (gas: 23179) +RLPReader_readList_Test:test_readList_empty_succeeds() (gas: 4612) +RLPReader_readList_Test:test_readList_incorrectLengthInArray_reverts() (gas: 3976) +RLPReader_readList_Test:test_readList_int32Overflow2_reverts() (gas: 4094) +RLPReader_readList_Test:test_readList_int32Overflow_reverts() (gas: 4094) +RLPReader_readList_Test:test_readList_invalidRemainder_reverts() (gas: 4158) +RLPReader_readList_Test:test_readList_invalidShortList_reverts() (gas: 3967) +RLPReader_readList_Test:test_readList_invalidValue_reverts() (gas: 3878) +RLPReader_readList_Test:test_readList_leadingZerosInLongLengthArray1_reverts() (gas: 3982) +RLPReader_readList_Test:test_readList_leadingZerosInLongLengthArray2_reverts() (gas: 3945) +RLPReader_readList_Test:test_readList_leadingZerosInLongLengthList1_reverts() (gas: 3984) +RLPReader_readList_Test:test_readList_listLongerThan32Elements_reverts() (gas: 38571) +RLPReader_readList_Test:test_readList_listOfLists2_succeeds() (gas: 12124) +RLPReader_readList_Test:test_readList_listOfLists_succeeds() (gas: 9504) +RLPReader_readList_Test:test_readList_longList1_succeeds() (gas: 28372) +RLPReader_readList_Test:test_readList_longList2_succeeds() (gas: 196855) +RLPReader_readList_Test:test_readList_longListLessThan56Bytes_reverts() (gas: 4023) +RLPReader_readList_Test:test_readList_longStringLength_reverts() (gas: 3901) +RLPReader_readList_Test:test_readList_longStringLessThan56Bytes_reverts() (gas: 4009) +RLPReader_readList_Test:test_readList_multiList_succeeds() (gas: 11719) +RLPReader_readList_Test:test_readList_nonOptimalLongLengthArray1_reverts() (gas: 3999) +RLPReader_readList_Test:test_readList_nonOptimalLongLengthArray2_reverts() (gas: 4022) +RLPReader_readList_Test:test_readList_notEnoughContentForList1_reverts() (gas: 4115) +RLPReader_readList_Test:test_readList_notEnoughContentForList2_reverts() (gas: 4161) +RLPReader_readList_Test:test_readList_notEnoughContentForString1_reverts() (gas: 4072) +RLPReader_readList_Test:test_readList_notEnoughContentForString2_reverts() (gas: 4116) +RLPReader_readList_Test:test_readList_notLongEnough_reverts() (gas: 3955) +RLPReader_readList_Test:test_readList_shortListMax1_succeeds() (gas: 39724) +RLPWriter_writeList_Test:test_writeList_dictTest1_succeeds() (gas: 37112) +RLPWriter_writeList_Test:test_writeList_empty_succeeds() (gas: 1676) +RLPWriter_writeList_Test:test_writeList_listoflists2_succeeds() (gas: 16633) +RLPWriter_writeList_Test:test_writeList_listoflists_succeeds() (gas: 10879) +RLPWriter_writeList_Test:test_writeList_longlist1_succeeds() (gas: 40467) +RLPWriter_writeList_Test:test_writeList_longlist2_succeeds() (gas: 281258) +RLPWriter_writeList_Test:test_writeList_multiList_succeeds() (gas: 22546) +RLPWriter_writeList_Test:test_writeList_shortListMax1_succeeds() (gas: 36896) +RLPWriter_writeList_Test:test_writeList_stringList_succeeds() (gas: 10720) +RLPWriter_writeString_Test:test_writeString_bytestring00_succeeds() (gas: 954) +RLPWriter_writeString_Test:test_writeString_bytestring01_succeeds() (gas: 975) +RLPWriter_writeString_Test:test_writeString_bytestring7f_succeeds() (gas: 953) +RLPWriter_writeString_Test:test_writeString_empty_succeeds() (gas: 1621) +RLPWriter_writeString_Test:test_writeString_longstring2_succeeds() (gas: 258734) +RLPWriter_writeString_Test:test_writeString_longstring_succeeds() (gas: 16950) +RLPWriter_writeString_Test:test_writeString_shortstring2_succeeds() (gas: 15364) +RLPWriter_writeString_Test:test_writeString_shortstring_succeeds() (gas: 2502) +RLPWriter_writeUint_Test:test_writeUint_mediumint2_succeeds() (gas: 8714) +RLPWriter_writeUint_Test:test_writeUint_mediumint3_succeeds() (gas: 9091) +RLPWriter_writeUint_Test:test_writeUint_mediumint_succeeds() (gas: 8372) +RLPWriter_writeUint_Test:test_writeUint_smallint2_succeeds() (gas: 7279) +RLPWriter_writeUint_Test:test_writeUint_smallint3_succeeds() (gas: 7256) +RLPWriter_writeUint_Test:test_writeUint_smallint4_succeeds() (gas: 7280) +RLPWriter_writeUint_Test:test_writeUint_smallint_succeeds() (gas: 7258) +RLPWriter_writeUint_Test:test_writeUint_zero_succeeds() (gas: 7726) ResourceMetering_Test:test_meter_initialResourceParams_succeeds() (gas: 8983) ResourceMetering_Test:test_meter_updateNoGasDelta_succeeds() (gas: 2008119) ResourceMetering_Test:test_meter_updateOneEmptyBlock_succeeds() (gas: 18148) diff --git a/packages/contracts-bedrock/contracts/test/MerkleTrie.t.sol b/packages/contracts-bedrock/contracts/test/MerkleTrie.t.sol index cb2eb1bc7..f80c7c5d2 100644 --- a/packages/contracts-bedrock/contracts/test/MerkleTrie.t.sol +++ b/packages/contracts-bedrock/contracts/test/MerkleTrie.t.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.15; import { CommonTest } from "./CommonTest.t.sol"; import { MerkleTrie } from "../libraries/trie/MerkleTrie.sol"; -contract MerkleTrie_Test is CommonTest { +contract MerkleTrie_get_Test is CommonTest { function setUp() public { _setUp(); } diff --git a/packages/contracts-bedrock/contracts/test/MintManager.t.sol b/packages/contracts-bedrock/contracts/test/MintManager.t.sol index 8f1c39deb..19aafb309 100644 --- a/packages/contracts-bedrock/contracts/test/MintManager.t.sol +++ b/packages/contracts-bedrock/contracts/test/MintManager.t.sol @@ -5,7 +5,7 @@ import { CommonTest } from "./CommonTest.t.sol"; import { MintManager } from "../governance/MintManager.sol"; import { GovernanceToken } from "../governance/GovernanceToken.sol"; -contract MintManager_Test is CommonTest { +contract MintManager_Initializer is CommonTest { address constant owner = address(0x1234); address constant rando = address(0x5678); GovernanceToken internal gov; @@ -21,12 +21,22 @@ contract MintManager_Test is CommonTest { vm.prank(owner); gov.transferOwnership(address(manager)); } +} +contract MintManager_constructor_Test is MintManager_Initializer { + /** + * @notice Tests that the constructor properly configures the contract. + */ function test_constructor_succeeds() external { assertEq(manager.owner(), owner); assertEq(address(manager.governanceToken()), address(gov)); } +} +contract MintManager_mint_Test is MintManager_Initializer { + /** + * @notice Tests that the mint function properly mints tokens when called by the owner. + */ function test_mint_fromOwner_succeeds() external { // Mint once. vm.prank(owner); @@ -36,6 +46,9 @@ contract MintManager_Test is CommonTest { assertEq(gov.balanceOf(owner), 100); } + /** + * @notice Tests that the mint function reverts when called by a non-owner. + */ function test_mint_fromNotOwner_reverts() external { // Mint from rando fails. vm.prank(rando); @@ -43,6 +56,10 @@ contract MintManager_Test is CommonTest { manager.mint(owner, 100); } + /** + * @notice Tests that the mint function properly mints tokens when called by the owner a second + * time after the mint period has elapsed. + */ function test_mint_afterPeriodElapsed_succeeds() external { // Mint once. vm.prank(owner); @@ -60,6 +77,10 @@ contract MintManager_Test is CommonTest { assertEq(gov.balanceOf(owner), 102); } + /** + * @notice Tests that the mint function always reverts when called before the mint period has + * elapsed, even if the caller is the owner. + */ function test_mint_beforePeriodElapsed_reverts() external { // Mint once. vm.prank(owner); @@ -77,6 +98,9 @@ contract MintManager_Test is CommonTest { assertEq(gov.balanceOf(owner), 100); } + /** + * @notice Tests that the owner cannot mint more than the mint cap. + */ function test_mint_moreThanCap_reverts() external { // Mint once. vm.prank(owner); @@ -94,7 +118,12 @@ contract MintManager_Test is CommonTest { // Token balance does not increase. assertEq(gov.balanceOf(owner), 100); } +} +contract MintManager_upgrade_Test is MintManager_Initializer { + /** + * @notice Tests that the owner can upgrade the mint manager. + */ function test_upgrade_fromOwner_succeeds() external { // Upgrade to new manager. vm.prank(owner); @@ -104,6 +133,9 @@ contract MintManager_Test is CommonTest { assertEq(gov.owner(), rando); } + /** + * @notice Tests that the upgrade function reverts when called by a non-owner. + */ function test_upgrade_fromNotOwner_reverts() external { // Upgrade from rando fails. vm.prank(rando); @@ -111,6 +143,10 @@ contract MintManager_Test is CommonTest { manager.upgrade(rando); } + /** + * @notice Tests that the upgrade function reverts when attempting to update to the zero + * address, even if the caller is the owner. + */ function test_upgrade_toZeroAddress_reverts() external { // Upgrade to zero address fails. vm.prank(owner); diff --git a/packages/contracts-bedrock/contracts/test/RLPReader.t.sol b/packages/contracts-bedrock/contracts/test/RLPReader.t.sol index 358703eb9..c304495fe 100644 --- a/packages/contracts-bedrock/contracts/test/RLPReader.t.sol +++ b/packages/contracts-bedrock/contracts/test/RLPReader.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.15; -import { RLPReader } from "../libraries/rlp/RLPReader.sol"; -import { CommonTest } from "./CommonTest.t.sol"; import { stdError } from "forge-std/Test.sol"; +import { CommonTest } from "./CommonTest.t.sol"; +import { RLPReader } from "../libraries/rlp/RLPReader.sol"; -contract RLPReader_Test is CommonTest { +contract RLPReader_readBytes_Test is CommonTest { function test_readBytes_bytestring00_succeeds() external { assertEq(RLPReader.readBytes(hex"00"), hex"00"); } @@ -48,7 +48,9 @@ contract RLPReader_Test is CommonTest { ); RLPReader.readBytes(hex"810a"); } +} +contract RLPReader_readList_Test is CommonTest { function test_readList_empty_succeeds() external { RLPReader.RLPItem[] memory list = RLPReader.readList(hex"c0"); assertEq(list.length, 0); diff --git a/packages/contracts-bedrock/contracts/test/RLPWriter.t.sol b/packages/contracts-bedrock/contracts/test/RLPWriter.t.sol index b441c5bf1..7c59819d3 100644 --- a/packages/contracts-bedrock/contracts/test/RLPWriter.t.sol +++ b/packages/contracts-bedrock/contracts/test/RLPWriter.t.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.15; import { RLPWriter } from "../libraries/rlp/RLPWriter.sol"; import { CommonTest } from "./CommonTest.t.sol"; -contract RLPWriter_Test is CommonTest { +contract RLPWriter_writeString_Test is CommonTest { function test_writeString_empty_succeeds() external { assertEq(RLPWriter.writeString(""), hex"80"); } @@ -47,7 +47,9 @@ contract RLPWriter_Test is CommonTest { hex"b904004c6f72656d20697073756d20646f6c6f722073697420616d65742c20636f6e73656374657475722061646970697363696e6720656c69742e20437572616269747572206d6175726973206d61676e612c20737573636970697420736564207665686963756c61206e6f6e2c20696163756c697320666175636962757320746f72746f722e2050726f696e20737573636970697420756c74726963696573206d616c6573756164612e204475697320746f72746f7220656c69742c2064696374756d2071756973207472697374697175652065752c20756c7472696365732061742072697375732e204d6f72626920612065737420696d70657264696574206d6920756c6c616d636f7270657220616c6971756574207375736369706974206e6563206c6f72656d2e2041656e65616e2071756973206c656f206d6f6c6c69732c2076756c70757461746520656c6974207661726975732c20636f6e73657175617420656e696d2e204e756c6c6120756c74726963657320747572706973206a7573746f2c20657420706f73756572652075726e6120636f6e7365637465747572206e65632e2050726f696e206e6f6e20636f6e76616c6c6973206d657475732e20446f6e65632074656d706f7220697073756d20696e206d617572697320636f6e67756520736f6c6c696369747564696e2e20566573746962756c756d20616e746520697073756d207072696d697320696e206661756369627573206f726369206c756374757320657420756c74726963657320706f737565726520637562696c69612043757261653b2053757370656e646973736520636f6e76616c6c69732073656d2076656c206d617373612066617563696275732c2065676574206c6163696e6961206c616375732074656d706f722e204e756c6c61207175697320756c747269636965732070757275732e2050726f696e20617563746f722072686f6e637573206e69626820636f6e64696d656e74756d206d6f6c6c69732e20416c697175616d20636f6e73657175617420656e696d206174206d65747573206c75637475732c206120656c656966656e6420707572757320656765737461732e20437572616269747572206174206e696268206d657475732e204e616d20626962656e64756d2c206e6571756520617420617563746f72207472697374697175652c206c6f72656d206c696265726f20616c697175657420617263752c206e6f6e20696e74657264756d2074656c6c7573206c65637475732073697420616d65742065726f732e20437261732072686f6e6375732c206d65747573206163206f726e617265206375727375732c20646f6c6f72206a7573746f20756c747269636573206d657475732c20617420756c6c616d636f7270657220766f6c7574706174" ); } +} +contract RLPWriter_writeUint_Test is CommonTest { function test_writeUint_zero_succeeds() external { assertEq(RLPWriter.writeUint(0x0), hex"80"); } @@ -79,7 +81,9 @@ contract RLPWriter_Test is CommonTest { function test_writeUint_mediumint3_succeeds() external { assertEq(RLPWriter.writeUint(100000), hex"830186a0"); } +} +contract RLPWriter_writeList_Test is CommonTest { function test_writeList_empty_succeeds() external { assertEq(RLPWriter.writeList(new bytes[](0)), hex"c0"); } diff --git a/packages/contracts-bedrock/contracts/test/SafeCall.t.sol b/packages/contracts-bedrock/contracts/test/SafeCall.t.sol index 04954f229..292a92836 100644 --- a/packages/contracts-bedrock/contracts/test/SafeCall.t.sol +++ b/packages/contracts-bedrock/contracts/test/SafeCall.t.sol @@ -4,8 +4,8 @@ pragma solidity 0.8.15; import { CommonTest } from "./CommonTest.t.sol"; import { SafeCall } from "../libraries/SafeCall.sol"; -contract SafeCall_Test is CommonTest { - function testFuzz_safeCall_succeeds( +contract SafeCall_call_Test is CommonTest { + function testFuzz_call_succeeds( address from, address to, uint256 gas,