Commit graph

115 commits

Author SHA1 Message Date
ikripaka
9c0f3edb5a
Merge 3867d2421a into merged_master (Bitcoin PR bitcoin/bitcoin#31112) 2026-04-08 10:07:51 +00:00
Tom Trevethan
c8515145fa Merge df241970a3 into merged_master (Bitcoin PR bitcoin/bitcoin#30554) 2026-03-11 00:30:13 +00:00
ivanlele
aa41e29f97
Merge 3a29ff5dea into merged_master (Bitcoin PR bitcoin/bitcoin#30463) 2026-03-09 16:54:19 +00:00
ikripaka
17631653e2
Merge 5ee6b76c69 into merged_master (Bitcoin PR bitcoin/bitcoin#29325) 2026-02-26 20:15:02 +00:00
ivanlele
273d7e2364
Merge f9486de6a9 into merged_master (Bitcoin PR bitcoin/bitcoin#30029) 2026-02-19 14:52:48 +00:00
Byron Hambly
fcf66c57af
Merge 962ea5c525 into merged_master (Bitcoin PR bitcoin/bitcoin#28374) 2025-11-06 09:52:16 +02:00
Byron Hambly
cc4cd3f1dd
Merge f028470654 into merged_master (Bitcoin PR bitcoin/bitcoin#28727) 2025-11-05 15:56:50 +02:00
Byron Hambly
21c91f16cc Merge 626d346469 into merged_master (Bitcoin PR bitcoin/bitcoin#26222) 2025-06-30 13:48:36 +02:00
Byron Hambly
9b92a563d4 Merge 8847497161 into merged_master (Bitcoin PR bitcoin/bitcoin#27631) 2025-06-28 09:20:57 +02:00
Byron Hambly
ccd960b0f9 Merge 7d65e3372f into merged_master (Bitcoin PR bitcoin/bitcoin#27733) 2025-06-27 21:52:08 +02:00
Byron Hambly
6431ebbbd2 Merge 49b87bfe7e into merged_master (Bitcoin PR bitcoin/bitcoin#27389) 2025-04-12 12:30:40 +02:00
Tom Trevethan
9b8a5eacea Merge 9f6ef0c156 into merged_master (Bitcoin PR bitcoin/bitcoin#27143) 2025-04-08 13:40:24 +00:00
Byron Hambly
b4405ba453 Merge e9262ea32a into merged_master (Bitcoin PR bitcoin/bitcoin#26750) 2025-03-31 16:37:52 +02:00
Byron Hambly
41f380c8f0 Merge bd13d6b369 into merged_master (Bitcoin PR bitcoin/bitcoin#26656) 2025-03-31 10:06:08 +02:00
Byron Hambly
0b0d5d214e Merge 8597260872 into merged_master (Bitcoin PR bitcoin/bitcoin#26480) 2025-03-04 10:42:21 +02:00
Byron Hambly
f0478dd601 Merge 38d06e1561 into merged_master (Bitcoin PR bitcoin/bitcoin#26383) 2025-03-03 13:44:12 +02:00
Byron Hambly
ca0a68b350
Merge UP TO 551c8e9526 into merged_master (UP TO bitcoin/bitcoin#26349)
Includes FIXMEs for a few functional tests
2025-02-05 09:50:17 +02:00
Pieter Wuille
146a3d5426 [validation] Make script error messages uniform for parallel/single validation
This makes the debug output mostly the same for -par=1 and parallel validation runs. Of course,
parallel validation is non-deterministic in what error it may encounter first if there are
multiple issues. Also, the way certain script-related and non-script-related checks are
performed differs between the two modes still, which may result in discrepancies.
2024-12-02 16:25:17 -05:00
Byron Hambly
d78604da4c Merge 2534141e19 into merged_master (Elements PR ElementsProject/elements#1219) 2024-12-02 08:51:39 +02:00
Byron Hambly
f17a9fd322 Merge 2bca32b7c3 into merged_master (Bitcoin PR bitcoin/bitcoin#24799) 2024-10-24 14:55:38 +02:00
Byron Hambly
6db4ca0b66 Merge d67f89bd95 into merged_master (Bitcoin PR bitcoin/bitcoin#25625)
Commented out the change to the psbt test with a FIXME, due to
differences between PSBT/PSET
2024-10-18 12:05:54 +02: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
James Dorfman
f810d6d444 Merge 47b8256da8 into merged_master (Bitcoin PR bitcoin/bitcoin#24937) 2024-08-06 19:57:11 +00:00
MarcoFalke
fadf621825
test: Make leaf_script mandatory when scriptpath is set in TaprootSignatureMsg
This removes the default value, because there should not be a use-case
to fall back to a an empty leaf_script by default. (If there was, it
could trivially be added back)
2024-07-31 09:57:42 +02:00
Hennadii Stepanov
a0473442d1
scripted-diff: Add __file__ argument to BitcoinTestFramework.init()
-BEGIN VERIFY SCRIPT-
sed -i -e 's/\s*().main\s*()/(__file__).main()/' $(git ls-files test/functional/*.py)
sed -i -e 's/def __init__(self)/def __init__(self, test_file)/' test/functional/test_framework/test_framework.py
-END VERIFY SCRIPT-
2024-07-16 22:06:47 +01: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
ismaelsadeeq
af3c18169a [test]: remove duplicate WITNESS_SCALE_FACTOR 2024-05-03 10:30:50 +01:00
James Dorfman
087b2f13f4 Merge 7c08d81e11 into merged_master (Bitcoin PR bitcoin/bitcoin#23536) 2024-03-19 19:58:32 +00:00
Andrew Chow
962ea5c525
Merge bitcoin/bitcoin#28374: test: python cryptography required for BIP 324 functional tests
c534c08710 [test/crypto] Add FSChaCha20Poly1305 AEAD python implementation (stratospher)
c2a458f1c2 [test/crypto] Add FSChaCha20 python implementation (stratospher)
c4ea5f6288 [test/crypto] Add RFC 8439's ChaCha20Poly1305 AEAD (stratospher)
9fc6e0355e [test/crypto] Add Poly1305 python implementation (stratospher)
fec2ca6c9a [test/crypto] Use chacha20_block function in `data_to_num3072` (stratospher)
0cde60da3a [test/crypto] Add ChaCha20 python implementation (stratospher)
69d3f50ab6 [test/crypto] Add HMAC-based Key Derivation Function (HKDF) (stratospher)
08a4a56cbc [test] Move test framework crypto functions to crypto/ (stratospher)

Pull request description:

  split off from #24748 to keep commits related to cryptography and functional test framework changes separate.

  This PR adds python implementation and unit tests for HKDF, ChaCha20, Poly1305, ChaCha20Poly1305 AEAD, FSChaCha20 and FSChaCha20Poly1305 AEAD.

  They're based on cc177ab7bc/bip-0324/reference.py for easy review.

ACKs for top commit:
  sipa:
    utACK c534c08710
  achow101:
    ACK c534c08710
  theStack:
    re-ACK c534c08710

Tree-SHA512: 08a0a422d2937eadcf0edfede37e535e6bc4c2e4b192441bbf9bc26dd3f03fa3388effd22f0527c55af173933d0b50e5b2b3d36f2b62d0aca3098728ef06970e
2023-11-07 16:48:57 -05:00
ns-xvrn
fe3ac3700d test: replace random_bytes with randbytes #28720 2023-10-25 08:56:41 -04:00
stratospher
08a4a56cbc [test] Move test framework crypto functions to crypto/ 2023-09-10 23:16:39 +05:30
Byron Hambly
b59e244da3
lint: fix issues from lint-python.sh 2023-09-01 16:04:39 +02: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
Byron Hambly
8dbf577aaa Merge cfc10a5dd6 into merged_master (Elements PR #1232) 2023-07-03 13:48:57 +00:00
Pieter Wuille
1830dd8820 test: add secp256k1 module with FE (field element) and GE (group element) classes
These are primarily designed for ease of understanding, not performance.
2023-06-27 09:34:48 -04:00
Andrew Chow
8847497161
Merge bitcoin/bitcoin#27631: test: avoid sporadic MINIMALDATA failure in feature_taproot.py (fixes #27595)
54877253c8 test: avoid sporadic MINIMALDATA failure in feature_taproot.py (fixes #27595) (Sebastian Falbesoner)

Pull request description:

  The functional test feature_taproot.py fails in some rare cases on the execution of the following `"branched_codesep"` spending script (can be reproduced via `$ ./test/functional/feature_taproot.py --randomseed 9048710178866422833` on master / 137a98c5a2):

  9d85c03620/test/functional/feature_taproot.py (L741)

  The problem occurs if the first data-push (having random content with a random length in the range [0, 510]) has a length of 1 and the single byte has value of [1...16] or [-1]; in this case, the data-push is not minimally encoded by test framework's CScript class (i.e. doesn't use the special op-codes OP_1...OP_16 or OP_1NEGATE) and the script interpreter throws an SCRIPT_ERR_MINIMALDATA error:

  ```
  test_framework.authproxy.JSONRPCException: non-mandatory-script-verify-flag (Data push larger than necessary) (-26)
  ```

  Background: the functional test framework's CScript class translates passed bytes/bytearrays always to data pushes using OP_PUSHx/OP_PUSHDATA{1,2,4} op-codes (see `CScript.__coerce_instance(...)`). E.g. the expression `CScript(bytes([1]))` yields `bytes([OP_PUSH1, 1])` instead of the minimal-encoded `bytes([OP_1])`.

  Fix this by adapting the random-size range to [2,...], i.e. never pass byte-arrays below length two to be pushed.

  Closes #27595.

ACKs for top commit:
  instagibbs:
    ACK https://github.com/bitcoin/bitcoin/pull/27631/commits/54877253c807dac7a3720b2c3d1d989c410259a7
  sipa:
    utACK 54877253c8
  achow101:
    ACK 54877253c8

Tree-SHA512: 3ffad89b2c3985c20702242192e744c9b10188bff880efaf3c38424a00fa07bd4608d8c948678ff9cdbb4e1e5b06696c7f55407ee10bb05edbb3ee03aa599cdc
2023-06-23 18:54:06 -04:00
Byron Hambly
c53eb39edf Merge 807169e10b into merged_master (Bitcoin PR bitcoin/bitcoin#24035) 2023-06-20 09:57:58 +00:00
Sebastian Falbesoner
1a572ce7d6 test: refactor: introduce generate_keypair helper with WIF support
In functional tests it is a quite common scenario to generate fresh
elliptic curve keypairs, which is currently a bit cumbersome as it
involves multiple steps, e.g.:

    privkey = ECKey()
    privkey.generate()
    privkey_wif = bytes_to_wif(privkey.get_bytes())
    pubkey = privkey.get_pubkey().get_bytes()

Simplify this by providing a new `generate_keypair` helper function that
returns the private key either as `ECKey` object or as WIF-string
(depending on the boolean `wif` parameter) and the public key as
byte-string; these formats are what we mostly need (currently we don't
use `ECPubKey` objects from generated keypairs anywhere).

With this, most of the affected code blocks following the pattern above
can be replaced by one-liners, e.g.:

    privkey, pubkey = generate_keypair(wif=True)

Note that after this commit, the only direct uses of `ECKey` remain in
situations where we want to set the private key explicitly, e.g. in
MiniWallet (test/functional/test_framework/wallet.py) or the test for
the signet miner script (test/functional/tool_signet_miner.py).
2023-06-19 17:38:14 +02:00
Byron Hambly
5cbd44f1c8
test: re-enable and fix script assets test
Re-enables and fixes the script_assets_test by changing feature_taproot.py to include the genesis block hash when dumping the json tests.

Requires the json file from https://github.com/ElementsProject/qa-assets/pull/1

Co-authored-by: Andrew Poelstra <apoelstra@wpsoftware.net>
2023-06-05 16:43:06 +02:00
Sebastian Falbesoner
54877253c8 test: avoid sporadic MINIMALDATA failure in feature_taproot.py (fixes #27595)
The functional test feature_taproot.py fails in some rare cases on the
execution of the `"branched_codesep"` spending script. The problem
occurs if the first data-push (having random content with a random
length in the range [0, 510]) has a length of 1 and the single byte has
value of [1...16] or [-1]; in this case, the data-push is not minimally
encoded by test framework's CScript class (i.e. doesn't use the special
op-codes OP_1...OP_16 or OP_1NEGATE) and the script interpreter throws
an SCRIPT_ERR_MINIMALDATA error:

```
test_framework.authproxy.JSONRPCException: non-mandatory-script-verify-flag (Data push larger than necessary) (-26)
```

Background:
The functional test framework's CScript class translates passed
bytes/bytearrays always to data pushes using OP_PUSHx/OP_PUSHDATA{1,2,4}
op-codes. E.g. the expression `CScript(bytes([1]))` yields
`bytes([OP_PUSH1, 1])` instead of the minimal-encoded `bytes([OP_1])`.

Fix this by adapting the random-size range to [2,...], i.e. never pass
byte-arrays below length two to be pushed.

Closes #27595.
2023-06-04 23:50:30 +02:00
James Dorfman
c134b5a012 Merge 064c729a96 into merged_master (Bitcoin PR bitcoin/bitcoin#23512) 2023-05-31 06:23:55 +00:00
Byron Hambly
b50c367ff6 Merge 3a36ec83d0 into merged_master (Bitcoin PR bitcoin/bitcoin#23521) 2023-05-29 13:17:22 +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
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
James Dorfman
4fbdbb640e Merge ffcb4374c4 into merged_master (Bitcoin PR bitcoin/bitcoin#23498) 2023-05-24 18:15:21 +00:00
Byron Hambly
ee8f77f5b2 Merge 991753e4d5 into merged_master (Bitcoin PR bitcoin/bitcoin#23118) 2023-05-10 11:36:56 +00:00
James Dorfman
ae89c4bc51 Merge a5d00d4baf into merged_master (Bitcoin PR bitcoin/bitcoin#22788) 2023-04-21 04:02:55 +00:00
Sebastian Falbesoner
f842ed9a40 test: refactor: replace unnecessary BytesIO uses
Rather than needing to create intermediate stream variables, we can use
helper functions like `tx_from_hex` instead or access the result
directly, leading both to increased readability and less code.
2023-04-01 14:15:17 +02:00