Commit graph

34818 commits

Author SHA1 Message Date
Pablo Greco
48dd32a609 Merge branch 'master' into elements-22-rc4 2022-08-18 17:08:16 +00:00
Pablo Greco
0be72f4c39
Merge pull request #1146 from andreabonel/master_issue_1144
Elements-qt: Fix arrows to increase/decrease Amount
2022-08-18 13:59:45 -03:00
Pablo Greco
debf46b89e
Merge pull request #1145 from allenpiscitello/pset-fixes
Fixing issuance cases and half blinded cases in PSET
2022-08-18 13:40:04 -03:00
Allen Piscitello
5954b10a1a Fixing issuance cases and half blinded cases in PSET 2022-08-18 11:20:02 -05:00
Andrea Bonel
38e9490de5 Elements-qt: Fix arrows to increase/decrease Amount 2022-08-18 13:16:37 -03:00
Pablo Greco
fa809aff5e
Merge pull request #1141 from ElementsProject/roconnor-blockstream-patch-1
Fix tapscript comment
2022-08-12 13:01:41 -03:00
roconnor-blockstream
707cf20b12
Fix tapscript comment
In elements tapscript is verison 0xc4
2022-08-12 11:56:15 -04:00
Andrew Poelstra
6422e50652
Merge ElementsProject/elements#1140: Fix Icon position in dmg
7fb99ff33f Fix Icon position in dmg (Pablo Greco)

