Commit graph

1281 commits

Author SHA1 Message Date
merge-script
720238c41f
Merge ElementsProject/elements#1511: Introduce per-txin sighash midstate cache for legacy/p2sh/segwitv0 scripts
eb64d2486f Merge bitcoin/bitcoin#32473: Introduce per-txin sighash midstate cache for legacy/p2sh/segwitv0 scripts (merge-script)

Pull request description:

  Backport of https://github.com/bitcoin/bitcoin/pull/32473

  Additional cache index bit added for sighash combination with `SIGHASH_RANGEPROOF`

ACKs for top commit:
  delta1:
    ACK eb64d2486f

Tree-SHA512: 94014e726ff16473809672f3e01a8e4d11c4abd38b3ae3ae64b8b9ae61be2e3c246157dca5a3a3afc4b85cc8ec69e23181af8f11c36e0b43cfac2dcb3e2e8d70
2025-11-27 16:33:38 +02:00
merge-script
6664587c2f
Merge ElementsProject/elements#1515: v30 patches
b7ee5fb8a5 Merge bitcoin/bitcoin#33001: test: Do not pass tests on unhandled exceptions (merge-script)
1ac1f75ec0 Merge bitcoin/bitcoin#32765: test: Fix list index out of range error in feature_bip68_sequence.py (merge-script)
0f06cebc61 Merge bitcoin/bitcoin#33395: net: do not apply whitelist permissions to onion inbounds (merge-script)
53a5bd0790 Merge bitcoin/bitcoin#33296: net: check for empty header before calling FillBlock (Ava Chow)

Pull request description:

  Cherry-picks of bugfix patches included in the Bitcoin v30 release.

  net: check for empty header before calling FillBlock
  https://github.com/bitcoin/bitcoin/pull/33296

  net: do not apply whitelist permissions to onion inbounds
  https://github.com/bitcoin/bitcoin/pull/33395

  test: Fix list index out of range error in feature_bip68_sequence.py
  https://github.com/bitcoin/bitcoin/pull/32765

  test: Do not pass tests on unhandled exceptions
  https://github.com/bitcoin/bitcoin/pull/33001

ACKs for top commit:
  delta1:
    ACK b7ee5fb8a5

Tree-SHA512: 7fee367e549a0a5f8b2461be317dc8469feb0f907993f86638e9ca8ca333f9643fa90ecec4dd4edeba2d7e9098aa953f047dbaa0d35a9fc75a68fb62391c7616
2025-11-27 12:56:42 +02:00
Ava Chow
4b301666ff Merge bitcoin/bitcoin#33050: net, validation: don't punish peers for consensus-invalid txs
876dbdfb4702410dfd4037614dc9298a0c09c63e tests: drop expect_disconnect behaviour for tx relay (Anthony Towns)
b29ae9efdfeeff774e32ee433ce67d8ed8ecd49f validation: only check input scripts once (Anthony Towns)
266dd0e10d08c0bfde63205db15d6c210a021b90 net_processing: drop MaybePunishNodeForTx (Anthony Towns)

Pull request description:

  Because we do not discourage nodes for transactions we consider non-standard, we don't get any DoS protection from this check in adversarial scenarios, so remove the check entirely both to simplify the code and reduce the risk of splitting the network due to changes in tx relay policy.

  Then, because we no longer make use of the distinction between consensus and standardness failures during script validation, don't re-validate each script with only-consensus rules, reducing the cost to us of transactions that we won't relay.

ACKs for top commit:
  achow101:
    ACK 876dbdfb4702410dfd4037614dc9298a0c09c63e
  darosior:
    re-ACK 876dbdfb4702410dfd4037614dc9298a0c09c63e
  sipa:
    re-ACK 876dbdfb4702410dfd4037614dc9298a0c09c63e
  glozow:
    ACK 876dbdfb4702410dfd4037614dc9298a0c09c63e

Tree-SHA512: 8bb0395766dde54fc48f7077b80b88e35581aa6e3054d6d65735965147abefffa7348f0850bb3d46f6c2541fd384ecd40a00a57fa653adabff8a35582e2d1811
2025-11-26 10:22:33 +00:00
merge-script
b7ee5fb8a5 Merge bitcoin/bitcoin#33001: test: Do not pass tests on unhandled exceptions
faa3e684118bffa7a98cf76eeeb59243219df900 test: Log KeyboardInterrupt as exception (MarcoFalke)
fa30b34026f76a5b8af997152fced2d281782e0d test: Do not pass tests on unhandled exceptions (MarcoFalke)

