Commit graph

35 commits

Author SHA1 Message Date
Byron Hambly
edc585d157 Merge 9564f98fee into merged_master (Bitcoin PR bitcoin/bitcoin#27636) 2025-06-25 11:40:46 +02:00
Byron Hambly
668be09bc4 Merge 811d835960 into merged_master (Elements PR #1439) 2025-04-16 12:04:15 +02:00
Thomas Trevethan
51f81f3286 add missing proof checks and tests 2025-03-26 11:35:22 +00:00
Byron Hambly
a6f8dc6a86
tidy: fixes for clang tidy ci job 2024-12-04 14:16:45 +02:00
James Dorfman
f86857195f Merge 43bb106613 into merged_master (Bitcoin PR bitcoin/bitcoin#24213) 2024-08-01 20:20:30 +00:00
Byron Hambly
b33a4cdb4f elements: fixes for bitcoin/bitcoin#22976 2023-04-24 12:05:24 +00:00
Pablo Greco
58b5fa0dbf
Merge pull request #1186 from achow101/createfunded-explicit-value
Add include_explicit to walletcreatefundedpsbt
2022-11-21 17:15:58 -03:00
Andrew Chow
462c873639 blindpsbt: Expose CreateBlind{Asset,Value}Proof
Make these two functions available to external callers.
CreateBlindValueProof is a wrapper around the static function to avoid
requiring callers to parse things into secp256k1 objects.
2022-10-18 16:52:31 -04:00
Jon Griffiths
e2348dadf3
PSET: VerifyBlindValueProof: fail verification if the value or asset commitment is missing
It is arguable whether attempting a value proof without an asset
commitment should be treated as incomplete or incorrect blinding. Since
the asset commitment is required to produce the value proof in the first
place, failing to provide it in the source PSET and thus at this call
site is treated as an error.

This does not change the existing behaviour since a missing asset
or value commitment in this function would already cause it to fail.

Future work on the blinding iterface should likely return the blinding
state directly from the verify calls and remove the duplicated mapping of
blinding error codes to transaction blinding error codes, instead of the
verify functions returning just true/false.
2022-10-06 09:12:02 +13:00
Andrew Chow
9ecbf38050 pset: Respect issuance needs blinded flag 2022-09-06 11:41:02 -04:00
Andrew Chow
be602495f9 pset: Implement VerifyBlindProofs for PSBTInput 2022-09-06 11:37:14 -04:00
Allen Piscitello
dd2d758bc6 fixed minor issues found in review 2022-08-24 16:31:42 -05:00
Allen Piscitello
420de43c1c removing code to blind issuances. PSET should be modified to include an option to blind or unblind issuances, defaulting to unblind. 2022-08-24 09:42:29 -05:00
Allen Piscitello
5954b10a1a Fixing issuance cases and half blinded cases in PSET 2022-08-18 11:20:02 -05:00
Jon Griffiths
3be6e80f90
PSET: handle missing/NULL issuance assets when blinding 2022-08-09 09:36:02 +12:00
Glenn Willen
0fe5e825ad ci: Update for libsecp256k1-zkp API changes 2022-05-25 16:12:00 -07:00
Andrew Poelstra
b64ca7f411 Merge 6eed792d43 into merged_master (Elements PR ElementsProject/elements#1050)
Conflicts were mostly obvious, except for those in CreateTransactionInternal.
(This function was moved from wallet.cpp to spend.cpp, and substantially
rewritten, between 0.21 and 22.0.) For those I manually applied the changes
from the diff, which wound up taking a slightly different form.

Also had to update the new test because the `addresses` field of the RPC
output was removed.
2021-10-04 15:13:47 +00:00
Andrew Poelstra
6eed792d43
Merge ElementsProject/elements#1050: wallet: fix a pile of bugs in transaction funding logic
a67a2df330 pset: remove one more intermediate-zero check from the blinding logic (Andrew Poelstra)
9eb285c19d test: add test for confidential non-wallet-owned change (Andrew Poelstra)
185d473fe8 walletcreatefundedpsbt: add functional test for blinding edge cases (Andrew Poelstra)
533da12c2c wallet: make sure extra OP_RETURN output is blinded when called from fundraw (Andrew Poelstra)
b09b63bd1b pset: allow input blinding factors to sum to zero, or value to be 0 (Andrew Poelstra)
9afcb83baf wallet: correctly handle blinding of manually-set change addresses (Andrew Poelstra)
9813c3e74a wallet: fix "cannot unblind IsMine output" check in SignPSBT (Andrew Poelstra)
7103471fd5 walletcreatefundedpsbt: signal blinding data correctly to `FundTransaction` (Andrew Poelstra)

Pull request description:

  Fixes #1049

  Needs backport to 0.21 (and a new rc).

  Although there are several bugs here, none affect the functionaries. There is a more thorough summary in the second-to-last commit message.

ACKs for top commit:
  achow101:
    ACK a67a2df330

Tree-SHA512: 25066c29f080e43cd00c5b33c60a986a8cb5bbf4ca01ceb3b4182c5b8f61979a1d6d946b8f28fa871ec90f44bdb6fc22014b5c11280cf081181db102cd588cdf
2021-10-02 15:13:45 +00:00
Andrew Poelstra
7b69a940eb Merge 846ab81794 into merged_master (Elements PR ElementsProject/elements#1051) 2021-10-02 13:27:49 +00:00
Andrew Poelstra
a67a2df330 pset: remove one more intermediate-zero check from the blinding logic 2021-10-01 23:30:58 +00:00
Andrew Poelstra
187c8094bb combinepsbt: only use explicit values if the corresponding proofs pass 2021-10-01 17:17:41 +00:00
Andrew Poelstra
b09b63bd1b pset: allow input blinding factors to sum to zero, or value to be 0
There are a number of special cases (and inconsistencies with wallet.cpp)
in the blinding logic that can prevent blinding from succeeding when various
intermediate values are zero. This fixes two of them.

A proper fix would involve adding new APIs to secp-zkp and then overhauling
all of the wallet blinding code. But for now let's get the tests working.
2021-09-30 21:54:40 +00:00
Andrew Poelstra
daa471ddd2 Merge 4c7dc0620a into merged_master (Elements PR ElementsProject/elements#1046) 2021-09-22 02:26:13 +00:00
Andrew Poelstra
694ec795e4 PSET: fix asset proof generation and verification
A couple issues with this -- one is that it was verifying the asset
commitment against itself, rather than against the explicit asset,
and the other is that the verification logic had an extra `== 0` at
the end which inverted the verification check.

Both pretty embarassing to have not caught in review..
2021-09-21 21:59:10 +00:00
Andrew Poelstra
c6f801d4ce PSET: encapsulate blind proof checks into one method 2021-09-21 20:33:31 +00:00
Andrew Poelstra
edac5081f4 Merge 1240172eaa into merged_master (Elements PR ElementsProject/elements#1038)
Surprisingly the only conflicts were converting nullopts
2021-09-18 02:10:36 +00:00
Andrew Chow
3ac7e78a84 pset, rpc: Better error messages for imbalance failure conditions
Instead of not failing and silently allowing bad PSETs to be created,
provide error messages that explain why the operation the user did was
wrong. Specifically for combining PSETs such that they would become
fully blinded but have imbalanced values and blinders, and for blinding
a PSET when the wallet has a blind input but no outputs to blind (would
result in an imbalance).
2021-09-13 18:36:38 -04:00
Andrew Chow
b2a7007961 pset: verify blind value and asset proofs when signing 2021-09-11 21:02:26 -04:00
Andrew Chow
941c54fcda pset: Create explicit value and asset proofs during blinding 2021-09-08 14:57:09 -04:00
Andrew Chow
37c925f472 pset: Do not remove amounts after blinding 2021-09-07 20:44:30 -04:00
Andrew Poelstra
36e5e2a7f1 Merge 9a154599fe into merged_master (Elements PR ElementsProject/elements#900)
Surprisingly easy to do. Almost all of the diff resolution was mechanically
  * replacing boost::variant with std::variant
  * replacing Optional with std::optional
     * then replacing `nullopt` with `std::nullopt`
  * updating the RPC functions for the new RPCArg::Default type
  * update the tests/ directory to make new (since 22) tests use arrays for
    createrawtransaction outputs
  * other ad-hoc changes to function parameters etc (not too many of these)

I had to "really" change the code in PrecomputePSBTData, which was introduced
in 22.0 and affected by PSET, but this function was like 8 lines long so it
was easy.

Reviewing the diff may be a bit difficult because of the mix of mechanical
changes and ad-hoc things. Probably the most straightforward thing to do
is to redo the merge, `sed -i` to fix the boost::variant and Optional stuff,
then diff the remaining conflicts against this commit.

TODO: grep for `blindpsbt` and you will see that this RPC is still referenced
in documentation and help text even though it was deleted. Need to fix this
in 0.21 in a separate PR.
2021-09-04 19:34:14 +00:00
Andrew Chow
4940ceeea6 Use a constant for maximum surjection targets 2021-06-22 14:42:38 -04:00
Andrew Chow
e9bfff25db Allow empty scriptPubKeys 2021-06-22 14:42:19 -04:00
Andrew Chow
124efa2668 Return better errors for BlindingStatus 2021-06-22 14:42:19 -04:00
Andrew Chow
e7dd046b03 Implement BlindPSBT 2021-06-22 14:42:19 -04:00