Commit graph

39047 commits

Author SHA1 Message Date
Byron Hambly
d7efd310f8
Merge pull request #1400 from psgreco/master-fixbuild
Fix build in master with newer environments
2025-02-11 17:56:44 +02:00
Pablo Greco
04b114c148 CI: Cirrus: use -j2 in TSan to stabilize 2025-02-11 06:14:51 -08:00
Pablo Greco
276e405ab0 CI: Cirrus: Avoid using -j3 in some jobs when elements has -j3 as the global limit 2025-02-11 06:14:51 -08:00
Pablo Greco
b703da1148 Fix build with gcc-15 2025-02-11 06:14:51 -08:00
fanquake
8251fc8162 23.x Add missing includes to fix gcc-13 compile error
Additional include fixes are required to make the 23.x branch compile
using GCC 13.

(cherry picked from commit af86266165)
2025-02-11 06:14:51 -08:00
MarcoFalke
f64aa1e6c6 Add missing includes to fix gcc-13 compile error
(cherry picked from commit fadeb6b103)
2025-02-11 06:14:51 -08:00
Hennadii Stepanov
f8b1bb7070 build: Fix Boost.Process test for Boost 1.78
(cherry picked from commit 532c64a726)
2025-02-11 06:14:51 -08:00
Hennadii Stepanov
8a1500c63e build: Fix Boost.Process detection on macOS arm64
Could be tested as follows:
```
% brew install boost@1.76
% ./autogen.sh
% ./configure --with-boost='/opt/homebrew/opt/boost@1.76'
```

(cherry picked from commit 1d4157a42b)
2025-02-11 06:14:51 -08:00
Byron Hambly
99c2ee7f9a
Merge pull request #1399 from apoelstra/2025-02--fuzz-fixes
various bugfixes for new fuzz test vectors
2025-02-11 09:49:42 +02:00
Byron Hambly
22089ac8f6
Merge pull request #1372 from delta1/issues-1371
decodepsbt: add asset/assetcommitment to input.witness_utxo
2025-02-11 08:47:17 +02:00
Andrew Poelstra
363c5101c2
fuzz: change int to unsigned in witness_program
Avoids a signed/unsigned integer conversion.
2025-02-11 04:04:25 +00:00
Andrew Poelstra
b90ef38727
ubsan: add suppression for simplicity 2025-02-11 03:00:51 +00:00
MarcoFalke
371718bc99
Use CAmount for fee delta and modified fee
Cherry-pick of fa84a49526
https://github.com/bitcoin/bitcoin/pull/24625 (2/2)
2025-02-11 02:58:42 +00:00
MarcoFalke
3e46754507
Replace struct update_fee_delta with lambda
Cherry-pick of https://github.com/bitcoin/bitcoin/pull/24625 (1/2)
2025-02-11 02:58:42 +00:00
Andrew Poelstra
bd4ae1bcc4
rpc: fix crash in getcompactsketch
This originates in 8723debb3d which has no
PR associated with it. We've really gotta stop putting thousands of
unreviewed commits into this project and rebasing the history away..
2025-02-11 02:58:41 +00:00
Andrew Poelstra
f5ed4e4520
chain: make some integer conversions explicit
We have an unsigned constant which we're bit-inverting, or'ing into a
signed constant, then assigning back to the signed constant. We should
make it explicit wth is going on here.
2025-02-11 02:53:49 +00:00
Andrew Poelstra
86d740b5eb
fuzz: fix crash on null pointer in witness_program target 2025-02-11 02:53:44 +00:00
Byron Hambly
bd551ad186
Merge pull request #1393 from psgreco/master-fixci
CI: Fix Win64 native build, TSAN and CentOS 8 test
2025-02-09 11:22:34 +02:00
Pablo Greco
77b3bdd864 ci: Use clang-18 in tsan task (Ubuntu 20.04)
Cherry-picked from fabb6af850
Cherry-picked from faf4aca15a
Cherry-picked from fa23c9aa7c
Cherry-picked from fa83b65ef8
Cherry-picked from fa75220ac5
2025-02-07 14:49:19 -08:00
MarcoFalke
06b72ec82c ci: Temporarily use clang-13 to work around clang-14 TSan bug
Github-Pull: bitcoin#24572
Rebased-From: fa43933
2025-02-07 14:39:33 -08:00
Pablo Greco
7f10cd11c1 Update xcb_proto to 1.15.2, manually picked from 7cb88c8b46 2025-02-07 13:34:50 -08:00
Pablo Greco
871e9d2ea2 Update boost to 1.81, manually picked from e8b4201ba2 2025-02-07 13:33:59 -08:00
Cory Fields
cad37df99f upnp: add compatibility for miniupnpc 2.2.8
See: c0a50ce33e