Pull request description:

  Currently the functional tests are problematic, because they pass, even if they encounter an unhanded exception.

  Fix this by handling all exceptions: Catch `BaseException` as fallback and mark it as failure.

  Can be tested via:

  ```diff
  diff --git a/test/functional/wallet_disable.py b/test/functional/wallet_disable.py
  index da6e5d408f..ecc41fb041 100755
  --- a/test/functional/wallet_disable.py
  +++ b/test/functional/wallet_disable.py
  @@ -19,6 +19,7 @@ class DisableWalletTest (BitcoinTestFramework):
           self.wallet_names = []

       def run_test (self):
  +        import sys;sys.exit("fatal error")
           # Make sure wallet is really disabled
           assert_raises_rpc_error(-32601, 'Method not found', self.nodes[0].getwalletinfo)
           x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
  ```

  Previously, the test would pass. With this patch, it would fail.

ACKs for top commit:
  enirox001:
    Looks good to me—ACK faa3e68
  stickies-v:
    re-ACK faa3e684118bffa7a98cf76eeeb59243219df900
  pablomartin4btc:
    tACK faa3e684118bffa7a98cf76eeeb59243219df900

Tree-SHA512: 11ecd5201982e2c776e48d98834b17c15a415306a95524bc702daeba20a316aac797748e9592be8db575597804f149ee7ef104416037cc9e5891758625810e2d
2025-11-25 16:25:39 +00:00
merge-script
eb64d2486f Merge bitcoin/bitcoin#32473: Introduce per-txin sighash midstate cache for legacy/p2sh/segwitv0 scripts
83950275eddacac56c58a7a3648ed435a5593328 qa: unit test sighash caching (Antoine Poinsot)
b221aa80a081579b8d3b460e3403f7ac0daa7139 qa: simple differential fuzzing for sighash with/without caching (Antoine Poinsot)
92af9f74d74e76681f7d98f293eab226972137b4 script: (optimization) introduce sighash midstate caching (Pieter Wuille)
8f3ddb0bccebc930836b4a6745a7cf29b41eb302 script: (refactor) prepare for introducing sighash midstate cache (Pieter Wuille)
9014d4016ad9351cb59b587541895e55f5d589cc tests: add sighash caching tests to feature_taproot (Pieter Wuille)

