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
9fb2b72d
Unverified
Commit
9fb2b72d
authored
Jun 09, 2023
by
Roberto Bayardo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make extradata configurable for the genesis block generator
parent
9576bed0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
4 deletions
+15
-4
config.go
op-chain-ops/genesis/config.go
+3
-0
config_test.go
op-chain-ops/genesis/config_test.go
+4
-2
genesis.go
op-chain-ops/genesis/genesis.go
+7
-2
test-deploy-config-full.json
op-chain-ops/genesis/testdata/test-deploy-config-full.json
+1
-0
No files found.
op-chain-ops/genesis/config.go
View file @
9fb2b72d
...
...
@@ -72,6 +72,9 @@ type DeployConfig struct {
// Seconds after genesis block that Regolith hard fork activates. 0 to activate at genesis. Nil to disable regolith
L2GenesisRegolithTimeOffset
*
hexutil
.
Uint64
`json:"l2GenesisRegolithTimeOffset,omitempty"`
// Configurable extradata. Will default to []byte("BEDROCK") if left unspecified.
L2GenesisBlockExtraData
[]
byte
`json:"l2GenesisBlockExtraData"`
// Owner of the ProxyAdmin predeploy
ProxyAdminOwner
common
.
Address
`json:"proxyAdminOwner"`
// Owner of the system on L1
...
...
op-chain-ops/genesis/config_test.go
View file @
9fb2b72d
...
...
@@ -14,14 +14,16 @@ import (
"github.com/stretchr/testify/require"
)
func
TestConfigMarshalUnmarshal
(
t
*
testing
.
T
)
{
func
TestConfig
Data
MarshalUnmarshal
(
t
*
testing
.
T
)
{
b
,
err
:=
os
.
ReadFile
(
"testdata/test-deploy-config-full.json"
)
require
.
NoError
(
t
,
err
)
dec
:=
json
.
NewDecoder
(
bytes
.
NewReader
(
b
))
decoded
:=
new
(
DeployConfig
)
require
.
NoError
(
t
,
dec
.
Decode
(
decoded
))
encoded
,
err
:=
json
.
MarshalIndent
(
decoded
,
""
,
" "
)
require
.
EqualValues
(
t
,
"non-default value"
,
string
(
decoded
.
L2GenesisBlockExtraData
)
)
encoded
,
err
:=
json
.
MarshalIndent
(
decoded
,
""
,
" "
)
require
.
NoError
(
t
,
err
)
require
.
JSONEq
(
t
,
string
(
b
),
string
(
encoded
))
}
...
...
op-chain-ops/genesis/genesis.go
View file @
9fb2b72d
...
...
@@ -74,8 +74,13 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro
difficulty
=
newHexBig
(
0
)
}
extraData
:=
config
.
L2GenesisBlockExtraData
if
extraData
==
nil
{
// L2GenesisBlockExtraData is optional, so use a default value when nil
extraData
=
BedrockTransitionBlockExtraData
}
// Ensure that the extradata is valid
if
size
:=
len
(
BedrockTransitionBlockE
xtraData
);
size
>
32
{
if
size
:=
len
(
e
xtraData
);
size
>
32
{
return
nil
,
fmt
.
Errorf
(
"transition block extradata too long: %d"
,
size
)
}
...
...
@@ -83,7 +88,7 @@ func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, erro
Config
:
&
optimismChainConfig
,
Nonce
:
uint64
(
config
.
L2GenesisBlockNonce
),
Timestamp
:
block
.
Time
(),
ExtraData
:
BedrockTransitionBlockE
xtraData
,
ExtraData
:
e
xtraData
,
GasLimit
:
uint64
(
gasLimit
),
Difficulty
:
difficulty
.
ToInt
(),
Mixhash
:
config
.
L2GenesisBlockMixHash
,
...
...
op-chain-ops/genesis/testdata/test-deploy-config-full.json
View file @
9fb2b72d
...
...
@@ -36,6 +36,7 @@
"l2GenesisBlockGasUsed"
:
"0x0"
,
"l2GenesisBlockParentHash"
:
"0x0000000000000000000000000000000000000000000000000000000000000000"
,
"l2GenesisBlockBaseFeePerGas"
:
"0x3b9aca00"
,
"l2GenesisBlockExtraData"
:
"bm9uLWRlZmF1bHQgdmFsdWU="
,
"baseFeeVaultRecipient"
:
"0x42000000000000000000000000000000000000f5"
,
"l1FeeVaultRecipient"
:
"0x42000000000000000000000000000000000000f6"
,
"sequencerFeeVaultRecipient"
:
"0x42000000000000000000000000000000000000f7"
,
...
...
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