The return value of 2 now indicates:
"A valid connected IGD has been found but its IP address is reserved (non routable)"

We continue to ignore any return value other than 1.

(cherry picked from commit 8acdf66540)
2025-02-07 13:25:48 -08:00
Pablo Greco
d1a9ff3478 Win64 native: fix build with simplicity 2025-02-07 13:09:38 -08:00
Pablo Greco
0b40e25beb Win64 native: fix build before simplicity 2025-02-07 13:09:24 -08:00
Pablo Greco
5194a62393 Win64 native: disable psbt_wallet_test just like in Makefile 2025-02-07 05:03:14 -08:00
Pablo Greco
daf8ddc7d2 CI: Use RockyLinux 8 instead of CentOS Stream 8 2025-02-07 05:03:14 -08:00
Byron Hambly
29cf7c21b1
Merge pull request #1392 from psgreco/master-fixfunctional
Fix some functional tests when bdb is not available
2025-02-07 14:37:47 +02:00
Byron Hambly
72a5e4117c
Merge pull request #1391 from apoelstra/2025-02--misc-fuzz-fixes
A couple miscellaneous fixes for fuzztests
2025-02-07 09:31:18 +02:00
Pablo Greco
e6aa6e773e CI: example_elements_code_tutorial test test uses initialfreecoins, disable for descriptor wallets 2025-02-06 13:35:38 -08:00
Pablo Greco
a33ceacdbc CI: feature_tapscript_opcodes test uses initialfreecoins, disable for descriptor wallets 2025-02-06 13:35:38 -08:00
Pablo Greco
87808101be CI: feature_taphash_pegins_issuances test uses initialfreecoins, disable for descriptor wallets 2025-02-06 13:35:20 -08:00
Pablo Greco
e3c318b2b8 CI: discounttests use initialfreecoins, disable for descriptor wallets 2025-02-06 13:35:20 -08:00
Pablo Greco
6991cf7960 CI: trim_headers test uses combineblocksigs, disable for descriptor wallets 2025-02-06 13:35:20 -08:00
Pablo Greco
1ecd5821e8 CI: wallet_elements_regression_1263 uses getpeginaddress, disable for descriptor wallets 2025-02-06 13:35:20 -08:00
Pablo Greco
74cae2d9ec CI: use default wallet name in wallet_elements_21million 2025-02-06 13:35:20 -08:00
Andrew Poelstra
ff6482fc29
fuzz: add SelectParams to rbf.cpp
We cannot fuzz RBF (or do anything mempool-related, really) without
chainparams. This has been true since 2019 at least. I suspect this fuzz
test has never really been run.
2025-02-06 21:31:47 +00:00
Andrew Poelstra
a3b7e71a3d
transaction: refuse to deserialize TxOuts with null values
In Bitcoin Core the notion of a "null" amount (and therefore a "null"
txout) is one which cannot be serialized or deserialized. In Core this
is implemented using a value of -1.

In Elements we use the CT notion of "nullness" which is that the flag on
the confidential value is 0. See d53479c9ff
which implemented this. This is reasonable, but because we don't have
checks on deserialization, we can deserialize objects that cannot be
reserialized.

In particular, in coins.h, we deserialize a coin by deserializing its
txout. When reserializing we assert that !out.IsNull(). This assertion
is hit by the `coins_deserialize` fuzztest.

There are a few potential fixes here:

* Remove the assertion from coins.h, which is there to catch logic bugs
  in Core, on the assumption that if they have no bugs then we don't
  either. This seems like a bad idea.
* Change "nullness" for amounts to be an encoding of -1, like in Core.
  This seems dangerous because we call `GetAmount` all over the place,
  and if this could return the -1 amount, this will likely blow
  something up. Probably this is safe for the same reason it is in Core
  -- that is, we never create null txouts except as sentinel values. But
  do you wanna bet that this is true now? That it'll always be true?
* Same as above, but assert that the amount is not null. This is safer
  than just blindly hoping that no overflows will occur but still not
  obviously safe.
* Refuse to deserialize null CT objects. This is impossible because we
  use null nonce values in txouts.
* Refuse to deserialize null CT values. Similarly, this is impossible
  because we use null values in null asset issuances, which are legal.
* Refused to deserialize CTxOuts with null values or assets.

We are going with the latter solution, because it is narrowly scoped,
does not increase the "crash surface" (we throw an exception, and we
already throw exceptions for other kinds of invalid serializations),
and is very unlikely to cause bugs (null values are invalid on the
network anyway; this is the first check in VerifyAmounts) (so are null
assets for that matter, which we maybe also should refuse to
deserialize).
2025-02-06 21:31:47 +00:00
Byron Hambly
368010a308
Merge pull request #1390 from ElementsProject/simplicity
Update to latest Simplicity
2025-02-06 07:26:06 +02:00
Russell O'Connor
00399aa117 Enable coverage for simplicity/secp256k1
While the bitcoin/elements project testing isn't trying to gain coverage of the regular
libsecp256k1 library, in our case we do want our (fuzz) testing to cover
simplicity's own copy of libsecp256k1, which has been specifically trimmed down
to only include functionality needed by simplicity's jets.
2025-02-04 12:14:28 -05:00
Russell O'Connor
31d94775b3 Update to latest Simplicity
The main difference is that there is now explicit simplicity deallocation functions to go with the allocation functions in the API.
There are some minor changes to error message text.
The deserialization code is now automatically generated.
The are some other minor internal changes.
2025-02-04 12:14:25 -05:00
Russell O'Connor
7fc546656d Merge commit '3b60583dd2' into simplicity 2025-01-31 11:44:47 -05:00
Russell O'Connor
3b60583dd2 Squashed 'src/simplicity/' changes from 86ac0f92c4..c2d4c3d07b
c2d4c3d07b Update elements-sources.mk
5ba4a709ac Add explicit deallocation functions to the Simplicity API
fd3a1a7c3f Fix comments
e10d34fa49 Clarify comment about illegal hidden children
3b55e8150e Rename STOP code error message
f67d1ad145 Generate contents of decodePrimitive automatically
991fddcb6a Correctly name identity hashes
a840706c2f Static asserts on imr_buf not needed
7e91641218 Prep C code for VST proving

git-subtree-dir: src/simplicity
git-subtree-split: c2d4c3d07bb7e5973fc22cf172ed8fb9a84b4365
2025-01-31 11:44:47 -05:00
Andrew Poelstra
b1b4e6d5c9 Sanitize libsimplicity
Without this patch, the --with-sanitizers config flag has no effect on
the copy of libsimplicity in Elements Core. This means that we aren't
running asan or tsan when we intend to, and also means that when fuzzing
we aren't instrumenting the Simplicity binary.

The result is extremely bad fuzz coverage and missed bugs.

ubsan suppression for simplicity sha256.c

ubsan detects when a left shift would overflow an integer type. This is
not UB (it would be if you tried to shift more than the type's width in
one shot) but "may be unintentional" and is therefore detected.

Add a whitelist to the giant list of whitelists.
2025-01-31 11:43:23 -05:00
Andrew Poelstra
1c871c8c20 interpreter: fix use-after-free in Simplicity init code
We have the code fragment `txTo.GetHash().begin()`, which takes a
transaction, computes its txid as a uint256, and then saves a pointer to
the internal data of the uint256.

However, in C++, expressions of the form a.b().c() lead to the return
value of `b` being dropped immediately after the call to `c`. This is
fine if `c` is something like `GetHex` which returns a new independently
allocated object with no pointers to its input. It is not fine for
`begin` which returns a pointer into the return value of `GetHash`.

So this fragment returns a dangling pointer, which is later used by the
Simplicity interpreter, leading to UB.

In practice this code appeared to work, possibly because the stack
layout was such that it actually did work ok. Or possibly because we
don't test with enough fidelity to tell that Simplicity's view of the
txid of a transaction was mangled.
2025-01-31 11:39:07 -05:00
Pablo Greco
e9a914465d
Merge pull request #1385 from delta1/wallet-receive-gt-21million
assets: allow issuance and transaction amounts of more than MAX_MONEY for non-policy assets
2025-01-23 05:44:33 -08:00
Byron Hambly
e7f32aac75
unblindconfidentialpair: update moneyrange check with asset 2025-01-17 13:09:11 +02:00
Byron Hambly
8dabb73663
moneyrange: check asset type 2025-01-17 13:09:10 +02:00
Byron Hambly
a3e0ce2e8c
amountfromvalue: add arg to check moneyrange 2025-01-17 13:09:10 +02:00
Byron Hambly
4303fa500d
test: add functional test for issue 2025-01-14 15:25:05 +02:00