Commit graph

709 commits

Author SHA1 Message Date
Byron Hambly
9a5c281863 Merge b2ec0326fd into merged_master (Bitcoin PR bitcoin/bitcoin#28008) 2025-07-03 21:09:28 +02:00
Byron Hambly
3af734391e Merge 8aa77a77e6 into merged_master (Bitcoin PR bitcoin/bitcoin#28168) 2025-07-03 12:29:20 +02:00
Byron Hambly
c384ea35c3 Merge 8f40271037 into merged_master (Bitcoin PR bitcoin/bitcoin#27902) 2025-06-27 14:40:42 +02:00
Byron Hambly
07d32d31e6 Merge 7a59865793 into merged_master (Bitcoin PR bitcoin/bitcoin#27647) 2025-06-27 14:40:26 +02:00
Byron Hambly
0d64b264ee Merge 0f8c95dccd into merged_master (Bitcoin PR bitcoin/bitcoin#27021) 2025-06-20 21:39:19 +02:00
Byron Hambly
d2ce32e63a Merge d819840f38 into merged_master (Bitcoin PR bitcoin/bitcoin#27041) 2025-06-20 15:48:59 +02:00
Byron Hambly
9c9439cef9 Merge 322ec63b01 into merged_master (Bitcoin PR bitcoin/bitcoin#17860) 2025-05-16 11:01:25 +02:00
Byron Hambly
0c1e24ab17 Merge 5aa0c82ccd into merged_master (Bitcoin PR bitcoin/bitcoin#25325) 2025-05-02 15:01:30 +02:00
Byron Hambly
abdf08133b Merge c17d4d3b6b into merged_master (Bitcoin PR bitcoin/bitcoin#26662) 2025-04-12 13:49:26 +02:00
Tom Trevethan
0ab95ded19 Merge fc037c8c83 into merged_master (Bitcoin PR bitcoin/bitcoin#27150) 2025-04-09 17:42:19 +00:00
Tom Trevethan
bff78b8a4e Merge 4ea3a8b71d into merged_master (Bitcoin PR bitcoin/bitcoin#25806) 2025-04-09 17:17:19 +00:00
Byron Hambly
bdb3612cea Merge 1e0198b6c1 into merged_master (Bitcoin PR bitcoin/bitcoin#26153) 2025-04-05 18:42:18 +02:00
Byron Hambly
14af5f2c3c Merge 8126551d54 into merged_master (Bitcoin PR bitcoin/bitcoin#27011) 2025-04-05 16:54:52 +02:00
Byron Hambly
c38021b28f Merge 837e9ed611 into merged_master (Bitcoin PR bitcoin/bitcoin#26898) 2025-04-04 10:27:59 +02:00
Byron Hambly
6be0c1b786 Merge 65d7c31b3f into merged_master (Bitcoin PR bitcoin/bitcoin#25789) 2025-04-01 06:55:02 +02:00
Byron Hambly
9d04fc68e4 Merge b9028b2e26 into merged_master (Bitcoin PR bitcoin/bitcoin#26481) 2025-03-31 16:57:17 +02:00
Byron Hambly
58b3c39377 Merge 5690848dfb into merged_master (Bitcoin PR bitcoin/bitcoin#26532) 2025-03-04 10:57:04 +02:00
Byron Hambly
f92dc0ec3c
Merge 547a963628 into merged_master (Bitcoin PR bitcoin/bitcoin#26489) 2025-02-27 15:22:57 +02:00
Byron Hambly
4a8546600d
Merge e41b225107 into merged_master (Elements PR #1384) 2025-02-13 08:48:21 +02:00
Andrew Poelstra
eea423e3d6
fuzz: add second simplicity fuzz test
The first fuzztest takes a Simplicity program and a transaction and
directly calls the Simplicity interpreter with some context cobbled
together from the transaction. It also tries messing with the budget
and computes AMRs to check that the AMR-check works, even though on
the blockchain AMRs are never used.

It also attempts mangling programs to directly fuzz the parser, type
inference and CMR checking.

THIS test, on the other hand, takes a transaction, looks for Simplicity
programs (or witnesses which look like Simplicity programs), computes
their CMRs to produce a correct corresponding scriptPubKey, creates
scriptchecks, and executes them. This should do an end-to-end coverage
of the whole Simplicity consensus logic, including all the new branches
in interpreter.cpp.

To produce seeds for this, I have a a local fuzz target which uses
rust-simplicity and rust-elements to produce programs, deep Taproot trees,
and transactions. I run this to get high coverage, then dump the
resulting complete transactions to disk, where they can be used as
seeds for this test.
2025-02-11 16:12:29 +00:00
Andrew Poelstra
a87e4cf70b
simplicity: rewrite fuzz target
This fuzz target takes its seeds in a simple and well-defined format: a
four-byte LE budget, then a transaction, Simplicity program and witness,
each prefixed by a four-byte LE length. The fuzz target extracts any
additional randomness it needs from the txid of the first input of the
transaction, since this data is not interpreted in any other way we
therefore won't confuse the fuzzer.

The reason for this design, rather than a more typical "just query the
fuzzer when you need stuff", is to make it possible to fairly easily
generate test vectors from sources other than this fuzz test. (For
example, I have an alternate target which uses Rust code to generate
well-formed Simplicity programs, which quickly gets high coverage at the
expense of being an unmaintainable mess.)

This commit includes a .c file with a small function to comute the AMR
of a program. This is needed to pass a correct AMR to the Simplicity
interpreter, to exercise all the AMR-checking paths. In practice this is
not really necessary; Elements passes NULL to disable these AMR checks.
2025-02-11 16:12:28 +00:00
Byron Hambly
52642b1afd
simplicity: add fuzz target 2025-02-11 16:12:28 +00: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
Byron Hambly
8499b13762
lint: fix lint issues 2024-12-03 14:02:33 +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
f27a4980b0 Merge 13fd9ee5c2 into merged_master (Bitcoin PR bitcoin/bitcoin#26056) 2024-11-26 15:10:26 +02:00
Byron Hambly
cd60150aa4 Merge c85688347e into merged_master (Bitcoin PR bitcoin/bitcoin#26021) 2024-11-26 15:01:13 +02:00
Byron Hambly
54b236050d Merge e9035f867a into merged_master (Bitcoin PR bitcoin/bitcoin#25717)
The new minchainwork test was modified to use bitcoin regtest instead of
elements, which required a few changes and a FIXME.
2024-11-22 14:26:38 +02:00
Byron Hambly
b07694187c Merge 607d5a46aa into merged_master (Bitcoin PR bitcoin/bitcoin#23202)
added a FIXME for the new bumpfee tests on non-owned inputs
2024-11-04 15:03:28 +02:00
Byron Hambly
81b4ef626a Merge 243d7bde78 into merged_master (Bitcoin PR bitcoin/bitcoin#25798) 2024-11-01 14:26:52 +02:00
Byron Hambly
257be0ced9 Merge deb7ad35e6 into merged_master (Bitcoin PR bitcoin/bitcoin#25813) 2024-11-01 13:08:54 +02:00
Byron Hambly
49d368ea6b Merge 006740b6f6 into merged_master (Bitcoin PR bitcoin/bitcoin#25721) 2024-10-25 13:33:19 +02:00
Byron Hambly
f7b03ad72e
Merge 1abbae65eb into merged_master (Bitcoin PR bitcoin/bitcoin#24584)
This should be reviewed carefully. The new availablecoins_test was
showing an intermittent error [1]. The test variants were split out into
their own test cases to work around the issue, but requires further
investigation.

[1]: https://github.com/ElementsProject/elements/issues/1370
2024-10-24 12:08:44 +02:00
Byron Hambly
e6e789d33f Merge 41205bf442 into merged_master (Bitcoin PR bitcoin/bitcoin#25674)
2 minor rbf tests commented out with ELEMENTS FIXME
2024-10-21 09:30:50 +02:00
James Dorfman
0fc13e69d9 Merge 4e2929e987 into merged_master (Bitcoin PR bitcoin/bitcoin#25617) 2024-10-16 07:08:03 +00:00
James Dorfman
1c819b5313 Merge bac52a1cfe into merged_master (Bitcoin PR bitcoin/bitcoin#25447) 2024-10-13 06:28:07 +00:00
Russell O'Connor
28553fdf67 Add Simplicity to the build system. 2024-10-07 14:39:09 -04:00
James Dorfman
7b3b3b21a0 Merge b1a824dd06 into merged_master (Bitcoin PR bitcoin/bitcoin#24291) 2024-09-16 05:05:47 +00:00
James Dorfman
a52fff5abe Merge 695ca641a4 into merged_master (Bitcoin PR bitcoin/bitcoin#24860) 2024-09-09 17:06:48 +00:00
James Dorfman
1deb77b104 Merge b752dade04 into merged_master (Bitcoin PR bitcoin/bitcoin#25244) 2024-09-06 18:49:44 +00:00
James Dorfman
9d137c5a45 Merge dd8a2df488 into merged_master (Bitcoin PR bitcoin/bitcoin#25107) 2024-08-13 03:41:10 +00:00
James Dorfman
be5644ff35 Merge dd17c42a16 into merged_master (Bitcoin PR bitcoin/bitcoin#24322) 2024-08-06 19:29:46 +00:00
James Dorfman
53f8f47c64 Merge 1ae65b4c5f into merged_master (Bitcoin PR bitcoin/bitcoin#24968) 2024-08-01 23:50:58 +00:00
James Dorfman
18d0ebdd77 Merge 27cfaeed1e into merged_master (Bitcoin PR bitcoin/bitcoin#24098) 2024-07-09 02:27:59 +00:00
James Dorfman
94e058d3b7 Merge d492dc1cda into merged_master (Bitcoin PR bitcoin/bitcoin#24147) 2024-07-08 17:49:09 +00:00
James Dorfman
c326619931 Merge 1021e4cc68 into merged_master (Bitcoin PR bitcoin/bitcoin#24602) 2024-07-08 07:26:33 +00:00
James Dorfman
eb29b4a80f Merge d2b4355c58 into merged_master (Bitcoin PR bitcoin/bitcoin#24715) 2024-06-21 20:54:51 +00:00
James Dorfman
1b570a616b Merge d2615312c1 into merged_master (Bitcoin PR bitcoin/bitcoin#19385) 2024-03-19 07:11:44 +00:00
Byron Hambly
e592d94373 Merge 3617d22562 into merged_master (Bitcoin PR bitcoin/bitcoin#14752) 2023-10-16 08:38:28 +00:00
fanquake
b2ec0326fd
Merge bitcoin/bitcoin#28008: BIP324 ciphersuite
1c7582ead6 tests: add decryption test to bip324_tests (Pieter Wuille)
990f0f8da9 Add BIP324Cipher, encapsulating key agreement, derivation, and stream/AEAD ciphers (Pieter Wuille)
c91cedf281 crypto: support split plaintext in ChaCha20Poly1305 Encrypt/Decrypt (Pieter Wuille)
af2b44c76e bench: add benchmark for FSChaCha20Poly1305 (Pieter Wuille)
aa8cee9334 crypto: add FSChaCha20Poly1305, rekeying wrapper around ChaCha20Poly1305 (Pieter Wuille)
0fee267792 crypto: add FSChaCha20, a rekeying wrapper around ChaCha20 (Pieter Wuille)
9ff0768bdc crypto: add the ChaCha20Poly1305 AEAD as specified in RFC8439 (Pieter Wuille)
9fd085a1a4 crypto: remove outdated variant of ChaCha20Poly1305 AEAD (Pieter Wuille)

Pull request description:

  Depends on #27985 and #27993, based on and partially replaces #25361, part of #27634. Draft while dependencies are not merged.

  This adds implementations of:
  * The ChaCha20Poly1305 AEAD from [RFC8439 section 2.8](https://datatracker.ietf.org/doc/html/rfc8439#section-2.8), including test vectors.
  * The FSChaCha20 stream cipher as specified in [BIP324](https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki#rekeying-wrappers-fschacha20poly1305-and-fschacha20), a rekeying wrapper around ChaCha20.
  * The FSChaCha20Poly1305 AEAD as specified in [BIP324](https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki#rekeying-wrappers-fschacha20poly1305-and-fschacha20), a rekeying wrapper around ChaCha20Poly1305.
  * A BIP324Cipher class that encapsulates key agreement, key derivation, and stream ciphers and AEADs for [BIP324 packet encoding](https://github.com/bitcoin/bips/blob/master/bip-0324.mediawiki#overall-packet-encryption-and-decryption-pseudocode).

  The ChaCha20Poly1305 and FSChaCha20Poly1305 implementations are new, taking advance of the improvements in #27993.

ACKs for top commit:
  jamesob:
    reACK 1c7582e
  theStack:
    ACK 1c7582ead6
  stratospher:
    tested ACK 1c7582e.

Tree-SHA512: 06728b4b95b21c5b732ed08faf40e94d0583f9d86ff4db3b92dd519dcd9fbfa0f310bc66ef1e59c9e49dd844ba8c5ac06e2001762a804fb5aa97027816045a46
2023-08-10 11:58:59 +02:00