Skip to content

Commit

Permalink
op-program: Update verify scripts to supply a beacon endpoint. (#9707)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajsutton authored Mar 2, 2024
1 parent c04421a commit 4a3a18d
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1397,9 +1397,9 @@ jobs:
- restore_cache:
key: golang-build-cache
- run:
name: compat-goerli
name: compat-sepolia
command: |
make run-goerli-verify
make run-sepolia-verify
working_directory: op-program

check-generated-mocks-op-node:
Expand Down
6 changes: 3 additions & 3 deletions op-program/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ run-goerli-verify: op-program-host op-program-client
./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
env GO111MODULE=on go run ./verify/sepolia/cmd/sepolia.go --l1 $$SEPOLIA_L1URL --l1.beacon $$SEPOLIA_BEACON_URL --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"
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"
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
curl -L -o "$(COMPAT_DIR)/sepolia.tar.bz" https://github.com/ethereum-optimism/chain-test-data/releases/download/2024-03-01.2-branch/sepolia.tar.bz
tar jxf "$(COMPAT_DIR)/sepolia.tar.bz" -C "$(COMPAT_DIR)"
./bin/op-program `cat "$(COMPAT_DIR)/sepolia/args.txt"`

Expand Down
18 changes: 14 additions & 4 deletions op-program/verify/goerli/cmd/goerli.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,32 @@ import (
func main() {
var l1RpcUrl string
var l1RpcKind string
var l1BeaconUrl 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(&l1BeaconUrl, "l1.beacon", "", "L1 Beacon URL to use")
flag.StringVar(&l1RpcKind, "l1-rpckind", "", "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")
if l1RpcUrl == "" {
_, _ = fmt.Fprintln(os.Stderr, "Must specify --l1 RPC URL")
os.Exit(2)
}
if l1BeaconUrl == "" {
_, _ = fmt.Fprintln(os.Stderr, "Must specify --l1.beacon URL")
os.Exit(2)
}
if l2RpcUrl == "" {
_, _ = fmt.Fprintln(os.Stderr, "Must specify --l2 RPC URL")
os.Exit(2)
}

goerliOutputAddress := common.HexToAddress("0xE6Dfba0953616Bacab0c9A8ecb3a9BBa77FC15c0")
err := verify.Run(l1RpcUrl, l1RpcKind, l2RpcUrl, goerliOutputAddress, dataDir, "goerli", chainconfig.OPGoerliChainConfig)
err := verify.Run(l1RpcUrl, l1RpcKind, l1BeaconUrl, l2RpcUrl, goerliOutputAddress, dataDir, "goerli", chainconfig.OPGoerliChainConfig)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed: %v\n", err.Error())
os.Exit(1)
Expand Down
18 changes: 14 additions & 4 deletions op-program/verify/sepolia/cmd/sepolia.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,32 @@ import (
func main() {
var l1RpcUrl string
var l1RpcKind string
var l1BeaconUrl 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(&l1BeaconUrl, "l1.beacon", "", "L1 Beacon URL to use")
flag.StringVar(&l1RpcKind, "l1-rpckind", "", "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")
if l1RpcUrl == "" {
_, _ = fmt.Fprintln(os.Stderr, "Must specify --l1 RPC URL")
os.Exit(2)
}
if l1BeaconUrl == "" {
_, _ = fmt.Fprintln(os.Stderr, "Must specify --l1.beacon URL")
os.Exit(2)
}
if l2RpcUrl == "" {
_, _ = fmt.Fprintln(os.Stderr, "Must specify --l2 RPC URL")
os.Exit(2)
}

sepoliaOutputAddress := common.HexToAddress("0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F")
err := verify.Run(l1RpcUrl, l1RpcKind, l2RpcUrl, sepoliaOutputAddress, dataDir, "sepolia", chainconfig.OPSepoliaChainConfig)
err := verify.Run(l1RpcUrl, l1RpcKind, l1BeaconUrl, l2RpcUrl, sepoliaOutputAddress, dataDir, "sepolia", chainconfig.OPSepoliaChainConfig)
if err != nil {
_, _ = fmt.Fprintf(os.Stderr, "Failed: %v\n", err.Error())
os.Exit(1)
Expand Down
7 changes: 5 additions & 2 deletions op-program/verify/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)

func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common.Address, dataDir string, network string, chainCfg *params.ChainConfig) error {
func Run(l1RpcUrl string, l1RpcKind string, l1BeaconUrl string, l2RpcUrl string, l2OracleAddr common.Address, dataDir string, network string, chainCfg *params.ChainConfig) error {
ctx := context.Background()
logger := oplog.DefaultCLIConfig()
logger.Level = log.LevelDebug
Expand Down Expand Up @@ -140,8 +140,11 @@ func Run(l1RpcUrl string, l1RpcKind string, l2RpcUrl string, l2OracleAddr common
}
onlineCfg := offlineCfg
onlineCfg.L1URL = l1RpcUrl
onlineCfg.L1BeaconURL = l1BeaconUrl
onlineCfg.L2URL = l2RpcUrl
onlineCfg.L1RPCKind = sources.RPCProviderKind(l1RpcKind)
if l1RpcKind != "" {
onlineCfg.L1RPCKind = sources.RPCProviderKind(l1RpcKind)
}

fmt.Println("Running in online mode")
err = host.Main(oplog.NewLogger(os.Stderr, logger), &onlineCfg)
Expand Down

0 comments on commit 4a3a18d

Please sign in to comment.