Commit a3ac6a90 authored by Adrian Sutton's avatar Adrian Sutton Committed by GitHub

op-program: Update verification tests to not depend on L2OO (#9821)

* op-program: Update fpp-verify to not depend on L2OO

Add verify test for the first sepolia testnet block

* op-program: Capture first mainnet block

* op-program: Capture ecotone section of sepolia

* op-program: Remove logging of l1 head again to make testing easier
parent 53a235c9
...@@ -38,24 +38,25 @@ clean: ...@@ -38,24 +38,25 @@ clean:
test: test:
go test -v ./... go test -v ./...
verify-goerli: op-program-host op-program-client verify-sepolia: op-program-host op-program-client
env GO111MODULE=on go run ./verify/goerli/cmd/goerli.go --l1 $$L1URL --l2 $$L2URL env GO111MODULE=on go run ./verify/sepolia/cmd/sepolia.go --l1 $$SEPOLIA_L1URL --l1.beacon $$SEPOLIA_BEACON_URL --l2 $$SEPOLIA_L2URL --datadir /tmp/test-sepolia
run-goerli-verify: op-program-host op-program-client capture-mainnet-genesis: op-program-host op-program-client
mkdir -p "$(COMPAT_DIR)" rm -rf "$(COMPAT_DIR)/mainnet-genesis" "$(COMPAT_DIR)/mainnet-genesis.tar.bz"
curl -L -o "$(COMPAT_DIR)/goerli.tar.bz" https://github.com/ethereum-optimism/chain-test-data/releases/download/2023-10-11/goerli.tar.bz env GO111MODULE=on go run ./verify/mainnet/cmd/mainnet.go --l1 $$MAINNET_L1URL --l1.beacon $$MAINNET_BEACON_URL --l2 $$MAINNET_L2URL --datadir "$(COMPAT_DIR)/mainnet-genesis" --l1.head "0x4903424f6cc2cfba7c2bf8c8f48ca46721c963fa64b411cfee3697b781e3e5f1" --l2.start "105235063" --l2.end "105235064"
tar jxf "$(COMPAT_DIR)/goerli.tar.bz" -C "$(COMPAT_DIR)" tar jcf "$(COMPAT_DIR)/mainnet-genesis.tar.bz" -C "$(COMPAT_DIR)" mainnet-genesis
./bin/op-program `cat "$(COMPAT_DIR)/goerli/args.txt"`
verify-sepolia: op-program-host op-program-client capture-sepolia-delta: op-program-host op-program-client
env GO111MODULE=on go run ./verify/sepolia/cmd/sepolia.go --l1 $$SEPOLIA_L1URL --l1.beacon $$SEPOLIA_BEACON_URL --l2 $$SEPOLIA_L2URL rm -rf "$(COMPAT_DIR)/sepolia-delta" "$(COMPAT_DIR)/sepolia-delta.tar.bz"
env GO111MODULE=on go run ./verify/sepolia/cmd/sepolia.go --l1 $$SEPOLIA_L1URL --l1.beacon $$SEPOLIA_BEACON_URL --l2 $$SEPOLIA_L2URL --datadir "$(COMPAT_DIR)/sepolia-delta" --l1.head "0x935428728bcfcfeb2e5ba9175fd2890e52831dae221aa4d5dcffed8320edc001" --l2.start "8728200" --l2.end "8728320"
tar jcf "$(COMPAT_DIR)/sepolia-delta.tar.bz" -C "$(COMPAT_DIR)" sepolia-delta
capture-sepolia-verify: op-program-host op-program-client capture-sepolia-ecotone: op-program-host op-program-client
rm -rf "$(COMPAT_DIR)/sepolia" "$(COMPAT_DIR)/sepolia.tar.bz" rm -rf "$(COMPAT_DIR)/sepolia-ecotone" "$(COMPAT_DIR)/sepolia-ecotone.tar.bz"
env GO111MODULE=on go run ./verify/sepolia/cmd/sepolia.go --l1 $$SEPOLIA_L1URL --l1.beacon $$SEPOLIA_BEACON_URL --l2 $$SEPOLIA_L2URL --datadir "$(COMPAT_DIR)/sepolia" env GO111MODULE=on go run ./verify/sepolia/cmd/sepolia.go --l1 $$SEPOLIA_L1URL --l1.beacon $$SEPOLIA_BEACON_URL --l2 $$SEPOLIA_L2URL --datadir "$(COMPAT_DIR)/sepolia-ecotone" --l1.head "0x5d491a8c1e728a4e70720c09fefdaa083681a9421cd365af85220cf8bd4448a3" --l2.start "9205715" --l2.end "9205815"
tar jcf "$(COMPAT_DIR)/sepolia.tar.bz" -C "$(COMPAT_DIR)" sepolia tar jcf "$(COMPAT_DIR)/sepolia-ecotone.tar.bz" -C "$(COMPAT_DIR)" sepolia-ecotone
capture-chain-test-data: capture-sepolia-verify capture-chain-test-data: capture-mainnet-genesis capture-sepolia-delta
run-sepolia-verify: op-program-host op-program-client run-sepolia-verify: op-program-host op-program-client
mkdir -p "$(COMPAT_DIR)" mkdir -p "$(COMPAT_DIR)"
...@@ -70,10 +71,11 @@ run-sepolia-verify: op-program-host op-program-client ...@@ -70,10 +71,11 @@ run-sepolia-verify: op-program-host op-program-client
op-program-client-mips \ op-program-client-mips \
clean \ clean \
test \ test \
verify-goerli \
capture-goerli-verify \ capture-goerli-verify \
verify-sepolia \ verify-sepolia \
capture-sepolia-verify \ capture-mainnet-genesis \
capture-sepolia-delta \
capture-sepolia-ecotone \
capture-chain-test-data \ capture-chain-test-data \
run-goerli-verify \ run-goerli-verify \
run-sepolia-verify run-sepolia-verify
package main package main
import ( import (
"context"
"flag" "flag"
"fmt" "fmt"
"os" "os"
...@@ -16,12 +17,18 @@ func main() { ...@@ -16,12 +17,18 @@ func main() {
var l1BeaconUrl string var l1BeaconUrl string
var l2RpcUrl string var l2RpcUrl string
var dataDir string var dataDir string
var l1HashStr string
var l2Start uint64
var l2End uint64
flag.StringVar(&l1RpcUrl, "l1", "", "L1 RPC URL to use") flag.StringVar(&l1RpcUrl, "l1", "", "L1 RPC URL to use")
flag.StringVar(&l1BeaconUrl, "l1.beacon", "", "L1 Beacon URL to use") flag.StringVar(&l1BeaconUrl, "l1.beacon", "", "L1 Beacon URL to use")
flag.StringVar(&l1RpcKind, "l1-rpckind", "", "L1 RPC kind") flag.StringVar(&l1RpcKind, "l1-rpckind", "", "L1 RPC kind")
flag.StringVar(&l2RpcUrl, "l2", "", "L2 RPC URL to use") flag.StringVar(&l2RpcUrl, "l2", "", "L2 RPC URL to use")
flag.StringVar(&dataDir, "datadir", "", flag.StringVar(&dataDir, "datadir", "",
"Directory to use for storing pre-images. If not set a temporary directory will be used.") "Directory to use for storing pre-images. If not set a temporary directory will be used.")
flag.StringVar(&l1HashStr, "l1.head", "", "Hash of L1 block to use")
flag.Uint64Var(&l2Start, "l2.start", 0, "Block number of agreed L2 block")
flag.Uint64Var(&l2End, "l2.end", 0, "Block number of claimed L2 block")
flag.Parse() flag.Parse()
if l1RpcUrl == "" { if l1RpcUrl == "" {
...@@ -37,8 +44,22 @@ func main() { ...@@ -37,8 +44,22 @@ func main() {
os.Exit(2) os.Exit(2)
} }
goerliOutputAddress := common.HexToAddress("0xE6Dfba0953616Bacab0c9A8ecb3a9BBa77FC15c0") runner, err := verify.NewRunner(l1RpcUrl, l1RpcKind, l1BeaconUrl, l2RpcUrl, dataDir, "op-mainnet", chainconfig.OPMainnetChainConfig)
err := verify.Run(l1RpcUrl, l1RpcKind, l1BeaconUrl, l2RpcUrl, goerliOutputAddress, dataDir, "goerli", chainconfig.OPGoerliChainConfig) if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed to create runner: %v\n", err.Error())
os.Exit(1)
}
if l1HashStr == "" && l2Start == 0 && l2End == 0 {
err = runner.RunToFinalized(context.Background())
} else {
l1Hash := common.HexToHash(l1HashStr)
if l1Hash == (common.Hash{}) {
_, _ = fmt.Fprintf(os.Stderr, "Invalid --l1.head: %v\n", l1HashStr)
os.Exit(2)
}
err = runner.RunBetweenBlocks(context.Background(), l1Hash, l2Start, l2End)
}
if err != nil { if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed: %v\n", err.Error()) _, _ = fmt.Fprintf(os.Stderr, "Failed: %v\n", err.Error())
os.Exit(1) os.Exit(1)
......
package main package main
import ( import (
"context"
"flag" "flag"
"fmt" "fmt"
"os" "os"
...@@ -16,12 +17,18 @@ func main() { ...@@ -16,12 +17,18 @@ func main() {
var l1BeaconUrl string var l1BeaconUrl string
var l2RpcUrl string var l2RpcUrl string
var dataDir string var dataDir string
var l1HashStr string
var l2Start uint64
var l2End uint64
flag.StringVar(&l1RpcUrl, "l1", "", "L1 RPC URL to use") flag.StringVar(&l1RpcUrl, "l1", "", "L1 RPC URL to use")
flag.StringVar(&l1BeaconUrl, "l1.beacon", "", "L1 Beacon URL to use") flag.StringVar(&l1BeaconUrl, "l1.beacon", "", "L1 Beacon URL to use")
flag.StringVar(&l1RpcKind, "l1-rpckind", "", "L1 RPC kind") flag.StringVar(&l1RpcKind, "l1-rpckind", "", "L1 RPC kind")
flag.StringVar(&l2RpcUrl, "l2", "", "L2 RPC URL to use") flag.StringVar(&l2RpcUrl, "l2", "", "L2 RPC URL to use")
flag.StringVar(&dataDir, "datadir", "", flag.StringVar(&dataDir, "datadir", "",
"Directory to use for storing pre-images. If not set a temporary directory will be used.") "Directory to use for storing pre-images. If not set a temporary directory will be used.")
flag.StringVar(&l1HashStr, "l1.head", "", "Hash of L1 block to use")
flag.Uint64Var(&l2Start, "l2.start", 0, "Block number of agreed L2 block")
flag.Uint64Var(&l2End, "l2.end", 0, "Block number of claimed L2 block")
flag.Parse() flag.Parse()
if l1RpcUrl == "" { if l1RpcUrl == "" {
...@@ -37,8 +44,22 @@ func main() { ...@@ -37,8 +44,22 @@ func main() {
os.Exit(2) os.Exit(2)
} }
sepoliaOutputAddress := common.HexToAddress("0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F") runner, err := verify.NewRunner(l1RpcUrl, l1RpcKind, l1BeaconUrl, l2RpcUrl, dataDir, "sepolia", chainconfig.OPSepoliaChainConfig)
err := verify.Run(l1RpcUrl, l1RpcKind, l1BeaconUrl, l2RpcUrl, sepoliaOutputAddress, dataDir, "sepolia", chainconfig.OPSepoliaChainConfig) if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed to create runner: %v\n", err.Error())
os.Exit(1)
}
if l1HashStr == "" && l2Start == 0 && l2End == 0 {
err = runner.RunToFinalized(context.Background())
} else {
l1Hash := common.HexToHash(l1HashStr)
if l1Hash == (common.Hash{}) {
_, _ = fmt.Fprintf(os.Stderr, "Invalid --l1.head: %v\n", l1HashStr)
os.Exit(2)
}
err = runner.RunBetweenBlocks(context.Background(), l1Hash, l2Start, l2End)
}
if err != nil { if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed: %v\n", err.Error()) _, _ = fmt.Fprintf(os.Stderr, "Failed: %v\n", err.Error())
os.Exit(1) os.Exit(1)
......
This diff is collapsed.
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