From fb897bbe70e869a971c8d6da2ca9bd2befb302ce Mon Sep 17 00:00:00 2001 From: Nodar Ambroladze Date: Sat, 20 Apr 2024 01:22:45 +0200 Subject: [PATCH] Set rootModule dynamically --- system_tests/block_validator_test.go | 3 +-- system_tests/common_test.go | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/system_tests/block_validator_test.go b/system_tests/block_validator_test.go index b472ec2a3c..68fcaa5ba4 100644 --- a/system_tests/block_validator_test.go +++ b/system_tests/block_validator_test.go @@ -73,9 +73,8 @@ func testBlockValidatorSimple(t *testing.T, dasModeString string, workloadLoops if useRedisStreams { redisURL = redisutil.CreateTestRedis(ctx, t) validatorConfig.BlockValidator.RedisValidationClientConfig = server_api.DefaultRedisValidationClientConfig - validatorConfig.BlockValidator.RedisValidationClientConfig.ModuleRoots = wasmModuleRoots + validatorConfig.BlockValidator.RedisValidationClientConfig.ModuleRoots = []string{currentRootModule(t).Hex()} validatorConfig.BlockValidator.RedisValidationClientConfig.RedisURL = redisURL - validatorConfig.BlockValidator.CurrentModuleRoot = wasmModuleRoots[0] } AddDefaultValNode(t, ctx, validatorConfig, !arbitrator, redisURL) diff --git a/system_tests/common_test.go b/system_tests/common_test.go index 91b08fdeaf..fb82ca5fa2 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -72,11 +72,6 @@ import ( type info = *BlockchainTestInfo type client = arbutil.L1Interface -var wasmModuleRoots = []string{ - "0xb1e1f56cdcb7453d9416e9b242ded14aa4324674f1173e86fec9b85e923284e7", - // "0x0e5403827cef82bcbb6f4ba1b6f3d84edc5b4b8991b164f623ff2eacda768e35", -} - type SecondNodeParams struct { nodeConfig *arbnode.Config execConfig *gethexec.Config @@ -589,6 +584,15 @@ func configByValidationNode(t *testing.T, clientConfig *arbnode.Config, valStack clientConfig.BlockValidator.ValidationServerConfigs[0].JWTSecret = "" } +func currentRootModule(t *testing.T) common.Hash { + t.Helper() + locator, err := server_common.NewMachineLocator("") + if err != nil { + t.Fatalf("Error creating machine locator: %v", err) + } + return locator.LatestWasmModuleRoot() +} + func AddDefaultValNode(t *testing.T, ctx context.Context, nodeConfig *arbnode.Config, useJit bool, redisURL string) { if !nodeConfig.ValidatorRequired() { return @@ -605,13 +609,11 @@ func AddDefaultValNode(t *testing.T, ctx context.Context, nodeConfig *arbnode.Co if err != nil { t.Fatalf("Error creating redis coordinator: %v", err) } - for _, rootModule := range wasmModuleRoots { - redisStream := server_api.RedisStreamForRoot(common.HexToHash(rootModule)) - createGroup(ctx, t, redisStream, redisClient) - conf.Arbitrator.RedisValidationServerConfig.RedisURL = redisURL - t.Cleanup(func() { destroyGroup(ctx, t, redisStream, redisClient) }) - } - conf.Arbitrator.RedisValidationServerConfig.ModuleRoots = wasmModuleRoots + redisStream := server_api.RedisStreamForRoot(currentRootModule(t)) + createGroup(ctx, t, redisStream, redisClient) + conf.Arbitrator.RedisValidationServerConfig.RedisURL = redisURL + t.Cleanup(func() { destroyGroup(ctx, t, redisStream, redisClient) }) + conf.Arbitrator.RedisValidationServerConfig.ModuleRoots = []string{currentRootModule(t).Hex()} } _, valStack := createTestValidationNode(t, ctx, &conf) configByValidationNode(t, nodeConfig, valStack)