Commit 28011644 authored by Adrian Sutton's avatar Adrian Sutton

op-challenger: Don't hard code supported networks in unit test

parent b49317b1
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"testing" "testing"
"github.com/ethereum-optimism/optimism/op-challenger/config" "github.com/ethereum-optimism/optimism/op-challenger/config"
"github.com/ethereum-optimism/optimism/op-node/chaincfg"
"github.com/ethereum-optimism/optimism/op-service/txmgr" "github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
...@@ -15,7 +16,8 @@ import ( ...@@ -15,7 +16,8 @@ import (
var ( var (
l1EthRpc = "http://example.com:8545" l1EthRpc = "http://example.com:8545"
gameAddressValue = "0xaa00000000000000000000000000000000000000" gameAddressValue = "0xaa00000000000000000000000000000000000000"
cannonNetwork = "mainnet" cannonNetwork = chaincfg.AvailableNetworks()[0]
otherCannonNetwork = chaincfg.AvailableNetworks()[1]
cannonBin = "./bin/cannon" cannonBin = "./bin/cannon"
cannonServer = "./bin/op-program" cannonServer = "./bin/op-program"
cannonPreState = "./pre.json" cannonPreState = "./pre.json"
...@@ -247,7 +249,7 @@ func TestMustNotSpecifyNetworkAndRollup(t *testing.T) { ...@@ -247,7 +249,7 @@ func TestMustNotSpecifyNetworkAndRollup(t *testing.T) {
t, t,
"flag cannon-network can not be used with cannon-rollup-config and cannon-l2-genesis", "flag cannon-network can not be used with cannon-rollup-config and cannon-l2-genesis",
addRequiredArgsExcept(config.TraceTypeCannon, "--cannon-network", addRequiredArgsExcept(config.TraceTypeCannon, "--cannon-network",
"--cannon-network=mainnet", "--cannon-rollup-config=rollup.json")) "--cannon-network", cannonNetwork, "--cannon-rollup-config=rollup.json"))
} }
func TestCannonNetwork(t *testing.T) { func TestCannonNetwork(t *testing.T) {
...@@ -261,8 +263,8 @@ func TestCannonNetwork(t *testing.T) { ...@@ -261,8 +263,8 @@ func TestCannonNetwork(t *testing.T) {
}) })
t.Run("Valid", func(t *testing.T) { t.Run("Valid", func(t *testing.T) {
cfg := configForArgs(t, addRequiredArgsExcept(config.TraceTypeCannon, "--cannon-network", "--cannon-network=goerli")) cfg := configForArgs(t, addRequiredArgsExcept(config.TraceTypeCannon, "--cannon-network", "--cannon-network", otherCannonNetwork))
require.Equal(t, "goerli", cfg.CannonNetwork) require.Equal(t, otherCannonNetwork, cfg.CannonNetwork)
}) })
} }
......
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