Commit 44e22e52 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub

Merge branch 'develop' into ajsutton/validate-chainid

parents 3a2c63fa ad2d6aa2
......@@ -178,4 +178,4 @@ require (
lukechampine.com/blake3 v1.1.7 // indirect
)
replace github.com/ethereum/go-ethereum v1.10.26 => github.com/ethereum-optimism/op-geth v0.0.0-20221216190603-60b51d600468
replace github.com/ethereum/go-ethereum v1.10.26 => github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b
......@@ -203,8 +203,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z8veEq5ZO3DfIhZ7xgRP9WTc=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/op-geth v0.0.0-20221216190603-60b51d600468 h1:7KgjBYDji5AKi42eRYI+n8Gs+ZJVilSASL3WBu82c3M=
github.com/ethereum-optimism/op-geth v0.0.0-20221216190603-60b51d600468/go.mod h1:p0Yox74PhYlq1HvijrCBCD9A3cI7rXco7hT6KrQr+rY=
github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b h1:qpsJ9tFppQOwO0rHrggOrSXW5XIx4G3DBEV6jrf9gU0=
github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b/go.mod h1:p0Yox74PhYlq1HvijrCBCD9A3cI7rXco7hT6KrQr+rY=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fjl/memsize v0.0.1 h1:+zhkb+dhUgx0/e+M8sF0QqiouvMQUiKR+QYvdxIOKcQ=
github.com/fjl/memsize v0.0.1/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
......
......@@ -2,7 +2,7 @@ module github.com/ethereum-optimism/optimism/indexer
go 1.17
replace github.com/ethereum/go-ethereum v1.10.26 => github.com/ethereum-optimism/op-geth v0.0.0-20221216190603-60b51d600468
replace github.com/ethereum/go-ethereum v1.10.26 => github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b
require (
github.com/ethereum-optimism/optimism/op-bindings v0.10.14
......
......@@ -266,8 +266,8 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3 h1:RWHKLhCrQThMfch+QJ1Z8veEq5ZO3DfIhZ7xgRP9WTc=
github.com/ethereum-optimism/go-ethereum-hdwallet v0.1.3/go.mod h1:QziizLAiF0KqyLdNJYD7O5cpDlaFMNZzlxYNcWsJUxs=
github.com/ethereum-optimism/op-geth v0.0.0-20221216190603-60b51d600468 h1:7KgjBYDji5AKi42eRYI+n8Gs+ZJVilSASL3WBu82c3M=
github.com/ethereum-optimism/op-geth v0.0.0-20221216190603-60b51d600468/go.mod h1:p0Yox74PhYlq1HvijrCBCD9A3cI7rXco7hT6KrQr+rY=
github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b h1:qpsJ9tFppQOwO0rHrggOrSXW5XIx4G3DBEV6jrf9gU0=
github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b/go.mod h1:p0Yox74PhYlq1HvijrCBCD9A3cI7rXco7hT6KrQr+rY=
github.com/ethereum-optimism/optimism/op-batcher v0.10.14 h1:4C8hR2ut4kfzY9Lk7IZ8Utyw3P5rgiSabfech57nHP8=
github.com/ethereum-optimism/optimism/op-batcher v0.10.14/go.mod h1:j+uvhHcyqifm+IjpIKMSrdGRVyjjdmtLnYazZGt+ti4=
github.com/ethereum-optimism/optimism/op-bindings v0.10.1/go.mod h1:UeTZlpZyhOL3y9Sogzvbn8Z3q1tDmZEv1VmGxMiZYCg=
......
This diff is collapsed.
......@@ -22,7 +22,10 @@ import (
"github.com/ethereum-optimism/optimism/op-node/rollup"
)
var ErrInvalidDeployConfig = errors.New("invalid deploy config")
var (
ErrInvalidDeployConfig = errors.New("invalid deploy config")
ErrInvalidImmutablesConfig = errors.New("invalid immutables config")
)
// DeployConfig represents the deployment configuration for Optimism
type DeployConfig struct {
......@@ -344,12 +347,27 @@ func NewDeployConfigWithNetwork(network, path string) (*DeployConfig, error) {
}
// NewL2ImmutableConfig will create an ImmutableConfig given an instance of a
// Hardhat and a DeployConfig.
// DeployConfig and a block.
func NewL2ImmutableConfig(config *DeployConfig, block *types.Block) (immutables.ImmutableConfig, error) {
immutable := make(immutables.ImmutableConfig)
if config.L1StandardBridgeProxy == (common.Address{}) {
return immutable, fmt.Errorf("L1StandardBridgeProxy cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
if config.L1CrossDomainMessengerProxy == (common.Address{}) {
return immutable, fmt.Errorf("L1CrossDomainMessengerProxy cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
if config.L1ERC721BridgeProxy == (common.Address{}) {
return immutable, errors.New("L1ERC721BridgeProxy cannot be address(0)")
return immutable, fmt.Errorf("L1ERC721BridgeProxy cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
if config.SequencerFeeVaultRecipient == (common.Address{}) {
return immutable, fmt.Errorf("SequencerFeeVaultRecipient cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
if config.BaseFeeVaultRecipient == (common.Address{}) {
return immutable, fmt.Errorf("BaseFeeVaultRecipient cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
if config.L1FeeVaultRecipient == (common.Address{}) {
return immutable, fmt.Errorf("L1FeeVaultRecipient cannot be address(0): %w", ErrInvalidImmutablesConfig)
}
immutable["L2StandardBridge"] = immutables.ImmutableValues{
......
......@@ -23,6 +23,8 @@
"l1FeeVaultRecipient": "0x71bE63f3384f5fb98995898A86B02Fb2426c5788",
"sequencerFeeVaultRecipient": "0x71bE63f3384f5fb98995898A86B02Fb2426c5788",
"l1ERC721BridgeProxy": "0xff000000000000000000000000000000000000ff",
"l1StandardBridgeProxy": "0xff000000000000000000000000000000000000fd",
"l1CrossDomainMessengerProxy": "0xff000000000000000000000000000000000000dd",
"deploymentWaitConfirmations": 1,
"fundDevAccounts": true
......
package immutables
import (
"errors"
"fmt"
"math/big"
......@@ -24,6 +25,39 @@ type ImmutableValues map[string]any
// contracts.
type ImmutableConfig map[string]ImmutableValues
// Check does a sanity check that the specific values that
// Optimism uses are set inside of the ImmutableConfig.
func (i ImmutableConfig) Check() error {
if _, ok := i["L2CrossDomainMessenger"]["otherMessenger"]; !ok {
return errors.New("L2CrossDomainMessenger otherMessenger not set")
}
if _, ok := i["L2StandardBridge"]["otherBridge"]; !ok {
return errors.New("L2StandardBridge otherBridge not set")
}
if _, ok := i["L2ERC721Bridge"]["messenger"]; !ok {
return errors.New("L2ERC721Bridge messenger not set")
}
if _, ok := i["L2ERC721Bridge"]["otherBridge"]; !ok {
return errors.New("L2ERC721Bridge otherBridge not set")
}
if _, ok := i["OptimismMintableERC721Factory"]["bridge"]; !ok {
return errors.New("OptimismMintableERC20Factory bridge not set")
}
if _, ok := i["OptimismMintableERC721Factory"]["remoteChainId"]; !ok {
return errors.New("OptimismMintableERC20Factory remoteChainId not set")
}
if _, ok := i["SequencerFeeVault"]["recipient"]; !ok {
return errors.New("SequencerFeeVault recipient not set")
}
if _, ok := i["L1FeeVault"]["recipient"]; !ok {
return errors.New("L1FeeVault recipient not set")
}
if _, ok := i["BaseFeeVault"]["recipient"]; !ok {
return errors.New("BaseFeeVault recipient not set")
}
return nil
}
// DeploymentResults represents the output of deploying each of the
// contracts so that the immutables can be set properly in the bytecode.
type DeploymentResults map[string]hexutil.Bytes
......@@ -31,6 +65,10 @@ type DeploymentResults map[string]hexutil.Bytes
// BuildOptimism will deploy the L2 predeploys so that their immutables are set
// correctly.
func BuildOptimism(immutable ImmutableConfig) (DeploymentResults, error) {
if err := immutable.Check(); err != nil {
return DeploymentResults{}, err
}
deployments := []deployer.Constructor{
{
Name: "GasPriceOracle",
......
......@@ -19,9 +19,11 @@ func TestBuildOptimism(t *testing.T) {
},
"L2ERC721Bridge": {
"otherBridge": common.HexToAddress("0x1234567890123456789012345678901234567890"),
"messenger": common.HexToAddress("0x1234567890123456789012345678901234567890"),
},
"OptimismMintableERC721Factory": {
"remoteChainId": big.NewInt(1),
"bridge": common.HexToAddress("0x1234567890123456789012345678901234567890"),
},
"SequencerFeeVault": {
"recipient": common.HexToAddress("0x1234567890123456789012345678901234567890"),
......
......@@ -102,6 +102,10 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
GasPriceOracleScalar: 1000_000,
DeploymentWaitConfirmations: 1,
SequencerFeeVaultRecipient: common.Address{19: 1},
BaseFeeVaultRecipient: common.Address{19: 2},
L1FeeVaultRecipient: common.Address{19: 3},
EIP1559Elasticity: 10,
EIP1559Denominator: 50,
......
......@@ -92,6 +92,10 @@ func DefaultSystemConfig(t *testing.T) SystemConfig {
GasPriceOracleOverhead: 2100,
GasPriceOracleScalar: 1_000_000,
SequencerFeeVaultRecipient: common.Address{19: 1},
BaseFeeVaultRecipient: common.Address{19: 2},
L1FeeVaultRecipient: common.Address{19: 3},
DeploymentWaitConfirmations: 1,
EIP1559Elasticity: 2,
......
......@@ -20,6 +20,7 @@ type BlockInfo interface {
MixDigest() common.Hash
BaseFee() *big.Int
ReceiptHash() common.Hash
GasUsed() uint64
}
func InfoToL1BlockRef(info BlockInfo) L1BlockRef {
......@@ -79,6 +80,10 @@ func (h headerBlockInfo) ReceiptHash() common.Hash {
return h.Header.ReceiptHash
}
func (h headerBlockInfo) GasUsed() uint64 {
return h.Header.GasUsed
}
// HeaderBlockInfo returns h as a BlockInfo implementation.
func HeaderBlockInfo(h *types.Header) BlockInfo {
return headerBlockInfo{h}
......
......@@ -46,6 +46,7 @@ type HeaderInfo struct {
baseFee *big.Int
txHash common.Hash
receiptHash common.Hash
gasUsed uint64
}
var _ eth.BlockInfo = (*HeaderInfo)(nil)
......@@ -90,6 +91,10 @@ func (info *HeaderInfo) ReceiptHash() common.Hash {
return info.receiptHash
}
func (info *HeaderInfo) GasUsed() uint64 {
return info.gasUsed
}
type rpcHeader struct {
ParentHash common.Hash `json:"parentHash"`
UncleHash common.Hash `json:"sha3Uncles"`
......@@ -182,6 +187,7 @@ func (hdr *rpcHeader) Info(trustCache bool, mustBePostMerge bool) (*HeaderInfo,
baseFee: (*big.Int)(hdr.BaseFee),
txHash: hdr.TxHash,
receiptHash: hdr.ReceiptHash,
gasUsed: uint64(hdr.GasUsed),
}
return &info, nil
}
......
......@@ -21,6 +21,7 @@ type MockBlockInfo struct {
InfoMixDigest [32]byte
InfoBaseFee *big.Int
InfoReceiptRoot common.Hash
InfoGasUsed uint64
}
func (l *MockBlockInfo) Hash() common.Hash {
......@@ -59,6 +60,10 @@ func (l *MockBlockInfo) ReceiptHash() common.Hash {
return l.InfoReceiptRoot
}
func (l *MockBlockInfo) GasUsed() uint64 {
return l.InfoGasUsed
}
func (l *MockBlockInfo) ID() eth.BlockID {
return eth.BlockID{Hash: l.InfoHash, Number: l.InfoNum}
}
......@@ -81,6 +86,7 @@ func RandomBlockInfo(rng *rand.Rand) *MockBlockInfo {
InfoBaseFee: big.NewInt(rng.Int63n(1000_000 * 1e9)), // a million GWEI
InfoReceiptRoot: types.EmptyRootHash,
InfoRoot: RandomHash(rng),
InfoGasUsed: rng.Uint64(),
}
}
......
......@@ -85,4 +85,4 @@ require (
lukechampine.com/blake3 v1.1.7 // indirect
)
replace github.com/ethereum/go-ethereum v1.10.26 => github.com/ethereum-optimism/op-geth v0.0.0-20221216190603-60b51d600468
replace github.com/ethereum/go-ethereum v1.10.26 => github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b
......@@ -81,8 +81,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum-optimism/op-geth v0.0.0-20221216190603-60b51d600468 h1:7KgjBYDji5AKi42eRYI+n8Gs+ZJVilSASL3WBu82c3M=
github.com/ethereum-optimism/op-geth v0.0.0-20221216190603-60b51d600468/go.mod h1:p0Yox74PhYlq1HvijrCBCD9A3cI7rXco7hT6KrQr+rY=
github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b h1:qpsJ9tFppQOwO0rHrggOrSXW5XIx4G3DBEV6jrf9gU0=
github.com/ethereum-optimism/op-geth v0.0.0-20230214215134-401b7fd3309b/go.mod h1:p0Yox74PhYlq1HvijrCBCD9A3cI7rXco7hT6KrQr+rY=
github.com/ethereum-optimism/optimism/op-node v0.10.3 h1:96KbEtbfJTg5GXtNqLnrDPnXMbeynIy1G8iSc47whrA=
github.com/ethereum-optimism/optimism/op-node v0.10.3/go.mod h1:fsRLXH68xaLhjfr67MPEtjCocCzSXGhZIre536QccIw=
github.com/ethereum-optimism/optimism/op-service v0.10.3 h1:gr+eVq6CzxMFqo0/9n6EoUkpumtYZEzO84gti6ekj/s=
......
#!/usr/bin/env python3
import urllib3
import json
import subprocess
import os
......@@ -11,34 +10,10 @@ GETH_VERSION='v1.10.26'
def main():
for project in ('op-service', 'op-node', 'op-proposer', 'op-batcher', 'op-bindings', 'op-chain-ops', 'op-e2e', 'op-wheel'):
for project in ('.', 'op-wheel', 'indexer'):
print(f'Updating {project}...')
update_mod(project)
# pull the replacer from one of the modules above, since
# go work edit -replace does not resolve the branch name
# into a pseudo-version.
pv = None
with open('./op-service/go.mod') as f:
for line in f:
if line.startswith(f'replace github.com/ethereum/go-ethereum {GETH_VERSION}'):
splits = line.split(' => ')
pv = splits[1].strip()
pv = pv.split(' ')[1]
break
if pv is None:
raise Exception('Pseudo version not found.')
print('Updating go.work...')
subprocess.run([
'go',
'work',
'edit',
'-replace',
f'github.com/ethereum/go-ethereum@{GETH_VERSION}=github.com/ethereum-optimism/op-geth@{pv}'
], cwd=os.path.join(project), check=True)
def update_mod(project):
print('Replacing...')
......
......@@ -139,29 +139,30 @@ L2ERC721Bridge_Test:test_finalizeBridgeERC721_notFromRemoteMessenger_reverts() (
L2ERC721Bridge_Test:test_finalizeBridgeERC721_notViaLocalMessenger_reverts() (gas: 16148)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_selfToken_reverts() (gas: 17637)
L2ERC721Bridge_Test:test_finalizeBridgeERC721_succeeds() (gas: 168905)
L2OutputOracleTest:test_computeL2Timestamp_succeeds() (gas: 37184)
L2OutputOracleTest:test_constructor_badTimestamp_reverts() (gas: 70717)
L2OutputOracleTest:test_constructor_succeeds() (gas: 33760)
L2OutputOracleTest:test_deleteL2Outputs_afterLatest_reverts() (gas: 211900)
L2OutputOracleTest:test_computeL2Timestamp_succeeds() (gas: 37206)
L2OutputOracleTest:test_constructor_badTimestamp_reverts() (gas: 70767)
L2OutputOracleTest:test_constructor_l2BlockTimeZero_reverts() (gas: 45786)
L2OutputOracleTest:test_constructor_succeeds() (gas: 33695)
L2OutputOracleTest:test_deleteL2Outputs_afterLatest_reverts() (gas: 211855)
L2OutputOracleTest:test_deleteL2Outputs_ifNotChallenger_reverts() (gas: 18883)
L2OutputOracleTest:test_deleteL2Outputs_nonExistent_reverts() (gas: 107292)
L2OutputOracleTest:test_deleteOutputs_multipleOutputs_succeeds() (gas: 302121)
L2OutputOracleTest:test_deleteOutputs_singleOutput_succeeds() (gas: 180656)
L2OutputOracleTest:test_getL2OutputIndexAfter_multipleOutputsExist_succeeds() (gas: 267182)
L2OutputOracleTest:test_getL2OutputIndexAfter_noOutputsExis_reverts() (gas: 17914)
L2OutputOracleTest:test_getL2OutputIndexAfter_previousBlock_succeeds() (gas: 96086)
L2OutputOracleTest:test_getL2OutputIndexAfter_sameBlock_succeeds() (gas: 95994)
L2OutputOracleTest:test_getL2Output_succeeds() (gas: 101699)
L2OutputOracleTest:test_latestBlockNumber_succeeds() (gas: 96983)
L2OutputOracleTest:test_nextBlockNumber_succeeds() (gas: 17468)
L2OutputOracleTest:test_proposeL2Output_emptyOutput_reverts() (gas: 26688)
L2OutputOracleTest:test_proposeL2Output_futureTimetamp_reverts() (gas: 28646)
L2OutputOracleTest:test_proposeL2Output_notProposer_reverts() (gas: 25782)
L2OutputOracleTest:test_proposeL2Output_proposeAnotherOutput_succeeds() (gas: 101027)
L2OutputOracleTest:test_deleteOutputs_multipleOutputs_succeeds() (gas: 302143)
L2OutputOracleTest:test_deleteOutputs_singleOutput_succeeds() (gas: 180700)
L2OutputOracleTest:test_getL2OutputIndexAfter_multipleOutputsExist_succeeds() (gas: 267226)
L2OutputOracleTest:test_getL2OutputIndexAfter_noOutputsExis_reverts() (gas: 17936)
L2OutputOracleTest:test_getL2OutputIndexAfter_previousBlock_succeeds() (gas: 96042)
L2OutputOracleTest:test_getL2OutputIndexAfter_sameBlock_succeeds() (gas: 96016)
L2OutputOracleTest:test_getL2Output_succeeds() (gas: 101721)
L2OutputOracleTest:test_latestBlockNumber_succeeds() (gas: 96960)
L2OutputOracleTest:test_nextBlockNumber_succeeds() (gas: 17490)
L2OutputOracleTest:test_proposeL2Output_emptyOutput_reverts() (gas: 26710)
L2OutputOracleTest:test_proposeL2Output_futureTimetamp_reverts() (gas: 28690)
L2OutputOracleTest:test_proposeL2Output_notProposer_reverts() (gas: 25826)
L2OutputOracleTest:test_proposeL2Output_proposeAnotherOutput_succeeds() (gas: 101049)
L2OutputOracleTest:test_proposeL2Output_unexpectedBlockNumber_reverts() (gas: 28402)
L2OutputOracleTest:test_proposeL2Output_unmatchedBlockhash_reverts() (gas: 29446)
L2OutputOracleTest:test_proposeL2Output_unmatchedBlockhash_reverts() (gas: 29402)
L2OutputOracleTest:test_proposeL2Output_wrongFork_reverts() (gas: 29005)
L2OutputOracleTest:test_proposeWithBlockhashAndHeight_succeeds() (gas: 95296)
L2OutputOracleTest:test_proposeWithBlockhashAndHeight_succeeds() (gas: 95318)
L2OutputOracleUpgradeable_Test:test_initValuesOnProxy_succeeds() (gas: 26093)
L2OutputOracleUpgradeable_Test:test_initializeImpl_alreadyInitialized_reverts() (gas: 15149)
L2OutputOracleUpgradeable_Test:test_initializeProxy_alreadyInitialized_reverts() (gas: 20131)
......
......@@ -73,7 +73,7 @@ contract L2OutputOracle is Initializable, Semver {
event OutputsDeleted(uint256 indexed prevNextOutputIndex, uint256 indexed newNextOutputIndex);
/**
* @custom:semver 1.0.0
* @custom:semver 1.1.0
*
* @param _submissionInterval Interval in blocks at which checkpoints must be submitted.
* @param _l2BlockTime The time per L2 block, in seconds.
......@@ -89,7 +89,13 @@ contract L2OutputOracle is Initializable, Semver {
uint256 _startingTimestamp,
address _proposer,
address _challenger
) Semver(1, 0, 0) {
) Semver(1, 1, 0) {
require(_l2BlockTime > 0, "L2OutputOracle: L2 block time must be greater than 0");
require(
_submissionInterval > _l2BlockTime,
"L2OutputOracle: submission interval must be greater than L2 block time"
);
SUBMISSION_INTERVAL = _submissionInterval;
L2_BLOCK_TIME = _l2BlockTime;
PROPOSER = _proposer;
......
......@@ -44,6 +44,40 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
);
}
function test_constructor_l2BlockTimeZero_reverts() external {
vm.expectRevert("L2OutputOracle: L2 block time must be greater than 0");
new L2OutputOracle(
submissionInterval,
0,
startingBlockNumber,
block.timestamp,
proposer,
owner
);
}
function testFuzz_constructor_submissionIntervalLteL2BlockTime_reverts(
uint256 _submissionInterval,
uint256 _l2BlockTime
) external {
// Bound the _l2blockTime to be in the range of [1, type(uint256).max]
_l2BlockTime = bound(_l2BlockTime, 1, type(uint256).max);
// Roll the block number to _l2blockTime (the starting L2 timestamp must be less than or equal to the current time)
vm.roll(_l2BlockTime);
// Bound _submissionInterval to be less than or equal to _l2BlockTime
_submissionInterval = bound(_submissionInterval, 0, _l2BlockTime);
vm.expectRevert("L2OutputOracle: submission interval must be greater than L2 block time");
new L2OutputOracle(
_submissionInterval,
_l2BlockTime,
startingBlockNumber,
block.timestamp,
proposer,
owner
);
}
/****************
* Getter Tests *
****************/
......
{
"numDeployConfirmations": 1,
"finalSystemOwner": "ADMIN",
"controller": "ADMIN",
"l1StartingBlockTag": "BLOCKHASH",
"l1ChainID": 5,
"l2ChainID": 42069,
"l2BlockTime": 2,
"maxSequencerDrift": 600,
"sequencerWindowSize": 3600,
"channelTimeout": 300,
"p2pSequencerAddress": "SEQUENCER",
"batchInboxAddress": "0xff00000000000000000000000000000000042069",
"batchSenderAddress": "BATCHER",
"l2OutputOracleSubmissionInterval": 120,
"l2OutputOracleStartingBlockNumber": 0,
"l2OutputOracleStartingTimestamp": "TIMESTAMP",
"l2OutputOracleProposer": "PROPOSER",
"l2OutputOracleChallenger": "ADMIN",
"finalizationPeriodSeconds": 12,
"proxyAdminOwner": "ADMIN",
"baseFeeVaultRecipient": "ADMIN",
"l1FeeVaultRecipient": "ADMIN",
"sequencerFeeVaultRecipient": "ADMIN",
"gasPriceOracleOverhead": 2100,
"gasPriceOracleScalar": 1000000,
"governanceTokenSymbol": "OP",
"governanceTokenName": "Optimism",
"governanceTokenOwner": "ADMIN",
"l2GenesisBlockGasLimit": "0x17D7840",
"l2GenesisBlockBaseFeePerGas": "0x3b9aca00",
"eip1559Denominator": 50,
"eip1559Elasticity": 10
}
import { DeployConfig } from '../src/deploy-config'
import config from './getting-started.json'
export default config satisfies DeployConfig
......@@ -5,6 +5,19 @@ import '@nomiclabs/hardhat-ethers'
import { assertContractVariable, deploy } from '../src/deploy-utils'
const deployFn: DeployFunction = async (hre) => {
if (hre.deployConfig.l2BlockTime === 0) {
throw new Error(
'L2OutputOracle deployment: l2BlockTime must be greater than 0'
)
} else if (
hre.deployConfig.l2OutputOracleSubmissionInterval <=
hre.deployConfig.l2BlockTime
) {
throw new Error(
'L2OutputOracle deployment: submissionInterval must be greater than the l2BlockTime'
)
}
await deploy({
hre,
name: 'L2OutputOracle',
......
......@@ -84,6 +84,12 @@ const config: HardhatUserConfig = {
accounts: [process.env.PRIVATE_KEY_DEPLOYER || ethers.constants.HashZero],
live: true,
},
'getting-started': {
chainId: 5,
url: process.env.L1_RPC || '',
accounts: [process.env.PRIVATE_KEY_DEPLOYER || ethers.constants.HashZero],
live: true,
},
},
foundry: {
buildInfo: true,
......
......@@ -18,7 +18,7 @@
"build:forge": "forge build",
"build:with-metadata": "FOUNDRY_PROFILE=echidna yarn build:forge",
"build:differential": "tsc scripts/differential-testing.ts --outDir dist --moduleResolution node --esModuleInterop",
"build:fuzz": "go build -o test-case-generator test-case-generator/cmd/fuzz.go",
"build:fuzz": "(cd test-case-generator && go build ./cmd/fuzz.go)",
"prebuild": "yarn ts-node scripts/verify-foundry-install.ts",
"build": "hardhat compile && yarn autogen:artifacts && yarn build:ts && yarn typechain",
"build:ts": "tsc -p tsconfig.build.json",
......
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