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
0fe6c13a
Commit
0fe6c13a
authored
Sep 25, 2022
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-chain-ops: setup new predeploys
parent
73caf914
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
13 deletions
+79
-13
config.go
op-chain-ops/genesis/config.go
+10
-1
layer_one.go
op-chain-ops/genesis/layer_one.go
+10
-0
layer_two.go
op-chain-ops/genesis/layer_two.go
+2
-0
layer_two_test.go
op-chain-ops/genesis/layer_two_test.go
+2
-2
immutables.go
op-chain-ops/immutables/immutables.go
+36
-0
immutables_test.go
op-chain-ops/immutables/immutables_test.go
+19
-10
No files found.
op-chain-ops/genesis/config.go
View file @
0fe6c13a
...
...
@@ -3,6 +3,7 @@ package genesis
import
(
"encoding/json"
"errors"
"math/big"
"os"
"path/filepath"
...
...
@@ -103,7 +104,7 @@ func NewDeployConfigWithNetwork(network, path string) (*DeployConfig, error) {
// NewL2ImmutableConfig will create an ImmutableConfig given an instance of a
// Hardhat and a DeployConfig.
func
NewL2ImmutableConfig
(
config
*
DeployConfig
,
block
*
types
.
Block
,
proxyL1StandardBridge
common
.
Address
,
proxyL1CrossDomainMessenger
common
.
Address
)
(
immutables
.
ImmutableConfig
,
error
)
{
func
NewL2ImmutableConfig
(
config
*
DeployConfig
,
block
*
types
.
Block
,
proxyL1StandardBridge
,
proxyL1CrossDomainMessenger
,
proxyL1ERC721Bridge
common
.
Address
)
(
immutables
.
ImmutableConfig
,
error
)
{
immutable
:=
make
(
immutables
.
ImmutableConfig
)
immutable
[
"L2StandardBridge"
]
=
immutables
.
ImmutableValues
{
...
...
@@ -112,6 +113,14 @@ func NewL2ImmutableConfig(config *DeployConfig, block *types.Block, proxyL1Stand
immutable
[
"L2CrossDomainMessenger"
]
=
immutables
.
ImmutableValues
{
"otherMessenger"
:
proxyL1CrossDomainMessenger
,
}
immutable
[
"L2ERC721Bridge"
]
=
immutables
.
ImmutableValues
{
"messenger"
:
predeploys
.
L2CrossDomainMessengerAddr
,
"otherBridge"
:
proxyL1ERC721Bridge
,
}
immutable
[
"OptimismMintableERC721Factory"
]
=
immutables
.
ImmutableValues
{
"bridge"
:
predeploys
.
L2ERC721BridgeAddr
,
"remoteChainId"
:
new
(
big
.
Int
)
.
SetUint64
(
config
.
L1ChainID
),
}
return
immutable
,
nil
}
...
...
op-chain-ops/genesis/layer_one.go
View file @
0fe6c13a
...
...
@@ -249,6 +249,9 @@ func deployL1Contracts(config *DeployConfig, backend *backends.SimulatedBackend)
{
Name
:
"L1StandardBridge"
,
},
{
Name
:
"L1ERC721Bridge"
,
},
{
Name
:
"OptimismMintableERC20Factory"
,
},
...
...
@@ -327,6 +330,13 @@ func l1Deployer(backend *backends.SimulatedBackend, opts *bind.TransactOpts, dep
opts
,
backend
,
)
case
"L1ERC721Bridge"
:
_
,
tx
,
_
,
err
=
bindings
.
DeployL1ERC721Bridge
(
opts
,
backend
,
predeploys
.
DevL1CrossDomainMessengerAddr
,
predeploys
.
L2ERC721BridgeAddr
,
)
default
:
if
strings
.
HasSuffix
(
deployment
.
Name
,
"Proxy"
)
{
_
,
tx
,
_
,
err
=
bindings
.
DeployProxy
(
opts
,
backend
,
deployer
.
TestAddress
)
...
...
op-chain-ops/genesis/layer_two.go
View file @
0fe6c13a
...
...
@@ -13,6 +13,7 @@ type L2Addresses struct {
ProxyAdmin
common
.
Address
L1StandardBridgeProxy
common
.
Address
L1CrossDomainMessengerProxy
common
.
Address
L1ERC721BridgeProxy
common
.
Address
}
// BuildL2DeveloperGenesis will build the developer Optimism Genesis
...
...
@@ -66,6 +67,7 @@ func BuildL2Genesis(db *state.MemoryStateDB, config *DeployConfig, l1Block *type
l1Block
,
l2Addrs
.
L1StandardBridgeProxy
,
l2Addrs
.
L1CrossDomainMessengerProxy
,
l2Addrs
.
L1ERC721BridgeProxy
,
)
if
err
!=
nil
{
return
nil
,
err
...
...
op-chain-ops/genesis/layer_two_test.go
View file @
0fe6c13a
...
...
@@ -77,7 +77,7 @@ func TestBuildL2DeveloperGenesis(t *testing.T) {
require
.
Equal
(
t
,
adminSlot
,
proxyAdmin
.
Address
.
Hash
())
require
.
Equal
(
t
,
account
.
Code
,
depB
)
}
require
.
Equal
(
t
,
23
39
,
len
(
gen
.
Alloc
))
require
.
Equal
(
t
,
23
41
,
len
(
gen
.
Alloc
))
if
writeFile
{
file
,
_
:=
json
.
MarshalIndent
(
gen
,
""
,
" "
)
...
...
@@ -102,5 +102,5 @@ func TestBuildL2DeveloperGenesisDevAccountsFunding(t *testing.T) {
ProxyAdmin
:
common
.
Address
{},
})
require
.
NoError
(
t
,
err
)
require
.
Equal
(
t
,
231
7
,
len
(
gen
.
Alloc
))
require
.
Equal
(
t
,
231
9
,
len
(
gen
.
Alloc
))
}
op-chain-ops/immutables/immutables.go
View file @
0fe6c13a
...
...
@@ -2,6 +2,7 @@ package immutables
import
(
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/core/types"
...
...
@@ -67,6 +68,20 @@ func BuildOptimism(immutable ImmutableConfig) (DeploymentResults, error) {
{
Name
:
"L1BlockNumber"
,
},
{
Name
:
"L2ERC721Bridge"
,
Args
:
[]
interface
{}{
predeploys
.
L2CrossDomainMessengerAddr
,
immutable
[
"L2ERC721Bridge"
][
"otherBridge"
],
},
},
{
Name
:
"OptimismMintableERC721Factory"
,
Args
:
[]
interface
{}{
predeploys
.
L2ERC721BridgeAddr
,
immutable
[
"OptimismMintableERC721Factory"
][
"remoteChainId"
],
},
},
}
return
BuildL2
(
deployments
)
}
...
...
@@ -124,6 +139,27 @@ func l2Deployer(backend *backends.SimulatedBackend, opts *bind.TransactOpts, dep
_
,
tx
,
_
,
err
=
bindings
.
DeployLegacyMessagePasser
(
opts
,
backend
)
case
"L1BlockNumber"
:
_
,
tx
,
_
,
err
=
bindings
.
DeployL1BlockNumber
(
opts
,
backend
)
case
"L2ERC721Bridge"
:
// TODO(tynes): messenger should be hardcoded in the contract
messenger
,
ok
:=
deployment
.
Args
[
0
]
.
(
common
.
Address
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"invalid type for messenger"
)
}
otherBridge
,
ok
:=
deployment
.
Args
[
1
]
.
(
common
.
Address
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"invalid type for otherBridge"
)
}
_
,
tx
,
_
,
err
=
bindings
.
DeployL2ERC721Bridge
(
opts
,
backend
,
messenger
,
otherBridge
)
case
"OptimismMintableERC721Factory"
:
bridge
,
ok
:=
deployment
.
Args
[
0
]
.
(
common
.
Address
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"invalid type for bridge"
)
}
remoteChainId
,
ok
:=
deployment
.
Args
[
1
]
.
(
*
big
.
Int
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"invalid type for remoteChainId"
)
}
_
,
tx
,
_
,
err
=
bindings
.
DeployOptimismMintableERC721Factory
(
opts
,
backend
,
bridge
,
remoteChainId
)
default
:
return
tx
,
fmt
.
Errorf
(
"unknown contract: %s"
,
deployment
.
Name
)
}
...
...
op-chain-ops/immutables/immutables_test.go
View file @
0fe6c13a
package
immutables_test
import
(
"math/big"
"testing"
"github.com/ethereum-optimism/optimism/op-chain-ops/immutables"
...
...
@@ -16,21 +17,29 @@ func TestBuildOptimism(t *testing.T) {
"L2CrossDomainMessenger"
:
{
"otherMessenger"
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
},
"L2ERC721Bridge"
:
{
"otherBridge"
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
},
"OptimismMintableERC721Factory"
:
{
"remoteChainId"
:
big
.
NewInt
(
1
),
},
})
require
.
Nil
(
t
,
err
)
require
.
NotNil
(
t
,
results
)
contracts
:=
map
[
string
]
bool
{
"GasPriceOracle"
:
true
,
"L1Block"
:
true
,
"L2CrossDomainMessenger"
:
true
,
"L2StandardBridge"
:
true
,
"L2ToL1MessagePasser"
:
true
,
"SequencerFeeVault"
:
true
,
"OptimismMintableERC20Factory"
:
true
,
"DeployerWhitelist"
:
true
,
"LegacyMessagePasser"
:
true
,
"L1BlockNumber"
:
true
,
"GasPriceOracle"
:
true
,
"L1Block"
:
true
,
"L2CrossDomainMessenger"
:
true
,
"L2StandardBridge"
:
true
,
"L2ToL1MessagePasser"
:
true
,
"SequencerFeeVault"
:
true
,
"OptimismMintableERC20Factory"
:
true
,
"DeployerWhitelist"
:
true
,
"LegacyMessagePasser"
:
true
,
"L1BlockNumber"
:
true
,
"L2ERC721Bridge"
:
true
,
"OptimismMintableERC721Factory"
:
true
,
}
// Only the exact contracts that we care about are being
...
...
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