feat(localnet): configure sequencer binary and config path#37
feat(localnet): configure sequencer binary and config path#37danisharora099 wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR completes the [localnet] config surface by making the sequencer executable name and config path configurable, and then wiring those values through localnet startup, setup, and doctor checks to support newer LSSA/LEZ layouts without patching Scaffold.
Changes:
- Add
[localnet].sequencer_binaryand[localnet].sequencer_config_pathwith backwards-compatible defaults. - Use the configured binary/config path in
logos-scaffold setup,localnet start, anddoctor. - Extend doctor’s standalone-support detection to recognize both older and newer sequencer repo layouts, and add a regression test covering the new config wiring.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/model.rs |
Extends LocalnetConfig with sequencer_binary and sequencer_config_path defaults. |
src/constants.rs |
Adds default values for the new localnet sequencer settings. |
src/config.rs |
Parses/serializes the new [localnet] keys with fallback defaults. |
src/commands/setup.rs |
Uses configured sequencer identifier when building the standalone sequencer. |
src/commands/localnet.rs |
Uses configured sequencer binary/config path when spawning the localnet sequencer. |
src/commands/doctor.rs |
Checks for the configured sequencer binary under target/release. |
src/doctor_checks.rs |
Expands standalone marker search to include sequencer/service layout. |
tests/cli.rs |
Adds regression test asserting localnet start uses configured binary and config path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (2)
src/commands/localnet.rs:138
sequencer_binarycomes from config and is joined ontolssa/target/release.Path::joinwill ignore the prefix ifsequencer_binaryis absolute, and..segments can escape the intended directory, which can lead to executing an unexpected binary when runninglocalnet start. Consider rejecting absolute paths / path separators insequencer_binary(treat it as a binary name), or explicitly normalize and enforce that the resolved path stays underlssa/target/releasebefore spawning.
ensure_dir_exists(lssa, "lssa")?;
let sequencer_bin = lssa.join("target/release").join(sequencer_binary);
if !sequencer_bin.exists() {
return Err(LocalnetError::MissingSequencerBinary {
path: sequencer_bin.display().to_string(),
}
.into());
src/commands/localnet.rs:183
- Now that
sequencer_config_pathis configurable,localnet startwill happily spawn the sequencer even if that path is wrong/missing, leading to a harder-to-diagnose readiness timeout/exit. Consider validating the configured config path exists (when relative, checklssa.join(sequencer_config_path); when absolute, check it directly) and returning a targeted error before spawning the process.
let sequencer_pid = spawn_to_log(
Command::new(sequencer_bin)
.current_dir(lssa)
.arg(sequencer_config_path)
.arg("--port")
.arg(localnet_port.to_string())
.env("RUST_LOG", "info")
.env("RISC0_DEV_MODE", if risc0_dev_mode { "1" } else { "0" }),
log_path,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
What Copilot and @fryorcraken said, otherwise looks good:) |
|
can you add doc with example how to use with other than default sequencer? otherwise lgtm |
0fb81fa to
90822c4
Compare
90822c4 to
a9d02fe
Compare
|
@logos-co/eco-dev-eng addressed comment |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@danisharora099 you should be able to open your branched in this repo and not your fork |
Code reviewCriticalC1. Branch is severely stale relative to
Cannot merge as-is. After rebase the meaningful delta shrinks to ~30 lines. Please re-validate the entire diff post-rebase — most of what's "added" already exists in master under different names. C2. .arg(sequencer_config_path)
.arg("--port")
.arg(localnet_port.to_string())Master removed CLI-level port passing because the pinned sequencer reads its port from the JSON config. Master patches that JSON via C3. ImportantI1. I2. No unit tests for new parsing or new validator. The PR adds an end-to-end test for I3. I4. README copy needs re-merging. The PR still references the pre-master SuggestionsS1. Asymmetric absolute-path handling between doctor and localnet ( S2. S3. The new test only asserts on stdout containing the right substrings ( Security / Performance
Recommended next steps
|
Add `[localnet].sequencer_binary` and `[localnet].sequencer_config_path` so projects can point scaffold at a non-upstream sequencer (custom fork, older/newer LEZ layout) without forking scaffold itself. Defaults match upstream LEZ at the pinned version (`sequencer_service` plus `sequencer/service/configs/debug/sequencer_config.json`), so existing `scaffold.toml` files pick up the new keys with no behaviour change. Wiring: - `setup` builds via `cargo build -p <sequencer_binary>` (cargo package name and binary file name share a value upstream and must continue to match in any fork). - `localnet start` resolves the binary as `<lez>/target/release/<name>` and patches the configured JSON config in place to honour `[localnet].port` (the pinned LEZ rejects unknown CLI flags, so we keep master's `patch_sequencer_port` flow rather than adding `--port`). The configured config path is verified to be a regular file before we call into `patch_sequencer_port`, so a misconfiguration surfaces with a targeted error instead of a generic JSON parse failure. - `doctor` surfaces both the sequencer binary and the sequencer config as `check_path` rows resolved through the same helpers, so absolute and LEZ-relative values render symmetrically. Validation: - `sequencer_binary` is a cargo package name — no path separators, leading `-`, `.`, `..`, or absolute paths. - `sequencer_config_path` allows path separators (the file lives a few directories deep in LEZ) but rejects values that look like CLI flags so they can't sneak into the spawned sequencer's argv. Tests: - Unit tests for default propagation, round-trip, and each rejected validator form. - A doctor JSON integration test that asserts both new rows surface the configured paths rather than upstream defaults. Tested: - `cargo fmt --all`, `cargo check`, `cargo test --lib`, plus the localnet/doctor/setup/init/config integration test suites. Co-authored-by: Cursor <cursoragent@cursor.com>
a9d02fe to
97649ce
Compare
|
Force-pushed a rebase |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Follow-up to #30, rebased onto the v0.2.0 schema (#95). Adds
[localnet].sequencer_binaryand[localnet].sequencer_config_pathso projects can point scaffold at a non-upstream sequencer (custom fork, alternate LEZ layout) without forking scaffold itself. Defaults match upstream LEZ at the pinned version, so existingscaffold.tomlfiles pick up the new keys with no behaviour change and no schema bump.What changed
LocalnetConfig(src/model.rs) gains the twoStringfields and two helpers —sequencer_bin_path(lez)andsequencer_config_resolved_path(lez)— so the absolute/relative resolution lives in one place.setup(src/commands/setup.rs) builds viacargo build -p <sequencer_binary>. The binary file name and the cargo package name share a value upstream and must continue to match in any fork — documented inline.localnet start(src/commands/localnet.rs) resolves the binary via the helper, verifies the resolved config path is a regular file before callingpatch_sequencer_port, and keeps master's JSON-mutation flow (the pinned LEZ rejects unknown CLI flags, so no--portarg).doctor(src/commands/doctor.rs) surfaces both the binary and the config ascheck_pathrows resolved through the same helpers, so absolute and LEZ-relative values render symmetrically.Validation
sequencer_binaryis constrained to a cargo package name: rejects empty, leading-,.,.., path separators, and absolute paths. Both thecargo -parg and thetarget/release/<name>join become impossible to subvert.sequencer_config_pathallows path separators (the file lives a few directories deep in LEZ) but rejects empty values and leading-so flag-shaped values can't sneak into the spawned sequencer's argv.Tested
cargo fmt --allcargo checkcargo test --lib— 8 new unit tests inconfig.rs(defaults, round-trip, each forbidden form for both keys)cargo test --test cli— newdoctor --jsonintegration test asserts the configured paths surface end-to-end (replaces the oldlocalnet startsmoke test, which had a port-binding race)Non-changes
[scaffold].version = "0.2.0", defaults make existing configs work unchanged.--portCLI flag for the spawned sequencer; master'spatch_sequencer_portflow is preserved.Out of scope
<lez>/target/release/<name>).sequencer_packageknob if a fork ever needs the cargo package and runtime binary names to diverge — easy to add later, not needed today.