Observability, error handling, and API improvements#101
Open
moshemalawach wants to merge 14 commits into
Open
Conversation
The workspace Cargo.toml declared edition = "2024" which does not exist. All individual crates already override to 2021, so this was silently ignored but would break if any crate removed its local edition field.
…lers Convert panicking unwrap/expect calls in production request handlers to proper error propagation. Fixes hash().unwrap(), try_into().unwrap(), and .first().unwrap() patterns. Also replaces a dbg!() macro with debug!() logging and resolves two stale TODO comments.
Add limit and offset query parameters (default: limit=100, offset=0) to prevent unbounded response bodies. Backwards-compatible — existing clients without query params receive up to 100 results.
Wraps docker-compose, cargo, and forge commands into simple make targets. Run 'make help' to see all available targets.
Replace the minimal 9-line README with comprehensive documentation including architecture overview, prerequisites, quick start guide, development commands, API endpoint tables, and documentation links.
- Log orphaned commitments in rollback paths instead of silently dropping - Clamp pagination limit to i64::MAX before casting to prevent overflow - Scope docker-clean to project images only (--rmi local)
- Restore panic logging via set_hook (replaces removed log-panics crate) - Add /v1/ready and /metrics to OpenAPI spec - Improve RoundRobin test storage slot comment for maintainability
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
Structured improvements to observability, code quality, security, and developer experience across the Nightfall 4 CE codebase.
Observability
logcrate totracingfor structured logging with span support (57 source files updated)GET /metricsendpoint to both client and proposer services, with counters for requests, histograms for latency, and gauges for queue/mempool depthGET /v1/readyreadiness probe that verifies MongoDB connectivity, returning 200 or 503 with component-level status JSONstd::panic::set_hook(replaceslog-panicsremoved during tracing migration)Code quality
thiserrorderive macros for error types inlib/src/error.rs,nightfall_client, andnightfall_proposer, reducing ~264 lines of manualDisplay/Error/Fromboilerplate while preserving all error messages and behaviorclient_nf_3.rs(1190 lines) into focuseddeposit.rs,transfer.rs, andwithdraw.rsmodules with a sharedmod.rs, preserving the public APISecurity
RoundRobin.solto prevent gas DoS from unbounded iteration inadd_proposer()androtate_proposer(). Includes a new Foundry testtest_addProposer_revertsWhenMaxReached. V2/V3 contracts inherit the cap automatically.Documentation
openapi.yaml) covering all 29 REST endpoints across client and proposer services, with request/response schemas derived from the actual Rust typesTest plan
cargo buildsucceedscargo clippy --all-targets -- -D warningspassescargo testunit tests passforge testSolidity tests pass (including newtest_addProposer_revertsWhenMaxReached)GET /metricsreturns Prometheus text exposition format on client (:3000) and proposer (:3001)GET /v1/readyreturns{"status": "ready", "checks": {"database": "ok"}}when DB is up, 503 otherwise