From 8013499269683e1741bc08f2bfabd5960f4776bd Mon Sep 17 00:00:00 2001 From: Matt Solomon Date: Fri, 9 Aug 2024 11:00:31 -0700 Subject: [PATCH 1/6] add additional address to exclude --- packages/contracts-bedrock/test/libraries/SafeCall.t.sol | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/contracts-bedrock/test/libraries/SafeCall.t.sol b/packages/contracts-bedrock/test/libraries/SafeCall.t.sol index 5bd3fb3a4ab7..bf2acd6949b7 100644 --- a/packages/contracts-bedrock/test/libraries/SafeCall.t.sol +++ b/packages/contracts-bedrock/test/libraries/SafeCall.t.sol @@ -13,6 +13,7 @@ contract SafeCall_Test is Test { function assumeNot(address _addr) internal { vm.assume(_addr.balance == 0); vm.assume(_addr != address(this)); + vm.assume(_addr != 0x5F65cD7D792E9746EF82929D60de9a1C526f93A5); // Identified as ForgeArtifacts in traces vm.assume(uint256(uint160(_addr)) > uint256(256)); // TODO temp fix until new forge-std release with modern // precompiles: https://github.com/foundry-rs/forge-std/pull/594 assumeAddressIsNot(_addr, StdCheatsSafe.AddressType.ForgeAddress, StdCheatsSafe.AddressType.Precompile); From e587e02436a39af7601bef85ee19d4fb24720adf Mon Sep 17 00:00:00 2001 From: Matt Solomon Date: Fri, 9 Aug 2024 11:32:07 -0700 Subject: [PATCH 2/6] chore: make public library methods internal --- packages/contracts-bedrock/scripts/ForgeArtifacts.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contracts-bedrock/scripts/ForgeArtifacts.sol b/packages/contracts-bedrock/scripts/ForgeArtifacts.sol index 6731e9729a63..9886f9cd9bc0 100644 --- a/packages/contracts-bedrock/scripts/ForgeArtifacts.sol +++ b/packages/contracts-bedrock/scripts/ForgeArtifacts.sol @@ -54,7 +54,7 @@ library ForgeArtifacts { } /// @notice Returns the storage layout for a deployed contract. - function getStorageLayout(string memory _name) public returns (string memory layout_) { + function getStorageLayout(string memory _name) internal returns (string memory layout_) { string[] memory cmd = new string[](3); cmd[0] = Executables.bash; cmd[1] = "-c"; @@ -64,7 +64,7 @@ library ForgeArtifacts { } /// @notice Returns the abi from a the forge artifact - function getAbi(string memory _name) public returns (string memory abi_) { + function getAbi(string memory _name) internal returns (string memory abi_) { string[] memory cmd = new string[](3); cmd[0] = Executables.bash; cmd[1] = "-c"; From d1c5323d95fa9e15e3183919574bdfb63c37e645 Mon Sep 17 00:00:00 2001 From: Matt Solomon Date: Fri, 9 Aug 2024 11:42:42 -0700 Subject: [PATCH 3/6] remove another public lib method --- packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol b/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol index 1c5a505095a6..795ebd202736 100644 --- a/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol +++ b/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol @@ -54,7 +54,7 @@ struct SafeInstance { library Sort { /// @dev Sorts an array of addresses in place - function sort(address[] memory arr) public pure returns (address[] memory) { + function sort(address[] memory arr) internal pure returns (address[] memory) { LibSort.sort(arr); return arr; } From f5ff125325e34ab82910eb2f0e18773a9f4c0166 Mon Sep 17 00:00:00 2001 From: Matt Solomon Date: Fri, 9 Aug 2024 11:42:42 -0700 Subject: [PATCH 4/6] remove additional public lib methods --- .../contracts-bedrock/src/cannon/libraries/MIPSSyscalls.sol | 2 +- packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/contracts-bedrock/src/cannon/libraries/MIPSSyscalls.sol b/packages/contracts-bedrock/src/cannon/libraries/MIPSSyscalls.sol index da15b3499586..1017f07f688d 100644 --- a/packages/contracts-bedrock/src/cannon/libraries/MIPSSyscalls.sol +++ b/packages/contracts-bedrock/src/cannon/libraries/MIPSSyscalls.sol @@ -99,7 +99,7 @@ library MIPSSyscalls { uint32 internal constant SCHED_QUANTUM = 100_000; /// @notice Start of the data segment. - uint32 public constant BRK_START = 0x40000000; + uint32 internal constant BRK_START = 0x40000000; // SYS_CLONE flags uint32 internal constant CLONE_VM = 0x100; diff --git a/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol b/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol index 795ebd202736..95780a5ed6de 100644 --- a/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol +++ b/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol @@ -62,9 +62,9 @@ library Sort { library SafeTestLib { /// @dev The address of foundry's VM contract - address constant VM_ADDR = 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D; + address constant internal VM_ADDR = 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D; /// @dev The address of the first owner in the linked list of owners - address constant SENTINEL_OWNERS = address(0x1); + address constant internal SENTINEL_OWNERS = address(0x1); /// @dev Get the address from a private key function getAddr(uint256 pk) internal pure returns (address) { From 9bcfd78a8672c8373b1c50d1c25614b4a18612d7 Mon Sep 17 00:00:00 2001 From: Matt Solomon Date: Fri, 9 Aug 2024 11:51:17 -0700 Subject: [PATCH 5/6] remove hardcoded assumption now that we know it's lib linking --- packages/contracts-bedrock/test/libraries/SafeCall.t.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/contracts-bedrock/test/libraries/SafeCall.t.sol b/packages/contracts-bedrock/test/libraries/SafeCall.t.sol index bf2acd6949b7..5bd3fb3a4ab7 100644 --- a/packages/contracts-bedrock/test/libraries/SafeCall.t.sol +++ b/packages/contracts-bedrock/test/libraries/SafeCall.t.sol @@ -13,7 +13,6 @@ contract SafeCall_Test is Test { function assumeNot(address _addr) internal { vm.assume(_addr.balance == 0); vm.assume(_addr != address(this)); - vm.assume(_addr != 0x5F65cD7D792E9746EF82929D60de9a1C526f93A5); // Identified as ForgeArtifacts in traces vm.assume(uint256(uint160(_addr)) > uint256(256)); // TODO temp fix until new forge-std release with modern // precompiles: https://github.com/foundry-rs/forge-std/pull/594 assumeAddressIsNot(_addr, StdCheatsSafe.AddressType.ForgeAddress, StdCheatsSafe.AddressType.Precompile); From 4bb5781da1f861456885d7370d87dfef5b59b101 Mon Sep 17 00:00:00 2001 From: Matt Solomon Date: Fri, 9 Aug 2024 12:15:59 -0700 Subject: [PATCH 6/6] style: forge fmt --- packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol b/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol index 95780a5ed6de..34386f5e3923 100644 --- a/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol +++ b/packages/contracts-bedrock/test/safe-tools/SafeTestTools.sol @@ -62,9 +62,9 @@ library Sort { library SafeTestLib { /// @dev The address of foundry's VM contract - address constant internal VM_ADDR = 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D; + address internal constant VM_ADDR = 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D; /// @dev The address of the first owner in the linked list of owners - address constant internal SENTINEL_OWNERS = address(0x1); + address internal constant SENTINEL_OWNERS = address(0x1); /// @dev Get the address from a private key function getAddr(uint256 pk) internal pure returns (address) {