fix(cli): flag, duration, and env-var parity with charon#519
Open
varex83agent wants to merge 2 commits into
Open
fix(cli): flag, duration, and env-var parity with charon#519varex83agent wants to merge 2 commits into
varex83agent wants to merge 2 commits into
Conversation
Three parity fixes against charon v1.7.1 (improvement plan area 06): - Replace humantime with a hand-written Go time.ParseDuration-equivalent parser (parse_go_duration): accepts ns/us/µs/μs/ms/s/m/h units, multi-segment and fractional values, leading +, and the bare "0" special case; rejects d/w/y/M units and unitless values. Deviation: negative durations are rejected since std::time::Duration is unsigned. All CLI duration flags (dkg via Duration::FromStr; test beacon/validator/peers/mod via value_parser) now use it. The serde/UnmarshalText bare-integer-nanoseconds path is unchanged. The humantime dependency is dropped from the workspace. - Add the missing must_output_to_file_on_quiet guard to test validator, matching charon cmd/testvalidator.go PreRunE and the sibling mev/peers/infra/beacon subcommands. - Rename the 19 PLUTO_* env bindings on the relay command to CHARON_*, matching charon's env prefix (cmd/cmd.go) and the rest of the CLI. Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
quick-xml 0.39.4 is flagged by RUSTSEC for unbounded namespace allocation (fixed in >=0.41.0). Bump the workspace dependency and dedupe the lockfile to a single quick-xml 0.41.0. Co-authored-by: varex83 <ivan.uvarov02@gmail.com>
iamquang95
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three CLI parity fixes against charon
v1.7.1(improvement plan area 06 — CLI flag / duration / env-var parity):1. Go-equivalent duration parsing (T01)
CLI duration flags were parsed with
humantime, which diverges from Go'stime.ParseDuration: it accepts1d/1w/1y/1M(Go rejects them) and rejects a leading+(Go accepts it).parse_go_durationincrates/cli/src/duration.rs— a faithful port of Go'stime.ParseDurationgrammar (cmd/duration.gobinds all charon duration flags through it): unitsns/us/µs/μs/ms/s/m/h, multi-segment (1h30m), fractional (1.5h), leading+, the bare-"0"special case, and Go's1<<63-1ns overflow limit.-is rejected (Go accepts negative durations) becausestd::time::Durationis unsigned and every flag using this parser is a non-negative timeout/delay. Noted in a// PARITY:comment.Duration::FromStrkeeps its bare-integer-nanoseconds branch (charonUnmarshalTextstrconv.ParseIntparity) and falls back to the new parser; the serde/JSON path is untouched.value_parser = humantime::parse_durationsites repointed:test/mod.rs,test/validator.rs,test/peers.rs(×3), andtest/beacon.rs(missed by the plan); the threedkg.rsflags pick it up viaFromStr.humantimeis dropped from the workspace (no remaining users).2.
test validatormissing--quietguard (T02)pluto alpha test validator --quietwithout--output-jsonsilently ran and produced no output at all. Adds themust_output_to_file_on_quietguard as the first statement ofrun(), matching charoncmd/testvalidator.goPreRunEand the sibling mev/peers/infra/beacon subcommands, plus a test asserting the error path.3. Relay command env vars
PLUTO_*→CHARON_*(T03)Charon binds every flag under the
charonenv prefix (cmd/cmd.go), so relay env vars areCHARON_HTTP_ADDRESSetc. The relay command was the only Pluto command usingPLUTO_*(19 bindings). Renamed all 19 toCHARON_*; all 20 resulting env names in the file (incl. pre-existingCHARON_DATA_DIR) are unique, so no clap duplicate-env conflicts.Out of scope (follow-ups per the plan): T04
alpha test allorchestration, T05 cosmetic help-text drifts.Test plan
cargo +nightly fmt --all --check✅cargo clippy --workspace --all-targets --all-features -- -D warnings✅cargo test --workspace --all-features— 52 test binaries, 0 failures ✅cargo deny check— fails on a pre-existing quick-xml advisory also present onmain; unrelated (this PR'sCargo.lockdiff only removes humantime)🤖 Generated with Claude Code