Commit graph

274 commits

Author SHA1 Message Date
ivanlele
3b9eb6edd7
Merge f07a533dfc into merged_master (Bitcoin PR bitcoin/bitcoin#24214) 2026-04-02 10:09:02 +00:00
Tom Trevethan
59a761bf56 Merge 48c20dbd86 into merged_master (Bitcoin PR bitcoin/bitcoin#30794) 2026-03-26 22:15:08 +00:00
ivanlele
cd6ec40d0f
Merge 2aff9a36c3 into merged_master (Bitcoin PR bitcoin/bitcoin#30352) 2026-03-11 09:41:57 +00:00
ikripaka
17631653e2
Merge 5ee6b76c69 into merged_master (Bitcoin PR bitcoin/bitcoin#29325) 2026-02-26 20:15:02 +00:00
Byron Hambly
93159ee063
Merge e360a967b6 into merged_master (Elements PR #1518) 2026-02-11 14:55:53 +02:00
Russell O'Connor
6c7788adf3 Avoid Simplicity header dependency propogation
The problem with including <simplicity/elements/env.h> in interpreter.h is that
now everyone who needs to include interpreter.h also needs access to
Simplicity's header files too.

This commit breaks that dependency chain by using forward declarations.  It will
pay signifigant dividends when elements switches to CMake.
2025-12-24 09:50:30 -05:00
Byron Hambly
a801fa32e9
interpreter: add macos compat for htole32 and htole64 2025-12-11 15:47:12 +02:00
Byron Hambly
b489a41d50
ci: fuzz fixes 2025-12-08 15:01:09 +02:00
Byron Hambly
26b9abc2f2
Merge b5a271334c into merged_master (Bitcoin PR bitcoin/bitcoin#28922) 2025-11-11 08:56:23 +02:00
Byron Hambly
d46449ab86
Merge 950af7c876 into merged_master (Bitcoin PR bitcoin/bitcoin#28878) 2025-11-10 14:35:23 +02:00
Byron Hambly
8cf8bd5564
Merge 108462139b into merged_master (Bitcoin PR bitcoin/bitcoin#28438) 2025-11-10 13:45:17 +02:00
Byron Hambly
e826a411ec
Merge 48b8910d12 into merged_master (Bitcoin PR bitcoin/bitcoin#28508)
GetHash now manually implemented for CBlockHeader. SER_GETHASH removed,
so CProof now always serializes `solution`. CBlockHeader::GetHash copies
from Serialize, but only includes `challenge` of CProof, and no signblock witness

This needs to be tested with liquidv1 chain
2025-08-05 14:12:48 +02:00
Byron Hambly
833114cc24 Merge b379bb2465 into merged_master (Elements PR #1459) 2025-07-18 11:45:30 +02:00
Russell O'Connor
0a0a69f315 Update Simplicity integeration
This Simplicity update has
- renamed a few types
- moved some files around
- added a minCost parameter, currently set to 0
- added a new error code
2025-06-24 11:38:08 -04:00
Byron Hambly
833eaacade
ci: use 24.04 instead of lunar for tidy and fuzz ci 2025-04-29 13:49:55 +02:00
Byron Hambly
82f8b9e1ff Merge 0eb2ea5cbe into merged_master (Elements PR #1425) 2025-04-15 11:19:51 +02:00
Byron Hambly
44e0c0fe10 Merge 58da1619be into merged_master (Bitcoin PR bitcoin/bitcoin#25877) 2025-04-03 21:23:59 +02:00
Tom Trevethan
694c51a39f Merge 3212d104f4 into merged_master (Bitcoin PR bitcoin/bitcoin#23829) 2025-04-01 15:23:27 +00:00
Byron Hambly
b4405ba453 Merge e9262ea32a into merged_master (Bitcoin PR bitcoin/bitcoin#26750) 2025-03-31 16:37:52 +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
301f7c9225
Merge 368010a308 into merged_master (Elements PR #1390) 2025-02-11 15:06:18 +02: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
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
Byron Hambly
a6f8dc6a86
tidy: fixes for clang tidy ci job 2024-12-04 14:16:45 +02:00
Byron Hambly
d78604da4c Merge 2534141e19 into merged_master (Elements PR ElementsProject/elements#1219) 2024-12-02 08:51:39 +02:00
Byron Hambly
28d35f619e Merge 510ac41eac into merged_master (Bitcoin PR bitcoin/bitcoin#25331) 2024-10-18 13:14:02 +02: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
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
MarcoFalke
bbbbaa0d9a
Fix unsigned integer overflows in interpreter 2024-10-01 10:45:44 +02:00
James Dorfman
bcc0b07392 Merge cacbdbaa95 into merged_master (Bitcoin PR bitcoin/bitcoin#25132) 2024-09-06 06:39:01 +00:00
Simon
bc52cda1f3 fix use int32_t instead of int type for risczero compile with (-march=rv32i, -mabi=ilp32) 2024-09-03 09:52:02 +08:00
Greg Sanders
b60aaf8b23 policy: make anchor spend standard
Only standard when non-nested.
2024-07-30 14:06:58 -04:00
James Dorfman
94e058d3b7 Merge d492dc1cda into merged_master (Bitcoin PR bitcoin/bitcoin#24147) 2024-07-08 17:49:09 +00:00
James Dorfman
b3a377c2d0 Merge 0da559e02e into merged_master (Bitcoin PR bitcoin/bitcoin#24661) 2024-07-08 15:17:32 +00:00
Ava Chow
429ec1aaaa refactor: Rename CTransaction::nVersion to version
In order to ensure that the change of nVersion to a uint32_t in the
previous commit has no effect, rename nVersion to version in this commit
so that reviewers can easily spot if a spot was missed or if there is a
check somewhere whose semantics have changed.
2024-06-07 13:55:23 -04:00
Ava Chow
27e70f1f5b consensus: Store transaction nVersion as uint32_t
Given that the use of a transaction's nVersion is always as an unsigned
int, it doesn't make sense to store it as signed and then cast it to
unsigned.
2024-06-07 12:40:21 -04:00
Anthony Towns
1410d300df serialize: Drop useless version param from GetSerializeSize() 2023-11-16 11:14:13 +10:00
Byron Hambly
a992ccaac2 Merge 196b459920 into merged_master (Bitcoin PR bitcoin/bitcoin#23438) 2023-06-29 08:37:35 +00:00
Byron Hambly
23ffcd4fc8 Merge bd482b3ffe into merged_master (Bitcoin PR bitcoin/bitcoin#24105) 2023-06-21 11:44:35 +00:00
Byron Hambly
47626b5a64 Merge 623745ca74 into merged_master (Bitcoin PR bitcoin/bitcoin#23912) 2023-06-14 15:44:11 +00:00
James Dorfman
72a90148c8 Merge 8b1de78577 into merged_master (Bitcoin PR bitcoin/bitcoin#23413) 2023-06-01 18:51:42 +00:00
Byron Hambly
1beaa601b4 Merge 5ccab7187b into merged_master (Bitcoin PR bitcoin/bitcoin#23394)
- commented out some script tests that need to be fixed
 - commented out feature_taproot.py since it needs significant updates
2023-05-26 09:14:20 +00:00
Byron Hambly
c70b9b1b43 Merge a93e7a4422 into merged_master (Bitcoin PR bitcoin/bitcoin#22748) 2023-04-10 13:22:14 +00:00
James Dorfman
91eba3427c Merge a3791da0e8 into merged_master (Bitcoin PR bitcoin/bitcoin#22428) 2023-03-21 16:20:59 +00:00
Pieter Wuille
95f12de925 BIP341 txdata cannot be precomputed without spent outputs 2023-02-17 16:29:49 -05:00
Andrew Chow
58da1619be
Merge bitcoin/bitcoin#25877: refactor: Do not use CScript for tapleaf scripts until the tapleaf version is known
dee89438b8 Abstract out ComputeTapbranchHash (Russell O'Connor)
8e3fc99427 Do not use CScript for tapleaf scripts until the tapleaf version is known (Russell O'Connor)

Pull request description:

  While BIP-341 calls the contents of tapleaf a "script", only in the case that the tapleaf version is `0xc0` is this script known to be a tapscript.  Otherwise the tapleaf "script" is simply an uninterpreted string of bytes.

  This PR corrects the issue where the type `CScript` is used prior to the tapleaf version being known to be a tapscript.  This prevents `CScript` methods from erroneously being called on non-tapscript data.

  A second commit abstracts out the TapBranch hash computation in the same manner that the TapLeaf computation is already abstracted.  These two abstractions ensure that the TapLeaf and TapBranch tagged hashes are always constructed properly.

ACKs for top commit:
  ajtowns:
    ACK dee89438b8
  instagibbs:
    ACK dee89438b8
  achow101:
    ACK dee89438b8
  sipa:
    ACK dee89438b8
  aureleoules:
    reACK dee89438b8 - I verified that there is no behavior change.

Tree-SHA512: 4a1d37f3e9a1890e7f5eadcf65562688cc451389581fe6e2da0feb2368708edacdd95392578d8afff05270d88fc61dce732d83d1063d84d12cf47b5f4633ec7e
2023-01-19 17:51:21 -05:00
Pasta
f2fc03ec85
refactor: use braced init for integer constants instead of c style casts 2023-01-03 19:31:29 -06:00
Hennadii Stepanov
306ccd4927
scripted-diff: Bump copyright headers
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./
-END VERIFY SCRIPT-

Commits of previous years:
- 2021: f47dda2c58
- 2020: fa0074e2d8
- 2019: aaaaad6ac9
2022-12-24 23:49:50 +00:00
Russell O'Connor
dee89438b8 Abstract out ComputeTapbranchHash 2022-11-21 12:38:53 -05:00