Repository navigation
refactor: remove dead code and duplication in the node - #25
Merged
Merged
Conversation
- main.rs uses the library crate instead of compiling `mod node` a second time, which made every #[allow(dead_code)] in the tree necessary; drop them - remove unused code: Database::get_keys_by_cf_name, StateUpdate::from_legacy/_vec, the async-trait and direct tungstenite deps - websocket: one submit path for send_transaction/send_raw_transaction, one TripFilter and list_response for the five list methods - Transaction: one sign_bytes helper behind sign/sign_personal/sign_tron - balance effects: index entries reuse the records already built - blockchain: doc comments back on the functions they describe, one JSON dump helper for developer mode - sync handlers: drop parameters they never used - delete sweep.timestamp, setup-protection.ps1 (printed manual steps only), the duplicate root PR template and examples/README.md (it listed example files that never existed) No RPC method, response shape, wire format or stored format changes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VPqyiX6mcp9E33S59NwbKo
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.
Requested by Mehran · project thread
📋 Description
Before:
main.rsdeclaredmod nodeitself, so the whole module tree compiled twice (once in the library, once in the binary). That second copy is why 13#[allow(dead_code)]attributes were needed. The repo also held unused functions, two unused crates, copy-pasted RPC handlers and a few stray files.After: the binary uses
clutch_node::node::…from the library, the tree compiles once, and the build has zero warnings with noallow(dead_code)anywhere. 145 lines added, 305 removed.What changed:
Database::get_keys_by_cf_name,StateUpdate::from_legacy/from_legacy_vec, theasync-traitcrate and the directtungstenite0.24 crate. The node already usestokio_tungstenite::tungstenite. The lockfile only loses entries.send_transactionandsend_raw_transactionshare one submit path. The fivelist_*methods share onelist_response, and the three trip lists share oneTripFilter. Error texts and response shapes are unchanged.sign,sign_personalandsign_tronshare onesign_bytes. The signed bytes and verification are unchanged.validate_authoritiesanddrop_intra_block_conflicts. They are back on the right ones.sweep.timestamp, a cargo-sweep marker. It is now in.gitignore.setup-protection.ps1, which only printed manual steps.pull_request_template.md, a duplicate of.github/PULL_REQUEST_TEMPLATE.md.examples/README.md, which listed four example files that never existed.No RPC method, response field, wire or RLP format, signature scheme, state key or stored value changed, so this needs no chain reset.
block_reward/reward_recipientinget_block_by_indexare left in on purpose: the explorer may still read them.🎯 Type of Change
🧪 Testing
cargo test -- --test-threads=1: all suites green, the same command CI runs)cargo build --all-targetswith zero warnings✅ Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01VPqyiX6mcp9E33S59NwbKo
Generated by Claude Code