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
ee5c794d
Unverified
Commit
ee5c794d
authored
Dec 05, 2024
by
Matthew Slipper
Committed by
GitHub
Dec 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-deployer: Clean up to use latest libs (#13257)
parent
0648499c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
21 additions
and
251 deletions
+21
-251
delayed_weth.go
op-deployer/pkg/deployer/bootstrap/delayed_weth.go
+3
-22
dispute_game.go
op-deployer/pkg/deployer/bootstrap/dispute_game.go
+3
-22
mips.go
op-deployer/pkg/deployer/bootstrap/mips.go
+8
-8
asterisc.go
op-deployer/pkg/deployer/opcm/asterisc.go
+1
-35
delayed_weth.go
op-deployer/pkg/deployer/opcm/delayed_weth.go
+1
-34
dispute_game.go
op-deployer/pkg/deployer/opcm/dispute_game.go
+1
-31
mips.go
op-deployer/pkg/deployer/opcm/mips.go
+1
-31
opchain.go
op-deployer/pkg/deployer/opcm/opchain.go
+1
-30
opcm.go
op-deployer/pkg/deployer/opcm/opcm.go
+1
-4
superchain.go
op-deployer/pkg/deployer/opcm/superchain.go
+1
-34
No files found.
op-deployer/pkg/deployer/bootstrap/delayed_weth.go
View file @
ee5c794d
...
...
@@ -7,8 +7,6 @@ import (
"math/big"
"strings"
"github.com/ethereum-optimism/optimism/op-chain-ops/script"
"github.com/ethereum-optimism/optimism/op-chain-ops/script/forking"
artifacts2
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/artifacts"
"github.com/ethereum-optimism/optimism/op-deployer/pkg/env"
...
...
@@ -165,35 +163,18 @@ func DelayedWETH(ctx context.Context, cfg DelayedWETHConfig) error {
return
fmt
.
Errorf
(
"failed to connect to L1 RPC: %w"
,
err
)
}
host
,
err
:=
env
.
DefaultScriptHost
(
host
,
err
:=
env
.
DefaultForkedScriptHost
(
ctx
,
bcaster
,
lgr
,
chainDeployer
,
artifactsFS
,
script
.
WithForkHook
(
func
(
cfg
*
script
.
ForkConfig
)
(
forking
.
ForkSource
,
error
)
{
src
,
err
:=
forking
.
RPCSourceByNumber
(
cfg
.
URLOrAlias
,
l1RPC
,
*
cfg
.
BlockNumber
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to create RPC fork source: %w"
,
err
)
}
return
forking
.
Cache
(
src
),
nil
}),
l1RPC
,
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to create script host: %w"
,
err
)
}
latest
,
err
:=
l1Client
.
HeaderByNumber
(
ctx
,
nil
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to get latest block: %w"
,
err
)
}
if
_
,
err
:=
host
.
CreateSelectFork
(
script
.
ForkWithURLOrAlias
(
"main"
),
script
.
ForkWithBlockNumberU256
(
latest
.
Number
),
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to select fork: %w"
,
err
)
}
var
release
string
if
cfg
.
ArtifactsLocator
.
IsTag
()
{
release
=
cfg
.
ArtifactsLocator
.
Tag
...
...
op-deployer/pkg/deployer/bootstrap/dispute_game.go
View file @
ee5c794d
...
...
@@ -6,8 +6,6 @@ import (
"fmt"
"strings"
"github.com/ethereum-optimism/optimism/op-chain-ops/script"
"github.com/ethereum-optimism/optimism/op-chain-ops/script/forking"
artifacts2
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/artifacts"
"github.com/ethereum/go-ethereum/rpc"
...
...
@@ -179,35 +177,18 @@ func DisputeGame(ctx context.Context, cfg DisputeGameConfig) error {
return
fmt
.
Errorf
(
"failed to create broadcaster: %w"
,
err
)
}
host
,
err
:=
env
.
DefaultScriptHost
(
host
,
err
:=
env
.
DefaultForkedScriptHost
(
ctx
,
bcaster
,
lgr
,
chainDeployer
,
artifactsFS
,
script
.
WithForkHook
(
func
(
forkCfg
*
script
.
ForkConfig
)
(
forking
.
ForkSource
,
error
)
{
src
,
err
:=
forking
.
RPCSourceByNumber
(
forkCfg
.
URLOrAlias
,
l1Rpc
,
*
forkCfg
.
BlockNumber
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to create RPC fork source: %w"
,
err
)
}
return
forking
.
Cache
(
src
),
nil
}),
l1Rpc
,
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to create L1 script host: %w"
,
err
)
}
latest
,
err
:=
l1Client
.
HeaderByNumber
(
ctx
,
nil
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to get latest block: %w"
,
err
)
}
if
_
,
err
:=
host
.
CreateSelectFork
(
script
.
ForkWithURLOrAlias
(
"main"
),
script
.
ForkWithBlockNumberU256
(
latest
.
Number
),
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to select fork: %w"
,
err
)
}
var
release
string
if
cfg
.
ArtifactsLocator
.
IsTag
()
{
release
=
cfg
.
ArtifactsLocator
.
Tag
...
...
op-deployer/pkg/deployer/bootstrap/mips.go
View file @
ee5c794d
...
...
@@ -6,6 +6,8 @@ import (
"fmt"
"strings"
"github.com/ethereum/go-ethereum/rpc"
artifacts2
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/artifacts"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -123,11 +125,13 @@ func MIPS(ctx context.Context, cfg MIPSConfig) error {
}
}()
l1
Client
,
err
:=
ethclient
.
Dial
(
cfg
.
L1RPCUrl
)
l1
RPC
,
err
:=
rpc
.
Dial
(
cfg
.
L1RPCUrl
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to connect to L1 RPC: %w"
,
err
)
}
l1Client
:=
ethclient
.
NewClient
(
l1RPC
)
chainID
,
err
:=
l1Client
.
ChainID
(
ctx
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to get chain ID: %w"
,
err
)
...
...
@@ -147,21 +151,17 @@ func MIPS(ctx context.Context, cfg MIPSConfig) error {
return
fmt
.
Errorf
(
"failed to create broadcaster: %w"
,
err
)
}
nonce
,
err
:=
l1Client
.
NonceAt
(
ctx
,
chainDeployer
,
nil
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to get starting nonce: %w"
,
err
)
}
host
,
err
:=
env
.
DefaultScriptHost
(
host
,
err
:=
env
.
DefaultForkedScriptHost
(
ctx
,
bcaster
,
lgr
,
chainDeployer
,
artifactsFS
,
l1RPC
,
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to create script host: %w"
,
err
)
}
host
.
SetNonce
(
chainDeployer
,
nonce
)
var
release
string
if
cfg
.
ArtifactsLocator
.
IsTag
()
{
...
...
op-deployer/pkg/deployer/opcm/asterisc.go
View file @
ee5c794d
package
opcm
import
(
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum-optimism/optimism/op-chain-ops/script"
...
...
@@ -24,41 +22,9 @@ func (output *DeployAsteriscOutput) CheckOutput(input common.Address) error {
return
nil
}
type
DeployAsteriscScript
struct
{
Run
func
(
input
,
output
common
.
Address
)
error
}
func
DeployAsterisc
(
host
*
script
.
Host
,
input
DeployAsteriscInput
,
)
(
DeployAsteriscOutput
,
error
)
{
var
output
DeployAsteriscOutput
inputAddr
:=
host
.
NewScriptAddress
()
outputAddr
:=
host
.
NewScriptAddress
()
cleanupInput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeployAsteriscInput
](
host
,
inputAddr
,
&
input
)
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to insert DeployAsteriscInput precompile: %w"
,
err
)
}
defer
cleanupInput
()
cleanupOutput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeployAsteriscOutput
](
host
,
outputAddr
,
&
output
,
script
.
WithFieldSetter
[
*
DeployAsteriscOutput
])
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to insert DeployAsteriscOutput precompile: %w"
,
err
)
}
defer
cleanupOutput
()
implContract
:=
"DeployAsterisc"
deployScript
,
cleanupDeploy
,
err
:=
script
.
WithScript
[
DeployAsteriscScript
](
host
,
"DeployAsterisc.s.sol"
,
implContract
)
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to load %s script: %w"
,
implContract
,
err
)
}
defer
cleanupDeploy
()
if
err
:=
deployScript
.
Run
(
inputAddr
,
outputAddr
);
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to run %s script: %w"
,
implContract
,
err
)
}
return
output
,
nil
return
RunBasicScript
[
DeployAsteriscInput
,
DeployAsteriscOutput
](
host
,
input
,
"DeployAsterisc.s.sol"
,
"DeployAsterisc"
)
}
op-deployer/pkg/deployer/opcm/delayed_weth.go
View file @
ee5c794d
package
opcm
import
(
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -31,41 +30,9 @@ func (output *DeployDelayedWETHOutput) CheckOutput(input common.Address) error {
return
nil
}
type
DeployDelayedWETHScript
struct
{
Run
func
(
input
,
output
common
.
Address
)
error
}
func
DeployDelayedWETH
(
host
*
script
.
Host
,
input
DeployDelayedWETHInput
,
)
(
DeployDelayedWETHOutput
,
error
)
{
var
output
DeployDelayedWETHOutput
inputAddr
:=
host
.
NewScriptAddress
()
outputAddr
:=
host
.
NewScriptAddress
()
cleanupInput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeployDelayedWETHInput
](
host
,
inputAddr
,
&
input
)
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to insert DeployDelayedWETHInput precompile: %w"
,
err
)
}
defer
cleanupInput
()
cleanupOutput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeployDelayedWETHOutput
](
host
,
outputAddr
,
&
output
,
script
.
WithFieldSetter
[
*
DeployDelayedWETHOutput
])
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to insert DeployDelayedWETHOutput precompile: %w"
,
err
)
}
defer
cleanupOutput
()
implContract
:=
"DeployDelayedWETH"
deployScript
,
cleanupDeploy
,
err
:=
script
.
WithScript
[
DeployDelayedWETHScript
](
host
,
"DeployDelayedWETH.s.sol"
,
implContract
)
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to load %s script: %w"
,
implContract
,
err
)
}
defer
cleanupDeploy
()
if
err
:=
deployScript
.
Run
(
inputAddr
,
outputAddr
);
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to run %s script: %w"
,
implContract
,
err
)
}
return
output
,
nil
return
RunBasicScript
[
DeployDelayedWETHInput
,
DeployDelayedWETHOutput
](
host
,
input
,
"DeployDelayedWETH.s.sol"
,
"DeployDelayedWETH"
)
}
op-deployer/pkg/deployer/opcm/dispute_game.go
View file @
ee5c794d
package
opcm
import
(
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum-optimism/optimism/op-chain-ops/script"
...
...
@@ -46,33 +44,5 @@ func DeployDisputeGame(
host
*
script
.
Host
,
input
DeployDisputeGameInput
,
)
(
DeployDisputeGameOutput
,
error
)
{
var
output
DeployDisputeGameOutput
inputAddr
:=
host
.
NewScriptAddress
()
outputAddr
:=
host
.
NewScriptAddress
()
cleanupInput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeployDisputeGameInput
](
host
,
inputAddr
,
&
input
)
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to insert DeployDisputeGameInput precompile: %w"
,
err
)
}
defer
cleanupInput
()
cleanupOutput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeployDisputeGameOutput
](
host
,
outputAddr
,
&
output
,
script
.
WithFieldSetter
[
*
DeployDisputeGameOutput
])
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to insert DeployDisputeGameOutput precompile: %w"
,
err
)
}
defer
cleanupOutput
()
implContract
:=
"DeployDisputeGame"
deployScript
,
cleanupDeploy
,
err
:=
script
.
WithScript
[
DeployDisputeGameScript
](
host
,
"DeployDisputeGame.s.sol"
,
implContract
)
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to load %s script: %w"
,
implContract
,
err
)
}
defer
cleanupDeploy
()
if
err
:=
deployScript
.
Run
(
inputAddr
,
outputAddr
);
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to run %s script: %w"
,
implContract
,
err
)
}
return
output
,
nil
return
RunBasicScript
[
DeployDisputeGameInput
,
DeployDisputeGameOutput
](
host
,
input
,
"DeployDisputeGame.s.sol"
,
"DeployDisputeGame"
)
}
op-deployer/pkg/deployer/opcm/mips.go
View file @
ee5c794d
package
opcm
import
(
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum-optimism/optimism/op-chain-ops/script"
...
...
@@ -33,33 +31,5 @@ func DeployMIPS(
host
*
script
.
Host
,
input
DeployMIPSInput
,
)
(
DeployMIPSOutput
,
error
)
{
var
output
DeployMIPSOutput
inputAddr
:=
host
.
NewScriptAddress
()
outputAddr
:=
host
.
NewScriptAddress
()
cleanupInput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeployMIPSInput
](
host
,
inputAddr
,
&
input
)
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to insert DeployMIPSInput precompile: %w"
,
err
)
}
defer
cleanupInput
()
cleanupOutput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeployMIPSOutput
](
host
,
outputAddr
,
&
output
,
script
.
WithFieldSetter
[
*
DeployMIPSOutput
])
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to insert DeployMIPSOutput precompile: %w"
,
err
)
}
defer
cleanupOutput
()
implContract
:=
"DeployMIPS"
deployScript
,
cleanupDeploy
,
err
:=
script
.
WithScript
[
DeployMIPSScript
](
host
,
"DeployMIPS.s.sol"
,
implContract
)
if
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to load %s script: %w"
,
implContract
,
err
)
}
defer
cleanupDeploy
()
if
err
:=
deployScript
.
Run
(
inputAddr
,
outputAddr
);
err
!=
nil
{
return
output
,
fmt
.
Errorf
(
"failed to run %s script: %w"
,
implContract
,
err
)
}
return
output
,
nil
return
RunBasicScript
[
DeployMIPSInput
,
DeployMIPSOutput
](
host
,
input
,
"DeployMIPS.s.sol"
,
"DeployMIPS"
)
}
op-deployer/pkg/deployer/opcm/opchain.go
View file @
ee5c794d
...
...
@@ -88,36 +88,7 @@ func DeployOPChainIsthmus(host *script.Host, input DeployOPChainInputIsthmus) (D
}
func
deployOPChain
[
T
any
](
host
*
script
.
Host
,
input
T
)
(
DeployOPChainOutput
,
error
)
{
var
dco
DeployOPChainOutput
inputAddr
:=
host
.
NewScriptAddress
()
outputAddr
:=
host
.
NewScriptAddress
()
cleanupInput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
T
](
host
,
inputAddr
,
&
input
)
if
err
!=
nil
{
return
dco
,
fmt
.
Errorf
(
"failed to insert DeployOPChainInput precompile: %w"
,
err
)
}
defer
cleanupInput
()
host
.
Label
(
inputAddr
,
"DeployOPChainInput"
)
cleanupOutput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeployOPChainOutput
](
host
,
outputAddr
,
&
dco
,
script
.
WithFieldSetter
[
*
DeployOPChainOutput
])
if
err
!=
nil
{
return
dco
,
fmt
.
Errorf
(
"failed to insert DeployOPChainOutput precompile: %w"
,
err
)
}
defer
cleanupOutput
()
host
.
Label
(
outputAddr
,
"DeployOPChainOutput"
)
deployScript
,
cleanupDeploy
,
err
:=
script
.
WithScript
[
DeployOPChainScript
](
host
,
"DeployOPChain.s.sol"
,
"DeployOPChain"
)
if
err
!=
nil
{
return
dco
,
fmt
.
Errorf
(
"failed to load DeployOPChain script: %w"
,
err
)
}
defer
cleanupDeploy
()
if
err
:=
deployScript
.
Run
(
inputAddr
,
outputAddr
);
err
!=
nil
{
return
dco
,
fmt
.
Errorf
(
"failed to run DeployOPChain script: %w"
,
err
)
}
return
dco
,
nil
return
RunBasicScript
[
T
,
DeployOPChainOutput
](
host
,
input
,
"DeployOPChain.s.sol"
,
"DeployOPChain"
)
}
type
ReadImplementationAddressesInput
struct
{
...
...
op-deployer/pkg/deployer/opcm/opcm.go
View file @
ee5c794d
...
...
@@ -40,10 +40,7 @@ func DeployOPCM(
host
*
script
.
Host
,
input
DeployOPCMInput
,
)
(
DeployOPCMOutput
,
error
)
{
scriptFile
:=
"DeployOPCM.s.sol"
contractName
:=
"DeployOPCM"
out
,
err
:=
RunBasicScript
[
DeployOPCMInput
,
DeployOPCMOutput
](
host
,
input
,
scriptFile
,
contractName
)
out
,
err
:=
RunBasicScript
[
DeployOPCMInput
,
DeployOPCMOutput
](
host
,
input
,
"DeployOPCM.s.sol"
,
"DeployOPCM"
)
if
err
!=
nil
{
return
DeployOPCMOutput
{},
fmt
.
Errorf
(
"failed to deploy OPCM: %w"
,
err
)
}
...
...
op-deployer/pkg/deployer/opcm/superchain.go
View file @
ee5c794d
package
opcm
import
(
"fmt"
"math/big"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
...
...
@@ -53,37 +52,5 @@ type DeploySuperchainOpts struct {
}
func
DeploySuperchain
(
h
*
script
.
Host
,
input
DeploySuperchainInput
)
(
DeploySuperchainOutput
,
error
)
{
var
dso
DeploySuperchainOutput
inputAddr
:=
h
.
NewScriptAddress
()
outputAddr
:=
h
.
NewScriptAddress
()
cleanupInput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeploySuperchainInput
](
h
,
inputAddr
,
&
input
)
if
err
!=
nil
{
return
dso
,
fmt
.
Errorf
(
"failed to insert DeploySuperchainInput precompile: %w"
,
err
)
}
defer
cleanupInput
()
cleanupOutput
,
err
:=
script
.
WithPrecompileAtAddress
[
*
DeploySuperchainOutput
](
h
,
outputAddr
,
&
dso
,
script
.
WithFieldSetter
[
*
DeploySuperchainOutput
],
)
if
err
!=
nil
{
return
dso
,
fmt
.
Errorf
(
"failed to insert DeploySuperchainOutput precompile: %w"
,
err
)
}
defer
cleanupOutput
()
deployScript
,
cleanupDeploy
,
err
:=
script
.
WithScript
[
DeploySuperchainScript
](
h
,
"DeploySuperchain.s.sol"
,
"DeploySuperchain"
)
if
err
!=
nil
{
return
dso
,
fmt
.
Errorf
(
"failed to load DeploySuperchain script: %w"
,
err
)
}
defer
cleanupDeploy
()
if
err
:=
deployScript
.
Run
(
inputAddr
,
outputAddr
);
err
!=
nil
{
return
dso
,
fmt
.
Errorf
(
"failed to run DeploySuperchain script: %w"
,
err
)
}
return
dso
,
nil
return
RunBasicScript
[
DeploySuperchainInput
,
DeploySuperchainOutput
](
h
,
input
,
"DeploySuperchain.s.sol"
,
"DeploySuperchain"
)
}
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