Skip to content

Run nitro with rust validator#4497

Open
pmikolajczyk41 wants to merge 6 commits intomasterfrom
pmikolajczyk/nit-4469-run-nitro-with-rust-validator
Open

Run nitro with rust validator#4497
pmikolajczyk41 wants to merge 6 commits intomasterfrom
pmikolajczyk/nit-4469-run-nitro-with-rust-validator

Conversation

@pmikolajczyk41
Copy link
Copy Markdown
Member

Replace the Go validation node (nitro-val) with the Rust validation server (crates/validator) in the nitro-testnode setup. The Rust server is fully compatible with the Go validation client and exposes JIT validation over HTTP JSON-RPC.

Changes

Dockerfile

  • Build the Rust validator binary in the prover-builder stage (alongside jit, prover-lib, prover-bin)
  • Copy validator binary into the nitro-node-dev image at /usr/local/bin/
  • Symlink legacy machine directories from /home/user/nitro-legacy/machines/ into /home/user/target/machines/ so the Rust validator can serve all module roots (latest + legacy) from a single --root-path
  • Bump Go version from 1.25.1 to 1.25.8 (I had some problems with fetching the old version)

staker/block_validator.go

  • Allow http:// and https:// URL schemes for validation server configs (previously only ws:///wss:// were accepted)
  • Upgrade "result validated" log from Trace to Info level with additional fields (batch, posInBatch) for easier debugging

nitro-testnode (submodule)

  • docker-compose.yaml: Replace nitro-val with validator as entrypoint for the validation_node service, configure it with CLI args (--address, --root-path), add RUST_LOG=tower_http=debug,info for HTTP-level request tracing, and add a healthcheck so dependent services wait for the server to be ready
  • scripts/config.ts: Remove jwtsecret from block-validator config (Rust server doesn't use JWT auth)
  • scripts/index.ts: Change default validation node URL from ws://validation_node:8549 to http://validation_node:4141

Reproduction

cd nitro-testnode
./test-node.bash --dev --init-force --validate

Expected output

# validation_node (Rust server) — HTTP request/response traces from tower_http:
DEBUG tower_http: started processing request method=POST uri=/
DEBUG tower_http: finished processing request latency=42ms status=200

# validator (Go node) — Block validation confirmations:
INFO block validated count=42 blockHash=0x... batch=1 posInBatch=0

companion PR: OffchainLabs/nitro-testnode#181

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.57%. Comparing base (e89bc08) to head (627ffff).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4497      +/-   ##
==========================================
- Coverage   32.93%   32.57%   -0.37%     
==========================================
  Files         495      495              
  Lines       58648    58648              
==========================================
- Hits        19317    19103     -214     
- Misses      35912    36187     +275     
+ Partials     3419     3358      -61     

@github-actions
Copy link
Copy Markdown
Contributor

❌ 9 Tests Failed:

Tests completed Failed Passed Skipped
4366 9 4357 0
View the top 3 failed tests by shortest run time
TestEndToEnd_ManyEvilValidators
Stack Traces | -0.000s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
created by github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast in goroutine 210761
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:106 +0x10a

goroutine 5417675 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast.func1()
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:107 +0xd9
created by github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast in goroutine 210758
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:106 +0x10a

goroutine 5417671 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast.func1()
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:107 +0xd9
created by github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast in goroutine 210758
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:106 +0x10a

goroutine 5417196 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast.func1()
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:107 +0xd9
created by github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast in goroutine 210764
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:106 +0x10a
TestEndToEnd_ManyEvilValidators/honest_essential_edges_confirmed_by_challenge_win
Stack Traces | -0.000s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
created by github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast in goroutine 210761
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:106 +0x10a

goroutine 5417675 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast.func1()
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:107 +0xd9
created by github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast in goroutine 210758
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:106 +0x10a

goroutine 5417671 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast.func1()
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:107 +0xd9
created by github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast in goroutine 210758
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:106 +0x10a

goroutine 5417196 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast.func1()
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:107 +0xd9
created by github.com/offchainlabs/nitro/bold/containers/events.(*Producer[...]).Broadcast in goroutine 210764
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:106 +0x10a
TestMultigasStylus_StorageWrite/out_of_gas
Stack Traces | 0.010s run time
=== RUN   TestMultigasStylus_StorageWrite/out_of_gas
INFO [03-11|16:52:48.150] Starting peer-to-peer node               instance=test-stack-name/linux-amd64/go1.25.7
WARN [03-11|16:52:48.150] P2P server will be useless, neither dialing nor listening
INFO [03-11|16:52:48.150] Started log indexer
INFO [03-11|16:52:48.150] message position already seen in l1 price data cache, ignoring
INFO [03-11|16:52:48.150] New local node record                    seq=1,773,247,968,150 id=a755d9b0059fe476   ip=127.0.0.1 udp=0 tcp=0
INFO [03-11|16:52:48.150] Started P2P networking                   self=enode://2c8e78ac144185098327b3d1fb7ee9b1aa6c96e5d58037453b229a7fa3115915e4f3366781c7ca978fc12190ae99bf3d367653de9cb6141cc6a50a5298b514c1@127.0.0.1:0
INFO [03-11|16:52:48.151] Log index head rendering in progress     firstblock=0 lastblock=1 processed=2 remaining=0 elapsed=1.432s
INFO [03-11|16:52:48.151] Log index head rendering finished        firstblock=0 lastblock=1 processed=2 elapsed=1.432s
    multigas_stylus_program_test.go:380: 
        	Error Trace:	/home/runner/work/nitro/nitro/system_tests/multigas_stylus_program_test.go:380
        	Error:      	An error is expected but got nil.
        	Test:       	TestMultigasStylus_StorageWrite/out_of_gas
--- FAIL: TestMultigasStylus_StorageWrite/out_of_gas (0.01s)

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants