From 27332b227640c5f332b981c2a2885cf1d48aa53a Mon Sep 17 00:00:00 2001 From: Lee Bousfield Date: Mon, 12 Aug 2024 10:40:27 -0500 Subject: [PATCH] Fix arbitrator validation tests --- system_tests/block_validator_test.go | 2 +- system_tests/common_test.go | 14 +++++++++----- system_tests/program_recursive_test.go | 2 +- util/testhelpers/github/releases.go | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/system_tests/block_validator_test.go b/system_tests/block_validator_test.go index 6b4e6d2088..bd0a1f3336 100644 --- a/system_tests/block_validator_test.go +++ b/system_tests/block_validator_test.go @@ -92,7 +92,7 @@ func testBlockValidatorSimple(t *testing.T, opts Options) { validatorConfig.BlockValidator.RedisValidationClientConfig = redis.ValidationClientConfig{} } - AddDefaultValNode(t, ctx, validatorConfig, !opts.arbitrator, redisURL, opts.wasmRootDir) + AddValNode(t, ctx, validatorConfig, !opts.arbitrator, redisURL, opts.wasmRootDir) testClientB, cleanupB := builder.Build2ndNode(t, &SecondNodeParams{nodeConfig: validatorConfig}) defer cleanupB() diff --git a/system_tests/common_test.go b/system_tests/common_test.go index c6964b37c0..62053c17f1 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -364,7 +364,7 @@ func (b *NodeBuilder) BuildL2OnL1(t *testing.T) func() { validatorTxOptsPtr = &validatorTxOpts } - AddDefaultValNode(t, b.ctx, b.nodeConfig, true, "", b.valnodeConfig.Wasm.RootPath) + AddValNodeIfNeeded(t, b.ctx, b.nodeConfig, true, "", b.valnodeConfig.Wasm.RootPath) Require(t, b.execConfig.Validate()) execConfig := b.execConfig @@ -400,7 +400,7 @@ func (b *NodeBuilder) BuildL2OnL1(t *testing.T) func() { func (b *NodeBuilder) BuildL2(t *testing.T) func() { b.L2 = NewTestClient(b.ctx) - AddDefaultValNode(t, b.ctx, b.nodeConfig, true, "", b.valnodeConfig.Wasm.RootPath) + AddValNodeIfNeeded(t, b.ctx, b.nodeConfig, true, "", b.valnodeConfig.Wasm.RootPath) var chainDb ethdb.Database var arbDb ethdb.Database @@ -891,10 +891,14 @@ func currentRootModule(t *testing.T) common.Hash { return locator.LatestWasmModuleRoot() } -func AddDefaultValNode(t *testing.T, ctx context.Context, nodeConfig *arbnode.Config, useJit bool, redisURL string, wasmRootDir string) { - if !nodeConfig.ValidatorRequired() { +func AddValNodeIfNeeded(t *testing.T, ctx context.Context, nodeConfig *arbnode.Config, useJit bool, redisURL string, wasmRootDir string) { + if !nodeConfig.ValidatorRequired() || nodeConfig.BlockValidator.ValidationServerConfigs[0].URL != "" { return } + AddValNode(t, ctx, nodeConfig, useJit, redisURL, wasmRootDir) +} + +func AddValNode(t *testing.T, ctx context.Context, nodeConfig *arbnode.Config, useJit bool, redisURL string, wasmRootDir string) { conf := valnode.TestValidationConfig conf.UseJit = useJit conf.Wasm.RootPath = wasmRootDir @@ -1168,7 +1172,7 @@ func Create2ndNodeWithConfig( l2blockchain, err := gethexec.WriteOrTestBlockChain(l2chainDb, coreCacheConfig, initReader, chainConfig, initMessage, ExecConfigDefaultTest().TxLookupLimit, 0) Require(t, err) - AddDefaultValNode(t, ctx, nodeConfig, true, "", valnodeConfig.Wasm.RootPath) + AddValNodeIfNeeded(t, ctx, nodeConfig, true, "", valnodeConfig.Wasm.RootPath) Require(t, execConfig.Validate()) Require(t, nodeConfig.Validate()) diff --git a/system_tests/program_recursive_test.go b/system_tests/program_recursive_test.go index 68d307948d..dbf527a293 100644 --- a/system_tests/program_recursive_test.go +++ b/system_tests/program_recursive_test.go @@ -136,7 +136,7 @@ func testProgramResursiveCalls(t *testing.T, tests [][]multiCallRecurse, jit boo validatorConfig.BlockValidator.Enable = true emptyRedisURL := "" defaultWasmRootPath := "" - AddDefaultValNode(t, ctx, validatorConfig, jit, emptyRedisURL, defaultWasmRootPath) + AddValNode(t, ctx, validatorConfig, jit, emptyRedisURL, defaultWasmRootPath) valClient, valCleanup := builder.Build2ndNode(t, &SecondNodeParams{nodeConfig: validatorConfig}) defer valCleanup() diff --git a/util/testhelpers/github/releases.go b/util/testhelpers/github/releases.go index 631111e7aa..5555c90aa1 100644 --- a/util/testhelpers/github/releases.go +++ b/util/testhelpers/github/releases.go @@ -47,7 +47,7 @@ func LatestConsensusRelease(ctx context.Context) (*ConsensusRelease, error) { } var found *ConsensusRelease for _, release := range releases { - if strings.HasPrefix(release.GetTagName(), "consensus") { + if strings.HasPrefix(release.GetTagName(), "consensus") && !release.GetPrerelease() { if found, err = fromRelease(release); err != nil { return nil, err }