Pull request description:

  Mac installer is showing the elements icon in a bad position
  ![image](https://user-images.githubusercontent.com/12950210/184251990-2496a5fc-de3a-450f-88d7-bce4188224f2.png)

  This small fix puts it back where it should be
  ![image](https://user-images.githubusercontent.com/12950210/184252039-0455a9ce-39f8-44cf-8d78-e8b1669e15e3.png)

ACKs for top commit:
  apoelstra:
    utACK 7fb99ff33f. Confirmed that it only touches Mac stuff.

Tree-SHA512: cbe3cd3ae4b5d461dc7f993ca0ea11f6ff1759a616d4d96d3a7ca9eda59cd2dc8e6664f2708d168bc9d84a8158adef73d0c995d6a8d40fd31311e4591f6747fd
2022-08-12 15:52:39 +00:00
Pablo Greco
7fb99ff33f Fix Icon position in dmg 2022-08-11 21:29:05 +00:00
Pablo Greco
3e44c1ff8c
Merge pull request #1139 from philippem/update-copyright-year-2022
Update copyright year to 2022
2022-08-11 18:15:57 -03:00
Philippe McLean
6518d4eb2f Update copyright year to 2022 2022-08-11 13:29:35 -07:00
Pablo Sebastian Greco
fdeaa4983b
Merge pull request #1137 from gwillen/release-backports-22
[backport] Backport #1121 and #1131 to elements-22.x for rc3
2022-08-09 18:11:43 -03:00
Glenn Willen
a17887b171 Bump version to -rc3 2022-08-09 12:40:35 -07:00
Glenn Willen
0229b2c277 Bring in Elements #1121 and #1131 for elements 22rc3. 2022-08-09 12:38:02 -07:00
Pablo Sebastian Greco
6132c01d60
Merge pull request #1121 from jgriffiths/pset_updates
PSET: Various fixes
2022-08-09 16:16:02 -03:00
Pablo Sebastian Greco
1efefc3914
Merge pull request #1131 from sanket1729/udpate_dump_blind_key
Allow dumpblinding key to accept non-CT address
2022-08-09 16:14:57 -03:00
Jon Griffiths
3be6e80f90
PSET: handle missing/NULL issuance assets when blinding 2022-08-09 09:36:02 +12:00
Jon Griffiths
e319fe0a9a
PSET: Add a parsepsbt RPC command to parse and dump a given PSBT
I found this useful for for creating test cases and checking validity.
In the event that alternative implementations do not aim for exact
serilization compatibility, this RPC can be used to validate and
re-serialize their output for testing.
2022-08-09 09:36:02 +12:00
Jon Griffiths
1462492553
PSET: Use the current serialization format in PSET tests
This allows these test cases to be re-used by alternate implementations
for round-trip serialization testing.
2022-08-09 09:36:02 +12:00
Jon Griffiths
e8e2bd1e61
PSET: Handle unknown global PSET extension fields
This makes global handling forwards-compatible when new fields are
added, and un-breaks any PSET implementations that serialize
PSBT_ELEMENTS_GLOBAL_TX_MODIFIABLE (which Elements does not yet
implement).
2022-08-09 09:36:02 +12:00
Jon Griffiths
9eeadc83da
PSET: Write input fields in their definition order
As for outputs. ISSUANCE_VALUE_COMMITMENT and ISSUANCE_VALUE were
misordered.
2022-08-09 09:36:02 +12:00
Jon Griffiths
4f71f62b43
PSET: Write output fields in their definition order
ASSET_COMMITMENT and ASSET were in the wrong order, which prevents
simply iterating the constants in simple parsers/writers.
2022-08-09 09:36:02 +12:00
Jon Griffiths
6e01e5dc82
PSET: Put PSBT_OUT_AMOUNT back in the same position as in PSBT
While the order of fields is not explicit in the PSBT/PSET specifications,
third parties need to be able to support both with a single implementation.
Keeping the PSBT fields in the same order makes this significantly
easier.
2022-08-09 09:36:02 +12:00
Jon Griffiths
5831e6b165
PSET: Serialize PSBT_ELEMENTS_GLOBAL_SCALAR according to spec
Note the re-parsing of the correct serialization is covered by the existing
PSBT tests which process PSBTs containing scalars.
2022-08-09 09:36:01 +12:00
Jon Griffiths
46c49c09b6
PSET: Allow reading of correctly serialized empty vectors
A single 0x00 byte indicates a zero length field; we must skip parsing
that field otherwise the length will be expected to be read again for
the vector that is passed in to revieve the value.

This allows PSBT_ELEMENTS_GLOBAL_SCALAR to be parsed when it is
serialized according to the spec, i.e. both of the following cases
will correctly parse to the same representation:

$cli decodepsbt 'cHNldP8B+wQCAAAAAQIEAgAAAAEEAQABBQEAJ/wEcHNldAABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fIAEAAA=='

and

$cli decodepsbt 'cHNldP8B+wQCAAAAAQIEAgAAAAEEAQABBQEAJ/wEcHNldAABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fIAAA'

PSBT_ELEMENTS_GLOBAL_SCALAR is the only PSBT/PSET field that contains
key data but no value data and so is the only field that currently hits
this special case.
2022-08-09 09:35:54 +12:00
Pablo Sebastian Greco
22fc036639
Merge pull request #1136 from gwillen/release-backports-22
Bump version to -rc2
2022-08-08 18:11:12 -03:00
Glenn Willen
ac04c99413 Bump version to -rc2 2022-08-08 14:03:31 -07:00
Pablo Sebastian Greco
9ee071f9da
Merge pull request #1135 from gwillen/release-backports-22
[elements-22.x] Backport #1134: Check the value assertion only on valid amounts
2022-08-08 17:53:35 -03:00
sanket1729
c30f9a3339 Check the value assetion only on valid amounts
This causes crash on elements wallet when dealing with transactions that
have explicit values and confidential assets. This creates a somewhat
serious DoS attack as the sender can cause the reciever's wallet to
crash by partially blinding the change output. To make matters worse,
the wallet initially accepts the transaction, but fails while spending
the output.

This is likely caused by a combination of two bugs:
1) The wallet's current behaviour stores the complete transaction of interest
in CWalletTx instead of just Outpoints. Only that the spend time do we
iterate over all outputs, try to unblind them and check which are
isMine. When calling wtx.GetOutputValueOut() or similar calls, we hit this assertion.

While the current behaviour is okay, I think the correct way is move
the IsMine == ISMINE_NO at the start of the loop. We should not do be
any checks on outputs that are not ours. This is used in multiple
places at different parts of the codebase for different RPCs.

2) When dealing with partially blinded trasactions, ComputeBlindingData
correctly sets value = -1, and the cache byte to 1. When getting the
data again with GetBlindingData for explicit value and confidential
asset, we load the precomputed data with value = -1 and assert the
loaded value be the explicit value in the transaction. This is only true
for explicit value and explicit asset.

