Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
51c00e93
Unverified
Commit
51c00e93
authored
Feb 15, 2023
by
mergify[bot]
Committed by
GitHub
Feb 15, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into ajsutton/fix-warnings
parents
4913b42a
355d3646
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
222 additions
and
16 deletions
+222
-16
types.go
op-node/rollup/types.go
+43
-16
types_test.go
op-node/rollup/types_test.go
+122
-0
getting-started.json
...ages/contracts-bedrock/deploy-config/getting-started.json
+47
-0
getting-started.ts
packages/contracts-bedrock/deploy-config/getting-started.ts
+4
-0
hardhat.config.ts
packages/contracts-bedrock/hardhat.config.ts
+6
-0
No files found.
op-node/rollup/types.go
View file @
51c00e93
...
...
@@ -12,6 +12,27 @@ import (
"github.com/ethereum-optimism/optimism/op-node/eth"
)
var
(
ErrBlockTimeZero
=
errors
.
New
(
"block time cannot be 0"
)
ErrMissingChannelTimeout
=
errors
.
New
(
"channel timeout must be set, this should cover at least a L1 block time"
)
ErrInvalidSeqWindowSize
=
errors
.
New
(
"sequencing window size must at least be 2"
)
ErrMissingGenesisL1Hash
=
errors
.
New
(
"genesis L1 hash cannot be empty"
)
ErrMissingGenesisL2Hash
=
errors
.
New
(
"genesis L2 hash cannot be empty"
)
ErrGenesisHashesSame
=
errors
.
New
(
"achievement get! rollup inception: L1 and L2 genesis cannot be the same"
)
ErrMissingGenesisL2Time
=
errors
.
New
(
"missing L2 genesis time"
)
ErrMissingBatcherAddr
=
errors
.
New
(
"missing genesis system config batcher address"
)
ErrMissingOverhead
=
errors
.
New
(
"missing genesis system config overhead"
)
ErrMissingScalar
=
errors
.
New
(
"missing genesis system config scalar"
)
ErrMissingGasLimit
=
errors
.
New
(
"missing genesis system config gas limit"
)
ErrMissingBatchInboxAddress
=
errors
.
New
(
"missing batch inbox address"
)
ErrMissingDepositContractAddress
=
errors
.
New
(
"missing deposit contract address"
)
ErrMissingL1ChainID
=
errors
.
New
(
"L1 chain ID must not be nil"
)
ErrMissingL2ChainID
=
errors
.
New
(
"L2 chain ID must not be nil"
)
ErrChainIDsSame
=
errors
.
New
(
"L1 and L2 chain IDs must be different"
)
ErrL1ChainIDNotPositive
=
errors
.
New
(
"L1 chain ID must be non-zero and positive"
)
ErrL2ChainIDNotPositive
=
errors
.
New
(
"L2 chain ID must be non-zero and positive"
)
)
type
Genesis
struct
{
// The L1 block that the rollup starts *after* (no derived transactions)
L1
eth
.
BlockID
`json:"l1"`
...
...
@@ -147,52 +168,58 @@ func (cfg *Config) CheckL2GenesisBlockHash(ctx context.Context, client L2Client)
// Check verifies that the given configuration makes sense
func
(
cfg
*
Config
)
Check
()
error
{
if
cfg
.
BlockTime
==
0
{
return
fmt
.
Errorf
(
"block time cannot be 0, got %d"
,
cfg
.
BlockTime
)
return
ErrBlockTimeZero
}
if
cfg
.
ChannelTimeout
==
0
{
return
fmt
.
Errorf
(
"channel timeout must be set, this should cover at least a L1 block time"
)
return
ErrMissingChannelTimeout
}
if
cfg
.
SeqWindowSize
<
2
{
return
fmt
.
Errorf
(
"sequencing window size must at least be 2, got %d"
,
cfg
.
SeqWindowSize
)
return
ErrInvalidSeqWindowSize
}
if
cfg
.
Genesis
.
L1
.
Hash
==
(
common
.
Hash
{})
{
return
errors
.
New
(
"genesis l1 hash cannot be empty"
)
return
ErrMissingGenesisL1Hash
}
if
cfg
.
Genesis
.
L2
.
Hash
==
(
common
.
Hash
{})
{
return
errors
.
New
(
"genesis l2 hash cannot be empty"
)
return
ErrMissingGenesisL2Hash
}
if
cfg
.
Genesis
.
L2
.
Hash
==
cfg
.
Genesis
.
L1
.
Hash
{
return
errors
.
New
(
"achievement get! rollup inception: L1 and L2 genesis cannot be the same"
)
return
ErrGenesisHashesSame
}
if
cfg
.
Genesis
.
L2Time
==
0
{
return
errors
.
New
(
"missing L2 genesis time"
)
return
ErrMissingGenesisL2Time
}
if
cfg
.
Genesis
.
SystemConfig
.
BatcherAddr
==
(
common
.
Address
{})
{
return
errors
.
New
(
"missing genesis system config batcher address"
)
return
ErrMissingBatcherAddr
}
if
cfg
.
Genesis
.
SystemConfig
.
Overhead
==
(
eth
.
Bytes32
{})
{
return
errors
.
New
(
"missing genesis system config overhead"
)
return
ErrMissingOverhead
}
if
cfg
.
Genesis
.
SystemConfig
.
Scalar
==
(
eth
.
Bytes32
{})
{
return
errors
.
New
(
"missing genesis system config scalar"
)
return
ErrMissingScalar
}
if
cfg
.
Genesis
.
SystemConfig
.
GasLimit
==
0
{
return
errors
.
New
(
"missing genesis system config gas limit"
)
return
ErrMissingGasLimit
}
if
cfg
.
BatchInboxAddress
==
(
common
.
Address
{})
{
return
errors
.
New
(
"missing batch inbox address"
)
return
ErrMissingBatchInboxAddress
}
if
cfg
.
DepositContractAddress
==
(
common
.
Address
{})
{
return
errors
.
New
(
"missing deposit contract address"
)
return
ErrMissingDepositContractAddress
}
if
cfg
.
L1ChainID
==
nil
{
return
errors
.
New
(
"l1 chain ID must not be nil"
)
return
ErrMissingL1ChainID
}
if
cfg
.
L2ChainID
==
nil
{
return
errors
.
New
(
"l2 chain ID must not be nil"
)
return
ErrMissingL2ChainID
}
if
cfg
.
L1ChainID
.
Cmp
(
cfg
.
L2ChainID
)
==
0
{
return
errors
.
New
(
"l1 and l2 chain IDs must be different"
)
return
ErrChainIDsSame
}
if
cfg
.
L1ChainID
.
Sign
()
<
1
{
return
ErrL1ChainIDNotPositive
}
if
cfg
.
L2ChainID
.
Sign
()
<
1
{
return
ErrL2ChainIDNotPositive
}
return
nil
}
...
...
op-node/rollup/types_test.go
View file @
51c00e93
...
...
@@ -212,3 +212,125 @@ func TestCheckL2BlockRefByNumber(t *testing.T) {
err
=
config
.
CheckL2GenesisBlockHash
(
context
.
TODO
(),
&
mockClient
)
assert
.
Error
(
t
,
err
)
}
func
TestConfig_Check
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
modifier
func
(
cfg
*
Config
)
expectedErr
error
}{
{
name
:
"BlockTimeZero"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
BlockTime
=
0
},
expectedErr
:
ErrBlockTimeZero
,
},
{
name
:
"ChannelTimeoutZero"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
ChannelTimeout
=
0
},
expectedErr
:
ErrMissingChannelTimeout
,
},
{
name
:
"SeqWindowSizeZero"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
SeqWindowSize
=
0
},
expectedErr
:
ErrInvalidSeqWindowSize
,
},
{
name
:
"SeqWindowSizeOne"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
SeqWindowSize
=
1
},
expectedErr
:
ErrInvalidSeqWindowSize
,
},
{
name
:
"NoL1Genesis"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
Genesis
.
L1
.
Hash
=
common
.
Hash
{}
},
expectedErr
:
ErrMissingGenesisL1Hash
,
},
{
name
:
"NoL2Genesis"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
Genesis
.
L2
.
Hash
=
common
.
Hash
{}
},
expectedErr
:
ErrMissingGenesisL2Hash
,
},
{
name
:
"GenesisHashesEqual"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
Genesis
.
L2
.
Hash
=
cfg
.
Genesis
.
L1
.
Hash
},
expectedErr
:
ErrGenesisHashesSame
,
},
{
name
:
"GenesisL2TimeZero"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
Genesis
.
L2Time
=
0
},
expectedErr
:
ErrMissingGenesisL2Time
,
},
{
name
:
"NoBatcherAddr"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
Genesis
.
SystemConfig
.
BatcherAddr
=
common
.
Address
{}
},
expectedErr
:
ErrMissingBatcherAddr
,
},
{
name
:
"NoOverhead"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
Genesis
.
SystemConfig
.
Overhead
=
eth
.
Bytes32
{}
},
expectedErr
:
ErrMissingOverhead
,
},
{
name
:
"NoScalar"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
Genesis
.
SystemConfig
.
Scalar
=
eth
.
Bytes32
{}
},
expectedErr
:
ErrMissingScalar
,
},
{
name
:
"NoGasLimit"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
Genesis
.
SystemConfig
.
GasLimit
=
0
},
expectedErr
:
ErrMissingGasLimit
,
},
{
name
:
"NoBatchInboxAddress"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
BatchInboxAddress
=
common
.
Address
{}
},
expectedErr
:
ErrMissingBatchInboxAddress
,
},
{
name
:
"NoDepositContractAddress"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
DepositContractAddress
=
common
.
Address
{}
},
expectedErr
:
ErrMissingDepositContractAddress
,
},
{
name
:
"NoL1ChainId"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
L1ChainID
=
nil
},
expectedErr
:
ErrMissingL1ChainID
,
},
{
name
:
"NoL2ChainId"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
L2ChainID
=
nil
},
expectedErr
:
ErrMissingL2ChainID
,
},
{
name
:
"ChainIDsEqual"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
L2ChainID
=
cfg
.
L1ChainID
},
expectedErr
:
ErrChainIDsSame
,
},
{
name
:
"L1ChainIdNegative"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
L1ChainID
=
big
.
NewInt
(
-
1
)
},
expectedErr
:
ErrL1ChainIDNotPositive
,
},
{
name
:
"L1ChainIdZero"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
L1ChainID
=
big
.
NewInt
(
0
)
},
expectedErr
:
ErrL1ChainIDNotPositive
,
},
{
name
:
"L2ChainIdNegative"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
L2ChainID
=
big
.
NewInt
(
-
1
)
},
expectedErr
:
ErrL2ChainIDNotPositive
,
},
{
name
:
"L2ChainIdZero"
,
modifier
:
func
(
cfg
*
Config
)
{
cfg
.
L2ChainID
=
big
.
NewInt
(
0
)
},
expectedErr
:
ErrL2ChainIDNotPositive
,
},
}
for
_
,
test
:=
range
tests
{
t
.
Run
(
test
.
name
,
func
(
t
*
testing
.
T
)
{
cfg
:=
randConfig
()
test
.
modifier
(
cfg
)
err
:=
cfg
.
Check
()
assert
.
Same
(
t
,
err
,
test
.
expectedErr
)
})
}
}
packages/contracts-bedrock/deploy-config/getting-started.json
0 → 100644
View file @
51c00e93
{
"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
}
packages/contracts-bedrock/deploy-config/getting-started.ts
0 → 100644
View file @
51c00e93
import
{
DeployConfig
}
from
'
../src/deploy-config
'
import
config
from
'
./getting-started.json
'
export
default
config
satisfies
DeployConfig
packages/contracts-bedrock/hardhat.config.ts
View file @
51c00e93
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment