Skip to content

Commit

Permalink
Fix TestChallengeManagerFullAsserterCorrect test
Browse files Browse the repository at this point in the history
  • Loading branch information
anodar committed Apr 20, 2024
1 parent 738f04d commit 005f441
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
16 changes: 9 additions & 7 deletions staker/stateless_block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,12 @@ func NewStatelessBlockValidator(
stack *node.Node,
) (*StatelessBlockValidator, error) {
var validationSpawners []validator.ValidationSpawner
redisValClient, err := validatorclient.NewRedisValidationClient(&config().RedisValidationClientConfig)
if err != nil {
log.Error("Creating redis validation client", "error", err)
} else {
if config().RedisValidationClientConfig.Enabled() {
redisValClient, err := validatorclient.NewRedisValidationClient(&config().RedisValidationClientConfig)
if err != nil {
return nil, fmt.Errorf("creating new redis validation client: %w", err)
// log.Error("Creating redis validation client, redis validator disabled", "error", err)
}
validationSpawners = append(validationSpawners, redisValClient)
}
for _, serverConfig := range config().ValidationServerConfigs {
Expand Down Expand Up @@ -427,17 +429,17 @@ func (v *StatelessBlockValidator) OverrideRecorder(t *testing.T, recorder execut
func (v *StatelessBlockValidator) Start(ctx_in context.Context) error {
for _, spawner := range v.validationSpawners {
if err := spawner.Start(ctx_in); err != nil {
return err
return fmt.Errorf("starting validation spawner: %w", err)
}
}
if err := v.execSpawner.Start(ctx_in); err != nil {
return err
return fmt.Errorf("starting execution spawner: %w", err)
}
if v.config.PendingUpgradeModuleRoot != "" {
if v.config.PendingUpgradeModuleRoot == "latest" {
latest, err := v.execSpawner.LatestWasmModuleRoot().Await(ctx_in)
if err != nil {
return err
return fmt.Errorf("getting latest wasm module root: %w", err)
}
v.pendingWasmModuleRoot = latest
} else {
Expand Down
4 changes: 4 additions & 0 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ func StaticFetcherFrom[T any](t *testing.T, config *T) func() *T {
func configByValidationNode(clientConfig *arbnode.Config, valStack *node.Node) {
clientConfig.BlockValidator.ExecutionServerConfig.URL = valStack.WSEndpoint()
clientConfig.BlockValidator.ExecutionServerConfig.JWTSecret = ""
if len(clientConfig.BlockValidator.ValidationServerConfigs) != 0 {
clientConfig.BlockValidator.ValidationServerConfigs[0].URL = valStack.WSEndpoint()
clientConfig.BlockValidator.ValidationServerConfigs[0].JWTSecret = ""
}
}

func currentRootModule(t *testing.T) common.Hash {
Expand Down
10 changes: 6 additions & 4 deletions system_tests/validation_mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ func (s *mockSpawner) Launch(entry *validator.ValidationInput, moduleRoot common

var mockWasmModuleRoot common.Hash = common.HexToHash("0xa5a5a5")

func (s *mockSpawner) Start(context.Context) error { return nil }
func (s *mockSpawner) Stop() {}
func (s *mockSpawner) Name() string { return "mock" }
func (s *mockSpawner) Room() int { return 4 }
func (s *mockSpawner) Start(context.Context) error {
return nil
}
func (s *mockSpawner) Stop() {}
func (s *mockSpawner) Name() string { return "mock" }
func (s *mockSpawner) Room() int { return 4 }

func (s *mockSpawner) CreateExecutionRun(wasmModuleRoot common.Hash, input *validator.ValidationInput) containers.PromiseInterface[validator.ExecutionRun] {
s.ExecSpawned = append(s.ExecSpawned, input.Id)
Expand Down
2 changes: 1 addition & 1 deletion validator/client/redisproducer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type RedisValidationClientConfig struct {
}

func (c RedisValidationClientConfig) Enabled() bool {
return len(c.ModuleRoots) > 0
return c.RedisURL != ""
}

var DefaultRedisValidationClientConfig = RedisValidationClientConfig{
Expand Down
6 changes: 2 additions & 4 deletions validator/client/validation_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ func (c *ValidationClient) Launch(entry *validator.ValidationInput, moduleRoot c
func (c *ValidationClient) Start(ctx_in context.Context) error {
c.StopWaiter.Start(ctx_in, c)
ctx := c.GetContext()
if c.client != nil {
if err := c.client.Start(ctx); err != nil {
return err
}
if err := c.client.Start(ctx); err != nil {
return err
}
var name string
if err := c.client.CallContext(ctx, &name, server_api.Namespace+"_name"); err != nil {
Expand Down

0 comments on commit 005f441

Please sign in to comment.