Commit 7998bed9 authored by Inphi's avatar Inphi Committed by GitHub

op-program: Migrate verify program to sepolia (#9217)

* op-program: Migrate verify program to sepolia

* op-program: Continue verifying goerli but capture data for sepolia.

Should get the tests passing so we can merge and trigger a release.

* op-program: Use debug_geth - proxyd isn't supporting standard

* op-program: Use separate packages for goerli and sepolia

---------
Co-authored-by: default avatarAdrian Sutton <adrian@oplabs.co>
parent d96975f2
...@@ -1255,9 +1255,9 @@ jobs: ...@@ -1255,9 +1255,9 @@ jobs:
steps: steps:
- checkout - checkout
- run: - run:
name: verify-goerli name: verify-sepolia
command: | command: |
make verify-goerli make verify-sepolia
working_directory: op-program working_directory: op-program
- notify-failures-on-develop - notify-failures-on-develop
......
...@@ -39,14 +39,7 @@ test: ...@@ -39,14 +39,7 @@ test:
go test -v ./... go test -v ./...
verify-goerli: op-program-host op-program-client verify-goerli: op-program-host op-program-client
env GO111MODULE=on go run ./verify/cmd/goerli.go --l1 $$L1URL --l2 $$L2URL env GO111MODULE=on go run ./verify/goerli/cmd/goerli.go --l1 $$L1URL --l2 $$L2URL
capture-goerli-verify: op-program-host op-program-client
rm -rf "$(COMPAT_DIR)/goerli" "$(COMPAT_DIR)/goerli.tar.bz"
env GO111MODULE=on go run ./verify/cmd/goerli.go --l1 $$L1URL --l2 $$L2URL --datadir "$(COMPAT_DIR)/goerli"
tar jcf "$(COMPAT_DIR)/goerli.tar.bz" -C "$(COMPAT_DIR)" goerli
capture-chain-test-data: capture-goerli-verify
run-goerli-verify: op-program-host op-program-client run-goerli-verify: op-program-host op-program-client
mkdir -p "$(COMPAT_DIR)" mkdir -p "$(COMPAT_DIR)"
...@@ -54,6 +47,22 @@ run-goerli-verify: op-program-host op-program-client ...@@ -54,6 +47,22 @@ run-goerli-verify: op-program-host op-program-client
tar jxf "$(COMPAT_DIR)/goerli.tar.bz" -C "$(COMPAT_DIR)" tar jxf "$(COMPAT_DIR)/goerli.tar.bz" -C "$(COMPAT_DIR)"
./bin/op-program `cat "$(COMPAT_DIR)/goerli/args.txt"` ./bin/op-program `cat "$(COMPAT_DIR)/goerli/args.txt"`
verify-sepolia: op-program-host op-program-client
env GO111MODULE=on go run ./verify/sepolia/cmd/sepolia.go --l1 $$SEPOLIA_L1URL --l2 $$SEPOLIA_L2URL
capture-sepolia-verify: op-program-host op-program-client
rm -rf "$(COMPAT_DIR)/sepolia" "$(COMPAT_DIR)/sepolia.tar.bz"
env GO111MODULE=on go run ./verify/sepolia/cmd/sepolia.go --l1 $$SEPOLIA_L1URL --l2 $$SEPOLIA_L2URL --datadir "$(COMPAT_DIR)/sepolia"
tar jcf "$(COMPAT_DIR)/sepolia.tar.bz" -C "$(COMPAT_DIR)" sepolia
capture-chain-test-data: capture-sepolia-verify
run-sepolia-verify: op-program-host op-program-client
mkdir -p "$(COMPAT_DIR)"
curl -L -o "$(COMPAT_DIR)/sepolia.tar.bz" https://github.com/ethereum-optimism/chain-test-data/releases/download/2023-10-11/sepolia.tar.bz
tar jxf "$(COMPAT_DIR)/sepolia.tar.bz" -C "$(COMPAT_DIR)"
./bin/op-program `cat "$(COMPAT_DIR)/sepolia/args.txt"`
.PHONY: \ .PHONY: \
op-program \ op-program \
op-program-host \ op-program-host \
...@@ -63,5 +72,8 @@ run-goerli-verify: op-program-host op-program-client ...@@ -63,5 +72,8 @@ run-goerli-verify: op-program-host op-program-client
test \ test \
verify-goerli \ verify-goerli \
capture-goerli-verify \ capture-goerli-verify \
verify-sepolia \
capture-sepolia-verify \
capture-chain-test-data \ capture-chain-test-data \
run-goerli-verify run-goerli-verify \
run-sepolia-verify
package main
import (
"flag"
"fmt"
"os"
"github.com/ethereum-optimism/optimism/op-program/chainconfig"
"github.com/ethereum-optimism/optimism/op-program/verify"
"github.com/ethereum/go-ethereum/common"
)
func main() {
var l1RpcUrl string
var l1RpcKind string
var l2RpcUrl string
var dataDir string
flag.StringVar(&l1RpcUrl, "l1", "", "L1 RPC URL to use")
flag.StringVar(&l1RpcKind, "l1-rpckind", "debug_geth", "L1 RPC kind")
flag.StringVar(&l2RpcUrl, "l2", "", "L2 RPC URL to use")
flag.StringVar(&dataDir, "datadir", "",
"Directory to use for storing pre-images. If not set a temporary directory will be used.")
flag.Parse()
if l1RpcUrl == "" || l2RpcUrl == "" {
_, _ = fmt.Fprintln(os.Stderr, "Must specify --l1 and --l2 RPC URLs")
os.Exit(2)
}
goerliOutputAddress := common.HexToAddress("0xE6Dfba0953616Bacab0c9A8ecb3a9BBa77FC15c0")
err := verify.Run(l1RpcUrl, l1RpcKind, l2RpcUrl, goerliOutputAddress, dataDir, "goerli", chainconfig.OPGoerliChainConfig)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed: %v\n", err.Error())
os.Exit(1)
}
}
package main
import (
"flag"
"fmt"
"os"
"github.com/ethereum-optimism/optimism/op-program/chainconfig"
"github.com/ethereum-optimism/optimism/op-program/verify"
"github.com/ethereum/go-ethereum/common"
)
func main() {
var l1RpcUrl string
var l1RpcKind string
var l2RpcUrl string
var dataDir string
flag.StringVar(&l1RpcUrl, "l1", "", "L1 RPC URL to use")
flag.StringVar(&l1RpcKind, "l1-rpckind", "debug_geth", "L1 RPC kind")
flag.StringVar(&l2RpcUrl, "l2", "", "L2 RPC URL to use")
flag.StringVar(&dataDir, "datadir", "",
"Directory to use for storing pre-images. If not set a temporary directory will be used.")
flag.Parse()
if l1RpcUrl == "" || l2RpcUrl == "" {
_, _ = fmt.Fprintln(os.Stderr, "Must specify --l1 and --l2 RPC URLs")
os.Exit(2)
}
sepoliaOutputAddress := common.HexToAddress("0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F")
err := verify.Run(l1RpcUrl, l1RpcKind, l2RpcUrl, sepoliaOutputAddress, dataDir, "sepolia", chainconfig.OPSepoliaChainConfig)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed: %v\n", err.Error())
os.Exit(1)
}
}
package main package verify
import ( import (
"context" "context"
"flag"
"fmt" "fmt"
"math/big" "math/big"
"os" "os"
...@@ -11,44 +10,19 @@ import ( ...@@ -11,44 +10,19 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/bindings" "github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-node/rollup" "github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-program/chainconfig"
"github.com/ethereum-optimism/optimism/op-program/host" "github.com/ethereum-optimism/optimism/op-program/host"
config "github.com/ethereum-optimism/optimism/op-program/host/config" "github.com/ethereum-optimism/optimism/op-program/host/config"
oplog "github.com/ethereum-optimism/optimism/op-service/log" oplog "github.com/ethereum-optimism/optimism/op-service/log"
"github.com/ethereum-optimism/optimism/op-service/sources" "github.com/ethereum-optimism/optimism/op-service/sources"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
) )
func main() { func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common.Address, dataDir string, network string, chainCfg *params.ChainConfig) error {
var l1RpcUrl string
var l1RpcKind string
var l2RpcUrl string
var dataDir string
flag.StringVar(&l1RpcUrl, "l1", "", "L1 RPC URL to use")
flag.StringVar(&l1RpcKind, "l1-rpckind", "alchemy", "L1 RPC kind")
flag.StringVar(&l2RpcUrl, "l2", "", "L2 RPC URL to use")
flag.StringVar(&dataDir, "datadir", "",
"Directory to use for storing pre-images. If not set a temporary directory will be used.")
flag.Parse()
if l1RpcUrl == "" || l2RpcUrl == "" {
_, _ = fmt.Fprintln(os.Stderr, "Must specify --l1 and --l2 RPC URLs")
os.Exit(2)
}
goerliOutputAddress := common.HexToAddress("0xE6Dfba0953616Bacab0c9A8ecb3a9BBa77FC15c0")
err := Run(l1RpcUrl, l1RpcKind, l2RpcUrl, goerliOutputAddress, dataDir)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed: %v\n", err.Error())
os.Exit(1)
}
}
func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common.Address, dataDir string) error {
ctx := context.Background() ctx := context.Background()
l1RpcClient, err := rpc.Dial(l1RpcUrl) l1RpcClient, err := rpc.Dial(l1RpcUrl)
if err != nil { if err != nil {
...@@ -122,7 +96,7 @@ func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common ...@@ -122,7 +96,7 @@ func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common
fmt.Printf("Using dir: %s\n", dataDir) fmt.Printf("Using dir: %s\n", dataDir)
args := []string{ args := []string{
"--log.level", "DEBUG", "--log.level", "DEBUG",
"--network", "goerli", "--network", network,
"--exec", "./bin/op-program-client", "--exec", "./bin/op-program-client",
"--datadir", dataDir, "--datadir", dataDir,
"--l1.head", l1Head.Hex(), "--l1.head", l1Head.Hex(),
...@@ -132,7 +106,7 @@ func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common ...@@ -132,7 +106,7 @@ func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common
"--l2.blocknumber", l2BlockNumber.String(), "--l2.blocknumber", l2BlockNumber.String(),
} }
argsStr := strings.Join(args, " ") argsStr := strings.Join(args, " ")
// args.txt is used by run-goerli-verify job for offline verification in CI // args.txt is used by the verify job for offline verification in CI
if err := os.WriteFile(filepath.Join(dataDir, "args.txt"), []byte(argsStr), 0644); err != nil { if err := os.WriteFile(filepath.Join(dataDir, "args.txt"), []byte(argsStr), 0644); err != nil {
fmt.Printf("Could not write args: %v", err) fmt.Printf("Could not write args: %v", err)
os.Exit(1) os.Exit(1)
...@@ -141,14 +115,14 @@ func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common ...@@ -141,14 +115,14 @@ func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common
logger := oplog.DefaultCLIConfig() logger := oplog.DefaultCLIConfig()
logger.Level = log.LvlDebug logger.Level = log.LvlDebug
rollupCfg, err := rollup.LoadOPStackRollupConfig(chainconfig.OPGoerliChainConfig.ChainID.Uint64()) rollupCfg, err := rollup.LoadOPStackRollupConfig(chainCfg.ChainID.Uint64())
if err != nil { if err != nil {
return fmt.Errorf("failed to load rollup config: %w", err) return fmt.Errorf("failed to load rollup config: %w", err)
} }
offlineCfg := config.Config{ offlineCfg := config.Config{
Rollup: rollupCfg, Rollup: rollupCfg,
DataDir: dataDir, DataDir: dataDir,
L2ChainConfig: chainconfig.OPGoerliChainConfig, L2ChainConfig: chainCfg,
L2Head: l2Head, L2Head: l2Head,
L2OutputRoot: agreedOutput.OutputRoot, L2OutputRoot: agreedOutput.OutputRoot,
L2Claim: l2Claim, L2Claim: l2Claim,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment