Conversation
A prior commit introduced a single `CONCAT_TO_SNAKE` table used by `sanitize_external_identifier` so that generated params and response structs use idiomatic Rust names. This commit extends that table with many additional RPC names that were still emitted as concatenated identifiers: response fields such as `pruneheight`, `feerate`, and `chainwork`, and param fields such as `hexstring`, `privkeys`, `prevtxs`, `iswitness`, and `permitsigdata`, which now map to `prune_height`, `fee_rate`, `chain_work`, `hex_string`, `priv_keys`, `prev_txs`, `is_witness`, and `permit_sig_data` (and others in the same vein). The hardcoded `DecodedVin` struct in the response-type generator previously used the field name `txinwitness`; it now uses `tx_in_witness` with `#[serde(rename = "txinwitness")]` so that the Rust API is consistent and the JSON wire format is unchanged. The codegen already emits `#[serde(rename = "...")]` when the Rust name differs from the RPC key, so no change to serialization behaviour is required beyond that one explicit attribute. These updates keep the codebase consistent with the convention that external RPC names are normalized at codegen time to snake_case for Rust consumers.
The transport infrastructure generator emitted a bare `use serde;` in two places (HTTP and Unix socket generated code). The same generated code uses `serde::Serialize` and `serde::Deserialize` via full path, so the import was never needed.
The pipeline template for the generated RPC client included `use std::result::Result;`. Rust's prelude already brings `Result` into scope, and the template does not need to disambiguate it.
The pipeline's lib.rs generator added `#![allow(unused_imports)]` and `#![allow(dead_code)]` to every generated client crate. Those allows hide real issues instead of fixing them. After removing redundant imports from templates and transport generation, generated code should not rely on these blanket allows. Removing them keeps the generated crate aligned with normal Rust lint expectations and makes future unused or dead code more easily visible.
The test node generator emits inline serde modules for `maxfeerate_opt` and `serde_amounts_map`. Each module imported `Serialize` even though only `Serializer` is used in the `serialize` functions. Dropping the unused `Serialize` import keeps generated code consistent with the stricter lint setup from the previous commit and avoids unused_imports warnings in generated client crates.
The test node generator emits a `maxfeerate_opt` serde module with both `serialize` and `deserialize`. For APIs that only send `maxfeerate` (e.g. as a request parameter) and never parse it, `deserialize` is unused and triggers `dead_code` after the crate-level allow was removed. Adding `#[allow(dead_code)]` on that function only keeps the generated crate clean for those API shapes without re-enabling a blanket allow for the whole library.
The generated `create_transport` logic used inline arrays and a magic number for Bitcoin Core RPC warmup codes and retry count. This change adds `generate_init_constants` to emit module-level `INIT_WAIT_RPC_CODES` and `INIT_MAX_RETRIES`, and updates the generated method to use them.
The Bitcoin Core test config used the same default `extra_args` list in both `from_config` and `Default`, with the literal repeated and a comment about full blockchain history. This change introduces a single `DEFAULT_EXTRA_ARGS` constant and uses it in both places via `map( String::from).to_vec()`.
The node manager generator emits a `create_transport` method that previously repeated `use std::sync::Arc` and `use crate::transport:: DefaultTransport` inside the method. The same generator already writes those imports at module level in `generate_imports`, so the inner `use` lines were redundant.
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.
Bump downstream crate to v30.2.8