Commit Graph

1615 Commits

Author SHA1 Message Date
Jamil Lambert, PhD e58cda6f92
Remove `unused_imports` in docs
Examples in documentation are not linted in the same way as other code,
but should still contain correctly written code.

unused_imports in docs have been removed in bitcoin, and a warn
attribute added to lib.rs.
2024-09-18 15:58:45 +01:00
merge-script d9d12dafdd
Merge rust-bitcoin/rust-bitcoin#2850: Implement GetKey for Vec<Xpriv>
8ec3571d80 Implement GetKey for Vec<Xpriv> (Nadav Ivgi)

Pull request description:

  It appears that the `BTreeSet<Xpriv>`/`HashSet<Xpriv>` sets currently implementing `GetKey` cannot actually be constructed, because `Xpriv` does not implement `Ord` nor `Hash`. (And that the rust-bitcoin code referencing these sets should not even compile? yet evidently it does 👀 )

  This PR adds support for `Vec<Xpriv>` to enable signing with multiple `Xpriv`s, but does not address the issue with the existing sets.

  The added test case demonstrates the issue:

  ```rust
  error[E0277]: the trait bound `bip32::Xpriv: std:#️⃣:Hash` is not satisfied
      --> bitcoin/src/psbt/mod.rs:2301:24
       |
  2301 |         HashSet::new().insert(xpriv.clone());
       |                        ^^^^^^ the trait `std:#️⃣:Hash` is not implemented for `bip32::Xpriv`
       |
  note: required by a bound in `std::collections::HashSet::<T, S>::insert`
      --> /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/collections/hash/set.rs:888:5

  error[E0277]: the trait bound `bip32::Xpriv: Ord` is not satisfied
      --> bitcoin/src/psbt/mod.rs:2302:25
       |
  2302 |         BTreeSet::new().insert(xpriv.clone());
       |                         ^^^^^^ the trait `Ord` is not implemented for `bip32::Xpriv`
       |
  note: required by a bound in `std::collections::BTreeSet::<T, A>::insert`
      --> /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/collections/btree/set.rs:899:5

  ```

ACKs for top commit:
  apoelstra:
    ACK 8ec3571d80 successfully ran local tests
  tcharding:
    ACK 8ec3571d80

Tree-SHA512: aceb95f8eaf11f91c6829e0b5e1c0264ebffbf587fd420145a22e924cb45678b2f4334f0b7de6ed99b57f0ce24c3d61f9e5c1e348e1b40975bc515e8fd16b75d
2024-09-18 00:09:53 +00:00
merge-script 1319c65506
Merge rust-bitcoin/rust-bitcoin#3370: Document the magic bytes for witness commitment
d942882b36 Document the magic bytes for witness commitment (Peter Ryszkiewicz)

Pull request description:

ACKs for top commit:
  apoelstra:
    ACK d942882b36 successfully ran local tests; neat! I don't think I was aware of this
  tcharding:
    ACK d942882b36

Tree-SHA512: 89766e986574e49b6c5fd00844db679eb8894a591463029f7f88079fa9ca65bd56265a42dd8fa5aad20ef4744bca3259c06f8a461abd1c695fb89433ed5cc145
2024-09-17 22:20:41 +00:00
merge-script 1fe9b79f66
Merge rust-bitcoin/rust-bitcoin#3356: Fix GetKey for sets (plus some related changes)
b593c886e3 Support GetKey where the Xpriv is a direct child of the looked up KeySource (Nadav Ivgi)
055aa9d4dc Refactor GetKey to take the KeyRequest by reference (Nadav Ivgi)
d15c57bd1f Refactor GetKey for sets to internally use Xpriv::get_key() (Nadav Ivgi)
d25c62bf45 Fix GetKey for sets to properly compare the fingerprint (Nadav Ivgi)

Pull request description:

  - The first commit is the simplest fix for a bug where the fingerprint wasn't compared correctly.

  - The second & third commits are optional refactoring to reuse `Xpriv::get_key` for `$set<Xpriv>::get_key`, so the Xpriv matching logic only has to be maintained in one place.

  - The forth commit adds support for signing with `Xpriv`s that are direct children of the `KeySource` -- possibly what the original (buggy) code author had in mind?

  Of course, feel free to take just the first commit if the others seem unnecessary. The last one is kind of meh, not sure if really useful.

  Note that multi-`Xpriv` signing does not actually work until #2850 is addressed too.

ACKs for top commit:
  apoelstra:
    ACK b593c886e3 successfully ran local tests
  tcharding:
    ACK b593c886e3

Tree-SHA512: a6f84fe12b68ddb71fc722649b1596d1561ab08a07d47f2345bd8932e155571f2b1e23c32a9c03d588fb697540340cb8ca38275dfe11f4910fd48265a993762a
2024-09-17 14:27:04 +00:00
merge-script bb4a9dec52
Merge rust-bitcoin/rust-bitcoin#3360: Improve documentation test in merkle_tree
9fc2c2a5b1 Improve documentation test in merkle_tree (Jiri Jakes)

Pull request description:

  Removes unnecessary usage of vector and adds a missing assert. Closes #3353.

  Note: Kixunil in the [referred comment](https://github.com/rust-bitcoin/rust-bitcoin/pull/3288#discussion_r1756514494) wondered about missing 'unused variable' warning. It seems that rustdoc [adds](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#pre-processing-examples) allows to the documentation tests. However, these warnings [can be enabled](https://doc.rust-lang.org/rustdoc/write-documentation/documentation-tests.html#showing-warnings-in-doctests) on module level. Do we want that? I tried to enable and there are already some occurrences of unused variables and imports. Caveat: it seems that we can't deny warnings on that, only print the warnings to stdout with `--show-output`.

ACKs for top commit:
  apoelstra:
    ACK 9fc2c2a5b1 successfully ran local tests
  tcharding:
    ACK 9fc2c2a5b1

Tree-SHA512: 776177a903a6d2dcd25ba5cc8ef0db5f38d2cdb061975d3f7cc179369796af17f70e9dfe8bb4f49ff0c6df85d7e7c9d5b1d1d386a7508eee6b7dec17b7093d80
2024-09-17 11:55:32 +00:00
Peter Ryszkiewicz d942882b36 Document the magic bytes for witness commitment 2024-09-16 21:02:29 -05:00
merge-script 85fa0ce28d
Merge rust-bitcoin/rust-bitcoin#3357: Support `impl AsRef<[u8]>` in `signed_msg_hash`
70ccd6b629 signed_msg_hash takes impl AsRef<[u8]> (Liam Aharon)

Pull request description:

  Closes #3249

  Seems not required for Kixunil's immediate use case anymore, but figured I'd open a PR anyways.

ACKs for top commit:
  apoelstra:
    ACK 70ccd6b629 successfully ran local tests
  Kixunil:
    ACK 70ccd6b629

Tree-SHA512: b15bafd1af0749cbac36652a4e4c9ab3f91b3980bb6c3cbc1c977d339810fc15075af5d4bc6b210de364bedc496ce3759eaf4539e40d215ab66a122ba69dd56a
2024-09-15 14:56:07 +00:00
Fmt Bot 7990724ff4 2024-09-15 automated rustfmt nightly 2024-09-15 01:19:55 +00:00
Nadav Ivgi 8ec3571d80
Implement GetKey for Vec<Xpriv> 2024-09-14 11:45:07 +03:00
Jiri Jakes 9fc2c2a5b1
Improve documentation test in merkle_tree
Removes unnecessary usage of vector and adds a missing assert.
2024-09-14 15:50:56 +08:00
Liam Aharon 70ccd6b629
signed_msg_hash takes impl AsRef<[u8]> 2024-09-14 00:19:05 +02:00
merge-script 60e15b8007
Merge rust-bitcoin/rust-bitcoin#3194: priority: Prepare moving script types to `primitives`
8f2f4cbb3c Re-order optional dependencies (Tobin C. Harding)
95f2a8dab6 Do not access ScriptBuf inner from builder (Tobin C. Harding)
900af453ff Stop accessing inner ScriptBuf field when encoding (Tobin C. Harding)
8b82363d97 Use Script::as_bytes instead of inner when indexing (Tobin C. Harding)
b0675a4a4f Use Script::len instead of inner field (Tobin C. Harding)
374c6118dc Deprecate Script::fmt_asm and to_asm_str (Tobin C. Harding)

Pull request description:

  Move the `Script` and `ScriptBuf` types to `primitives`. There were still a few preparations required, things we had missed while creating the extension traits.

  Note also please, in the last patch, we enable `hex` from the `serder` feature. This is not the final state we want but like we did for `alloc` it is a step to reduce the size of the diff.

ACKs for top commit:
  Kixunil:
    ACK 8f2f4cbb3c
  apoelstra:
    ACK 8f2f4cbb3c successfully ran local tests

Tree-SHA512: 62a5f3c253ecb54d95c37fdc7eb955f3952909dc3bca20444b85c44665f54d5a0c48daf729bed0dd60ff3e9571b41deed039984c8b757b075ac6e136cacd17d7
2024-09-13 16:58:59 +00:00
Nadav Ivgi b593c886e3
Support GetKey where the Xpriv is a direct child of the looked up KeySource 2024-09-13 14:49:54 +03:00
Nadav Ivgi 055aa9d4dc
Refactor GetKey to take the KeyRequest by reference
To avoid cloning when looking it up in sets.
2024-09-13 14:49:54 +03:00
Nadav Ivgi d15c57bd1f
Refactor GetKey for sets to internally use Xpriv::get_key() 2024-09-13 14:49:46 +03:00
Nadav Ivgi d25c62bf45
Fix GetKey for sets to properly compare the fingerprint 2024-09-13 11:28:17 +03:00
merge-script 0c2737f25a
Merge rust-bitcoin/rust-bitcoin#3288: priority: Move txid hash types to `primitives`
0403e52ce3 Move the transaction hash types over to primitives (Tobin C. Harding)
7e454d756d Define extension traits for txid types (Tobin C. Harding)
832b726d03 Stop using all_zeros (Tobin C. Harding)
d69c241b5c Improve docs on associated consts (Tobin C. Harding)
68c9e28165 Do not use private constructor for txid hash types (Tobin C. Harding)
98328b5a7b Use as_byte_array to encode hash type (Tobin C. Harding)

Pull request description:

  Move the `Txid` and `Wtxid` hash wrapper types over to `primitives`. This introduces to `primitves` an unconditional dependency on `hashes`.

ACKs for top commit:
  Kixunil:
    ACK 0403e52ce3
  apoelstra:
    ACK 0403e52ce3 successfully ran local tests

Tree-SHA512: d14fa95bc12c2399d30d4d640b5a3fce625d51adf587a8037158f7d7e7b6288170b2d4418ca2cb68f612086ea0bdd0fae3b577f84f0d60627072fdb2217a6531
2024-09-13 03:31:00 +00:00
merge-script eacdd69688
Merge rust-bitcoin/rust-bitcoin#3344: Deprecate `OutPoint::new` constructor
e064686397 Deprecate OutPoint::new constructor (Tobin C. Harding)

Pull request description:

  The `OutPoint` type has two public fields, providing a `new` constructor that just sets these two fields adds no value.

  Done after discussion in #3340 as part of `primitives` work.

ACKs for top commit:
  Kixunil:
    ACK e064686397
  apoelstra:
    ACK e064686397 successfully ran local tests

Tree-SHA512: d80cac85093946b3678883f4e3ad7fd2052d858dbd3fab4127916b0eb6153999d30827c84ccf8c6e4412fbc3842bd127a2e4d3ca0248d2307d0bca467a2555ce
2024-09-12 17:43:48 +00:00
merge-script e027be6457
Merge rust-bitcoin/rust-bitcoin#3350: Stop using deprecated `OutPoint` functions
f811e0adb6 Stop using deprecated OutPoint functions (Tobin C. Harding)

Pull request description:

  Either our CI is failing us or `deprecated` does not work as expected, either way we should not be using the `OutPoint::null()` or `is_null` functions any more because we deprecated them already.

ACKs for top commit:
  Kixunil:
    ACK f811e0adb6
  apoelstra:
    ACK f811e0adb6 successfully ran local tests

Tree-SHA512: 64e75601ce8062da78bbd9aea97792e35c728aa31255348413fe9b57ee585974370d3f59b5467d7e4a65dc05d2718aea18bb381e128c8410fbfde4a851006416
2024-09-12 16:32:50 +00:00
Tobin C. Harding e064686397
Deprecate OutPoint::new constructor
The `OutPoint` type has two public fields, providing a `new` constructor
that just sets these two fields adds no value.
2024-09-12 11:44:27 +10:00
Tobin C. Harding 0403e52ce3
Move the transaction hash types over to primitives
Move the `Txid` and `Wtxid` hash wrapper types over to `primitives`.
This introduces to `primitves` an unconditional dependency on
`hashes`.
2024-09-11 11:02:32 +10:00
Tobin C. Harding 8f2f4cbb3c
Re-order optional dependencies
The optional dependencies are ordered and separated by whitspace in a
manner that may not be obvious (or even have a reason).

Some of this is because since use of `?` deps changed name.

Put all the optional deps together in alphabetic order.
2024-09-11 10:50:18 +10:00
Tobin C. Harding 95f2a8dab6
Do not access ScriptBuf inner from builder
The `Builder` is staying in `bitcoin` while the `ScriptBuf` is moving to
`primitives`, so we cannot access the inner field of `ScriptBuf`.

Use the new `as_byte_vec` hack to mutate the inner `ScriptBuf` field.
2024-09-11 10:50:18 +10:00
Tobin C. Harding 900af453ff
Stop accessing inner ScriptBuf field when encoding
In preparation for moving the `ScriptBuf` type to `primitives` stop
accessing the inner field when encoding/decoding, use `as_script`
and `from_bytes` instead.
2024-09-11 10:50:18 +10:00
Tobin C. Harding 8b82363d97
Use Script::as_bytes instead of inner when indexing
In preparation for moving the `Script` type to `primitives` stop
accessing the inner field before doing slice operations, use `as_bytes`
to first get at the slice.
2024-09-11 10:50:18 +10:00
Tobin C. Harding b0675a4a4f
Use Script::len instead of inner field
In preparation for moving the `Script` type to `primitives` stop
accessing the inner field to get the length, call `len` directly.
2024-09-11 10:50:18 +10:00
Tobin C. Harding 374c6118dc
Deprecate Script::fmt_asm and to_asm_str
The `Script::fmt_asm` function is a legacy from days yore before
`Display` printed asm. We no longer need it.

Deprecate `Script::fmt_asm` and use the private `bytes_to_asm_fmt` or
`Display` impls.
2024-09-11 10:50:17 +10:00
Tobin C. Harding 7e454d756d
Define extension traits for txid types
Use the `define_extension_trait` macro to define two extension traits
for the two txid types. Each trait holds the deprecated `all_zeros`
function. There are no users of this trait in the code base.
2024-09-11 10:44:29 +10:00
Tobin C. Harding 832b726d03
Stop using all_zeros
Recently we deprecated the `all_zeros` functions on `Wtxid` and
`Txid` but for some reason our usage of them is not triggering a lint
warning.

Note please that this changes logic slightly, for example by using an
array of `0xFF` bytes instead of all zeros. Done in an effort to make it
even more obvious that the value is a dummy value and not mix it up with
the all zeros being used for coinbase thing.
2024-09-11 10:39:49 +10:00
Tobin C. Harding d69c241b5c
Improve docs on associated consts
In #3308 we added associated consts to the `Txid`, `Wtxid`, and
`OutPoint` types. During review and afterwards we realised the docs
could do with improving. Since we now want to move the types we should
do this first.

Close: #3331
2024-09-11 10:34:45 +10:00
Tobin C. Harding 68c9e28165
Do not use private constructor for txid hash types
In preparation for moving the txid hash types to `primitives` stop using
private constructors and cast the hash types as is typical.
2024-09-11 10:34:44 +10:00
Tobin C. Harding 98328b5a7b
Use as_byte_array to encode hash type
Instead of accessing the inner type of a hash wrapper type when
consensus encoding we can call `as_byte_array()`.

Done in preparation for moving `Txid` and `Wtxid` to `primitives`.

Internal change only.
2024-09-11 10:34:44 +10:00
merge-script 060ad58620
Merge rust-bitcoin/rust-bitcoin#3259: priority: Introduce and use a new `compact_size` module
d65de7c7de Introduce and use new compact_size module (Tobin C. Harding)

Pull request description:

  We would like to move the witness module to `primitives` but there is a bunch of usage of `VarInt`.

  Introduce a module that does the encoding and decoding instead, note that while the functionality is internal decoding returns an error which may one day end up in the public API. So put the module in `primitives` and make it public.

  Adds the module to `primitives`, adds a public `MAX_ENCODABLE_SIZE` variable that is commented with an issue link.

  https://github.com/rust-bitcoin/rust-bitcoin/issues/3264

ACKs for top commit:
  apoelstra:
    ACK d65de7c7de successfully ran local tests
  Kixunil:
    ACK d65de7c7de

Tree-SHA512: d9483c29b2b324e27460564a23f4639dde4037e6e773f4356216b02ebdea893a6361c342002b8e93a54de47b71ac69369431554f8cd0a2522fc451bf8493c81c
2024-09-10 13:27:24 +00:00
Tobin C. Harding f811e0adb6
Stop using deprecated OutPoint functions
Either our CI is failing us or `deprecated` does not work as expected,
either way we should not be using the `OutPoint::null()` or `is_null`
functions any more because we deprecated them already.
2024-09-10 09:32:06 +10:00
merge-script 08710d81a6
Merge rust-bitcoin/rust-bitcoin#3324: Add tests for witness_program
733505148c Add tests for witness_program (Shing Him Ng)

Pull request description:

  Add tests for witness_program

ACKs for top commit:
  tcharding:
    ACK 733505148c
  Kixunil:
    ACK 733505148c
  apoelstra:
    ACK 733505148c successfully ran local tests

Tree-SHA512: c1ee82edf22c7b39bc110d03836ba5ebfa785a63185a75c1a61781180ff907c1ea0c491c963629450f360152766845dacedccc6cf56bc3d8c607e66281427dd3
2024-09-09 20:28:24 +00:00
merge-script 1aed58a6d6
Merge rust-bitcoin/rust-bitcoin#3128: hashes: Remove `io` feature
ae93e226e3 Remove hashes io feature (Tobin C. Harding)

Pull request description:

  Currently we only get `std::io::Write` impls when the `bitcoin-io` dependency is used. This is overly restrictive, it would be nice to have `std::io::Write` imlps even without the `bitcoin-io` dependency.

  Copy the logic out of the `bitcoin_io::impl_write` macro into `hashes` but feature gate it differently.

  Call the new macro inside `hash_type` (and in `hmac`), remove the `impls` module, and move the tests to the integration test directory.

  Remove the `io` feature from `hashes`, now if users enable `std` they get `std::io::Write` impls and if they enable `bitcoin-io` they get `bitcoin_io::Write` impls as well.

ACKs for top commit:
  Kixunil:
    ACK ae93e226e3
  apoelstra:
    ACK ae93e226e3 successfully ran local tests

Tree-SHA512: d47c9c060750e8a024c46cbf7afe8d0d1245fa1f5e575f36b3a11e2460d3620ad9def1a6331dafe77d46affc99b043ec9679e619ce8ddfa32436a5826ece09e4
2024-09-09 19:28:51 +00:00
merge-script 9797e50ab5
Merge rust-bitcoin/rust-bitcoin#3310: Shoosh linter in bench build
fe46225ed0 Allow unused imports when running bench code (Tobin C. Harding)
eb67e873e0 Allow unused variables in release mode (Tobin C. Harding)

Pull request description:

  Two patches to clear the million warnings when running the bench code.

ACKs for top commit:
  apoelstra:
    ACK fe46225ed0 successfully ran local tests; though in the first commit you could also use `cfg_attr` FWIW
  Kixunil:
    ACK fe46225ed0

Tree-SHA512: 3f705e0441d8c0e41e9ceb5473572810ff2513f7e5531c1b7889418a3a85ac8622e50e271c7a3b5c386fb3f5629b85d4bd79739c4a02b51d58da86890721d8d2
2024-09-09 17:56:45 +00:00
merge-script cfe6c0a999
Merge rust-bitcoin/rust-bitcoin#3293: priority: Re-write (and re-name) `read_uint_iter`
0f897f80a5 Re-write (and re-name) read_uint_iter (Tobin C. Harding)

Pull request description:

  The `UintError` type (returned by `read_uint_iter`) is not that useful because one variant is unreachable. Re-write the function by doing:n

  - Re-write the function to reduce the error cases returned.
  - Re-name it to `read_push_data_len`
  - Move it to `internals`
  - Use `PushDataLenLen` enum instead of an int parameter

ACKs for top commit:
  apoelstra:
    ACK 0f897f80a5 successfully ran local tests; lol so much better than the old code
  Kixunil:
    ACK 0f897f80a5

Tree-SHA512: 095017a32c2d5bb2268cb1a059d0022e122faf8b41295f14970e7968374dd1c35c3b95357aba5aabaa17843439aebc237000009015ea9b8bc58ab1b337e8e1bc
2024-09-09 16:37:30 +00:00
merge-script 929eaf23d4
Merge rust-bitcoin/rust-bitcoin#3308: priority: Add coinbase associated consts
ea2efc155e Add coinbase associated consts (Tobin C. Harding)

Pull request description:

  Currently we have `all_zeros` functions and `null` functions but we can do better.

  Add associated consts and improve the names to better describe what these dummy zero hashes are used for.

  Deprecate related functions.

ACKs for top commit:
  Kixunil:
    ACK ea2efc155e
  apoelstra:
    ACK ea2efc155e successfully ran local tests

Tree-SHA512: bc7e840622a558bc46798e3606452ad24c16b7d23e7fe7a68fdf8a719326eb9d6d872ec1647620506f1de76b8086ae36cce0e1399e55e50bbd794efb8b4dda47
2024-09-09 16:01:43 +00:00
Tobin C. Harding ae93e226e3
Remove hashes io feature
Currently we only get `std::io::Write` impls when the `bitcoin-io`
dependency is used. This is overly restrictive, it would be nice to have
`std::io::Write` imlps even without the `bitcoin-io` dependency.

Copy the logic out of the `bitcoin_io::impl_write` macro into `hashes`
but feature gate it differently.

Call the new macro inside `hash_type` (and in `hmac`), remove the
`impls` module, and move the tests to the integration test directory.

Remove the `io` feature from `hashes`, now if users enable `std` they
get `std::io::Write` impls and if they enable `bitcoin-io` they get
`bitcoin_io::Write` impls as well.
2024-09-09 06:37:49 +10:00
Tobin C. Harding 0f897f80a5
Re-write (and re-name) read_uint_iter
The `UintError` type (returned by `read_uint_iter`) is not that useful
because one variant is unreachable. Re-write the function by doing:n

- Re-write the function to reduce the error cases returned.
- Re-name it to `read_push_data_len`
- Move it to `internals`
- Use `PushDataLenLen` enum instead of an int parameter
2024-09-09 06:31:39 +10:00
Shing Him Ng 733505148c Add tests for witness_program 2024-09-08 13:58:30 -05:00
Fmt Bot 9a5ba9b6df 2024-09-08 automated rustfmt nightly 2024-09-08 01:17:12 +00:00
merge-script 9afeb711e4
Merge rust-bitcoin/rust-bitcoin#3301: Deprecate `from_slice` methods in favor of arrays
c00afe8d52 Change MessageSignatureError to secp256k1::Error (Jamil Lambert, PhD)
a20d0bc4eb Deprecate `from_slice()` in sha256.rs (Jamil Lambert, PhD)
089043546f Deprecate `from_slice` methods in favor of arrays (Jamil Lambert, PhD)

Pull request description:

  As brought up in issue #3102 support for Rust arrays is now much better so slice-accepting methods that require a fixed length can be replaced with a method that accepts an array.

  `from_slice()` methods that require a fixed length have been deprecated and where needed a `from_byte_array()` method created that accepts an array.

  There are still `from_slice` methods that rely on changes to external crates before they can be changed to arrays.

ACKs for top commit:
  apoelstra:
    ACK c00afe8d52 successfully ran local tests
  tcharding:
    ACK c00afe8d52
  Kixunil:
    ACK c00afe8d52

Tree-SHA512: c505b78d5ca57e7e1004df6761ac6760d5d9b63c93edc6ac1f9adf047bc67011883575f835b06f6d35d7f6c2b6a4c6c7f0a82a3f0e293bfb4ef58123b75d3809
2024-09-06 22:33:19 +00:00
merge-script c63695ac1e
Merge rust-bitcoin/rust-bitcoin#3286: Add additional docs to Witness
333c8ab297 Add additional docs to Witness (Tobin C. Harding)

Pull request description:

  The `Witness` struct is non-trivial, in particular it is not immediately obvious where and when the compact size encode value for each witness element is stored.

  Make an effort to improve the docs on `Witness` in relation to the compact size encoded length of each witness element.

ACKs for top commit:
  apoelstra:
    ACK 333c8ab297 successfully ran local tests
  Kixunil:
    ACK 333c8ab297

Tree-SHA512: 1c61a9ad071c035d5ad2e54446120d29ebf8cc4a779c96f04eda825890687dcbd53accc17522f57ef4ffb226eb1d85c6a3a115f27bebcfc7ad3c677033a8a414
2024-09-06 14:28:04 +00:00
Jamil Lambert, PhD c00afe8d52
Change MessageSignatureError to secp256k1::Error
`from_byte_array` cannot error due to InvalidLength so the returned
MessageSignatureError has been changed to return a secp256k1::Error,
which is the only error type returned by the function.
2024-09-06 12:49:11 +01:00
Jamil Lambert, PhD 089043546f
Deprecate `from_slice` methods in favor of arrays
Support for Rust arrays is now much better so slice-accepting methods
that require a fixed length can be replaced with a method that accepts
an array.

`from_slice()` has been deprecated and replaced with `from_byte_array()`
2024-09-06 12:33:51 +01:00
Tobin C. Harding ea2efc155e
Add coinbase associated consts
Currently we have `all_zeros` functions and `null` functions but we can
do better.

Add associated consts and improve the names to better describe what
these dummy zero hashes are used for.

Deprecate related functions.
2024-09-06 09:04:56 +10:00
Tobin C. Harding fe46225ed0
Allow unused imports when running bench code
Running the bench code results in a million warnings, instead of
solving these just allow unused imports as we do for fuzz code.
2024-09-05 12:46:13 +10:00
Tobin C. Harding eb67e873e0
Allow unused variables in release mode
In release mode we have a few unused variable warnings, lets just
allow them.

Found when running bench code, interestingly `cargo bench` must build
in release mode.
2024-09-05 12:46:13 +10:00