Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
* [FIX][rust] A transaction's own TX_FEE note is no longer tracked as an input note the paying account could consume. It is a bearer note, so the note screener reported it as consumable, and tracking it registered its note tag: every TX_FEE note on a chain shares one tag, so from a client's first fee-paying transaction onwards every sync pulled in every fee note the chain had produced ([#2446](https://github.com/0xMiden/rust-sdk/issues/2446)).
* [FIX][rust] The RPC retry policy is now endpoint-aware: `SubmitProvenTransaction` and `SubmitProvenBatch` retry only `ResourceExhausted` and let `Unavailable` propagate, while read endpoints keep retrying both. `Unavailable` does not say whether the node processed the request, so resubmitting could hit the nullifier consumed by an accepted copy and report a conflict indistinguishable from a genuine double spend, hiding the original success ([#2441](https://github.com/0xMiden/rust-sdk/issues/2441)).
* [FIX][cli] `-V`/`--version` now work when the binary is invoked under a different name, such as through the `miden client` shim installed by midenup ([#2486] https://github.com/0xMiden/rust-sdk/pull/2486)).
* [FIX][rust] `get_block_header_by_number` now reports a `chain_length` that does not fit in `usize` as `RpcError::InvalidResponse` instead of panicking. On a 32-bit target such as `wasm32`, a node returning a chain length above `u32::MAX` would abort the client; the conversion now mirrors the `map_err` already used on the adjacent forest-size check ([#2504](https://github.com/0xMiden/rust-sdk/pull/2504)).
* [FIX][rust] `ChainAnchor` deserialization no longer panics on crafted input: a partial blockchain whose tracked leaf is missing an ancestor sibling, or whose block-map key disagrees with its header, is rejected as an invalid value, and anchors tracking more blocks than a transaction can reference are rejected early with the new `ChainAnchorError::TooManyTrackedBlocks` ([#2421](https://github.com/0xMiden/rust-sdk/pull/2421)).
* [FIX][rust] `Client::execute_transaction_at` now fails with the new `ChainAnchorError::AnchoredTransactionExpired` when the executed transaction's expiration block has already been reached, instead of handing back a transaction the network would reject after proving ([#2421](https://github.com/0xMiden/rust-sdk/pull/2421)).
* [FIX][rust] A request that sets `ignore_invalid_input_notes` but carries no input notes, or whose notes are all screened out, no longer fails with an out-of-range note-count error from the consumption checker ([#2421](https://github.com/0xMiden/rust-sdk/pull/2421)).
Expand Down
4 changes: 3 additions & 1 deletion crates/rust-client/src/rpc/tonic_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@ impl NodeRpcClient for GrpcClient {
.ok_or(RpcError::ExpectedDataMissing("MmrPath".into()))?
.try_into()?;

let forest_size = usize::try_from(forest).expect("u64 should fit in usize");
let forest_size = usize::try_from(forest).map_err(|_| {
RpcError::InvalidResponse(format!("chain length {forest} does not fit in usize"))
})?;
let forest = Forest::new(forest_size).map_err(|_| {
RpcError::InvalidResponse(format!("invalid forest size: {forest_size}"))
})?;
Expand Down