Skip to content

Consolidate test crates into a single Cargo workspace#4596

Open
pmikolajczyk41 wants to merge 13 commits intomasterfrom
pmikolajczyk/nit-4756-stylus-tests
Open

Consolidate test crates into a single Cargo workspace#4596
pmikolajczyk41 wants to merge 13 commits intomasterfrom
pmikolajczyk/nit-4756-stylus-tests

Conversation

@pmikolajczyk41
Copy link
Copy Markdown
Member

The crates/stylus/tests/ directory contained 13 independent Rust crates, each with its own Cargo.lock, .cargo/config.toml, and an empty [workspace] declaration. This caused duplicated dependency management and one Dependabot PR per crate per dependency update.

This PR consolidates them into a single Cargo workspace:

  • Add crates/stylus/tests/Cargo.toml as the workspace root with shared [workspace.dependencies], [workspace.package], and a common [profile.release] (with per-package opt-level overrides for erc20, hostio-test, sdk-storage)
  • Migrate all 13 member Cargo.tomls to inherit workspace package fields and use { workspace = true } dependencies
  • Replace 13 per-crate Cargo.lock files with a single workspace Cargo.lock
  • Remove 8 redundant per-crate .cargo/config.toml files — the workspace-level one at crates/stylus/tests/.cargo/config.toml is picked up automatically by Cargo for all members
  • Remove stray timings/Cargo.lock (no corresponding Cargo.toml)
  • Fix make clean target to remove the new shared target/ instead of per-crate target/ directories

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

❌ 17 Tests Failed:

Tests completed Failed Passed Skipped
4785 17 4768 0
View the top 3 failed tests by shortest run time
TestPruningDBSizeReduction
Stack Traces | 0.000s run time
=== RUN   TestPruningDBSizeReduction
--- FAIL: TestPruningDBSizeReduction (0.00s)
TestAliasingFlaky
Stack Traces | -0.000s run time
=== RUN   TestAliasingFlaky
=== PAUSE TestAliasingFlaky
=== CONT  TestAliasingFlaky
    common_test.go:777: BuildL1 deployConfig: DeployBold=true, DeployReferenceDAContracts=false
INFO [04-02|16:40:46.945] Started log indexer
INFO [04-02|16:40:46.945] Started log indexer
TestBatchPosterL1SurplusMatchesBatchGasFlaky
Stack Traces | 0.540s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
panic: runtime error: invalid memory address or nil pointer dereference [recovered, repanicked]
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x207e912]

goroutine 7 [running]:
testing.tRunner.func1.2({0x37e6160, 0x62019b0})
	/opt/hostedtoolcache/go/1.25.8/x64/src/testing/testing.go:1872 +0x237
testing.tRunner.func1()
	/opt/hostedtoolcache/go/1.25.8/x64/src/testing/testing.go:1875 +0x35b
panic({0x37e6160?, 0x62019b0?})
	/opt/hostedtoolcache/go/1.25.8/x64/src/runtime/panic.go:783 +0x132
github.com/offchainlabs/nitro/arbnode.(*InboxTracker).GetBatchCount(0x2abb900?)
	/home/runner/work/nitro/nitro/arbnode/inbox_tracker.go:210 +0x12
github.com/offchainlabs/nitro/arbnode.(*InboxTracker).FindInboxBatchContainingMessage(0x0, 0x7)
	/home/runner/work/nitro/nitro/arbnode/inbox_tracker.go:225 +0x2f
github.com/offchainlabs/nitro/system_tests.TestBatchPosterL1SurplusMatchesBatchGasFlaky(0xc00010bdc0)
	/home/runner/work/nitro/nitro/system_tests/batch_poster_test.go:839 +0x725
testing.tRunner(0xc00010bdc0, 0x41b8da0)
	/opt/hostedtoolcache/go/1.25.8/x64/src/testing/testing.go:1934 +0xea
created by testing.(*T).Run in goroutine 1
	/opt/hostedtoolcache/go/1.25.8/x64/src/testing/testing.go:1997 +0x465

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

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 34.22%. Comparing base (192393a) to head (22631fb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4596      +/-   ##
==========================================
+ Coverage   34.20%   34.22%   +0.01%     
==========================================
  Files         494      494              
  Lines       58926    58926              
==========================================
+ Hits        20156    20166      +10     
+ Misses      35230    35224       -6     
+ Partials     3540     3536       -4     

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.

This is very nice, are there any reasons we can't use the repo's main workspace Cargo.toml? Regardless this is a massive improvement 😁

@KolbyML KolbyML assigned joshuacolvin0 and unassigned KolbyML Apr 2, 2026
@pmikolajczyk41
Copy link
Copy Markdown
Member Author

are there any reasons we can't use the repo's main workspace Cargo.toml

theoretically we could, but my main reason was that all these stylus test crates have different target arch: see crates/stylus/tests/.cargo/config.toml - it sets target = "wasm32-unknown-unknown" for the whole tests/ directory. In the main workspace that config wouldn't be picked up automatically (Cargo reads it relative to where you run from), so every build of these crates would need an explicit --target wasm32-unknown-unknown. The Makefile already does this, but cargo build --workspace would try to compile them natively and likely produce garbage or fail.

Also, [profile.release] panic = "abort", lto = true, codegen-units = 1 are WASM-specific settings you wouldn't want applied to the whole main workspace. You'd need per-package overrides for all 13 crates in the root Cargo.toml, which is noisy

@KolbyML

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