You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The PR currently has no labels, but it appears the enhancement label is missing.
The title (feat: add shared witness encoding helpers) and the diff confirm this is a new feature: it introduces the witness_encoding module with shared helpers for compressing/decompressing/encoding/decoding witness RPC payloads, migrates rpc_client.rs to use the shared decoder, and adds round-trip tests. This matches the enhancement label description ("New feature or request").
Clean extraction. The layering is clear (compress/decompress for raw bytes, encode/decode for the full versioned string), error types are typed, and the rpc_client.rs migration is straightforward.
Two things before merge — see inline comments:
Missing error-path tests for the Base64 and decompression branches in decode_witness_response.
nit: WitnessEncodingError::Serialize uses #[source] while Compress uses #[from] — inconsistency without a clear reason.
LGTM. Previous feedback addressed — #[from] added to WitnessEncodingError::Serialize and all three error-path tests added. The module is well-structured and the encoding contract is clearly documented.
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
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
Add shared witness encoding helpers to
stateless-commonand switchRpcClientwitness decoding to use the shared implementation.What Changed
stateless-common::witness_encodingfor the shared witness RPC wire formatfetch_witness_rawdecode path inrpc_client.rsto call the shared decoderv0:test stub inrpc_client.rswith the shared version prefix constantNotes
v0:base64(zstd(level=9, bincode-legacy((SaltWitness, MptWitness))))rpc_client.rsrequest flow and retry behavior are unchangedValidation
cargo check -p stateless-commoncargo test -p stateless-common witness_encoding