Pull request description:

  This introduces a per-txin cache for sighash midstate computation to the script interpreter for legacy (bare), P2SH, P2WSH, and (as collateral effect, but not actually useful) P2WPKH. This reduces the impact of certain types of quadratic hashing attacks that use standard transactions. It is not known to improve the situation for attacks involving non-standard transaction attacks.

  The cache works by remembering for each of the 6 sighash modes a `(scriptCode, midstate)` tuple, which gives a midstate `CSHA256` object right before the appending of the sighash type itself (to permit all 256, rather than just the 6 ones that match the modes). The midstate is only reused if the `scriptCode` matches. This works because - within a single input - only the sighash type and the `scriptCode` affect the actual sighash used.

  The PR implements two different approaches:
  * The initial commits introduce the caching effect always, for both consensus and relay relation validation. Despite being primarily intended for improving the situation for standard transactions only, I chose this approach as the code paths are already largely common between the two, and this approach I believe involves fewer code changes than a more targetted approach, and furthermore, it should not hurt (it may even help common multisig cases slightly).
  * The final commit changes the behavior to only using the cache for non-consensus script validation. I'm open to feedback about whether adding this commit is worth it.

  Functional tests are included that construct contrived cases with many sighash types (standard and non-standard ones) and `OP_CODESEPARATOR`s in all script types (including P2TR, which isn't modified by this PR).

ACKs for top commit:
  achow101:
    ACK 83950275eddacac56c58a7a3648ed435a5593328
  dergoegge:
    Code review ACK 83950275eddacac56c58a7a3648ed435a5593328
  darosior:
    re-ACK 83950275eddacac56c58a7a3648ed435a5593328

Tree-SHA512: 65ae8635429a4d563b19969bac8128038ac2cbe01d9c9946abd4cac3c0780974d1e8b9aae9bb83f414e5d247a59f4a18fef5b37d93ad59ed41b6f11c3fe05af4
2025-11-21 15:55:19 +00:00
Russell O'Connor
bcd508f409 Add Simplicity Deployment structure 2024-10-07 14:39:10 -04:00
James Dorfman
bb30fa363d Fix feature_taproot functional test which has been failing since
the merge of bitcoin/bitcoin#23394 in 1beaa601b4

Co-authored-by: Sanket Kanjalkar <sanket1729@gmail.com>
2023-08-11 16:39:14 +00:00
James Dorfman
1c5469b60c
Re-activate assertion which was disabled in the merge of bitcoin/bitcoin#23371 in 2110cca
A subsequent commit appears to have fixed that assertion. It works now.
2023-08-01 10:28:20 +02:00
Byron Hambly
7a7253639a Merge 267917f563 into merged_master (Bitcoin PR bitcoin/bitcoin#23304) 2023-07-03 10:06:51 +00:00
Byron Hambly
1223ba95ca Merge f1ce67f09f into merged_master (Bitcoin PR bitcoin/bitcoin#19013) 2023-07-02 15:42:51 +00:00
Byron Hambly
d2ee0b0b61 Merge 7164e00e1b into merged_master (Bitcoin PR bitcoin/bitcoin#24324) 2023-06-30 17:34:42 +00:00
Byron Hambly
71acfa3da7 Merge 6b8e4977b8 into merged_master (Bitcoin PR bitcoin/bitcoin#24342) 2023-06-30 17:03:39 +00:00
Byron Hambly
900cf5f60d Merge eca694a4e7 into merged_master (Bitcoin PR bitcoin/bitcoin#24239) 2023-06-30 10:01:50 +00:00
Byron Hambly
687f3b8fcd Merge 8f137e69ca into merged_master (Bitcoin PR bitcoin/bitcoin#24192) 2023-06-29 14:39:34 +00:00
Byron Hambly
5931d7d47c Merge d4e92d8436 into merged_master (Bitcoin PR bitcoin/bitcoin#23508) 2023-06-29 11:46:17 +00:00
Byron Hambly
c53eb39edf Merge 807169e10b into merged_master (Bitcoin PR bitcoin/bitcoin#24035) 2023-06-20 09:57:58 +00:00
Byron Hambly
37a2061f06 Merge d69af93223 into merged_master (Bitcoin PR bitcoin/bitcoin#23737) 2023-06-14 17:43:17 +00:00
Byron Hambly
42605e228f Merge d3582f2d3b into merged_master (Bitcoin PR bitcoin/bitcoin#23866)
I had to make some python changes for the rpc_scantxoutset.py which are
pretty hacky but get the job done.
2023-06-14 13:08:29 +00:00
Byron Hambly
54c9ee347d Merge 9635760ce8 into merged_master (Bitcoin PR bitcoin/bitcoin#22777) 2023-06-13 10:06:36 +00:00
Byron Hambly
70c69d94f6 Merge 9f7661c0c4 into merged_master (Bitcoin PR bitcoin/bitcoin#19499) 2023-06-12 13:11:30 +00:00
Byron Hambly
32bcb2de54 Merge 09e60df115 into merged_master (Bitcoin PR bitcoin/bitcoin#23723) 2023-06-06 11:56:36 +00:00
Byron Hambly
ca596d446a Merge 529ed33362 into merged_master (Bitcoin PR bitcoin/bitcoin#23715) 2023-06-06 10:18:36 +00:00
Byron Hambly
1413ea774b Merge 68ca8677e0 into merged_master (Bitcoin PR bitcoin/bitcoin#23716) 2023-06-06 10:11:17 +00:00
Byron Hambly
50957f3e4b Merge 26a1147ce5 into merged_master (Bitcoin PR bitcoin/bitcoin#23636) 2023-06-01 12:04:07 +00:00
James Dorfman
b7ee0e8b7f Merge aef8c7cf82 into merged_master (Bitcoin PR bitcoin/bitcoin#23289) 2023-06-01 05:52:23 +00:00
James Dorfman
5aadbb7a9d Merge 63c0d0e937 into merged_master (Bitcoin PR bitcoin/bitcoin#21327)
I commented out a few new lines at the bottom of test/functional/p2p_ibd_txrelay.py
It tests that nodes process certain transactions, after IBD. These new assertions
from upstream are failing, but it may be because our IBD / tx sharing logic is different.

We should revisit this.
2023-06-01 05:27:06 +00:00
Byron Hambly
6f1067c437 Merge a574f4ad39 into merged_master (Bitcoin PR bitcoin/bitcoin#23392) 2023-05-31 11:42:45 +00:00
Byron Hambly
eb7b15c660 Merge 4f8b1f8759 into merged_master (Bitcoin PR bitcoin/bitcoin#23608) 2023-05-31 10:24:48 +00:00
Byron Hambly
bd68371fb6 Merge ffdab41f94 into merged_master (Bitcoin PR bitcoin/bitcoin#23474) 2023-05-26 10:32:04 +00:00
Byron Hambly
1ca7d86b81 Merge 41e6909c07 into merged_master (Bitcoin PR bitcoin/bitcoin#23516) 2023-05-26 09:32:13 +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
2a6a83b69b Merge fa2303989b into merged_master (Bitcoin PR bitcoin/bitcoin#23515) 2023-05-25 08:43:30 +00:00
Byron Hambly
2110cca82e Merge 2539980e1d into merged_master (Bitcoin PR bitcoin/bitcoin#23371)
- added a few fixme notes where necessary
- for some reason the given internal_key from upstream has a different
  parity, causing verifytaprootcommitment to fail... which is why the
  internal_key has been changed
- fixed up the rpc_blockchain test
2023-05-24 10:25:00 +00:00
Byron Hambly
af3fe60b69 Merge 94db963de5 into merged_master (Bitcoin PR bitcoin/bitcoin#23300) 2023-05-17 13:44:36 +00:00
Byron Hambly
14a31b99b1 Merge 24abd8312e into merged_master (Bitcoin PR bitcoin/bitcoin#22949) 2023-05-17 08:32:34 +00:00
Byron Hambly
18c7997de0 Merge 8bac3b1096 into merged_master (Bitcoin PR bitcoin/bitcoin#23375) 2023-05-16 12:39:37 +00:00
Byron Hambly
7e120e5e97 Merge ab25ef8c7f into merged_master (Bitcoin PR bitcoin/bitcoin#23305) 2023-05-16 10:18:11 +00:00
Byron Hambly
a27835cb7d Merge 548ad5ef7f into merged_master (Bitcoin PR bitcoin/bitcoin#23281) 2023-05-14 09:12:26 +00:00
James Dorfman
677e269c5c Merge 1435161f64 into merged_master (Bitcoin PR bitcoin/bitcoin#23316) 2023-05-14 01:36:16 +00:00
Byron Hambly
f80332fee5 Merge 2e82af46e2 into merged_master (Bitcoin PR bitcoin/bitcoin#23207) 2023-05-12 09:55:10 +00:00
Byron Hambly
ee8f77f5b2 Merge 991753e4d5 into merged_master (Bitcoin PR bitcoin/bitcoin#23118) 2023-05-10 11:36:56 +00:00
Byron Hambly
1c0f4948ec Merge b4437d7dfe into merged_master (Bitcoin PR bitcoin/bitcoin#23210) 2023-05-10 11:04:50 +00:00
Byron Hambly
15ada59eac Merge bb8550b788 into merged_master (Bitcoin PR bitcoin/bitcoin#23209) 2023-05-09 13:33:24 +00:00
Byron Hambly
cca3f919f8 Merge 9e530c6352 into merged_master (Bitcoin PR bitcoin/bitcoin#20487) 2023-05-09 11:22:04 +00:00
Byron Hambly
cc16227789 Merge 35a31d5f7e into merged_master (Bitcoin PR bitcoin/bitcoin#23136) 2023-04-28 14:14:21 +00:00
Byron Hambly
ceeb3783ee Merge 1cf7fb9fd6 into merged_master (Bitcoin PR bitcoin/bitcoin#23104) 2023-04-28 12:33:54 +00:00
James Dorfman
b582aaadb4 Merge 33e31f8df9 into merged_master (Bitcoin PR bitcoin/bitcoin#23079) 2023-04-28 10:07:15 +00:00
James Dorfman
203ee3f248 Merge 7d4ea7c7ef into merged_master (Bitcoin PR bitcoin/bitcoin#23120) 2023-04-27 20:08:05 +00:00
Byron Hambly
10b5206170 Merge 58c25bdcea into merged_master (Bitcoin PR bitcoin/bitcoin#23092) 2023-04-24 10:32:18 +00:00
Byron Hambly
ae797e1b5a Merge 442e32e117 into merged_master (Bitcoin PR bitcoin/bitcoin#22817) 2023-04-24 09:07:43 +00:00