The changed assertion checks that written value should be same as the
explicit value that was written only when the amounts are valid

(cherry picked from commit 53a75ebbae)
2022-08-08 13:35:04 -07:00
Glenn Willen
426679e48c
Merge pull request #1134 from sanket1729/crash_partial_blind
Check the value assertion only on valid amounts
2022-08-08 13:16:22 -07:00
sanket1729
53a75ebbae Check the value assetion only on valid amounts
This causes crash on elements wallet when dealing with transactions that
have explicit values and confidential assets. This creates a somewhat
serious DoS attack as the sender can cause the reciever's wallet to
crash by partially blinding the change output. To make matters worse,
the wallet initially accepts the transaction, but fails while spending
the output.

This is likely caused by a combination of two bugs:
1) The wallet's current behaviour stores the complete transaction of interest
in CWalletTx instead of just Outpoints. Only that the spend time do we
iterate over all outputs, try to unblind them and check which are
isMine. When calling wtx.GetOutputValueOut() or similar calls, we hit this assertion.

While the current behaviour is okay, I think the correct way is move
the IsMine == ISMINE_NO at the start of the loop. We should not do be
any checks on outputs that are not ours. This is used in multiple
places at different parts of the codebase for different RPCs.

2) When dealing with partially blinded trasactions, ComputeBlindingData
correctly sets value = -1, and the cache byte to 1. When getting the
data again with GetBlindingData for explicit value and confidential
asset, we load the precomputed data with value = -1 and assert the
loaded value be the explicit value in the transaction. This is only true
for explicit value and explicit asset.

The changed assertion checks that written value should be same as the
explicit value that was written only when the amounts are valid
2022-08-08 03:28:51 -07:00
Andrew Poelstra
2e3e791074
Merge ElementsProject/elements#1129: Elements 22 rc1
7286cdc3b5 wallet: fix some fee calculation bugs (Andrew Poelstra)
ada87dc6db Fix RC version to 22.0.0rc1 (Glenn Willen)
ff439d8d50 Another fix to manpages (Glenn Willen)
93ebe3b98a QT: fix title in custom chains (Pablo Greco)
dea9125620 Fixes to manpage generation; regenerate manpages (Glenn Willen)
7180bdcbc9 guix/prelude: Override VERSION with FORCE_VERSION (Carl Dong)
4f11bbf7d3 guix: ignore additioanl failing certvalidator test (fanquake)
1e4053c4f0 qt: Pre-rc3 translations update (Hennadii Stepanov)
4a7dc8b520 qt: Pre-rc2 translations update (Hennadii Stepanov)
7ce47bf53e qt: Pre-rc2 translations update (W. J. van der Laan)
f4820e59f0 Revert "Add parameter for chain name in initial download string" (Glenn Willen)
9fb51a2a20 generate manual pages for 22 release (Glenn Willen)
ca2d72ae8b elements: Fix build by removing newly-added assertion from upstream that doesn't make sense with assets (Glenn Willen)
a4b194c671 Some small improvements to release notes (Pieter Wuille)
9c9695f97f doc: mention bech32m/BIP350 in doc/descriptors.md (Pieter Wuille)
bf4d58f351 doc: Move 22.0 release notes from wiki (W. J. van der Laan)
5514d409a9 doc: Stop nixing `-` in manual pages (W. J. van der Laan)
4df7e88f6f Improve doc/i2p.md regarding I2P router options/versions (Jon Atack)
45898781ec Fix build with Boost 1.77.0 (Rafael Sadowski)
a94c1d5c61 qt: Handle new added plurals in bitcoin_en.ts (Hennadii Stepanov)
a5d5de2f35 doc: Mention the flat directory structure for uploads (Andrew Chow)
0bfa783a00 guix: Don't include directory name in SHA256SUMS (Andrew Chow)
c9d0d0cbe4 test: fix bug in 22686 (S3RK)
1c028b9a51 clientversion: No suffix #if CLIENT_VERSION_IS_RELEASE (Carl Dong)
58deead9b9 test: Test for ApproximateBestSubset edge case with too little fees (Andrew Chow)
a513722516 wallet: Assert that enough was selected to cover the fees (Andrew Chow)
efac8a33fa wallet: Use GetSelectionAmount for target value calculations (Andrew Chow)
13a256fc9b release: Release with separate SHA256SUMS and sig files (Carl Dong)
1e6ee42132 guix-verify: Non-zero exit code when anything fails (Carl Dong)
0608e9958f gui: ensure external signer option remains disabled without signers (Andrew Chow)
61e168957d qt: Fix regression in "Encrypt Wallet" menu item (Hennadii Stepanov)
68f17e6b67 consensus/params: simplify ValidDeployment check to avoid gcc warning (Anthony Towns)
8ec2c4fed5 ci: Run fuzzer task for the master branch only (Hennadii Stepanov)
c0bbec8982 build: Bump RC to rc2 (W. J. van der Laan)
a37b834a6b doc: add info to i2p.md about IBD time and multiple networks (Jon Atack)
50b66c238e contrib, p2p: update I2P hardcoded seeds (Jon Atack)
925571c7dd guix: Ensure EPOCH_SOURCE_DATE does not include GPG information (Andrew Chow)
8f495aa3ef guix: Remove extra \r from all.SHA256SUMS line ending (Andrew Chow)
2d948930e2 guix, doc: Add a note that codesigners need to rebuild after tagging (Andrew Chow)
c576e88cee guix: Allow changing the base manifest in guix-verify (Andrew Chow)
82d8bdb042 guix: Make all.SHA256SUMS rather than codesigned.SHA256SUMS (Andrew Chow)
a32205f9cc script, doc: guix touchups (jonatack)
bd56b60454 Updated Readme, Corrected the codesign typo (h)
96aaed9813 guix/build: Remove vestigial SKIPATTEST.TAG (Carl Dong)
9cc787300b guix/INSTALL: Misc fixups (Carl Dong)
d1be61f836 guix: Silence getent(1) invocation (Carl Dong)
6c7021777c build: Bump version to 22.0.0rc1 (W. J. van der Laan)

Pull request description:

  The changes shown here are mostly backports from bitcoin core.

  There are several manual changes by me, near the end.

  ca2d72a - Removes a new upstream assertion around change-handling in coin selection. I would really like someone familiar with the coin selection algorithm to look at this. As far as I can tell, the assertion either (1) does not apply because we have substantially changed this due to asset handling, or (2) is caught by things we already check. But I'd like that reviewed.

  9fb51a2 - Generates updated manual pages.

  f4820e5 - Reverts a change to the translation files. To quote `doc/translation_process.md`:
  > For general PRs, you shouldn’t include any updates to the translation source files. They will be updated periodically, primarily around pre-releases, allowing time for any new phrases to be translated before public releases. This is also important in avoiding translation related merge conflicts.

  If we want to change our policy around how we handle these, we would need to discuss setting up the translation software ourselves. I don't think we should do that; the existing approach will fall back to English when a translation isn't available, and we have not gotten any complaints about that, to my knowledge.

ACKs for top commit:
  psgreco:
    ACK 7286cdc3b5 local tests look good now

Tree-SHA512: d40ae2aee7a78de82756c34da72d1fcf308c0419acca733801a9fb4b7a8f5c978673f2664303c00078bd7eabc640bc0f954e90b46f659cf1ad869b7e50c36d15
2022-08-05 22:31:18 +00:00
Andrew Poelstra
7286cdc3b5 wallet: fix some fee calculation bugs
First, this reverts commit ca2d72ae8b to reinstate
an assertion that was added in Bitcoin #22686. It did not compile because our
`change_and_fee` variable is a map rather than number; I changed it to use
`map_change_and_fee.at(policyAsset)` to match the equivalent change 2 lines down
from a5d97b363b (merge of Bitcoin #22008).

Then fix the following bugs:

1. Change the new test in rpc_fundrawtransaction.py to bump the -maxtxfee value,
   which we'd otherwise exceed, failing the test and masking actual failures.
   (This was just caused by the extreme fee settings of the test combined with
   Elements' large transactions.)
2. Change the fee-output size estimation for `tx_noinputs_size` to be 46 rather
   than 44 bytes; we forgot that even null surjection/rangeproofs need a 0 byte
   when output witnesses are present. This mistake triggered the new assertion.
3. Correct the logic in which change outputs are sometimes dropped even when
   they are the only blinded output in a transaction with blinded inputs. This
   would cause the new test to fail with `bad-txn-inputs-ne-outputs`; I'm very
   surprised that no existing tests hit this.

   (I have an existing comment block in this code where I "promise" that I had
   a good reason for doing something mysterious related to blinding. I was not
   able to reverse-engineer my intention here, though I think it is related to
   this, but since I couldn't understand it I just left this block intact and
   worked around it.)
4. This then triggered the assertion again since the coin selection code
   assumes that sufficiently-small change will always be dropped. If we prevent
   this drop we will have under-funded the transaction.

   To fix this we add Yet Another Flag `may_need_blinded_dummy` in which we add
   extra weight to `tx_noinputs_size` in the case that we're doing a blinded tx
   but have no blind destinations. We turn this off after coin selection if it
   turns out that we don't have any blinded inputs, though ofc at that point
   much of the damage/inefficiency has already been done..
5. Fix some constants in other functional tests which assumed precise fee
   calculations; these precise values changed because of fixes (2) and (4).

There is one new FIXME, which is that the "dummy change" value will now be a
zero-valued OP_RETURN but we still put a full-size rangeproof and surjection
proof on it. There is some plausible privacy benefit to this but not much,
and wasting 5000+ bytes rather than the ~65 needed for an exact-value proof
is not worth it. We will fix this in the future when we overhaul the wallet
blinding logic.
2022-08-05 16:32:52 +00:00
Glenn Willen
ada87dc6db Fix RC version to 22.0.0rc1 2022-08-03 18:21:41 -07:00
Glenn Willen
ff439d8d50 Another fix to manpages 2022-08-03 16:08:36 -07:00
Pablo Greco
93ebe3b98a QT: fix title in custom chains 2022-08-03 15:46:24 -07:00
Glenn Willen
dea9125620 Fixes to manpage generation; regenerate manpages 2022-08-03 15:27:36 -07:00
Carl Dong
7180bdcbc9 guix/prelude: Override VERSION with FORCE_VERSION
Previously, if the builder exported $VERSION in their environment (as
past Gitian-building docs told them to), but their HEAD does not
actually point to v$VERSION, their build outputs will differ from those
of other builders.

This is because the contrib/guix/guix-* scripts only ever act on the
current git worktree, and does not try to check out $VERSION if $VERSION
is set in the environment.

Setting $VERSION only makes the scripts pretend like the current
worktree is $VERSION.

This problem was seen in jonatack's attestation for all.SHA256SUMS,
where only his bitcoin-22.0rc3-osx-signed.dmg differed from everyone
else's.

Here is my deduced sequence of events:

1. Aug 27th: He guix-builds 22.0rc3 and uploads his attestations up to
   guix.sigs

2. Aug 30th, sometime after POSIX time 1630310848: he pulls the latest
   changes from master in the same worktree where he guix-built 22.0rc3
   and ends up at 7be143a960

3. Aug 30th, sometime before POSIX time 1630315907: With his worktree
   still on 7be143a960, he guix-codesigns. Normally, this would result
   in outputs going in guix-build-7be143a960e2, but he had
   VERSION=22.0rc3 in his environment, so the guix-* scripts pretended
   like he was building 22.0rc3, and used 22.0rc3's guix-build directory
   to locate un-codesigned outputs and dump codesigned ones.

   However, our SOURCE_DATE_EPOCH defaults to the POSIX time of HEAD
   (7be143a960), which made all timestamps in the resulting codesigned
   DMG 1630310848, 7be143a960e2's POSIX timestamp. This differs from the
   POSIX timestamp of 22.0rc3, which is 1630348517. Note that the
   windows codesigning procedure does not consider SOURCE_DATE_EPOCH.

We resolve this by only allowing VERSION overrides via the FORCE_VERSION
environment variable.
2022-08-03 12:19:43 -07:00
fanquake
4f11bbf7d3 guix: ignore additioanl failing certvalidator test
======================================================================
ERROR: test_revocation_mode_soft (tests.test_validate.ValidateTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/guix-build-python-certvalidator-0.1-1.e5bdb4b.drv-0/source/tests/test_validate.py", line 85, in test_revocation_mode_soft
    validate_path(context, path)
  File "/tmp/guix-build-python-certvalidator-0.1-1.e5bdb4b.drv-0/source/tests/../certvalidator/validate.py", line 50, in validate_path
    return _validate_path(validation_context, path)
  File "/tmp/guix-build-python-certvalidator-0.1-1.e5bdb4b.drv-0/source/tests/../certvalidator/validate.py", line 358, in _validate_path
    raise PathValidationError(pretty_message(
certvalidator.errors.PathValidationError: The path could not be validated because the end-entity certificate expired 2022-01-14 12:00:00Z

Github-Pull: #24057
Rebased-From: 8588591965
2022-08-03 12:18:11 -07:00
Glenn Willen
1be529a11b
Merge pull request #1130 from psgreco/master-qtfixtitle
QT: fix title in custom chains
2022-08-03 12:05:51 -07:00
sanket1729
a142232384 Allow dumpblinding key to accept non-CT address
This facilitates the following workflow:
1) Obtain an updated psbt with in_witness_utxo and in_utxo_rangeproof
2) Get the blinding key from the input utxo address obtained from input
script pubkey without revealing master blinding key
3) Rewind the proof to obtain blinding factors and implement stateless
blinding
2022-08-02 13:29:05 -07:00
Pablo Greco
088c24c16a QT: fix title in custom chains 2022-08-01 21:32:00 -03:00
Hennadii Stepanov
1e4053c4f0 qt: Pre-rc3 translations update 2022-08-01 15:36:16 -07:00
Hennadii Stepanov
4a7dc8b520 qt: Pre-rc2 translations update 2022-08-01 15:36:16 -07:00
W. J. van der Laan
7ce47bf53e qt: Pre-rc2 translations update
We forgot this for rc1. Thanks to Hebasto for fixing the import script.

Tree-SHA512: 127d0989dabf95867f4542e7f3134ef5d5045418b1411582772d60759e16a5090e30c83bffbbc44b2a496ba830a66bdb0d8ba0d2def43f3462a4f15edf64953a
2022-08-01 15:36:16 -07:00
Glenn Willen
f4820e59f0 Revert "Add parameter for chain name in initial download string"
This reverts commit 5e3019570f. That commit
erroneously made changes to translation files by hand, conflicting with
the automated translation pipeline.

Reverting will facilitate merging in upstream translation changes.
2022-08-01 15:36:16 -07:00
Glenn Willen
9fb51a2a20 generate manual pages for 22 release 2022-08-01 15:36:16 -07:00
Glenn Willen
ca2d72ae8b elements: Fix build by removing newly-added assertion from upstream that doesn't make sense with assets 2022-08-01 15:36:16 -07:00
Pieter Wuille
a4b194c671 Some small improvements to release notes 2022-08-01 15:36:16 -07:00
Pieter Wuille
9c9695f97f doc: mention bech32m/BIP350 in doc/descriptors.md
Github-Pull: #22837
Rebased-From: d2a09c8355
2022-08-01 15:35:07 -07:00