Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix split validation #2568

Merged
merged 8 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/split-val-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ for port in 52000 52001; do
done
done
echo launching nitro-node
/usr/local/bin/nitro --validation.wasm.allowed-wasm-module-roots /home/user/nitro-legacy/machines,/home/user/target/machines --node.block-validator.validation-server-configs-list='[{"jwtsecret":"/tmp/nitro-val.jwt","url":"http://127.0.0.10:52000"}, {"jwtsecret":"/tmp/nitro-val.jwt","url":"http://127.0.0.10:52001"}]' "$@"
/usr/local/bin/nitro --validation.wasm.allowed-wasm-module-roots /home/user/nitro-legacy/machines,/home/user/target/machines --node.block-validator.validation-server-configs-list='[{"jwtsecret":"/tmp/nitro-val.jwt","url":"ws://127.0.0.10:52000"}, {"jwtsecret":"/tmp/nitro-val.jwt","url":"ws://127.0.0.10:52001"}]' "$@"
11 changes: 11 additions & 0 deletions staker/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/json"
"errors"
"fmt"
"net/url"
"regexp"
"runtime"
"sync"
Expand Down Expand Up @@ -140,6 +141,16 @@ func (c *BlockValidatorConfig) Validate() error {
if err := c.ValidationServerConfigs[i].Validate(); err != nil {
return fmt.Errorf("failed to validate one of the block-validator validation-server-configs. url: %s, err: %w", c.ValidationServerConfigs[i].URL, err)
}
serverUrl := c.ValidationServerConfigs[i].URL
if serverUrl != "self" && serverUrl != "self-auth" {
u, err := url.Parse(serverUrl)
if err != nil {
return fmt.Errorf("failed parsing validation server's url:%s err: %w", serverUrl, err)
}
if u.Scheme != "ws" && u.Scheme != "wss" {
return fmt.Errorf("validation server's url scheme is unsupported, it should either be ws or wss, url:%s", serverUrl)
}
}
}
return nil
}
Expand Down
8 changes: 1 addition & 7 deletions staker/stateless_block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"errors"
"fmt"
"net/url"
"runtime"
"testing"

Expand Down Expand Up @@ -488,13 +487,8 @@ func (v *StatelessBlockValidator) Start(ctx_in context.Context) error {
return fmt.Errorf("starting execution spawner: %w", err)
}
}
for i, spawner := range v.execSpawners {
for _, 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 != "ws" && u.Scheme != "wss" {
return fmt.Errorf("validation server's url scheme is unsupported, it should either be ws or wss, url:%s err: %w", v.config.ValidationServerConfigs[i].URL, err)
}
}
return err
}
}
Expand Down
3 changes: 0 additions & 3 deletions validator/server_jit/machine_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@ var DefaultJitMachineConfig = JitMachineConfig{
func getJitPath() (string, error) {
var jitBinary string
executable, err := os.Executable()
println("executable: ", executable)
if err == nil {
if strings.Contains(filepath.Base(executable), "test") || strings.Contains(filepath.Dir(executable), "system_tests") {
_, thisfile, _, _ := runtime.Caller(0)
projectDir := filepath.Dir(filepath.Dir(filepath.Dir(thisfile)))
println("projectDir: ", projectDir)
jitBinary = filepath.Join(projectDir, "target", "bin", "jit")
} else {
jitBinary = filepath.Join(filepath.Dir(executable), "jit")
println("inside else: ", jitBinary)
}
_, err = os.Stat(jitBinary)
}
Expand Down
Loading