Skip to content

Commit 808734f

Browse files
committed
Support preprod tests
Signed-off-by: litt3 <[email protected]>
1 parent 8741cb6 commit 808734f

10 files changed

+125
-49
lines changed

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"go.testEnvVars": {
3-
"MEMSTORE": "true",
3+
"BACKEND": "memstore",
44
// To test against TESTNET, set SIGNER_PRIVATE_KEY and ETHEREUM_RPC.
55
"SIGNER_PRIVATE_KEY": "",
66
"ETHEREUM_RPC": "https://ethereum-holesky-rpc.publicnode.com"

Makefile

+9-4
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,19 @@ test-unit:
3333
test-e2e-local:
3434
# Add the -v flag to observe logs as the run is happening on CI, given that this test takes ~5 minutes to run.
3535
# Good to have early feedback when needed.
36-
MEMSTORE=true go test -v -timeout 10m ./e2e -parallel 4
36+
BACKEND=memstore go test -v -timeout 10m ./e2e -parallel 4
3737

38-
# E2E tests using holesky backend, leveraging op-e2e framework. Also tests the standard client against the proxy.
38+
# E2E tests using holesky testnet backend, leveraging op-e2e framework. Also tests the standard client against the proxy.
3939
# If holesky tests are failing, consider checking https://dora.holesky.ethpandaops.io/epochs for block production status.
40-
test-e2e-holesky:
40+
test-e2e-testnet:
4141
# Add the -v flag to observe logs as the run is happening on CI, given that this test takes ~5 minutes to run.
4242
# Good to have early feedback when needed.
43-
MEMSTORE=false go test -v -timeout 30m ./e2e -parallel 4
43+
BACKEND=testnet go test -v -timeout 30m ./e2e -parallel 4
44+
45+
test-e2e-preprod:
46+
# Add the -v flag to observe logs as the run is happening on CI, given that this test takes ~5 minutes to run.
47+
# Good to have early feedback when needed.
48+
BACKEND=preprod go test -v -timeout 30m ./e2e -parallel 4
4449

4550
# Very simple fuzzer which generates random bytes arrays and sends them to the proxy using the standard client.
4651
# To clean the cached corpus, run `go clean -fuzzcache` before running this.

benchmark/benchmark_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func putsWithSecondary(b *testing.B, useV2 bool) {
3434
}
3535

3636
ts, kill := testutils.CreateTestSuite(
37-
true,
37+
testutils.MemstoreBackend,
3838
useV2,
3939
testutils.TestSuiteWithOverriddenEnvVars(envVarsToOverride...))
4040
defer kill()

e2e/optimism_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func TestOptimismKeccak256CommitmentV2(t *testing.T) {
140140

141141
func testOptimismKeccak256Commitment(t *testing.T, v2Enabled bool) {
142142
proxyTS, shutDown := testutils.CreateTestSuite(
143-
testutils.UseMemstore(),
143+
testutils.GetBackend(),
144144
v2Enabled,
145145
testutils.TestSuiteWithOverriddenEnvVars(testutils.GetS3EnvVars()...))
146146
defer shutDown()
@@ -198,7 +198,7 @@ func TestOptimismGenericCommitmentV2(t *testing.T) {
198198
}
199199

200200
func testOptimismGenericCommitment(t *testing.T, v2Enabled bool) {
201-
proxyTS, shutDown := testutils.CreateTestSuite(testutils.UseMemstore(), v2Enabled)
201+
proxyTS, shutDown := testutils.CreateTestSuite(testutils.GetBackend(), v2Enabled)
202202
defer shutDown()
203203

204204
ot := actions.NewDefaultTesting(t)

e2e/safety_checks_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func testOpClientKeccak256MalformedInputs(t *testing.T, v2Enabled bool) {
3434
t.Parallel()
3535

3636
ts, kill := testutils.CreateTestSuite(
37-
testutils.UseMemstore(),
37+
testutils.GetBackend(),
3838
v2Enabled,
3939
testutils.TestSuiteWithOverriddenEnvVars(testutils.GetS3EnvVars()...))
4040
defer kill()
@@ -87,7 +87,7 @@ func TestProxyClientMalformedInputCasesV2(t *testing.T) {
8787
// byte, many unicode characters, single unicode character and an empty preimage. It then tries to get the data from the
8888
// proxy server with empty byte, single byte and random string.
8989
func testProxyClientMalformedInputCases(t *testing.T, v2Enabled bool) {
90-
ts, kill := testutils.CreateTestSuite(testutils.UseMemstore(), v2Enabled)
90+
ts, kill := testutils.CreateTestSuite(testutils.GetBackend(), v2Enabled)
9191
defer kill()
9292

9393
cfg := &standard_client.Config{
@@ -171,7 +171,7 @@ func testKeccak256CommitmentRequestErrorsWhenS3NotSet(t *testing.T, v2Enabled bo
171171
envVarsToOverride = append(envVarsToOverride, testutils.EnvVar{Name: s3.EndpointFlagName, Value: "localhost:1234"})
172172

173173
ts, kill := testutils.CreateTestSuite(
174-
testutils.UseMemstore(),
174+
testutils.GetBackend(),
175175
v2Enabled,
176176
testutils.TestSuiteWithOverriddenEnvVars(envVarsToOverride...))
177177
defer kill()
@@ -196,7 +196,7 @@ func TestOversizedBlobRequestErrorsV2(t *testing.T) {
196196
func testOversizedBlobRequestErrors(t *testing.T, v2Enabled bool) {
197197
t.Parallel()
198198

199-
ts, kill := testutils.CreateTestSuite(testutils.UseMemstore(), v2Enabled)
199+
ts, kill := testutils.CreateTestSuite(testutils.GetBackend(), v2Enabled)
200200
defer kill()
201201

202202
cfg := &standard_client.Config{

e2e/server_test.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func testOptimismClientWithKeccak256Commitment(t *testing.T, v2Enabled bool) {
8484
t.Parallel()
8585

8686
ts, kill := testutils.CreateTestSuite(
87-
testutils.UseMemstore(),
87+
testutils.GetBackend(),
8888
v2Enabled,
8989
testutils.TestSuiteWithOverriddenEnvVars(testutils.GetS3EnvVars()...))
9090
defer kill()
@@ -107,7 +107,7 @@ with a concurrent S3 backend configured
107107
func testOptimismClientWithGenericCommitment(t *testing.T, v2Enabled bool) {
108108
t.Parallel()
109109

110-
ts, kill := testutils.CreateTestSuite(testutils.UseMemstore(), v2Enabled)
110+
ts, kill := testutils.CreateTestSuite(testutils.GetBackend(), v2Enabled)
111111
defer kill()
112112

113113
requireOPClientSetGet(t, ts, testutils.RandBytes(100), false)
@@ -128,7 +128,7 @@ func TestProxyClientServerIntegrationV2(t *testing.T) {
128128
func testProxyClientServerIntegration(t *testing.T, v2Enabled bool) {
129129
t.Parallel()
130130

131-
ts, kill := testutils.CreateTestSuite(testutils.UseMemstore(), v2Enabled)
131+
ts, kill := testutils.CreateTestSuite(testutils.GetBackend(), v2Enabled)
132132
t.Cleanup(kill)
133133

134134
cfg := &standard_client.Config{
@@ -206,7 +206,7 @@ func TestProxyClientV2(t *testing.T) {
206206
func testProxyClient(t *testing.T, v2Enabled bool) {
207207
t.Parallel()
208208

209-
ts, kill := testutils.CreateTestSuite(testutils.UseMemstore(), v2Enabled)
209+
ts, kill := testutils.CreateTestSuite(testutils.GetBackend(), v2Enabled)
210210
defer kill()
211211

212212
cfg := &standard_client.Config{
@@ -237,7 +237,7 @@ func TestProxyClientWriteReadV2(t *testing.T) {
237237
func testProxyClientWriteRead(t *testing.T, v2Enabled bool) {
238238
t.Parallel()
239239

240-
ts, kill := testutils.CreateTestSuite(testutils.UseMemstore(), v2Enabled)
240+
ts, kill := testutils.CreateTestSuite(testutils.GetBackend(), v2Enabled)
241241
defer kill()
242242

243243
requireStandardClientSetGet(t, ts, testutils.RandBytes(100))
@@ -255,7 +255,7 @@ func TestProxyWithMaximumSizedBlobV2(t *testing.T) {
255255
func testProxyWithMaximumSizedBlob(t *testing.T, v2Enabled bool) {
256256
t.Parallel()
257257

258-
ts, kill := testutils.CreateTestSuite(testutils.UseMemstore(), v2Enabled)
258+
ts, kill := testutils.CreateTestSuite(testutils.GetBackend(), v2Enabled)
259259
defer kill()
260260

261261
requireStandardClientSetGet(t, ts, testutils.RandBytes(16_000_000))
@@ -277,7 +277,7 @@ func testProxyCaching(t *testing.T, v2Enabled bool) {
277277
t.Parallel()
278278

279279
ts, kill := testutils.CreateTestSuite(
280-
testutils.UseMemstore(),
280+
testutils.GetBackend(),
281281
v2Enabled,
282282
testutils.TestSuiteWithOverriddenEnvVars(testutils.GetS3EnvVars()...))
283283
defer kill()
@@ -299,7 +299,7 @@ func testProxyCachingWithRedis(t *testing.T, v2Enabled bool) {
299299
t.Parallel()
300300

301301
ts, kill := testutils.CreateTestSuite(
302-
testutils.UseMemstore(),
302+
testutils.GetBackend(),
303303
v2Enabled,
304304
testutils.TestSuiteWithOverriddenEnvVars(testutils.GetRedisEnvVars()...))
305305
defer kill()
@@ -332,7 +332,7 @@ func testProxyReadFallback(t *testing.T, v2Enabled bool) {
332332
testutils.EnvVar{Name: memstore.ExpirationFlagName, Value: fmt.Sprintf("%v", time.Millisecond*1)})
333333

334334
ts, kill := testutils.CreateTestSuite(
335-
testutils.UseMemstore(),
335+
testutils.GetBackend(),
336336
v2Enabled,
337337
testutils.TestSuiteWithOverriddenEnvVars(overriddenTestVars...))
338338
defer kill()
@@ -368,12 +368,12 @@ func TestProxyMemConfigClientCanGetAndPatchV2(t *testing.T) {
368368
func testProxyMemConfigClientCanGetAndPatch(t *testing.T, v2Enabled bool) {
369369
t.Parallel()
370370

371-
useMemstore := testutils.UseMemstore()
371+
useMemstore := testutils.GetBackend() == testutils.MemstoreBackend
372372
if !useMemstore {
373373
t.Skip("test can't be run against holesky since read failure case can't be manually triggered")
374374
}
375375

376-
ts, kill := testutils.CreateTestSuite(useMemstore, v2Enabled)
376+
ts, kill := testutils.CreateTestSuite(testutils.GetBackend(), v2Enabled)
377377
defer kill()
378378

379379
memClient := memconfig_client.New(

fuzz/server_fuzz_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func fuzzProxyClientServer(f *testing.F, useV2 bool) {
2727
// We want a silent logger for fuzzing because we need to see the output of the fuzzer itself,
2828
// which tells us each new interesting inputs it finds.
2929
logger := logging.NewTextSLogger(os.Stdout, &logging.SLoggerOptions{Level: slog.LevelError})
30-
ts, kill := testutils.CreateTestSuite(true, useV2, testutils.TestSuiteWithLogger(logger))
30+
ts, kill := testutils.CreateTestSuite(testutils.MemstoreBackend, useV2, testutils.TestSuiteWithLogger(logger))
3131
f.Cleanup(kill)
3232

3333
f.Add([]byte{})

testutils/env_vars.go

+62-11
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@ import (
1717
"github.com/urfave/cli/v2"
1818
)
1919

20+
const (
21+
privateKey = "SIGNER_PRIVATE_KEY"
22+
ethRPC = "ETHEREUM_RPC"
23+
transport = "http"
24+
host = "127.0.0.1"
25+
disperserPort = "443"
26+
27+
disperserPreprodHostname = "disperser-preprod-holesky.eigenda.xyz"
28+
preprodCertVerifierAddress = "0xd973fA62E22BC2779F8489258F040C0344B03C21"
29+
preprodSvcManagerAddress = "0x54A03db2784E3D0aCC08344D05385d0b62d4F432"
30+
31+
disperserTestnetHostname = "disperser-testnet-holesky.eigenda.xyz"
32+
testnetCertVerifierAddress = "0xFe52fE1940858DCb6e12153E2104aD0fDFbE1162"
33+
testnetSvcManagerAddress = "0xD4A7E1Bd8015057293f0D0A557088c286942e84b"
34+
)
35+
2036
// EnvVar represents an individual env var configuration, with a flag name and value
2137
type EnvVar struct {
2238
Name string
@@ -55,24 +71,26 @@ func configureContextFromEnvVars(envVars []EnvVar, flags []cli.Flag) (*cli.Conte
5571
//
5672
// Env vars are used to configure tests, since that's how it's done in production. We want to exercise as many prod
5773
// code pathways as possible in e2e tests.
58-
func getDefaultTestEnvVars(useMemory bool, useV2 bool) []EnvVar {
74+
func getDefaultTestEnvVars(backend Backend, useV2 bool) []EnvVar {
5975
signingKey := os.Getenv(privateKey)
6076
ethRPCURL := os.Getenv(ethRPC)
6177
maxBlobLengthString := "16mib"
6278
expiration := 14 * 24 * time.Hour
6379
writeThreadCount := 0
6480

6581
outputVars := make([]EnvVar, 0)
66-
outputVars = append(outputVars, getV1EnvVars(useMemory, signingKey, ethRPCURL, maxBlobLengthString)...)
67-
outputVars = append(outputVars, getV2EnvVars(useV2, signingKey, ethRPCURL, maxBlobLengthString)...)
82+
outputVars = append(outputVars, getV1EnvVars(backend, signingKey, ethRPCURL, maxBlobLengthString)...)
83+
outputVars = append(outputVars, getV2EnvVars(backend, useV2, signingKey, ethRPCURL, maxBlobLengthString)...)
6884
outputVars = append(outputVars, getKZGEnvVars()...)
6985

7086
// Memstore flags
71-
outputVars = append(outputVars, EnvVar{memstore.EnabledFlagName, fmt.Sprintf("%t", useMemory)})
87+
outputVars = append(outputVars, EnvVar{memstore.EnabledFlagName, fmt.Sprintf("%t", backend == MemstoreBackend)})
7288
outputVars = append(outputVars, EnvVar{memstore.ExpirationFlagName, expiration.String()})
7389

7490
// Verifier flags
75-
outputVars = append(outputVars, EnvVar{verify.CertVerificationDisabledFlagName, fmt.Sprintf("%t", useMemory)})
91+
outputVars = append(
92+
outputVars,
93+
EnvVar{verify.CertVerificationDisabledFlagName, fmt.Sprintf("%t", backend == MemstoreBackend)})
7694

7795
// Server flags
7896
outputVars = append(outputVars, EnvVar{config.ListenAddrFlagName, host})
@@ -85,26 +103,42 @@ func getDefaultTestEnvVars(useMemory bool, useV2 bool) []EnvVar {
85103
}
86104

87105
func getV1EnvVars(
88-
useMemstore bool,
106+
backend Backend,
89107
signingKey string,
90108
ethRPCURL string,
91109
maxBlobLengthString string,
92110
) []EnvVar {
93111
var pollInterval time.Duration
94-
if useMemstore {
112+
if backend == MemstoreBackend {
95113
pollInterval = time.Second * 1
96114
} else {
97115
pollInterval = time.Minute * 1
98116
}
99117

118+
var disperserHostname string
119+
var svcManagerAddress string
120+
switch backend {
121+
case MemstoreBackend:
122+
// no need to set these fields for local tests
123+
break
124+
case PreprodBackend:
125+
disperserHostname = disperserPreprodHostname
126+
svcManagerAddress = preprodSvcManagerAddress
127+
case TestnetBackend:
128+
disperserHostname = disperserTestnetHostname
129+
svcManagerAddress = testnetSvcManagerAddress
130+
default:
131+
panic("Unsupported backend")
132+
}
133+
100134
envVars := []EnvVar{
101135
{eigendaflags.SignerPrivateKeyHexFlagName, signingKey},
102136
{eigendaflags.EthRPCURLFlagName, ethRPCURL},
103-
{eigendaflags.DisperserRPCFlagName, holeskyDisperserHostname + ":" + holeskyDisperserPort},
137+
{eigendaflags.DisperserRPCFlagName, disperserHostname + ":" + disperserPort},
104138
{eigendaflags.StatusQueryRetryIntervalFlagName, pollInterval.String()},
105139
{eigendaflags.DisableTLSFlagName, fmt.Sprintf("%v", false)},
106140
{eigendaflags.ConfirmationDepthFlagName, "1"},
107-
{eigendaflags.SvcManagerAddrFlagName, "0xD4A7E1Bd8015057293f0D0A557088c286942e84b"}, // holesky testnet
141+
{eigendaflags.SvcManagerAddrFlagName, svcManagerAddress},
108142
{eigendaflags.MaxBlobLengthFlagName, maxBlobLengthString},
109143
{eigendaflags.StatusQueryTimeoutFlagName, "45m"},
110144
}
@@ -113,22 +147,39 @@ func getV1EnvVars(
113147
}
114148

115149
func getV2EnvVars(
150+
backend Backend,
116151
useV2 bool,
117152
signingKey string,
118153
ethRPCURL string,
119154
maxBlobLengthString string,
120155
) []EnvVar {
156+
var disperserHostname string
157+
var certVerifierAddress string
158+
switch backend {
159+
case MemstoreBackend:
160+
// no need to set these fields for local tests
161+
break
162+
case PreprodBackend:
163+
disperserHostname = disperserPreprodHostname
164+
certVerifierAddress = preprodCertVerifierAddress
165+
case TestnetBackend:
166+
disperserHostname = disperserTestnetHostname
167+
certVerifierAddress = testnetCertVerifierAddress
168+
default:
169+
panic("Unsupported backend")
170+
}
171+
121172
envVars := []EnvVar{
122173
{eigendaflagsv2.SignerPaymentKeyHexFlagName, signingKey},
123174
{eigendaflagsv2.EthRPCURLFlagName, ethRPCURL},
124175
{eigendaflagsv2.V2EnabledFlagName, fmt.Sprintf("%t", useV2)},
125-
{eigendaflagsv2.DisperserFlagName, holeskyDisperserHostname + ":" + holeskyDisperserPort},
176+
{eigendaflagsv2.DisperserFlagName, disperserHostname + ":" + disperserPort},
126177
{eigendaflagsv2.DisableTLSFlagName, fmt.Sprintf("%v", false)},
127178
{eigendaflagsv2.BlobStatusPollIntervalFlagName, "1s"},
128179
{eigendaflagsv2.PutRetriesFlagName, "1"},
129180
{eigendaflagsv2.DisperseBlobTimeoutFlagName, "2m"},
130181
{eigendaflagsv2.BlobCertifiedTimeoutFlagName, "2m"},
131-
{eigendaflagsv2.CertVerifierAddrFlagName, "0xFe52fE1940858DCb6e12153E2104aD0fDFbE1162"}, // holesky testnet
182+
{eigendaflagsv2.CertVerifierAddrFlagName, certVerifierAddress}, // holesky testnet
132183
{eigendaflagsv2.RelayTimeoutFlagName, "5s"},
133184
{eigendaflagsv2.ContractCallTimeoutFlagName, "5s"},
134185
{eigendaflagsv2.BlobParamsVersionFlagName, "0"},

0 commit comments

Comments
 (0)