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
df2349bd
Unverified
Commit
df2349bd
authored
Nov 09, 2023
by
Michael de Hoog
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure genesis contains create2deployer if canyon is enabled
parent
81d4b83f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
3 deletions
+24
-3
helpers.go
op-chain-ops/genesis/helpers.go
+11
-0
layer_two.go
op-chain-ops/genesis/layer_two.go
+3
-0
layer_two_test.go
op-chain-ops/genesis/layer_two_test.go
+6
-2
test-deploy-config-devnet-l1.json
...in-ops/genesis/testdata/test-deploy-config-devnet-l1.json
+4
-1
No files found.
op-chain-ops/genesis/helpers.go
View file @
df2349bd
...
...
@@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/rpc"
)
...
...
@@ -107,3 +108,13 @@ func newHexBig(in uint64) *hexutil.Big {
hb
:=
hexutil
.
Big
(
*
b
)
return
&
hb
}
// CreateAccountOnSetCode is a vm.StateDB wrapper that optimistically creates an account on SetCode
type
CreateAccountOnSetCode
struct
{
vm
.
StateDB
}
func
(
s
*
CreateAccountOnSetCode
)
SetCode
(
addr
common
.
Address
,
code
[]
byte
)
{
s
.
CreateAccount
(
addr
)
s
.
StateDB
.
SetCode
(
addr
,
code
)
}
op-chain-ops/genesis/layer_two.go
View file @
df2349bd
...
...
@@ -3,6 +3,7 @@ package genesis
import
(
"fmt"
"github.com/ethereum/go-ethereum/consensus/misc"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
...
...
@@ -77,5 +78,7 @@ func BuildL2Genesis(config *DeployConfig, l1StartBlock *types.Block) (*core.Gene
}
}
misc
.
EnsureCreate2Deployer
(
genspec
.
Config
,
0
,
&
CreateAccountOnSetCode
{
db
})
return
db
.
Genesis
(),
nil
}
op-chain-ops/genesis/layer_two_test.go
View file @
df2349bd
...
...
@@ -73,6 +73,10 @@ func testBuildL2Genesis(t *testing.T, config *genesis.DeployConfig) *core.Genesi
require
.
Equal
(
t
,
common
.
Big1
,
gen
.
Alloc
[
addr
]
.
Balance
)
}
create2Deployer
:=
gen
.
Alloc
[
common
.
HexToAddress
(
"0x13b0D85CcB8bf860b6b79AF3029fCA081AE9beF2"
)]
codeHash
:=
crypto
.
Keccak256Hash
(
create2Deployer
.
Code
)
require
.
Equal
(
t
,
codeHash
,
common
.
HexToHash
(
"0xb0550b5b431e30d38000efb7107aaa0ade03d48a7198a140edda9d27134468b2"
))
if
writeFile
{
file
,
_
:=
json
.
MarshalIndent
(
gen
,
""
,
" "
)
_
=
os
.
WriteFile
(
"genesis.json"
,
file
,
0644
)
...
...
@@ -86,7 +90,7 @@ func TestBuildL2MainnetGenesis(t *testing.T) {
config
.
EnableGovernance
=
true
config
.
FundDevAccounts
=
false
gen
:=
testBuildL2Genesis
(
t
,
config
)
require
.
Equal
(
t
,
232
2
,
len
(
gen
.
Alloc
))
require
.
Equal
(
t
,
232
3
,
len
(
gen
.
Alloc
))
}
func
TestBuildL2MainnetNoGovernanceGenesis
(
t
*
testing
.
T
)
{
...
...
@@ -95,5 +99,5 @@ func TestBuildL2MainnetNoGovernanceGenesis(t *testing.T) {
config
.
EnableGovernance
=
false
config
.
FundDevAccounts
=
false
gen
:=
testBuildL2Genesis
(
t
,
config
)
require
.
Equal
(
t
,
232
2
,
len
(
gen
.
Alloc
))
require
.
Equal
(
t
,
232
3
,
len
(
gen
.
Alloc
))
}
op-chain-ops/genesis/testdata/test-deploy-config-devnet-l1.json
View file @
df2349bd
...
...
@@ -41,5 +41,8 @@
"enableGovernance"
:
true
,
"governanceTokenSymbol"
:
"OP"
,
"governanceTokenName"
:
"Optimism"
,
"governanceTokenOwner"
:
"0x0000000000000000000000000000000000000333"
"governanceTokenOwner"
:
"0x0000000000000000000000000000000000000333"
,
"l2GenesisRegolithTimeOffset"
:
"0x0"
,
"l2GenesisCanyonTimeOffset"
:
"0x0"
}
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