rpc: Add JSON-RPC methods for working with PCZTs#8
Open
hashbender wants to merge 1 commit into
Open
Conversation
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.
Implements the PCZT (Partially Created Zcash Transaction) JSON-RPC methods requested in zcash#99, as the modern, robust replacements for
createrawtransaction,fundrawtransaction, andsignrawtransaction.Supersedes zcash#354 (thanks @lamb356 for the initial implementation) — this branch rebuilds that work on current
main, addresses all of @nullcopy's review feedback, and fills in the structural gaps.Closes zcash#99.
Methods
A transaction is assembled by threading a PCZT through these roles:
pczt_createpropose_transfer+create_pczt_from_proposalcreaterawtransaction+fundrawtransaction).pczt_combinepczt_provepczt_signpczt_extractThe stateless roles (
combine/prove/extract) live in the generalRpctrait;create/signrequire wallet state.Notes for review
pczt_createvspczt_fund. feat: Add PCZT RPC methods (issue #99) zcash/zallet#354 named thispczt_fund; @nullcopy noted that "fund" reads like adding funds to an existing PCZT. That operation (≈fundrawtransactionon a partial PCZT) is effectively infeasible at the pinnedlibrustzcashrev:create_pczt_from_proposalIO-finalizes its output (permanently clearingtx_modifiable), there is noConstructorimplementation or Builder-from-PCZT path, and no input-selector API for a "cover the remaining value" target. So this method builds a complete PCZT from a payment request in one shot (matchingzcash-devtool'spczt create), andpczt_createis the accurate name.pczt_createreusespayments::AmountParameter+build_request(from Extract the shared amount parameter into a reusable payments type zcash/zallet#535) and a new sharedpayments::propose_and_checkhelper (privacy-policy validation → propose → enforce → Orchard-action-limit) thatz_sendmanynow also uses, so the two stay in sync.pczt_createrecordszallet.v1.*proprietary fields for an offlinepczt_signto read back — a stand-in for the native path until upstream adds accessors.pczt_extractverifies. It runs the spend finalizer and verifies all proofs/signatures (supplying the bundled Sapling verifying keys) before producing the transaction, rather than deferring to the network.Dependencies
Adds
pczt0.7, pinned to the samelibrustzcashrevision as the other[patch.crates-io]crates, and enables thezcash_client_backend/pcztbuilder support pluszcash_client_sqlite/serde(required forAccountUuid: Serialize, whichcreate_pczt_from_proposalneeds).Testing
pczt_combinecaps.cargo clippy --all-targets -- -D warningsclean; fullzalletlib test suite green.zcash_client_backenddata_api::testingframework can't be used from a downstream crate at the pinned rev — its only concrete store factory (zcash_client_sqlite::testing) is#[cfg(test)]-only, and there is nozcash_client_memorycrate at this rev — so the fullcreate → prove → sign → extractpath is verified by manual regtest for now. A follow-up could vendor a minimal in-memory store factory to unlock a node-free CI test.Rebased onto
main@ 4fa38e1. The commits on this branch are currently unsigned.Mirror-of: zcash#541
zcash#541