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
c0c02964
Unverified
Commit
c0c02964
authored
Feb 14, 2023
by
Mark Tyneway
Committed by
GitHub
Feb 14, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4878 from ethereum-optimism/chain-ops/immutable-check
op-chain-ops: more strict checks for config validity
parents
624db0cf
c96309c5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
3 deletions
+71
-3
config.go
op-chain-ops/genesis/config.go
+21
-3
test-deploy-config-devnet-l1.json
...in-ops/genesis/testdata/test-deploy-config-devnet-l1.json
+2
-0
immutables.go
op-chain-ops/immutables/immutables.go
+38
-0
immutables_test.go
op-chain-ops/immutables/immutables_test.go
+2
-0
setup.go
op-e2e/e2eutils/setup.go
+4
-0
setup.go
op-e2e/setup.go
+4
-0
No files found.
op-chain-ops/genesis/config.go
View file @
c0c02964
...
@@ -22,7 +22,10 @@ import (
...
@@ -22,7 +22,10 @@ import (
"github.com/ethereum-optimism/optimism/op-node/rollup"
"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
// DeployConfig represents the deployment configuration for Optimism
type
DeployConfig
struct
{
type
DeployConfig
struct
{
...
@@ -344,12 +347,27 @@ func NewDeployConfigWithNetwork(network, path string) (*DeployConfig, error) {
...
@@ -344,12 +347,27 @@ func NewDeployConfigWithNetwork(network, path string) (*DeployConfig, error) {
}
}
// NewL2ImmutableConfig will create an ImmutableConfig given an instance of a
// 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
)
{
func
NewL2ImmutableConfig
(
config
*
DeployConfig
,
block
*
types
.
Block
)
(
immutables
.
ImmutableConfig
,
error
)
{
immutable
:=
make
(
immutables
.
ImmutableConfig
)
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
{})
{
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
{
immutable
[
"L2StandardBridge"
]
=
immutables
.
ImmutableValues
{
...
...
op-chain-ops/genesis/testdata/test-deploy-config-devnet-l1.json
View file @
c0c02964
...
@@ -23,6 +23,8 @@
...
@@ -23,6 +23,8 @@
"l1FeeVaultRecipient"
:
"0x71bE63f3384f5fb98995898A86B02Fb2426c5788"
,
"l1FeeVaultRecipient"
:
"0x71bE63f3384f5fb98995898A86B02Fb2426c5788"
,
"sequencerFeeVaultRecipient"
:
"0x71bE63f3384f5fb98995898A86B02Fb2426c5788"
,
"sequencerFeeVaultRecipient"
:
"0x71bE63f3384f5fb98995898A86B02Fb2426c5788"
,
"l1ERC721BridgeProxy"
:
"0xff000000000000000000000000000000000000ff"
,
"l1ERC721BridgeProxy"
:
"0xff000000000000000000000000000000000000ff"
,
"l1StandardBridgeProxy"
:
"0xff000000000000000000000000000000000000fd"
,
"l1CrossDomainMessengerProxy"
:
"0xff000000000000000000000000000000000000dd"
,
"deploymentWaitConfirmations"
:
1
,
"deploymentWaitConfirmations"
:
1
,
"fundDevAccounts"
:
true
"fundDevAccounts"
:
true
...
...
op-chain-ops/immutables/immutables.go
View file @
c0c02964
package
immutables
package
immutables
import
(
import
(
"errors"
"fmt"
"fmt"
"math/big"
"math/big"
...
@@ -24,6 +25,39 @@ type ImmutableValues map[string]any
...
@@ -24,6 +25,39 @@ type ImmutableValues map[string]any
// contracts.
// contracts.
type
ImmutableConfig
map
[
string
]
ImmutableValues
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
// DeploymentResults represents the output of deploying each of the
// contracts so that the immutables can be set properly in the bytecode.
// contracts so that the immutables can be set properly in the bytecode.
type
DeploymentResults
map
[
string
]
hexutil
.
Bytes
type
DeploymentResults
map
[
string
]
hexutil
.
Bytes
...
@@ -31,6 +65,10 @@ 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
// BuildOptimism will deploy the L2 predeploys so that their immutables are set
// correctly.
// correctly.
func
BuildOptimism
(
immutable
ImmutableConfig
)
(
DeploymentResults
,
error
)
{
func
BuildOptimism
(
immutable
ImmutableConfig
)
(
DeploymentResults
,
error
)
{
if
err
:=
immutable
.
Check
();
err
!=
nil
{
return
DeploymentResults
{},
err
}
deployments
:=
[]
deployer
.
Constructor
{
deployments
:=
[]
deployer
.
Constructor
{
{
{
Name
:
"GasPriceOracle"
,
Name
:
"GasPriceOracle"
,
...
...
op-chain-ops/immutables/immutables_test.go
View file @
c0c02964
...
@@ -19,9 +19,11 @@ func TestBuildOptimism(t *testing.T) {
...
@@ -19,9 +19,11 @@ func TestBuildOptimism(t *testing.T) {
},
},
"L2ERC721Bridge"
:
{
"L2ERC721Bridge"
:
{
"otherBridge"
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
"otherBridge"
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
"messenger"
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
},
},
"OptimismMintableERC721Factory"
:
{
"OptimismMintableERC721Factory"
:
{
"remoteChainId"
:
big
.
NewInt
(
1
),
"remoteChainId"
:
big
.
NewInt
(
1
),
"bridge"
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
},
},
"SequencerFeeVault"
:
{
"SequencerFeeVault"
:
{
"recipient"
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
"recipient"
:
common
.
HexToAddress
(
"0x1234567890123456789012345678901234567890"
),
...
...
op-e2e/e2eutils/setup.go
View file @
c0c02964
...
@@ -102,6 +102,10 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
...
@@ -102,6 +102,10 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
GasPriceOracleScalar
:
1000
_000
,
GasPriceOracleScalar
:
1000
_000
,
DeploymentWaitConfirmations
:
1
,
DeploymentWaitConfirmations
:
1
,
SequencerFeeVaultRecipient
:
common
.
Address
{
19
:
1
},
BaseFeeVaultRecipient
:
common
.
Address
{
19
:
2
},
L1FeeVaultRecipient
:
common
.
Address
{
19
:
3
},
EIP1559Elasticity
:
10
,
EIP1559Elasticity
:
10
,
EIP1559Denominator
:
50
,
EIP1559Denominator
:
50
,
...
...
op-e2e/setup.go
View file @
c0c02964
...
@@ -92,6 +92,10 @@ func DefaultSystemConfig(t *testing.T) SystemConfig {
...
@@ -92,6 +92,10 @@ func DefaultSystemConfig(t *testing.T) SystemConfig {
GasPriceOracleOverhead
:
2100
,
GasPriceOracleOverhead
:
2100
,
GasPriceOracleScalar
:
1
_000_000
,
GasPriceOracleScalar
:
1
_000_000
,
SequencerFeeVaultRecipient
:
common
.
Address
{
19
:
1
},
BaseFeeVaultRecipient
:
common
.
Address
{
19
:
2
},
L1FeeVaultRecipient
:
common
.
Address
{
19
:
3
},
DeploymentWaitConfirmations
:
1
,
DeploymentWaitConfirmations
:
1
,
EIP1559Elasticity
:
2
,
EIP1559Elasticity
:
2
,
...
...
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