Skip to content

Add local sequencer integration tests#140

Open
3esmit wants to merge 2 commits into
mainfrom
issue-134-local-sequencer-integration-tests
Open

Add local sequencer integration tests#140
3esmit wants to merge 2 commits into
mainfrom
issue-134-local-sequencer-integration-tests

Conversation

@3esmit

@3esmit 3esmit commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Introduce a local sequencer integration harness to enhance testing capabilities. This addition allows for end-to-end testing of various programs, including stablecoin, through a spawned sequencer, ensuring that transitions and outcomes are accurately asserted. Update documentation to reflect these changes and provide guidance on usage.

  • add an opt-in local sequencer integration harness for the existing token, AMM, ATA, and stablecoin integration suites
  • add a local-sequencer helper that prepares the pinned sequencer checkout, caches circuits, and runs the feature-gated test suite
  • wire CI, documentation, and developer commands for local sequencer coverage

Closes #134

Notes

  • The helper builds the sequencer from the immutable revision pinned by this workspace.
  • Circuit cache extraction is guarded by a readiness sentinel and atomic replacement to avoid reusing partial caches.
  • The harness submits transactions to the sequencer before checking final outcomes, so duplicate and rejected transactions are evaluated against the correct block range.

Validation

  • Rust formatting check
  • TOML formatting check
  • workspace clippy with warnings denied
  • workspace unit tests
  • integration test suite
  • local sequencer setup command
  • local sequencer integration test command

Copilot AI review requested due to automatic review settings June 5, 2026 03:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an opt-in local sequencer integration harness to the existing Rust integration test suites, plus a local-sequencer helper tool to clone/build the pinned LEZ checkout (and circuits cache) and run the feature-gated tests in CI and locally.

Changes:

  • Introduces tools/local-sequencer to manage a pinned LEZ checkout, circuits caching, and a setup/test workflow.
  • Adds a local-sequencer-tests feature to integration_tests that swaps V03State usage behind a TestState wrapper that mirrors transitions through a spawned sequencer.
  • Wires documentation, Makefile clippy, and CI to run the local sequencer integration suite.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/local-sequencer/src/main.rs New helper CLI to prepare LEZ checkout, circuits cache, and run feature-gated integration tests
tools/local-sequencer/Cargo.toml New workspace tool crate definition
README.md Documents local sequencer harness usage and stablecoin integration coverage
programs/integration_tests/tests/token.rs Switches to integration_tests::TestState alias and adds local-sequencer-specific assertions
programs/integration_tests/tests/stablecoin.rs Switches to integration_tests::TestState alias
programs/integration_tests/tests/ata.rs Switches to integration_tests::TestState alias
programs/integration_tests/tests/amm.rs Switches to integration_tests::TestState alias
programs/integration_tests/src/local_sequencer.rs New feature-gated local sequencer harness (spawn, seed, submit/poll, mirror state)
programs/integration_tests/src/lib.rs Feature-gated TestState export (wrapper vs type alias)
programs/integration_tests/Cargo.toml Adds local-sequencer-tests feature + optional deps (base64/borsh/rocksdb/serde_json)
Makefile Runs clippy for integration_tests with local-sequencer-tests enabled
CLAUDE.md Updates repository structure notes to include stablecoin integration tests
Cargo.toml Adds tools/local-sequencer and workspace deps for base64/rocksdb
Cargo.lock Adds dependency graph entries for new optional deps (e.g., rocksdb/librocksdb-sys/bindgen)
.github/workflows/ci.yml Adds CI job to run cargo run -p local-sequencer -- test with caching

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/local-sequencer/src/main.rs Outdated
Comment thread tools/local-sequencer/src/main.rs
Comment thread programs/integration_tests/src/local_sequencer.rs Outdated
@3esmit

3esmit commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

logos-co/scaffold is the right upstream home for this long-term, instead of a local-sequencer wrapper, but it does not currently provide the batteries-included surface needed here. This PR still needs the local harness/tool for now; if the scaffold test-node API and CI commands land later, this repo can replace the custom harness with direct scaffold API/command usage.

I've found some issues/PRs and created new issues that would make the local-sequencer wrapper unnecessary and let us depend on scaffold tool directly.

Existing scaffold work that is adjacent, but not enough:

  • logos-co/scaffold#195 merged: locks in standalone sequencer build mode. Useful prerequisite, but not a test harness.
  • logos-co/scaffold#173 open: circuits auto-fetch/pinning. Useful setup piece, but does not cover seeded test state or transaction outcomes.
  • logos-co/scaffold#172 open: lgs run lifecycle hooks. Useful orchestration, but not isolated per-test nodes or machine-readable receipts.
  • logos-co/scaffold#34 open: daemonizes localnet. Good for developer localnet, but integration tests need clean stop-on-exit behavior.
  • logos-co/scaffold#141 and logos-co/scaffold#159 merged: localnet config hardening. Helpful, but still localnet plumbing.
  • logos-co/scaffold#196 merged: template E2E CI. Validates scaffold templates, not downstream program state parity.
  • logos-co/scaffold#25 closed and logos-co/scaffold#32 closed unmerged: scaffold still does not expose its current command features as a Rust API, which means Rust tests would need subprocess calls and output parsing.

Missing pieces were submitted as issues as follow-up scaffold requirements:

  • logos-co/scaffold#202 expose current scaffold command features as a public Rust API. This should land first so later test-node commands have a typed API boundary instead of a CLI-only surface.
  • logos-co/scaffold#203 isolated local sequencer test nodes, with CLI and Rust API surfaces.
  • logos-co/scaffold#204 caller-provided state seeding for test nodes, with CLI and Rust API surfaces.
  • logos-co/scaffold#205 structured transaction outcomes for test nodes, with CLI and Rust API surfaces.
  • logos-co/scaffold#206 deterministic block and clock context for test-node replay, with CLI and Rust API surfaces.
  • logos-co/scaffold#207 stable account and proof snapshots for parity assertions, with CLI and Rust API surfaces.
  • logos-co/scaffold#208 caller project LEZ and circuits pins for test nodes, with CLI and Rust API surfaces.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.

Comment on lines +560 to +580
fn command_output(command: &mut Command) -> DynResult<String> {
let output = command.output()?;
if !output.status.success() {
return Err(format!(
"command failed with {}: {}",
output.status,
render_command(command)
)
.into());
}
Ok(String::from_utf8(output.stdout)?)
}

fn run_checked(command: &mut Command) -> DynResult<()> {
println!("$ {}", render_command(command));
let status = command.status()?;
if !status.success() {
return Err(format!("command failed with {status}: {}", render_command(command)).into());
}
Ok(())
}
"--",
"--nocapture",
]);
run_checked(&mut command)
Comment on lines +549 to +558
fn require_cmd(cmd: &str) -> DynResult<()> {
let status = Command::new(cmd).arg("--version").status();
match status {
Ok(_) => Ok(()),
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
Err(format!("missing required command: {cmd}").into())
}
Err(err) => Err(format!("failed to probe command `{cmd}`: {err}").into()),
}
}
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.

Setup integration tests agains local sequencer

2 participants