-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
op-deployer: Add more FP deploy scripts
Adds additional op-deployer scripts to support alternative fault proof implementations. This is a prerequisite to deleting the allocs files, since many tests need a fast dispute game and an alphabet VM.
- Loading branch information
Showing
28 changed files
with
803 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package opcm | ||
|
||
import ( | ||
"github.com/ethereum-optimism/optimism/op-chain-ops/script" | ||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
type DeployAlphabetVMInput struct { | ||
AbsolutePrestate common.Hash | ||
PreimageOracle common.Address | ||
} | ||
|
||
type DeployAlphabetVMOutput struct { | ||
AlphabetVM common.Address | ||
} | ||
|
||
func DeployAlphabetVM( | ||
host *script.Host, | ||
input DeployAlphabetVMInput, | ||
) (DeployAlphabetVMOutput, error) { | ||
return RunScriptSingle[DeployAlphabetVMInput, DeployAlphabetVMOutput]( | ||
host, | ||
input, | ||
"DeployAlphabetVM.s.sol", | ||
"DeployAlphabetVM", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package opcm | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/broadcaster" | ||
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/testutil" | ||
"github.com/ethereum-optimism/optimism/op-deployer/pkg/env" | ||
"github.com/ethereum-optimism/optimism/op-service/testlog" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/log" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDeployAlphabetVM(t *testing.T) { | ||
t.Parallel() | ||
|
||
_, artifacts := testutil.LocalArtifacts(t) | ||
|
||
host, err := env.DefaultScriptHost( | ||
broadcaster.NoopBroadcaster(), | ||
testlog.Logger(t, log.LevelInfo), | ||
common.Address{'D'}, | ||
artifacts, | ||
) | ||
require.NoError(t, err) | ||
|
||
input := DeployAlphabetVMInput{ | ||
AbsolutePrestate: common.Hash{'A'}, | ||
PreimageOracle: common.Address{'O'}, | ||
} | ||
|
||
output, err := DeployAlphabetVM(host, input) | ||
require.NoError(t, err) | ||
|
||
require.NotEmpty(t, output.AlphabetVM) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package opcm | ||
|
||
import ( | ||
"github.com/ethereum-optimism/optimism/op-chain-ops/script" | ||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
type SetDisputeGameImplInput struct { | ||
Factory common.Address | ||
Impl common.Address | ||
GameType uint32 | ||
} | ||
|
||
func SetDisputeGameImpl( | ||
h *script.Host, | ||
input SetDisputeGameImplInput, | ||
) error { | ||
return RunScriptVoid[SetDisputeGameImplInput]( | ||
h, | ||
input, | ||
"SetDisputeGameImpl.s.sol", | ||
"SetDisputeGameImpl", | ||
) | ||
} |
55 changes: 55 additions & 0 deletions
55
op-deployer/pkg/deployer/opcm/dispute_game_factory_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package opcm | ||
|
||
import ( | ||
"context" | ||
"os" | ||
"testing" | ||
"time" | ||
|
||
"github.com/ethereum/go-ethereum/rpc" | ||
|
||
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/broadcaster" | ||
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/testutil" | ||
"github.com/ethereum-optimism/optimism/op-deployer/pkg/env" | ||
"github.com/ethereum-optimism/optimism/op-service/testlog" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/log" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestSetDisputeGameImpl(t *testing.T) { | ||
t.Parallel() | ||
|
||
_, artifacts := testutil.LocalArtifacts(t) | ||
|
||
l1RPCUrl := os.Getenv("SEPOLIA_RPC_URL") | ||
require.NotEmpty(t, l1RPCUrl, "SEPOLIA_RPC_URL must be set") | ||
|
||
l1RPC, err := rpc.Dial(l1RPCUrl) | ||
require.NoError(t, err) | ||
|
||
// OP Sepolia DGF owner | ||
deployer := common.HexToAddress("0x1Eb2fFc903729a0F03966B917003800b145F56E2") | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute) | ||
defer cancel() | ||
host, err := env.DefaultForkedScriptHost( | ||
ctx, | ||
broadcaster.NoopBroadcaster(), | ||
testlog.Logger(t, log.LevelInfo), | ||
deployer, | ||
artifacts, | ||
l1RPC, | ||
) | ||
require.NoError(t, err) | ||
|
||
// Use OP Sepolia's dispute game factory | ||
factoryAddr := common.HexToAddress("0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1") | ||
|
||
input := SetDisputeGameImplInput{ | ||
Factory: factoryAddr, | ||
Impl: common.Address{'I'}, | ||
GameType: 999, | ||
} | ||
require.NoError(t, SetDisputeGameImpl(host, input)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package opcm | ||
|
||
import ( | ||
"math/big" | ||
|
||
"github.com/ethereum-optimism/optimism/op-chain-ops/script" | ||
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
type DeployPreimageOracleInput struct { | ||
MinProposalSize *big.Int | ||
ChallengePeriod *big.Int | ||
} | ||
|
||
type DeployPreimageOracleOutput struct { | ||
PreimageOracle common.Address | ||
} | ||
|
||
func DeployPreimageOracle( | ||
host *script.Host, | ||
input DeployPreimageOracleInput, | ||
) (DeployPreimageOracleOutput, error) { | ||
return RunScriptSingle[DeployPreimageOracleInput, DeployPreimageOracleOutput]( | ||
host, | ||
input, | ||
"DeployPreimageOracle.s.sol", | ||
"DeployPreimageOracle", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package opcm | ||
|
||
import ( | ||
"math/big" | ||
"testing" | ||
|
||
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/broadcaster" | ||
"github.com/ethereum-optimism/optimism/op-deployer/pkg/deployer/testutil" | ||
"github.com/ethereum-optimism/optimism/op-deployer/pkg/env" | ||
"github.com/ethereum-optimism/optimism/op-service/testlog" | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/log" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDeployPreimageOracle(t *testing.T) { | ||
t.Parallel() | ||
|
||
_, artifacts := testutil.LocalArtifacts(t) | ||
|
||
host, err := env.DefaultScriptHost( | ||
broadcaster.NoopBroadcaster(), | ||
testlog.Logger(t, log.LevelInfo), | ||
common.Address{'D'}, | ||
artifacts, | ||
) | ||
require.NoError(t, err) | ||
|
||
input := DeployPreimageOracleInput{ | ||
MinProposalSize: big.NewInt(123), | ||
ChallengePeriod: big.NewInt(456), | ||
} | ||
|
||
output, err := DeployPreimageOracle(host, input) | ||
require.NoError(t, err) | ||
|
||
require.NotEmpty(t, output.PreimageOracle) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.