Skip to content

[NIT-4259] Rust workspace#4184

Merged
tsahee merged 15 commits intomasterfrom
pmikolajczyk/nit-4259-rust-workspace
Jan 12, 2026
Merged

[NIT-4259] Rust workspace#4184
tsahee merged 15 commits intomasterfrom
pmikolajczyk/nit-4259-rust-workspace

Conversation

@pmikolajczyk41
Copy link
Copy Markdown
Member

@pmikolajczyk41 pmikolajczyk41 commented Dec 30, 2025

  1. Move rust code from arbitrator/ directory to crates/.
  2. Move Cargo.{toml, lock} to the repo root.
  3. Use common target/ directory for the main Rust workspace and Go artifacts (previously we had main target/ and arbitrator/target.
  4. Adjust naming in the CI workflows ("rust" instead of "arbitrator" - we already have code that is not arbitrator-related, we will have more soon).

pulls in: OffchainLabs/nitro-contracts#406
pulls in: OffchainLabs/nitro-contracts#407

@pmikolajczyk41 pmikolajczyk41 force-pushed the pmikolajczyk/nit-4259-rust-workspace branch from 72e0027 to 155b327 Compare December 30, 2025 17:42
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 32.84%. Comparing base (8dff9a2) to head (f7dbe73).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4184      +/-   ##
==========================================
- Coverage   33.12%   32.84%   -0.28%     
==========================================
  Files         462      462              
  Lines       55958    55958              
==========================================
- Hits        18534    18378     -156     
- Misses      34168    34356     +188     
+ Partials     3256     3224      -32     

@pmikolajczyk41 pmikolajczyk41 force-pushed the pmikolajczyk/nit-4259-rust-workspace branch from 155b327 to a79704b Compare December 30, 2025 18:04
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 30, 2025

❌ 8 Tests Failed:

Tests completed Failed Passed Skipped
4504 8 4496 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]
github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Spawn(0xc005fa8a00, {0x1fc31c0, 0xc00322b7c0})
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:205 +0x235
created by github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Act in goroutine 276661
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:358 +0x1125

goroutine 292024 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Subscription[...]).Next(0x1fc31c0, {0x1fc31c0?, 0xc00322b7c0?})
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:131 +0xd0
github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Spawn(0xc005fa8960, {0x1fc31c0, 0xc00322b7c0})
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:205 +0x235
created by github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Act in goroutine 276661
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:357 +0x10bf

goroutine 313340 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Subscription[...]).Next(0x1fc31c0, {0x1fc31c0?, 0xc00322b6d0?})
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:131 +0xd0
github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Spawn(0xc00272a500, {0x1fc31c0, 0xc00322b6d0})
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:205 +0x235
created by github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Act in goroutine 301096
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:358 +0x1125
TestEndToEnd_ManyEvilValidators/honest_essential_edges_confirmed_by_challenge_win
Stack Traces | -0.000s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Spawn(0xc005fa8a00, {0x1fc31c0, 0xc00322b7c0})
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:205 +0x235
created by github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Act in goroutine 276661
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:358 +0x1125

goroutine 292024 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Subscription[...]).Next(0x1fc31c0, {0x1fc31c0?, 0xc00322b7c0?})
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:131 +0xd0
github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Spawn(0xc005fa8960, {0x1fc31c0, 0xc00322b7c0})
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:205 +0x235
created by github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Act in goroutine 276661
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:357 +0x10bf

goroutine 313340 [select]:
github.com/offchainlabs/nitro/bold/containers/events.(*Subscription[...]).Next(0x1fc31c0, {0x1fc31c0?, 0xc00322b6d0?})
	/home/runner/work/nitro/nitro/bold/containers/events/producer.go:131 +0xd0
github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Spawn(0xc00272a500, {0x1fc31c0, 0xc00322b6d0})
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:205 +0x235
created by github.com/offchainlabs/nitro/bold/challenge/tracker.(*Tracker).Act in goroutine 301096
	/home/runner/work/nitro/nitro/bold/challenge/tracker/tracker.go:358 +0x1125
