Commit 60a7c69b authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #8076 from ethereum-optimism/ctb/forge-std-bump

contracts-bedrock: bump `forge-std`
parents 5b67802e 51763f49
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# `SystemConfig` Invariants # `SystemConfig` Invariants
## The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound. ## The gas limit of the `SystemConfig` contract can never be lower than the hard-coded lower bound.
**Test:** [`SystemConfig.t.sol#L80`](../test/invariants/SystemConfig.t.sol#L80) **Test:** [`SystemConfig.t.sol#L70`](../test/invariants/SystemConfig.t.sol#L70)
Subproject commit e8a047e3f40f13fa37af6fe14e6e06283d9a060e Subproject commit 37a37ab73364d6644bfe11edf88a07880f99bd56
...@@ -284,7 +284,7 @@ abstract contract Deployer is Script { ...@@ -284,7 +284,7 @@ abstract contract Deployer is Script {
} }
/// @notice Returns the contract name from a deploy transaction. /// @notice Returns the contract name from a deploy transaction.
function _getContractNameFromDeployTransaction(string memory _deployTx) internal returns (string memory) { function _getContractNameFromDeployTransaction(string memory _deployTx) internal pure returns (string memory) {
return stdJson.readString(_deployTx, ".contractName"); return stdJson.readString(_deployTx, ".contractName");
} }
......
...@@ -13,7 +13,7 @@ contract SafeCall_Test is Test { ...@@ -13,7 +13,7 @@ contract SafeCall_Test is Test {
vm.assume(from.balance == 0); vm.assume(from.balance == 0);
vm.assume(to.balance == 0); vm.assume(to.balance == 0);
// no precompiles (mainnet) // no precompiles (mainnet)
assumeNoPrecompiles(to, 1); assumeNotPrecompile(to);
// don't call the vm // don't call the vm
vm.assume(to != address(vm)); vm.assume(to != address(vm));
vm.assume(from != address(vm)); vm.assume(from != address(vm));
...@@ -47,7 +47,7 @@ contract SafeCall_Test is Test { ...@@ -47,7 +47,7 @@ contract SafeCall_Test is Test {
vm.assume(from.balance == 0); vm.assume(from.balance == 0);
vm.assume(to.balance == 0); vm.assume(to.balance == 0);
// no precompiles (mainnet) // no precompiles (mainnet)
assumeNoPrecompiles(to, 1); assumeNotPrecompile(to);
// don't call the vm // don't call the vm
vm.assume(to != address(vm)); vm.assume(to != address(vm));
vm.assume(from != address(vm)); vm.assume(from != address(vm));
...@@ -89,7 +89,7 @@ contract SafeCall_Test is Test { ...@@ -89,7 +89,7 @@ contract SafeCall_Test is Test {
vm.assume(from.balance == 0); vm.assume(from.balance == 0);
vm.assume(to.balance == 0); vm.assume(to.balance == 0);
// no precompiles (mainnet) // no precompiles (mainnet)
assumeNoPrecompiles(to, 1); assumeNotPrecompile(to);
// don't call the vm // don't call the vm
vm.assume(to != address(vm)); vm.assume(to != address(vm));
vm.assume(from != address(vm)); vm.assume(from != address(vm));
......
...@@ -8,11 +8,6 @@ import { ResourceMetering } from "src/L1/ResourceMetering.sol"; ...@@ -8,11 +8,6 @@ import { ResourceMetering } from "src/L1/ResourceMetering.sol";
import { Constants } from "src/libraries/Constants.sol"; import { Constants } from "src/libraries/Constants.sol";
contract SystemConfig_GasLimitLowerBound_Invariant is Test { contract SystemConfig_GasLimitLowerBound_Invariant is Test {
struct FuzzInterface {
address target;
string[] artifacts;
}
SystemConfig public config; SystemConfig public config;
function setUp() external { function setUp() external {
...@@ -59,19 +54,14 @@ contract SystemConfig_GasLimitLowerBound_Invariant is Test { ...@@ -59,19 +54,14 @@ contract SystemConfig_GasLimitLowerBound_Invariant is Test {
selectors[0] = config.setGasLimit.selector; selectors[0] = config.setGasLimit.selector;
FuzzSelector memory selector = FuzzSelector({ addr: address(config), selectors: selectors }); FuzzSelector memory selector = FuzzSelector({ addr: address(config), selectors: selectors });
targetSelector(selector); targetSelector(selector);
}
/// @dev Allows the SystemConfig contract to be the target of the invariant test
/// when it is behind a proxy. Foundry calls this function under the hood to
/// know the ABI to use when calling the target contract.
function targetInterfaces() public view returns (FuzzInterface[] memory) {
require(address(config) != address(0), "SystemConfig not initialized");
FuzzInterface[] memory targets = new FuzzInterface[](1); /// Allows the SystemConfig contract to be the target of the invariant test
/// when it is behind a proxy. Foundry calls this function under the hood to
/// know the ABI to use when calling the target contract.
string[] memory artifacts = new string[](1); string[] memory artifacts = new string[](1);
artifacts[0] = "SystemConfig"; artifacts[0] = "SystemConfig";
targets[0] = FuzzInterface(address(config), artifacts); FuzzInterface memory target = FuzzInterface(address(config), artifacts);
return targets; targetInterface(target);
} }
/// @custom:invariant The gas limit of the `SystemConfig` contract can never be lower /// @custom:invariant The gas limit of the `SystemConfig` contract can never be lower
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment