Commit graph

39130 commits

Author SHA1 Message Date
Hennadii Stepanov
8bde23c8e7 build: Fix "ERR: Unsigned tarballs do not exist"
Github-Pull: #24733
Rebased-From: 7762c5683f
2025-03-10 15:37:04 +00:00
Hennadii Stepanov
cc323e0d95 wallet: Postpone NotifyWalletLoaded() for encrypted wallets
Too early NotifyWalletLoaded() call in CWallet::Create() results the
notification goes before DescriptorScriptPubKeyMans were created and
added to an encrypted wallet.

Co-authored-by: Andrew Chow <achow101-github@achow101.com>

Github-Pull: bitcoin/bitcoin#24711
Rebased-From: 0c12f0116c
2025-03-10 15:36:55 +00:00
Hennadii Stepanov
92a518c4f3 wallet, refactor: Add wallet::NotifyWalletLoaded() function
This change is a prerequisite for the following bugfix.

Github-Pull: bitcoin/bitcoin#24711
Rebased-From: aeee419c6a
2025-03-10 15:36:42 +00:00
Hennadii Stepanov
17562c0a58 util: Add inotify_rm_watch to syscall sandbox (AllowFileSystem)
Github-Pull: bitcoin#24690
Rebased-From: f05a4cd
2025-03-10 15:35:55 +00:00
Andrew Chow
fb888905f5 tests: Calculate input weight more accurately
The external input test with specifying input weight would make a
pessimistic estimate of the input weight. However this would result in a
test failure as it is sometimes too pessimistic when an ECDSA signature
ends up being smaller than usual. To correct this, we can calculate the
input weight more accurately.

Github-Pull: #24454
Rebased-From: 8a04a386f7
2025-03-10 15:15:58 +00:00
fanquake
ba78a0a8cb util: add linkat to syscall sandbox (AllowFileSystem)
Github-Pull: bitcoin#24659
Rebased-From: 9809db3
2025-03-10 15:15:25 +00:00
Vasil Dimov
ff3e02f606 options: flip listenonion to false if not listening
If the user has unchecked "Allow incoming connections" in
`Settings->Options...->Network` then `fListen=false` is saved in
`~/.config/Bitcoin/Bitcoin-Qt.conf`. This flips `-listen` to `false`
during startup, but leaves `-listenonion` to `true`.

This flipping of `-listen` is done in `OptionsModel::Init()` after
`InitParameterInteraction()` has been executed which would have flipped
`-listenonion`, should it have seen `-listen` being `false`
(this is a difference between `bitcoind` and `bitcoin-qt`).

Fixes: https://github.com/bitcoin-core/gui/issues/567

Github-Pull: bitcoin-core/gui#568
Rebased-From: 7f90dc26c8
2025-03-10 15:14:53 +00:00
Thomas Trevethan
218360bb71 fix prefix 2025-03-10 14:39:32 +00:00
MarcoFalke
e8941f064a rpc: Exclude descriptor when address is excluded
Github-Pull: bitcoin#24636
Rebased-From: faf37c2
2025-03-10 13:35:38 +00:00
Jon Atack
ccb3a3e636 Clarify in -maxtimeadjustment that only outbound peers influence time data
Github-Pull: bitcoin#24609
Rebased-From: 1bba72d
2025-03-10 13:33:32 +00:00
Andrew Chow
d5746d466e Update signapple for platform identifier fix
Github-Pull: #24573
Rebased-From: 3c74f775ac
2025-03-10 13:33:14 +00:00
Hennadii Stepanov
e182058ad0 guix: Use "win64" for Windows artifacts consistently
Github-Pull: #24549
Rebased-From: 53dd6165b8
2025-03-10 13:33:03 +00:00
Thomas Trevethan
45fdd42927 fixed tests 2025-03-10 13:03:15 +00:00
Hennadii Stepanov
513c001fab guix: Drop "-signed" suffix for signed macOS .dmg files
This change makes naming of the signed artifacts consistent across
different OSes, including Windows.

Github-Pull: #24549
Rebased-From: 4b4b04a66d
2025-03-10 11:52:24 +00:00
Sebastian Falbesoner
62b5e053d8 contrib: fix signet miner (sighash mismatch)
PSBT signing was changed to use SIGHASH_DEFAULT by default in #22514.
The signet miner script sets the sighash type of the created PSBT to
SIGHASH_ALL, hence this leads to a sighash mismatch when the
`walletprocesspsbt` RPC is called. Fix this by explicitly passing the
correct sighash type.

Note that the same change was needed in one of our functional tests,
see commit d3992669df.

Reported by gruve-p.

Github-Pull: bitcoin#24553
Rebased-From: 12cc020
2025-03-10 11:52:12 +00:00
Hennadii Stepanov
fd2a5b7a4e guix: Use $HOST instead of generic osx{64} for macOS artifacts
Github-Pull: #24549
Rebased-From: 933a43018f
2025-03-10 11:52:05 +00:00
Jon Atack
608381c1e8 rpc: rename getdeploymentinfo status-next to status_next
Github-Pull: bitcoin#24528
Rebased-From: 5d7c69b
2025-03-10 11:51:55 +00:00
Martin Zumsande
b670213579 test: set segwit height back to 0 on regtest
This was changed in #22818 from 0 to 1. Since it changes
BLOCK_OPT_WIT of the genesis block, older versions of bitcoin
core would not read regtest directories created with newer versions
without a reindex.

Github-Pull: bitcoin#24527
Rebased-From: 5ce3057
2025-03-10 11:51:38 +00:00
Andrew Chow
141288d44d build, mac: Include arch in codesignature tarball
Github-Pull: #24506
Rebased-From: 0189df1d31
2025-03-10 11:51:22 +00:00
Andrew Chow
638095e811 guix: use latest signapple
Github-Pull: #24506
Rebased-From: 6e9308c6d4
2025-03-10 11:50:24 +00:00
Ryan Ofsky
7e7dbadf44 test: Add tests for GetArg methods / settings.json type coercion
Just add tests. No changes to application behavior. Tests will be
updated in the next commit changing & improving current behavior.

Include a Qt test for GUI startup crash reported by Rspigler in
https://github.com/bitcoin/bitcoin/issues/24457 caused by GetArg
behavior that happens if settings.json contains an integer value for any
of the configuration options which GUI settings can currently clash with
(-dbcache, -par, -spendzeroconfchange, -signer, -upnp, -natpmp, -listen,
-server, -proxy, -proxy, -onion, -onion, -lang, and -prune).

Github-Pull: bitcoin/bitcoin#24498
Rebased-From: 84b0973e35
2025-03-10 11:49:53 +00:00
fanquake
33fe2da55e guix: use same commit for codesigning time-machine
The time machines should be updated in lockstep.

Github-Pull: #24484
Rebased-From: 29862bdd40
2025-03-10 11:49:42 +00:00
Byron Hambly
0eb2ea5cbe
Merge pull request #1425 from ElementsProject/simplicity
Avoid double free in simplicity pointer when copying PrecomputedTrans…
2025-03-04 14:53:57 +02:00
Russell O'Connor
3a80782963 Avoid double free in simplicity pointer when copying PrecomputedTransactionData
We cannot put a raw pointer into a class that has a default copy constructor.
2025-03-03 17:35:07 -05:00
Byron Hambly
df4e99dca3
Merge pull request #1423 from psgreco/master-win64-fixassert
Fix Assert crash in win64 native builds
2025-02-26 14:50:20 +02:00
Pablo Greco
59c30c0779 Blinding: update change_position after calling fillBlindDetails 2025-02-25 14:57:10 -08:00
Pablo Greco
4058bd114b Remove extra ; in confidential.h 2025-02-25 14:57:10 -08:00
Byron Hambly
7ed2768dca
Merge pull request #1421 from psgreco/master-fixlock
Fix tests and build warnings
2025-02-24 15:58:18 +02:00
Pablo Greco
b92a3ceda2 TSAN: Avoid unlocked access to pindexBestHeader 2025-02-23 14:34:19 -08:00
Pablo Greco
38065e1159 Fix warning about mixing enum and int 2025-02-23 14:34:19 -08:00
Pablo Greco
d973e36ffa Win64 Native: Fix PACKAGE_NAME and bug report url 2025-02-23 14:34:19 -08:00
Pablo Greco
73c542ea58 Fix error reading cookie file on windows when path contains UTF-8 2025-02-23 14:34:19 -08:00
Pablo Greco
fe04483875 Avoid concatenating default path when mainchainrpccookiefile is an absolute path 2025-02-23 14:34:19 -08:00
Pablo Greco
258d9d3c87 feature_fedpeg: Use os.join instead of hardcoded separator 2025-02-23 10:19:51 -08:00
Pablo Greco
305de6d265 feature_confidential_transactions: Use system temp dir instead of hardcoded /tmp 2025-02-23 09:24:05 -08:00
Pablo Greco
cd67236c12 feature_discount_ct: some txs can return 2 different weights, adapt the test to it 2025-02-22 09:05:56 -08:00
Byron Hambly
1ded38874e
Merge pull request #1420 from ElementsProject/simplicity
Simplicity
2025-02-19 10:01:05 +02:00
Russell O'Connor
c211d1a4d9 Merge commit '37adf7d72d' into simplicity 2025-02-18 13:11:04 -05:00
Russell O'Connor
37adf7d72d Squashed 'src/simplicity/' changes from 4858b89526..b549192109
b549192109 codespell: fix typos

git-subtree-dir: src/simplicity
git-subtree-split: b5491921095b28bc554c325a7d05274690483a6f
2025-02-18 13:11:04 -05:00
Byron Hambly
12c586a3bf
Merge pull request #1417 from psgreco/master-fix-win64native
Fix Win64 native unit test
2025-02-18 16:05:44 +02:00
Byron Hambly
c9c21cf7df
Merge pull request #1416 from apoelstra/2025-02--psbt-fix
pset: fix NULL pointer dereference when deserializing malformed PSETs over RPC
2025-02-18 15:06:38 +02:00
Jon Atack
7f56623441 Put lock logging behind DEBUG_LOCKCONTENTION preprocessor directive 2025-02-15 00:22:57 -08:00
Andrew Poelstra
0bff9b06f7
psbt: guard against empty PSBT transaction
There is a crashing bug in psbt.h which works as follows. This occurs in
the psbt_deserialize_input fuzz test, which deserializes an input and
then tries to reserialize it. Here a PSET input may contain a mainchain
transaction, which is where our trouble is.

The process is as follows:

1. On line 901, we create a CTransactionRef, which is a newtype around
   std::shared_ptr<CTransaction> which defaults to being null.
2. On line 903 we then call `UnserializeFromVector` to populate this,
   where this is a helper function which attempts to read some number of
   objects from a byte vector, i.e. a length-prefixed blob.
3. HOWEVER, `UnserializeFromVector` when given an empty vector, decides
   that it has successfully deserialized zero elements, and returns.
4. Then, on line 904 we assign the CTransactionRef, which is a valid
   std::shared_ptr whose internal pointer is NULL, to `m_peg_in_tx`,
   which is a variant of monostate, Bitcoin::CTransactionRef, and
   CTransactionRef. Its variant changes from the default monostate
   to CTransactionRef.
5. Then, on line 419, we call `std::get_if<CTransactionRef>` on this
   object, which returns a std::optional<CTransactionRef>. Because
   `m_peg_in_tx` is in the `CTransactionRef` variant, this succeeds,
   returning a true std::optional containing a valid std::shared_ptr
   which contains a NULL pointer.
6. Then, on line 420, we call `if (peg_in_tx)`, which is true, because
   we have a true std::optional. We then dereference it on line 423,
   which is perfectly legal, to get our std::shared_ptr, and pass this
   shared pointer to SerializeToVector.
7. SerializeToVector passes through like 6 layers of serialize.h
   obfuscation and eventually dereferences the shared pointer, but
   because it's NULL, this is a NULL pointer dereference, and we get a
   crash.

There are two lessons here:

1. Don't use C++. As I say in acf709b3ab,
   where I introduced some of the offending code here (but only by
   replacing boost stuff with their STL equivalents; the bug existed
   before I did this), "what a trainwreck of a language".
2. Don't use `UnserializeFromVector` and expect it to throw if the data
   you're deserializing is malformed. If it's malformed in the sense of
   being empty, it will "succeed" and silently do nothing.

I glanced at every other instance of UnserializeFromVector to check what
will happen when it's passed an empty string. I believe there are no
other cases where it will fail to initialize a NULL pointer, so I
believe that this will not cause other crashes. But I also believe that
the behavior in this case is almost always wrong and that we parse
malformed PSETs in crazy and incorrect ways all over the place.

If anybody has a problem with this, I encourage you to go review the
Bitcoin PSBT2 PRs, which this stuff is based on, which have been
languishing in rebase hell for the better part of a decade. Don't blame
the author for not writing perfect code in a hostile language with no
support.

After this PR I ran the fuzzer for 16 hours on a 192-thread machine (so
3072 CPU-hours) and didn't see any more crashes.
2025-02-14 18:08:45 +00:00
Andrew Poelstra
f7826f9199
psbt: avoid assigning non-boolean values to bool (ubsan)
ubsan doesn't like assigning arbitrary uint8_t values to bool. It's easy
to avoid doing, so do it. (We do this specifically in PSET since that's
Elements-specific code, but the same issue is present in Bitcoin in the
Unserialize impl for bool in serialize.h. Upstream this is only used in
the wallet database, where it may be that non 0/1 values are impossible
(absent a corrupt wallet).
2025-02-14 18:07:48 +00:00
Byron Hambly
e343610b99
Merge pull request #1414 from apoelstra/2025-02--fuzz-update
fuzz: minor updates to the Simplicity fuzz tests
2025-02-14 16:23:16 +02:00
Andrew Poelstra
a2d24eff9e
fuzz: remove dead code from simplicity_tx.cpp 2025-02-13 23:09:51 +00:00
Andrew Poelstra
69c241592f
fuzz: update simplicity_tx target to hit simplicity CMR error 2025-02-13 23:08:57 +00:00
Pablo Greco
0397d22941
Merge pull request #1409 from ElementsProject/simplicity
Simplicity
2025-02-13 10:07:47 -08:00
Pablo Greco
24b43eaa66
Merge pull request #1413 from delta1/lint-merge-prs
lint: fix shellcheck, spelling, and locale
2025-02-13 06:51:24 -08:00
Byron Hambly
b8cf7b768d
Merge pull request #1412 from psgreco/master-fix-macos
CI: Fix macos native build
2025-02-13 16:34:20 +02:00