Skip to content

Commit

Permalink
Produce a more descriptive error when validation server url is not se…
Browse files Browse the repository at this point in the history
…t to a WS/WSS server
  • Loading branch information
ganeshvanahalli committed Jul 10, 2024
1 parent 0fb02ca commit 8daee6e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion staker/stateless_block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"errors"
"fmt"
"net/url"
"testing"

"github.com/offchainlabs/nitro/arbstate/daprovider"
Expand Down Expand Up @@ -428,8 +429,13 @@ func (v *StatelessBlockValidator) Start(ctx_in context.Context) error {
return fmt.Errorf("starting execution spawner: %w", err)
}
}
for _, spawner := range v.execSpawners {
for i, spawner := range v.execSpawners {
if err := spawner.Start(ctx_in); err != nil {
if u, parseErr := url.Parse(v.config.ValidationServerConfigs[i].URL); parseErr == nil {
if u.Scheme == "http" || u.Scheme == "https" {
return fmt.Errorf("validation server's url scheme: %s is unsupported, it should either be ws or wss, err: %w", u.Scheme, err)
}
}
return err
}
}
Expand Down

0 comments on commit 8daee6e

Please sign in to comment.