Skip to content

Commit 7e49e29

Browse files
authored
validation: add superchain config check (#361)
* validation: add a superchainconfig check * reduce number of retries * exclude bsae-devnet-o from superchain_config check it's on an old version of OptimismPortal
1 parent 8203867 commit 7e49e29

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

validation/exclusions_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ var exclusions = map[string]map[uint64]bool{
2626
11155421: true, // sepolia-dev-0/oplabs-devnet-0 (no public endpoint)
2727
11763072: true, // sepolia-dev-0/base-devnet-0 (no public endpoint)
2828
},
29+
"Superchain_Config": {
30+
11763072: true, // sepolia-dev-0/base-devnet-0 (old version of OptimismPortal)
31+
},
2932
"L2OO_Params": {
3033
11155421: true, // sepolia-dev-0/oplabs-devnet-0 (does not yet declare a contract versions tag)
3134
11763072: true, // sepolia-dev-0/base-devnet-0 (does not yet declare a contract versions tag)

validation/retry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
func Retry[S, T any](fn func(S) (T, error)) func(S) (T, error) {
10-
const maxAttempts = 10
10+
const maxAttempts = 3
1111
return func(s S) (T, error) {
1212
return retry.Do(context.Background(), maxAttempts, retry.Exponential(), func() (T, error) {
1313
return fn(s)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package validation
2+
3+
import (
4+
"testing"
5+
6+
. "github.com/ethereum-optimism/superchain-registry/superchain"
7+
"github.com/ethereum/go-ethereum/ethclient"
8+
"github.com/stretchr/testify/require"
9+
)
10+
11+
func testSuperchainConfig(t *testing.T, chain *ChainConfig) {
12+
skipIfExcluded(t, chain.ChainID)
13+
expected := Superchains[chain.Superchain].Config.SuperchainConfigAddr
14+
require.NotNil(t, expected, "Superchain does not declare a superchain_config_addr")
15+
16+
rpcEndpoint := Superchains[chain.Superchain].Config.L1.PublicRPC
17+
require.NotEmpty(t, rpcEndpoint, "no rpc specified")
18+
19+
client, err := ethclient.Dial(rpcEndpoint)
20+
require.NoErrorf(t, err, "could not dial rpc endpoint %s", rpcEndpoint)
21+
opp := Addresses[chain.ChainID].OptimismPortalProxy
22+
23+
got, err := getAddress("superchainConfig()", opp, client)
24+
require.NoError(t, err)
25+
26+
require.Equal(t, *expected, got)
27+
}

validation/validation_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func testStandardCandidate(t *testing.T, chain *ChainConfig) {
6868
t.Run("L2OO Params", func(t *testing.T) { testL2OOParams(t, chain) })
6969
t.Run("Gas Limit", func(t *testing.T) { testGasLimit(t, chain) })
7070
t.Run("GPO Params", func(t *testing.T) { testGasPriceOracleParams(t, chain) })
71+
t.Run("Superchain Config", func(t *testing.T) { testSuperchainConfig(t, chain) })
7172
})
7273
t.Run("Standard Config Roles", func(t *testing.T) {
7374
t.Run("L1 Security Config", func(t *testing.T) { testL1SecurityConfig(t, chain.ChainID) })

0 commit comments

Comments
 (0)