Skip to content

Commit

Permalink
Set rootModule dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
anodar committed Apr 19, 2024
1 parent 5b98d6f commit fb897bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
3 changes: 1 addition & 2 deletions system_tests/block_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
26 changes: 14 additions & 12 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit fb897bb

Please sign in to comment.