Skip to content

feat: refactor integration testing setup#166

Merged
haardikk21 merged 38 commits intomainfrom
refactor-tests
Nov 26, 2025
Merged

feat: refactor integration testing setup#166
haardikk21 merged 38 commits intomainfrom
refactor-tests

Conversation

@haardikk21
Copy link
Copy Markdown
Collaborator

@haardikk21 haardikk21 commented Nov 3, 2025

Introduces a shared integration test framework in crates/test-utils and migrates the existing flashblocks RPC tests to use this new infrastructure. This framework supports tests that need to advance the state of the chain via flashblocks or full blocks to verify behavior.

  • TestHarness: The main orchestration layer that combines node management, Engine API interactions, and account management. It handles block building, chain advancement, and flashblocks submission.
  • LocalNode: An in-process Optimism node wrapper with Base Sepolia configuration, isolated from P2P discovery for parallel testing.
  • EngineApi: A wrapper around the Consensus Layer (CL) Engine API for forkchoice updates and payload submission.
  • TestAccounts: Pre-funded, deterministic accounts (Alice, Bob, Charlie, Deployer) compatible with Anvil defaults.

Closes #162 and #164.

@cb-heimdall
Copy link
Copy Markdown
Collaborator

cb-heimdall commented Nov 3, 2025

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@steph-rs steph-rs mentioned this pull request Nov 12, 2025
1 task
@niran niran marked this pull request as ready for review November 20, 2025 04:01
@niran niran requested a review from danyalprout November 20, 2025 04:40
haardikk21 and others added 21 commits November 22, 2025 19:04
- Add latest_block() method to TestHarness in test-utils that encapsulates
  the two-step process of getting best_block_number then fetching that block
- Refactor test_progress_canonical_blocks_without_flashblocks to use the new method
- Refactor FlashblockBuilder::build() to use the new method
- Reduces code duplication and improves maintainability across all tests
Replace NodeBuilder::testing_node() with LocalNode::create_test_database()
to reduce memory usage in parallel tests. The testing_node() helper
hardcodes an 8 TB map size which causes ENOMEM errors when running
multiple test processes concurrently with cargo test.

This prevents memory exhaustion when running parallel tests while
maintaining the same functionality.
…er pattern

- Add missing max_pending_blocks_depth parameter (5) to FlashblocksState::new() calls in rpc.rs tests
- Add missing max_pending_blocks_depth parameter to init_flashblocks_state in test-utils
- Fix builder pattern to use engine_api_launcher() + launch_with() instead of .launch() to match TestHarness::new() signature
- Enable 'client' feature for reth-optimism-rpc dependency to fix OpEngineApiClient import error

These changes ensure no logic was lost during the rebase and fix compilation errors.
@haardikk21
Copy link
Copy Markdown
Collaborator Author

haardikk21 commented Nov 26, 2025

LGTM - thanks a lot! I can't do an approval since I opened this PR

cc @danyalprout

@haardikk21 haardikk21 merged commit e8e00a8 into main Nov 26, 2025
9 checks passed
@haardikk21 haardikk21 deleted the refactor-tests branch November 26, 2025 16:18
refcell added a commit that referenced this pull request Feb 18, 2026
### Description

Fixes test casing.
mw2000 pushed a commit that referenced this pull request Mar 9, 2026
* deployment

* feat: witnessgen args

* port for the server

* fix: proof timeout flag

* .env.example

* chore: cargo fmt

* feat: bump ram

* feat: update slack

* remove docker-compose.yml
mw2000 pushed a commit that referenced this pull request Mar 16, 2026
* deployment

* feat: witnessgen args

* port for the server

* fix: proof timeout flag

* .env.example

* chore: cargo fmt

* feat: bump ram

* feat: update slack

* remove docker-compose.yml
haardikk21 added a commit that referenced this pull request Mar 17, 2026
…ngine API support (#166)

* wip: create test harness independently

* wip: initialize foundry project

* wip: install solmate

* update readme

* wip: generalize test harness, allow for ExEx's and RPC modules to be passed down

* remove foundry github workflow

* wip: first test migration

* migrate most rpc.rs tests

* test-utils: wire flashblocks state into harness

* Remove legacy flashblocks RPC tests

* Port flashblocks state tests to shared harness

* Sync harness provider with canonical chain

* Cleanup flashblocks OnceCell usage

* Add latest_block() utility to base TestHarness

- Add latest_block() method to TestHarness in test-utils that encapsulates
  the two-step process of getting best_block_number then fetching that block
- Refactor test_progress_canonical_blocks_without_flashblocks to use the new method
- Refactor FlashblockBuilder::build() to use the new method
- Reduces code duplication and improves maintainability across all tests

* Remove unused utils

* refactor(test-utils): replace testing_node() with manual database setup

Replace NodeBuilder::testing_node() with LocalNode::create_test_database()
to reduce memory usage in parallel tests. The testing_node() helper
hardcodes an 8 TB map size which causes ENOMEM errors when running
multiple test processes concurrently with cargo test.

This prevents memory exhaustion when running parallel tests while
maintaining the same functionality.

* refactor: remove retry loop from new_canonical_block_without_processing

* Rename framework_test back to rpc

* cargo clippy

* fix: restore missing max_pending_blocks_depth parameter and fix builder pattern

- Add missing max_pending_blocks_depth parameter (5) to FlashblocksState::new() calls in rpc.rs tests
- Add missing max_pending_blocks_depth parameter to init_flashblocks_state in test-utils
- Fix builder pattern to use engine_api_launcher() + launch_with() instead of .launch() to match TestHarness::new() signature
- Enable 'client' feature for reth-optimism-rpc dependency to fix OpEngineApiClient import error

These changes ensure no logic was lost during the rebase and fix compilation errors.

* update test-utils docs

* cargo fmt

* just fix

* add jovianTime

* Move flashblocks tests to integration suite

* Silence executor warnings in flashblocks tests

* Add shared test tracing helper

* Document flashblocks integration tests

* Default TestHarness launcher

* Split flashblocks harness

* Introduce FlashblocksLocalNode

* Decouple Flashblocks node

* Refactor flashblocks harness and tests

* Add manual flashblocks harness

* Clarify flashblocks launcher wrapping

* Simplify flashblocks provider wiring

* Extract FlashblocksHarness module

* Document flashblocks harness module

---------

Co-authored-by: Niran Babalola <niran.babalola@coinbase.com>
haardikk21 pushed a commit that referenced this pull request Mar 17, 2026
* deployment

* feat: witnessgen args

* port for the server

* fix: proof timeout flag

* .env.example

* chore: cargo fmt

* feat: bump ram

* feat: update slack

* remove docker-compose.yml
mw2000 pushed a commit that referenced this pull request Mar 19, 2026
* deployment

* feat: witnessgen args

* port for the server

* fix: proof timeout flag

* .env.example

* chore: cargo fmt

* feat: bump ram

* feat: update slack

* remove docker-compose.yml
mw2000 pushed a commit that referenced this pull request Mar 23, 2026
* deployment

* feat: witnessgen args

* port for the server

* fix: proof timeout flag

* .env.example

* chore: cargo fmt

* feat: bump ram

* feat: update slack

* remove docker-compose.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants