Commit 3233c1cb authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: utilize constants

parent 501068fd
...@@ -17,6 +17,7 @@ import { OptimismMintableERC20Factory } from "../universal/OptimismMintableERC20 ...@@ -17,6 +17,7 @@ import { OptimismMintableERC20Factory } from "../universal/OptimismMintableERC20
import { PortalSender } from "./PortalSender.sol"; import { PortalSender } from "./PortalSender.sol";
import { SystemConfig } from "../L1/SystemConfig.sol"; import { SystemConfig } from "../L1/SystemConfig.sol";
import { ResourceMetering } from "../L1/ResourceMetering.sol"; import { ResourceMetering } from "../L1/ResourceMetering.sol";
import { Constants } from "../libraries/Constants.sol";
/** /**
* @title SystemDictator * @title SystemDictator
...@@ -162,14 +163,7 @@ contract SystemDictator is OwnableUpgradeable { ...@@ -162,14 +163,7 @@ contract SystemDictator is OwnableUpgradeable {
* initialized upon deployment. * initialized upon deployment.
*/ */
constructor() { constructor() {
ResourceMetering.ResourceConfig memory rcfg = ResourceMetering.ResourceConfig({ ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
maxResourceLimit: 20_000_000,
elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8,
minimumBaseFee: 1 gwei,
systemTxMaxGas: 1_000_000,
maximumBaseFee: type(uint128).max
});
// Using this shorter variable as an alias for address(0) just prevents us from having to // Using this shorter variable as an alias for address(0) just prevents us from having to
// to use a new line for every single parameter. // to use a new line for every single parameter.
......
...@@ -5,20 +5,14 @@ import { L2OutputOracle } from "../L1/L2OutputOracle.sol"; ...@@ -5,20 +5,14 @@ import { L2OutputOracle } from "../L1/L2OutputOracle.sol";
import { AddressAliasHelper } from "../vendor/AddressAliasHelper.sol"; import { AddressAliasHelper } from "../vendor/AddressAliasHelper.sol";
import { SystemConfig } from "../L1/SystemConfig.sol"; import { SystemConfig } from "../L1/SystemConfig.sol";
import { ResourceMetering } from "../L1/ResourceMetering.sol"; import { ResourceMetering } from "../L1/ResourceMetering.sol";
import { Constants } from "../libraries/Constants.sol";
contract EchidnaFuzzOptimismPortal { contract EchidnaFuzzOptimismPortal {
OptimismPortal internal portal; OptimismPortal internal portal;
bool internal failedToComplete; bool internal failedToComplete;
constructor() { constructor() {
ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({ ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
maxResourceLimit: 20_000_000,
elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8,
minimumBaseFee: 1 gwei,
systemTxMaxGas: 1_000_000,
maximumBaseFee: type(uint128).max
});
SystemConfig systemConfig = new SystemConfig({ SystemConfig systemConfig = new SystemConfig({
_owner: address(1), _owner: address(1),
...@@ -27,7 +21,7 @@ contract EchidnaFuzzOptimismPortal { ...@@ -27,7 +21,7 @@ contract EchidnaFuzzOptimismPortal {
_batcherHash: bytes32(0), _batcherHash: bytes32(0),
_gasLimit: 30_000_000, _gasLimit: 30_000_000,
_unsafeBlockSigner: address(0), _unsafeBlockSigner: address(0),
_config: config _config: rcfg
}); });
portal = new OptimismPortal({ portal = new OptimismPortal({
......
...@@ -3,6 +3,7 @@ pragma solidity 0.8.15; ...@@ -3,6 +3,7 @@ pragma solidity 0.8.15;
import { ResourceMetering } from "../L1/ResourceMetering.sol"; import { ResourceMetering } from "../L1/ResourceMetering.sol";
import { Arithmetic } from "../libraries/Arithmetic.sol"; import { Arithmetic } from "../libraries/Arithmetic.sol";
import { StdUtils } from "forge-std/Test.sol"; import { StdUtils } from "forge-std/Test.sol";
import { Constants } from "../libraries/Constants.sol";
contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils { contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils {
bool internal failedMaxGasPerBlock; bool internal failedMaxGasPerBlock;
...@@ -29,15 +30,8 @@ contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils { ...@@ -29,15 +30,8 @@ contract EchidnaFuzzResourceMetering is ResourceMetering, StdUtils {
} }
function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) { function _resourceConfig() internal pure override returns (ResourceMetering.ResourceConfig memory) {
ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({ ResourceMetering.ResourceConfig memory rcfg = Constants.DEFAULT_RESOURCE_CONFIG();
maxResourceLimit: 20_000_000, return rcfg;
elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8,
minimumBaseFee: 1 gwei,
systemTxMaxGas: 1_000_000,
maximumBaseFee: type(uint128).max
});
return config;
} }
/** /**
......
...@@ -30,6 +30,7 @@ import { Strings } from "@openzeppelin/contracts/utils/Strings.sol"; ...@@ -30,6 +30,7 @@ import { Strings } from "@openzeppelin/contracts/utils/Strings.sol";
import { LegacyMintableERC20 } from "../legacy/LegacyMintableERC20.sol"; import { LegacyMintableERC20 } from "../legacy/LegacyMintableERC20.sol";
import { SystemConfig } from "../L1/SystemConfig.sol"; import { SystemConfig } from "../L1/SystemConfig.sol";
import { ResourceMetering } from "../L1/ResourceMetering.sol"; import { ResourceMetering } from "../L1/ResourceMetering.sol";
import { Constants } from "../libraries/Constants.sol";
contract CommonTest is Test { contract CommonTest is Test {
address alice = address(128); address alice = address(128);
...@@ -172,14 +173,7 @@ contract Portal_Initializer is L2OutputOracle_Initializer { ...@@ -172,14 +173,7 @@ contract Portal_Initializer is L2OutputOracle_Initializer {
function setUp() public virtual override { function setUp() public virtual override {
super.setUp(); super.setUp();
ResourceMetering.ResourceConfig memory config = ResourceMetering.ResourceConfig({ ResourceMetering.ResourceConfig memory config = Constants.DEFAULT_RESOURCE_CONFIG();
maxResourceLimit: 20_000_000,
elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8,
minimumBaseFee: 1 gwei,
systemTxMaxGas: 1_000_000,
maximumBaseFee: type(uint128).max
});
systemConfig = new SystemConfig({ systemConfig = new SystemConfig({
_owner: address(1), _owner: address(1),
......
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