Commit graph

39015 commits

Author SHA1 Message Date
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
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
Byron Hambly
cc2ecbb978
Merge pull request #1378 from psgreco/master-discountct-liquidv1
Master discountct liquidv1
2024-12-17 09:22:57 +02:00
Pablo Greco
5de39247e6 Update help text for "acceptdiscountct" 2024-11-18 05:00:12 -08:00
Pablo Greco
22cc8dfe34 Accept by default discountct in liquidv1 2024-11-18 05:00:12 -08:00
Byron Hambly
60cf64e070
Merge pull request #1374 from psgreco/master-lbtc
Use LBTC instead of L-BTC in QT
2024-11-18 09:42:30 +02:00
Pablo Greco
7398cfae87 Use LBTC instead of L-BTC in QT 2024-11-04 05:54:22 -08:00
Byron Hambly
aa2420cd18
Merge pull request #1368 from apoelstra/2024-10--simplicity-activation
simplicity: define liquid testnet activation parameters
2024-10-08 17:16:01 +02:00
Andrew Poelstra
626e3aeafb
test: add functional simplicity activation test 2024-10-08 14:41:40 +00:00
Andrew Poelstra
57ab101352
simplicity: copy activation threshold/period from taproot
Copy the parameters for mainnet because they seem to have worked fine
for Taproot and are therefore a good starting point for Simplicity.
Copy them for regtest so that we can also copy the functional test for
activation, without needing to change a whole bunch of numbers.
2024-10-08 14:41:40 +00:00
Andrew Poelstra
2532c4a6c4
rpc: add simplicity to getdeploymentinfo 2024-10-08 14:41:39 +00:00
Andrew Poelstra
3621e7adc0
liquid testnet: enable simplicity at all times
This will effectively activate Simplicity as soon as the sole Liquid
Testnet signer is updated.
2024-10-08 14:41:39 +00:00
Andrew Poelstra
850b82095c
disable simplicity on regtest
We want to test Simplicity activation using evbparams.
2024-10-08 14:41:39 +00:00
Andrew Poelstra
2f2f3aac1e
link: add simplicity to bitcoin-chainstate binary 2024-10-08 13:03:02 +00:00
merge-script
2534141e19
Merge ElementsProject/elements#1219: Simplicity
508836028e Asset tests: Check script error (Christian Lewe)
4ca2411795 Asset tests: Parse Elements script errors (Russell O'Connor)
afee926dca Simplicity Functional Tests. (Russell O'Connor)
bcd508f409 Add Simplicity Deployment structure (Russell O'Connor)
1698454c2a Add Simplicity verification (Russell O'Connor)
96fb8f5d15 Store hash_genesis_block in PrecomputedTransactionData. (Russell O'Connor)
50916cf108 simplicity: enable coverage in configure.ac (Byron Hambly)
6c6925322c Add MSVC build configuration for libelementssimplicity (Russell O'Connor)
28553fdf67 Add Simplicity to the build system. (Russell O'Connor)
d5ad21b8a0 Lint simplicity subtree (Russell O'Connor)
f502c24196 Squashed 'src/simplicity/' content from commit 86ac0f92c4 (Russell O'Connor)
5224c1abbb Exclude simplicity directory (Russell O'Connor)
52b92b8213 Cherry-pick <https://github.com/bitcoin/bitcoin/pull/27122> (Russell O'Connor)

Pull request description:

  Tasks needed to pass CI:

  - [x] For Mingw32, remove pthread dependency from Simplicity (upstream).
  - [x] Merge (upcoming) libsecp256k1 release into Simplicity (upstream).

  Tasks needed for public signet:
  - [x] Add weight requirements for jets and combinantors (upstream).
  - [x] Maximum memory allocation (upstream).
  - [x] Other missing anti-DOS protection (upstream)?

  Tasks needed for testing.
  - [ ] Ensure that the fuzzer covers `libelementssimplicity`.

  Before merging:
  - [ ] Rebase on master.

ACKs for top commit:
  delta1:
    utACK 508836028e
  apoelstra:
    utACK 508836028e

Tree-SHA512: c1f77c6133306d4d88fbc79aa86764b751497b75ec2884241f7d4fe946bbe6a13f3469cd586c44b4c1640fe2cb4c12299cc9998742d49aea5658a1893c0a6a68
2024-10-07 19:26:59 +00:00
Christian Lewe
508836028e Asset tests: Check script error
Compare the expected script error, parsed from JSON, with the actual
error that VerifyScript returns. If the JSON does not include an
expected error, then skip this check.
2024-10-07 14:39:10 -04:00
Russell O'Connor
4ca2411795 Asset tests: Parse Elements script errors
Take the existing function to parse script errors and extend it to parse
Elements errors. SCRIPT_ERR_ERROR_COUNT is not included because it is a
pseudo error.
2024-10-07 14:39:10 -04:00
Russell O'Connor
afee926dca Simplicity Functional Tests. 2024-10-07 14:39:10 -04:00
Russell O'Connor
bcd508f409 Add Simplicity Deployment structure 2024-10-07 14:39:10 -04:00
Russell O'Connor
1698454c2a Add Simplicity verification
Unactivated.
2024-10-07 14:39:09 -04:00
Russell O'Connor
96fb8f5d15 Store hash_genesis_block in PrecomputedTransactionData.
This will be used by Simplicity.
2024-10-07 14:39:09 -04:00
Byron Hambly
50916cf108 simplicity: enable coverage in configure.ac
also filters src/simplicity/secp256k1 from the coverage results
2024-10-07 14:39:09 -04:00
Russell O'Connor
6c6925322c Add MSVC build configuration for libelementssimplicity 2024-10-07 14:39:09 -04:00
Russell O'Connor
28553fdf67 Add Simplicity to the build system. 2024-10-07 14:39:09 -04:00
Russell O'Connor
d5ad21b8a0 Lint simplicity subtree 2024-10-07 14:39:09 -04:00
Russell O'Connor
f502c24196 Squashed 'src/simplicity/' content from commit 86ac0f92c4
git-subtree-dir: src/simplicity
git-subtree-split: 86ac0f92c4b2b6d694dca85dce3b6909aed25894
2024-10-07 14:38:29 -04:00
Russell O'Connor
8760cdd7be Merge commit 'f502c24196' as 'src/simplicity' 2024-10-07 14:38:29 -04:00
Russell O'Connor
5224c1abbb Exclude simplicity directory 2024-10-07 14:38:19 -04:00
Russell O'Connor
52b92b8213 Cherry-pick <https://github.com/bitcoin/bitcoin/pull/27122>
Simplicity needs this fix.
2024-10-07 14:38:13 -04:00
Pablo Greco
fbc01d56d7
Merge pull request #1366 from delta1/discountweight
discount: fix weight calculation
2024-09-25 09:29:08 -07:00
Byron Hambly
09c5068ab1
discount: fix weight calculation
Thanks to Jon Griffiths for picking up that the amount and nonce discount
should be multiplied by the witness scaling factor as they form part of
the base transaction.
2024-09-25 15:18:38 +02:00
Byron Hambly
d0f714638a
feat: add discountweight to TxToUniv 2024-09-20 14:39:13 +02:00
Pablo Greco
99ca072a94
Merge pull request #1362 from delta1/ct-discount-package
fix: discountct package mining
2024-09-09 09:40:43 -07:00