From cbb43134cc8735583feecaf9c4b4e7a674653be3 Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Tue, 10 Dec 2024 13:24:07 -0500 Subject: [PATCH 01/12] clean up rpc replacement code and add local test case --- superchain/init.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/superchain/init.go b/superchain/init.go index 8bd5837ad..322f2805e 100644 --- a/superchain/init.go +++ b/superchain/init.go @@ -14,6 +14,14 @@ func init() { if err != nil { panic(fmt.Errorf("failed to read superchain dir: %w", err)) } + + runningInCodegen := os.Getenv("CODEGEN") != "" + runningInCI := os.Getenv("CI") == "true" + runningInTest := os.Getenv("TEST_DIRECTORY") != "" + + // Impute endpoints only if we're not in codegen mode. + replaceL1Rpc := !runningInCodegen && (runningInCI || runningInTest) + // iterate over superchain-target entries for _, s := range superchainTargets { @@ -70,18 +78,12 @@ func init() { GenesisSystemConfigs[chainConfig.ChainID] = &chainConfig.Genesis.SystemConfig } - // Impute endpoints only if we're not in codegen mode. - if os.Getenv("CODEGEN") == "" { - runningInCI := os.Getenv("CI") + if replaceL1Rpc { switch superchainEntry.Superchain { case "mainnet": - if runningInCI == "true" { - superchainEntry.Config.L1.PublicRPC = "https://ci-mainnet-l1-archive.optimism.io" - } + superchainEntry.Config.L1.PublicRPC = "https://ci-mainnet-l1-archive.optimism.io" case "sepolia", "sepolia-dev-0": - if runningInCI == "true" { - superchainEntry.Config.L1.PublicRPC = "https://ci-sepolia-l1-archive.optimism.io" - } + superchainEntry.Config.L1.PublicRPC = "https://ci-sepolia-l1-archive.optimism.io" } } From 96787c7debc87af0d88a89a3a57f07283b6b3085 Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Tue, 10 Dec 2024 13:30:13 -0500 Subject: [PATCH 02/12] add TestRPC field to superchain configs and read CI RPC endpoint replacement --- superchain/configs/mainnet/superchain.toml | 1 + superchain/configs/sepolia-dev-0/superchain.toml | 1 + superchain/configs/sepolia/superchain.toml | 1 + superchain/init.go | 7 +------ superchain/superchain.go | 1 + superchain/superchain_test.go | 2 ++ 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/superchain/configs/mainnet/superchain.toml b/superchain/configs/mainnet/superchain.toml index b9f0a75a5..26e40c3e9 100644 --- a/superchain/configs/mainnet/superchain.toml +++ b/superchain/configs/mainnet/superchain.toml @@ -13,4 +13,5 @@ holocene_time = 1736445601 # Thu 09 Jan 2025 18:00:01 UTC [l1] chain_id = 1 public_rpc = "https://ethereum-rpc.publicnode.com" + test_rpc = "https://ci-mainnet-l1-archive.optimism.io" explorer = "https://etherscan.io" diff --git a/superchain/configs/sepolia-dev-0/superchain.toml b/superchain/configs/sepolia-dev-0/superchain.toml index d728f0ea9..9b60eef86 100644 --- a/superchain/configs/sepolia-dev-0/superchain.toml +++ b/superchain/configs/sepolia-dev-0/superchain.toml @@ -12,4 +12,5 @@ holocene_time = 1731682800 # Fri Nov 15 15:00:00 UTC 2024 [l1] chain_id = 11155111 public_rpc = "https://ethereum-sepolia-rpc.publicnode.com" + test_rpc = "https://ci-sepolia-l1-archive.optimism.io" explorer = "https://sepolia.etherscan.io" diff --git a/superchain/configs/sepolia/superchain.toml b/superchain/configs/sepolia/superchain.toml index 821cb10a3..0ed8933ee 100644 --- a/superchain/configs/sepolia/superchain.toml +++ b/superchain/configs/sepolia/superchain.toml @@ -13,4 +13,5 @@ holocene_time = 1732633200 # Tue Nov 26 15:00:00 UTC 2024 [l1] chain_id = 11155111 public_rpc = "https://ethereum-sepolia-rpc.publicnode.com" + test_rpc = "https://ci-sepolia-l1-archive.optimism.io" explorer = "https://sepolia.etherscan.io" diff --git a/superchain/init.go b/superchain/init.go index 322f2805e..980cb8d6d 100644 --- a/superchain/init.go +++ b/superchain/init.go @@ -79,12 +79,7 @@ func init() { } if replaceL1Rpc { - switch superchainEntry.Superchain { - case "mainnet": - superchainEntry.Config.L1.PublicRPC = "https://ci-mainnet-l1-archive.optimism.io" - case "sepolia", "sepolia-dev-0": - superchainEntry.Config.L1.PublicRPC = "https://ci-sepolia-l1-archive.optimism.io" - } + superchainEntry.Config.L1.PublicRPC = superchainEntry.Config.L1.TestRPC } Superchains[superchainEntry.Superchain] = &superchainEntry diff --git a/superchain/superchain.go b/superchain/superchain.go index 8c85fe873..30cec78e8 100644 --- a/superchain/superchain.go +++ b/superchain/superchain.go @@ -505,6 +505,7 @@ type Genesis struct { type SuperchainL1Info struct { ChainID uint64 `toml:"chain_id"` PublicRPC string `toml:"public_rpc"` + TestRPC string `toml:"test_rpc"` Explorer string `toml:"explorer"` } diff --git a/superchain/superchain_test.go b/superchain/superchain_test.go index 6d519fbd6..db06d039c 100644 --- a/superchain/superchain_test.go +++ b/superchain/superchain_test.go @@ -206,6 +206,7 @@ isthmus_time = 7 [l1] chain_id = 314 public_rpc = "https://disney.com" + test_rpc = "https://ci.disney.com" explorer = "https://disneyscan.io" ` @@ -216,6 +217,7 @@ isthmus_time = 7 expectL1Info := SuperchainL1Info{ ChainID: 314, PublicRPC: "https://disney.com", + TestRPC: "https://ci.disney.com", Explorer: "https://disneyscan.io", } From 4c04892408f89181289807d49857ad1dd16a87d7 Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Tue, 10 Dec 2024 13:31:17 -0500 Subject: [PATCH 03/12] lint --- superchain/superchain.go | 2 +- superchain/superchain_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/superchain/superchain.go b/superchain/superchain.go index 30cec78e8..c0efa420e 100644 --- a/superchain/superchain.go +++ b/superchain/superchain.go @@ -505,7 +505,7 @@ type Genesis struct { type SuperchainL1Info struct { ChainID uint64 `toml:"chain_id"` PublicRPC string `toml:"public_rpc"` - TestRPC string `toml:"test_rpc"` + TestRPC string `toml:"test_rpc"` Explorer string `toml:"explorer"` } diff --git a/superchain/superchain_test.go b/superchain/superchain_test.go index db06d039c..289de1a5d 100644 --- a/superchain/superchain_test.go +++ b/superchain/superchain_test.go @@ -217,7 +217,7 @@ isthmus_time = 7 expectL1Info := SuperchainL1Info{ ChainID: 314, PublicRPC: "https://disney.com", - TestRPC: "https://ci.disney.com", + TestRPC: "https://ci.disney.com", Explorer: "https://disneyscan.io", } From 2ae7a7c9cd62b5217e42f9ed9859d664b07a85c3 Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Tue, 10 Dec 2024 13:31:23 -0500 Subject: [PATCH 04/12] codegen --- superchain/configs/configs.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/superchain/configs/configs.json b/superchain/configs/configs.json index 7d34c082c..541af2106 100644 --- a/superchain/configs/configs.json +++ b/superchain/configs/configs.json @@ -7,6 +7,7 @@ "L1": { "ChainID": 1, "PublicRPC": "https://ethereum-rpc.publicnode.com", + "TestRPC": "https://ci-mainnet-l1-archive.optimism.io", "Explorer": "https://etherscan.io" }, "ProtocolVersionsAddr": "0x8062AbC286f5e7D9428a0Ccb9AbD71e50d93b935", @@ -1546,6 +1547,7 @@ "L1": { "ChainID": 11155111, "PublicRPC": "https://ethereum-sepolia-rpc.publicnode.com", + "TestRPC": "https://ci-sepolia-l1-archive.optimism.io", "Explorer": "https://sepolia.etherscan.io" }, "ProtocolVersionsAddr": "0x79ADD5713B383DAa0a138d3C4780C7A1804a8090", @@ -2728,6 +2730,7 @@ "L1": { "ChainID": 11155111, "PublicRPC": "https://ethereum-sepolia-rpc.publicnode.com", + "TestRPC": "https://ci-sepolia-l1-archive.optimism.io", "Explorer": "https://sepolia.etherscan.io" }, "ProtocolVersionsAddr": "0x252CbE9517F731C618961D890D534183822dcC8d", From 7e08360e507c3d1c07c32cc3bfef4058ee5ebc43 Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Tue, 10 Dec 2024 13:37:18 -0500 Subject: [PATCH 05/12] add tailnet note to contributing doc --- CONTRIBUTING.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4905fe9b1..cfed9e3f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,6 +67,8 @@ The configs are consumed by downstream OP Stack software, i.e. `op-geth` and `op A second module exists in this repo whose purpose is to validate the config exported by the `superchain` module. It is a separate module to avoid import cycles and polluting downstream dependencies with things like `go-ethereum` (which is used in the validation tests). +> Note: when running validation tests locally, you must set Tailscale to use the OP Labs Tailnet exit node in order to be able to connect to CI L1 archive nodes. + ## `ops` Go module This module contains the CLI tool for generating `superchain` compliant configs and extra data to the registry. @@ -180,6 +182,7 @@ See [Superchain Upgrades] OP Stack specifications. [Superchain Upgrades]: https://specs.optimism.io/protocol/superchain-upgrades.html ## CircleCI Checks + The following CircleCI checks are not mandatory for submitting a pull request, but they should be reviewed: - `ci/circleci: compute-genesis-diff` From b0716ebdea4615d4257179b2cdb7de0ed33a1373 Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Tue, 10 Dec 2024 17:13:02 -0500 Subject: [PATCH 06/12] update contributing doc --- CONTRIBUTING.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cfed9e3f7..11f7f23e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,7 +67,11 @@ The configs are consumed by downstream OP Stack software, i.e. `op-geth` and `op A second module exists in this repo whose purpose is to validate the config exported by the `superchain` module. It is a separate module to avoid import cycles and polluting downstream dependencies with things like `go-ethereum` (which is used in the validation tests). -> Note: when running validation tests locally, you must set Tailscale to use the OP Labs Tailnet exit node in order to be able to connect to CI L1 archive nodes. +> In order to run validation tests locally you must have access to a L1 archive node. If you are an: +> +> - OP Labs core dev: you must set Tailscale to use the Tailnet exit node in order to be able to connect to CI L1 archive nodes +> +> - external contributor: you must provide your own L1 archive node and set its RPC endpoint in the `l1.test_rpc` field in the superchain config files (e.g. `superchain/configs/{mainnet,sepolia,sepolia-dev-0}/superchain.yaml`) ## `ops` Go module From baa0a31eef3f488e7e40dd48e01407fc61a995fb Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Tue, 10 Dec 2024 17:16:43 -0500 Subject: [PATCH 07/12] add check for test_rpc value --- superchain/init.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/superchain/init.go b/superchain/init.go index 980cb8d6d..66eca4d56 100644 --- a/superchain/init.go +++ b/superchain/init.go @@ -79,7 +79,12 @@ func init() { } if replaceL1Rpc { - superchainEntry.Config.L1.PublicRPC = superchainEntry.Config.L1.TestRPC + testRpc := superchainEntry.Config.L1.TestRPC + if testRpc == "" { + panic(fmt.Errorf("missing test RPC endpoint for superchain %q", superchainEntry.Superchain)) + } + + superchainEntry.Config.L1.PublicRPC = testRpc } Superchains[superchainEntry.Superchain] = &superchainEntry From eb53b172531288eb96672fb64e1fe3110e416051 Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Fri, 13 Dec 2024 13:21:36 -0500 Subject: [PATCH 08/12] add superchain l1 rpc preflight check --- validation/validation_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/validation/validation_test.go b/validation/validation_test.go index 5dcac98d7..c27f1151b 100644 --- a/validation/validation_test.go +++ b/validation/validation_test.go @@ -1,10 +1,16 @@ package validation import ( + "context" + "math/big" "testing" . "github.com/ethereum-optimism/superchain-registry/superchain" "github.com/ethereum-optimism/superchain-registry/validation/common" + "github.com/stretchr/testify/require" + + ethCommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" ) // Test names @@ -45,7 +51,29 @@ func applyExclusions(chain *ChainConfig, f subTestForChain) subTest { } } +func preflightChecks(t *testing.T) { + // Check that all superchains have an accessible L1 archive RPC endpoint configured + for name, chain := range Superchains { + rpcEndpoint := chain.Config.L1.PublicRPC + + require.NotEmpty(t, rpcEndpoint) + + client, err := ethclient.Dial(rpcEndpoint) + require.NoErrorf(t, err, "could not dial rpc endpoint '%s' for superchain '%s'", rpcEndpoint, name) + + _, err = client.ChainID(context.Background()) + require.NoErrorf(t, err, "could not query node at '%s' for superchain '%s'", rpcEndpoint, name) + + superchainConfigAddr := *chain.Config.SuperchainConfigAddr + + _, err = client.NonceAt(context.Background(), ethCommon.Address(superchainConfigAddr), big.NewInt(1)) + require.NoErrorf(t, err, "node at '%s' for superchain '%s' is not an archive node", rpcEndpoint, name) + } +} + func TestValidation(t *testing.T) { + preflightChecks(t) + // Entry point for validation checks which run // on each OP chain. for _, chain := range OPChains { From de3e72f35a2184fb18f3f5ec48b19187ada5d4c1 Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Fri, 13 Dec 2024 14:50:33 -0500 Subject: [PATCH 09/12] add PublicRPCTest --- validation/public-rpc_test.go | 18 ++++++++++++++++++ validation/validation_test.go | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 validation/public-rpc_test.go diff --git a/validation/public-rpc_test.go b/validation/public-rpc_test.go new file mode 100644 index 000000000..3e1169de7 --- /dev/null +++ b/validation/public-rpc_test.go @@ -0,0 +1,18 @@ +package validation + +import ( + "testing" + + . "github.com/ethereum-optimism/superchain-registry/superchain" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/stretchr/testify/require" +) + +func testPublicRPC(t *testing.T, chain *ChainConfig) { + rpcEndpoint := chain.PublicRPC + require.NotEmpty(t, rpcEndpoint, "no public_rpc endpoint specified") + + client, err := ethclient.Dial(rpcEndpoint) + defer client.Close() + require.NoErrorf(t, err, "could not dial rpc endpoint '%s'", rpcEndpoint) +} diff --git a/validation/validation_test.go b/validation/validation_test.go index c27f1151b..bb0a41e3e 100644 --- a/validation/validation_test.go +++ b/validation/validation_test.go @@ -18,6 +18,7 @@ const ( GenesisHashTest = "Genesis_Hash" GenesisRPCTest = "Genesis_RPC" UniquenessTest = "Uniqueness" + PublicRPCTest = "Public_RPC" ChainIDRPCTest = "ChainID_RPC" OptimismConfigTest = "Optimism_Config" GovernedByOptimismTest = "Governed_By_Optimism" @@ -56,9 +57,10 @@ func preflightChecks(t *testing.T) { for name, chain := range Superchains { rpcEndpoint := chain.Config.L1.PublicRPC - require.NotEmpty(t, rpcEndpoint) + require.NotEmpty(t, rpcEndpoint, "no public_rpc specified for superchain '%s'", name) client, err := ethclient.Dial(rpcEndpoint) + defer client.Close() require.NoErrorf(t, err, "could not dial rpc endpoint '%s' for superchain '%s'", rpcEndpoint, name) _, err = client.ChainID(context.Background()) @@ -107,6 +109,7 @@ func testUniversal(t *testing.T, chain *ChainConfig) { t.Run(GenesisHashTest, applyExclusions(chain, testGenesisHash)) t.Run(GenesisRPCTest, applyExclusions(chain, testGenesisHashAgainstRPC)) t.Run(UniquenessTest, applyExclusions(chain, testIsGloballyUnique)) + t.Run(PublicRPCTest, applyExclusions(chain, testPublicRPC)) t.Run(ChainIDRPCTest, applyExclusions(chain, testChainIDFromRPC)) t.Run(OptimismConfigTest, applyExclusions(chain, testOptimismConfig)) t.Run(GovernedByOptimismTest, applyExclusions(chain, testGovernedByOptimism)) From fe11e09ebd462391393fd7ab9e15b3ff1f4252be Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Fri, 13 Dec 2024 14:51:00 -0500 Subject: [PATCH 10/12] exclude devnet chains from rpc check --- validation/exclusions_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/validation/exclusions_test.go b/validation/exclusions_test.go index 206479359..41c989c0f 100644 --- a/validation/exclusions_test.go +++ b/validation/exclusions_test.go @@ -34,6 +34,10 @@ var exclusions = map[string]map[uint64]bool{ 10: true, // op-mainnet 1740: true, // metal-sepolia }, + PublicRPCTest: { + 11155421: true, // sepolia-dev-0/oplabs-devnet-0 No Public RPC declared + 11763072: true, // sepolia-dev-0/base-devnet-0 No Public RPC declared + }, ChainIDRPCTest: { 11155421: true, // sepolia-dev-0/oplabs-devnet-0 No Public RPC declared 11763072: true, // sepolia-dev-0/base-devnet-0 No Public RPC declared From 0e3753880bc5ca9435c72c8dbf37211ad78ad4ba Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Fri, 13 Dec 2024 15:00:17 -0500 Subject: [PATCH 11/12] lint fixes --- validation/data-availability-type_test.go | 2 -- validation/key-handover_test.go | 2 -- validation/optimism-portal-2-params_test.go | 2 -- validation/public-rpc_test.go | 2 +- validation/resource-config_test.go | 3 --- validation/security-configs_test.go | 2 -- validation/start-block_test.go | 2 -- validation/superchain-config_test.go | 2 -- validation/superchain-genesis_test.go | 1 - validation/superchain-version.go | 2 -- validation/validation_test.go | 6 +++--- 11 files changed, 4 insertions(+), 22 deletions(-) diff --git a/validation/data-availability-type_test.go b/validation/data-availability-type_test.go index ea07ee371..fdbec7132 100644 --- a/validation/data-availability-type_test.go +++ b/validation/data-availability-type_test.go @@ -20,8 +20,6 @@ import ( func testDataAvailabilityType(t *testing.T, chain *ChainConfig) { rpcEndpoint := Superchains[chain.Superchain].Config.L1.PublicRPC - require.NotEmpty(t, rpcEndpoint) - client, err := ethclient.Dial(rpcEndpoint) require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint) diff --git a/validation/key-handover_test.go b/validation/key-handover_test.go index 2d65cf7c1..85d0708e8 100644 --- a/validation/key-handover_test.go +++ b/validation/key-handover_test.go @@ -13,8 +13,6 @@ func testKeyHandover(t *testing.T, chain *ChainConfig) { chainID := chain.ChainID superchain := OPChains[chainID].Superchain rpcEndpoint := Superchains[superchain].Config.L1.PublicRPC - require.NotEmpty(t, rpcEndpoint, "no rpc specified") - client, err := ethclient.Dial(rpcEndpoint) require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint) diff --git a/validation/optimism-portal-2-params_test.go b/validation/optimism-portal-2-params_test.go index d3b87bce1..84595252c 100644 --- a/validation/optimism-portal-2-params_test.go +++ b/validation/optimism-portal-2-params_test.go @@ -20,8 +20,6 @@ func testOptimismPortal2Params(t *testing.T, chain *ChainConfig) { require.NoError(t, err) rpcEndpoint := Superchains[chain.Superchain].Config.L1.PublicRPC - - require.NotEmpty(t, rpcEndpoint, "no public endpoint for chain") client, err := ethclient.Dial(rpcEndpoint) require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint) diff --git a/validation/public-rpc_test.go b/validation/public-rpc_test.go index 3e1169de7..601a2e500 100644 --- a/validation/public-rpc_test.go +++ b/validation/public-rpc_test.go @@ -13,6 +13,6 @@ func testPublicRPC(t *testing.T, chain *ChainConfig) { require.NotEmpty(t, rpcEndpoint, "no public_rpc endpoint specified") client, err := ethclient.Dial(rpcEndpoint) - defer client.Close() require.NoErrorf(t, err, "could not dial rpc endpoint '%s'", rpcEndpoint) + defer client.Close() } diff --git a/validation/resource-config_test.go b/validation/resource-config_test.go index c51c2a75a..8d64d3426 100644 --- a/validation/resource-config_test.go +++ b/validation/resource-config_test.go @@ -17,9 +17,6 @@ import ( func testResourceConfig(t *testing.T, chain *ChainConfig) { rpcEndpoint := Superchains[chain.Superchain].Config.L1.PublicRPC - - require.NotEmpty(t, rpcEndpoint) - client, err := ethclient.Dial(rpcEndpoint) require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint) diff --git a/validation/security-configs_test.go b/validation/security-configs_test.go index 0755d4849..7059685ac 100644 --- a/validation/security-configs_test.go +++ b/validation/security-configs_test.go @@ -70,8 +70,6 @@ func testL1SecurityConfig(t *testing.T, chain *ChainConfig) { chainID := chain.ChainID rpcEndpoint := Superchains[chain.Superchain].Config.L1.PublicRPC - require.NotEmpty(t, rpcEndpoint, "no rpc specified") - client, err := ethclient.Dial(rpcEndpoint) require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint) diff --git a/validation/start-block_test.go b/validation/start-block_test.go index 6f9600372..cc9367310 100644 --- a/validation/start-block_test.go +++ b/validation/start-block_test.go @@ -19,8 +19,6 @@ import ( func testStartBlock(t *testing.T, chain *ChainConfig) { rpcEndpoint := Superchains[chain.Superchain].Config.L1.PublicRPC - require.NotEmpty(t, rpcEndpoint) - client, err := ethclient.Dial(rpcEndpoint) require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint) diff --git a/validation/superchain-config_test.go b/validation/superchain-config_test.go index 2da762da4..775a9c93a 100644 --- a/validation/superchain-config_test.go +++ b/validation/superchain-config_test.go @@ -16,8 +16,6 @@ func testSuperchainConfig(t *testing.T, chain *ChainConfig) { require.NotNil(t, opcm, "Superchain does not declare a op_contracts_manager_proxy_addr") rpcEndpoint := Superchains[chain.Superchain].Config.L1.PublicRPC - require.NotEmpty(t, rpcEndpoint, "no rpc specified") - client, err := ethclient.Dial(rpcEndpoint) require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint) diff --git a/validation/superchain-genesis_test.go b/validation/superchain-genesis_test.go index 5235c0a18..c54b53dcf 100644 --- a/validation/superchain-genesis_test.go +++ b/validation/superchain-genesis_test.go @@ -38,7 +38,6 @@ func testGenesisHash(t *testing.T, chain *ChainConfig) { func testGenesisHashAgainstRPC(t *testing.T, chain *ChainConfig) { declaredGenesisHash := chain.Genesis.L2.Hash rpcEndpoint := chain.PublicRPC - client, err := ethclient.Dial(rpcEndpoint) require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint) diff --git a/validation/superchain-version.go b/validation/superchain-version.go index ff496a4f3..5296061f9 100644 --- a/validation/superchain-version.go +++ b/validation/superchain-version.go @@ -27,8 +27,6 @@ import ( func checkForStandardVersions(t *testing.T, chain *ChainConfig) { rpcEndpoint := Superchains[chain.Superchain].Config.L1.PublicRPC - require.NotEmpty(t, rpcEndpoint) - client, err := ethclient.Dial(rpcEndpoint) require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint) diff --git a/validation/validation_test.go b/validation/validation_test.go index bb0a41e3e..0ccb0cd96 100644 --- a/validation/validation_test.go +++ b/validation/validation_test.go @@ -60,14 +60,14 @@ func preflightChecks(t *testing.T) { require.NotEmpty(t, rpcEndpoint, "no public_rpc specified for superchain '%s'", name) client, err := ethclient.Dial(rpcEndpoint) - defer client.Close() require.NoErrorf(t, err, "could not dial rpc endpoint '%s' for superchain '%s'", rpcEndpoint, name) - + defer client.Close() + _, err = client.ChainID(context.Background()) require.NoErrorf(t, err, "could not query node at '%s' for superchain '%s'", rpcEndpoint, name) superchainConfigAddr := *chain.Config.SuperchainConfigAddr - + _, err = client.NonceAt(context.Background(), ethCommon.Address(superchainConfigAddr), big.NewInt(1)) require.NoErrorf(t, err, "node at '%s' for superchain '%s' is not an archive node", rpcEndpoint, name) } From 4353e9a84dbc2dd316e585d3cc376417c573be5e Mon Sep 17 00:00:00 2001 From: Eugene Dobry Date: Fri, 13 Dec 2024 15:10:54 -0500 Subject: [PATCH 12/12] improve archive rpc check message --- validation/validation_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/validation_test.go b/validation/validation_test.go index 0ccb0cd96..88569ce78 100644 --- a/validation/validation_test.go +++ b/validation/validation_test.go @@ -69,7 +69,7 @@ func preflightChecks(t *testing.T) { superchainConfigAddr := *chain.Config.SuperchainConfigAddr _, err = client.NonceAt(context.Background(), ethCommon.Address(superchainConfigAddr), big.NewInt(1)) - require.NoErrorf(t, err, "node at '%s' for superchain '%s' is not an archive node", rpcEndpoint, name) + require.NoErrorf(t, err, "node at '%s' for superchain '%s' is not an archive node. please set an L1 archive node RPC url in the `test_rpc` field of the superchain config file", rpcEndpoint, name) } }