TestVersion30
Stack Traces | 5.880s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
=== CONT  TestVersion30
�[38;5;48;1myay!! we validated block 4 in 99.98ms�[0;0m
    precompile_inclusion_test.go:94: goroutine 610077 [running]:
        runtime/debug.Stack()
        	/opt/hostedtoolcache/go/1.25.5/x64/src/runtime/debug/stack.go:26 +0x5e
        github.com/offchainlabs/nitro/util/testhelpers.RequireImpl({0x4107450, 0xc0698d1180}, {0x40c4540, 0xc096068720}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/util/testhelpers/testhelpers.go:29 +0x55
        github.com/offchainlabs/nitro/system_tests.Require(0xc0698d1180, {0x40c4540, 0xc096068720}, {0x0, 0x0, 0x0})
        	/home/runner/work/nitro/nitro/system_tests/common_test.go:2034 +0x5d
        github.com/offchainlabs/nitro/system_tests.testPrecompiles(0xc0698d1180, 0x1e, {0xc0d1dcfdb0, 0x6, 0x38?})
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:94 +0x371
        github.com/offchainlabs/nitro/system_tests.TestVersion30(0xc0698d1180?)
        	/home/runner/work/nitro/nitro/system_tests/precompile_inclusion_test.go:67 +0x798
        testing.tRunner(0xc0698d1180, 0x3d45530)
        	/opt/hostedtoolcache/go/1.25.5/x64/src/testing/testing.go:1934 +0xea
        created by testing.(*T).Run in goroutine 1
        	/opt/hostedtoolcache/go/1.25.5/x64/src/testing/testing.go:1997 +0x465
        
    precompile_inclusion_test.go:94: �[31;1m [] execution aborted (timeout = 5s) �[0;0m
--- FAIL: TestVersion30 (5.88s)

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

@pmikolajczyk41 pmikolajczyk41 force-pushed the pmikolajczyk/nit-4259-rust-workspace branch from 477c24d to 8cd0330 Compare December 31, 2025 10:31
@pmikolajczyk41 pmikolajczyk41 self-assigned this Dec 31, 2025
KolbyML
KolbyML previously approved these changes Jan 6, 2026
Copy link
Copy Markdown
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks really good, just one minor concern. I don't know when lib/lib-wasm would be built, but it looks like target/lib doesn't use the standard target? But it isn't built with make test-go so I am not sure.

Anyways I would double check that, other then that I think this PR is good.

It looks like our CI doesn't verify have coverage if this is an issue or not, maybe we don't even need to lines, but Tsahi added one so I am assuming it was added intentional

Comment thread contracts-legacy
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was stated on call this would be reverted, just flagging it so we don't forget

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted in 0f43460

println!("cargo:rustc-link-search=../../target/lib-wasm/");
println!("cargo:rustc-link-search=../target/lib/");
println!("cargo:rustc-link-search=../../../target/lib-wasm/");
println!("cargo:rustc-link-search=../../../target/lib/");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original pathing looks odd

Maybe it was intentional? it looks like lib-wasm/lib isn't built when running make test-go, but I am assuming

Maybe we should do

    println!("cargo:rustc-link-search=../../../target/lib-wasm/");
    println!("cargo:rustc-link-search=../target/lib/");

As there is a target folder in crates/wasm-libraries, and target/lib-wasm/ looks like it is targeting the workspaces target.

Ideally everything was in 1 workspace, maybe having so many seperate workspaces was intentional? but that problem is unrelated to this PR, maybe something we can look into in the future, as having 1 target folder in the project would be very nice

@KolbyML KolbyML assigned pmikolajczyk41 and unassigned KolbyML Jan 6, 2026
@pmikolajczyk41
Copy link
Copy Markdown
Member Author

@KolbyML regarding the paths in the build scripts - it's pretty tricky and it took me some time until I got them right;

First thing to note is that build.rs expects lib paths relative to its crate workspace root directory. And we have actually 2 workspaces:

  • the main one (previously arbitrator directory)
  • wasm-libraries (within crates/wasm-libraries)

Both workspaces have at least one crate that requires some static libraries during linking phase. These libraries used to live in two different target directories: the global one (target/) and the arbitrator one (arbitrator/crates). After I moved Cargo.toml to the root directory, the arbitrator one got moved one dir up and merged with the global directory.

Hopefully this should explain all the changes to the target paths.

@pmikolajczyk41 pmikolajczyk41 requested a review from KolbyML January 6, 2026 19:45
@KolbyML
Copy link
Copy Markdown
Member

KolbyML commented Jan 6, 2026

@KolbyML regarding the paths in the build scripts - it's pretty tricky and it took me some time until I got them right;

First thing to note is that build.rs expects lib paths relative to its crate workspace root directory. And we have actually 2 workspaces:

  • the main one (previously arbitrator directory)
  • wasm-libraries (within crates/wasm-libraries)

Both workspaces have at least one crate that requires some static libraries during linking phase. These libraries used to live in two different target directories: the global one (target/) and the arbitrator one (arbitrator/crates). After I moved Cargo.toml to the root directory, the arbitrator one got moved one dir up and merged with the global directory.

Hopefully this should explain all the changes to the target paths.

Oh I see 👍

KolbyML
KolbyML previously approved these changes Jan 6, 2026
Copy link
Copy Markdown
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: looks good

KolbyML
KolbyML previously approved these changes Jan 6, 2026
Copy link
Copy Markdown
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: looks good

joshuacolvin0
joshuacolvin0 previously approved these changes Jan 6, 2026
Copy link
Copy Markdown
Member

@joshuacolvin0 joshuacolvin0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pmikolajczyk41 pmikolajczyk41 dismissed stale reviews from joshuacolvin0 and KolbyML via 46e2e4d January 9, 2026 11:01
KolbyML
KolbyML previously approved these changes Jan 9, 2026
Copy link
Copy Markdown
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: looks good

bragaigor
bragaigor previously approved these changes Jan 9, 2026
Copy link
Copy Markdown
Contributor

@bragaigor bragaigor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pmikolajczyk41 pmikolajczyk41 dismissed stale reviews from bragaigor and KolbyML via 194c0fd January 12, 2026 12:19
Copy link
Copy Markdown
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: looks good

@tsahee tsahee merged commit c552505 into master Jan 12, 2026
15 of 16 checks passed
@tsahee tsahee deleted the pmikolajczyk/nit-4259-rust-workspace branch January 12, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants