Commit f28d13bb authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: more cleanup

parent 50131bc1
......@@ -8,6 +8,7 @@ import (
"testing"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
......@@ -105,6 +106,24 @@ func TestBuildL1DeveloperGenesis(t *testing.T) {
cfg, err := sysCfg.ResourceConfig(&bind.CallOpts{})
require.NoError(t, err)
require.Equal(t, cfg, defaultResourceConfig)
owner, err = sysCfg.Owner(&bind.CallOpts{})
require.NoError(t, err)
require.Equal(t, owner, config.FinalSystemOwner)
overhead, err := sysCfg.Overhead(&bind.CallOpts{})
require.NoError(t, err)
require.Equal(t, overhead.Uint64(), config.GasPriceOracleOverhead)
scalar, err := sysCfg.Scalar(&bind.CallOpts{})
require.NoError(t, err)
require.Equal(t, scalar.Uint64(), config.GasPriceOracleScalar)
batcherHash, err := sysCfg.BatcherHash(&bind.CallOpts{})
require.NoError(t, err)
require.Equal(t, common.Hash(batcherHash), config.BatchSenderAddress.Hash())
gasLimit, err := sysCfg.GasLimit(&bind.CallOpts{})
require.NoError(t, err)
require.Equal(t, gasLimit, uint64(config.L2GenesisBlockGasLimit))
unsafeBlockSigner, err := sysCfg.UnsafeBlockSigner(&bind.CallOpts{})
require.NoError(t, err)
require.Equal(t, unsafeBlockSigner, config.P2PSequencerAddress)
// test that we can do deposits, etc.
priv, err := crypto.HexToECDSA("ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80")
......
......@@ -207,7 +207,8 @@ contract OptimismPortal is Initializable, ResourceMetering, Semver {
}
/**
* @notice
* @notice Getter for the resource config. Used internally by the ResourceMetering
* contract. The SystemConfig is the source of truth for the resource config.
*/
function _resourceConfig() internal view override returns (SystemConfig.ResourceConfig memory) {
return SYSTEM_CONFIG.resourceConfig();
......
......@@ -135,7 +135,8 @@ abstract contract ResourceMetering is Initializable {
}
/**
* @notice
* @notice Virtual function that returns the resource config. Contracts that inherit this
* contract must implement this function.
*/
function _resourceConfig() internal virtual returns (SystemConfig.ResourceConfig memory);
......
......@@ -136,7 +136,15 @@ contract SystemConfig is OwnableUpgradeable, Semver {
address _unsafeBlockSigner,
ResourceConfig memory _config
) Semver(1, 1, 0) {
initialize(_owner, _overhead, _scalar, _batcherHash, _gasLimit, _unsafeBlockSigner, _config);
initialize({
_owner: _owner,
_overhead: _overhead,
_scalar: _scalar,
_batcherHash: _batcherHash,
_gasLimit: _gasLimit,
_unsafeBlockSigner: _unsafeBlockSigner,
_config: _config
});
}
/**
......
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