Commit Graph

88 Commits

Author SHA1 Message Date
Andrew Poelstra 8bd5c64433
api changes for "drop GeneralHash from wrapped hash types"
There are a few green lines for the Tap*Hash types, which are tagged
hashes, and whose engine/from_engine impls are replaced. The rest is
red, for the other hashtypes where these methods are just dropped.

A later PR will also drop the methods for the Tap*Hash types but that
seemed different enough from the rest to warrant its own PR.
2024-06-24 14:00:57 +00:00
Andrew Poelstra 46dad847f2
api changes for split between Hash/GeneralHash 2024-06-24 13:51:09 +00:00
Jose Storopoli 2bde5d002e
api: Run just check-api 2024-06-24 08:55:05 +00:00
Andrew Poelstra b904de375a
Merge rust-bitcoin/rust-bitcoin#2877: hashes: remove `all_zeros` and constify constructors
4652ce20ed API changes for "delete `all_zeros`" (Andrew Poelstra)
8869f35a69 hashes: drop the `all_zeros` method on arbitrary hashes (Andrew Poelstra)
9f8797f486 API changes for constification of hash constructors (Andrew Poelstra)
154e91af8c hashes: constify a bunch of constructors (Andrew Poelstra)
c155cbf8b2 hashes: use workaround to get constfns on tagged hashes with MSRV (Andrew Poelstra)

Pull request description:

  I think these changes are both uncontroversial but they have fairly large diffs so I am PRing them together before making more invasive changes.

ACKs for top commit:
  tcharding:
    ACK 4652ce20ed

Tree-SHA512: 4560fa397deab50448598894b9364f9d8f8b48169901a84db6a44168cdba795ab69b48ad2cac61caebcee5e227a03271335b405cf5514265290a4d1f2fdf52a2
2024-06-24 04:15:47 +00:00
Tobin C. Harding dc10a49876
api: Run just check-api 2024-06-24 11:00:02 +10:00
Andrew Poelstra 09740853a9
Merge rust-bitcoin/rust-bitcoin#2887: Remove `InvalidInternalKey` variant from `TaprootBuilderError`
72655607b6 api: Run just check-api (Tobin C. Harding)
e8250cd96a Remove InvalidInternalKey variant from TaprootBuilderError (Tobin C. Harding)

Pull request description:

  This variant is unused, remove it.

  Done as part of #2883.

ACKs for top commit:
  Kixunil:
    ACK 72655607b6
  apoelstra:
    ACK 72655607b6

Tree-SHA512: 5cd27cacebcf078afdf1ceba4e3d51e78f20ee4883000b766efb7a246fd7a166240038a2e7d27249a22049c3258673a393ff2fd62cb4b27a2cade04b28ef2ac9
2024-06-23 00:18:01 +00:00
Andrew Poelstra ed514b422d
Merge rust-bitcoin/rust-bitcoin#2880: Pass hash types by value
433fd6bf7e api: Run just check-api (Tobin C. Harding)
8fd583b069 Pass hash types by value (Tobin C. Harding)

Pull request description:

  We should pass `Copy` types by value not by reference. Pass the hash types by value.

  Second step in the pass-copy-types-by-value work, pulled out of #2404.

ACKs for top commit:
  apoelstra:
    ACK 433fd6bf7e
  Kixunil:
    ACK 433fd6bf7e

Tree-SHA512: 999d12f60550cacc4ae19b4cbf505b25c1eed803820f22b1a706e9f95da1b7e7b422f393f4115d579927c0c476cd504036a39b3cdc06a1d6befbcff5513f7433
2024-06-22 19:42:24 +00:00
Andrew Poelstra 4652ce20ed
API changes for "delete `all_zeros`"
This is the kind of diff that is nicer to read than the source code.
2024-06-22 15:09:52 +00:00
Andrew Poelstra 9f8797f486
API changes for constification of hash constructors
This is a noisy diff and probably can just be ignored vs reading the
source diff in the previous commit.
2024-06-22 15:08:15 +00:00
Andrew Poelstra c155cbf8b2
hashes: use workaround to get constfns on tagged hashes with MSRV
As you can see from the - lines in the API diff, there is no reduction
in API surface (we just remove the T:Tag bound from the sha256t::Tag
type, which is not strictly necessary but maybe we would prefer to keep).
2024-06-22 15:08:15 +00:00
Divyansh Gupta 39df0a9fbe update api 2024-06-20 10:19:22 +05:30
Tobin C. Harding 72655607b6
api: Run just check-api 2024-06-20 13:05:24 +10:00
Tobin C. Harding 433fd6bf7e
api: Run just check-api 2024-06-20 09:23:45 +10:00
Andrew Poelstra 48ad5e4789
api changes for "rewrite merkle root calculation" 2024-06-18 16:11:37 +00:00
Andrew Poelstra 2bc97b22e2
api changes for new calculate_root method
These changes are nontrivial. They

* Drop the `From` impls from (w)txids to (w)TxMerkleRoots
* Introduce a new trait and bound calculate_root on it...
* ...in such a way that its return value cannot be inferred without
  further hints (though in practice this doesn't matter because usually
  the return value is immediately assigned to something with a known
  type such as a BlockHeader field)
2024-06-17 19:10:26 +00:00
Andrew Poelstra 04353901ba
api changes after moving the hashes
These are pretty noisy but it's just a move.
2024-06-17 19:10:26 +00:00
Tobin C. Harding 6014788a74
api: Run just check-api 2024-06-17 10:32:06 +10:00
Andrew Poelstra 4defdb08fa
Merge rust-bitcoin/rust-bitcoin#2868: Pass keys by value
9f01871c11 api: Run just check-api (Tobin C. Harding)
7929b51640 Pass keys by value (Tobin C. Harding)

Pull request description:

  We should pass `Copy` types by value not by reference. Pass the key types by value.

  This is patch 1 from #2404

ACKs for top commit:
  apoelstra:
    ACK 9f01871c11 this will annoy some people but I think we should do it

Tree-SHA512: 18afab537edf4ade4dc1c1e5992e50060b8935531f1e3cbe1d3b94b2fcb87aafa39947f342e0e762835bda3b4091dd35b3b74ea79f4dbb3b21660ffd21d1f82e
2024-06-14 23:56:46 +00:00
Andrew Poelstra 72ce271b6b
Merge rust-bitcoin/rust-bitcoin#2852: Add inherent functions to hashes
18b2788a5a api: Run just check-api (Tobin C. Harding)
6b7d02e5ae Add inherent functions to hashes (Tobin C. Harding)

Pull request description:

  Currently we have a trait `Hash` that is required for `Hmac`, `Hkdf`, and other use cases. However, it is unegonomic for users who just want to do a simple hash to have to import the trait.

  Add inherent functions to all hash types including those created with the new wrapper type macros.

  This patch introduces some duplicate code but we are trying to make progress in the hashes API re-write. We can come back and de-dublicate later.

  Includes making `to_byte_array`,`from_byte_array`, `as_byte_array`, and `all_zeros` const where easily possible.

ACKs for top commit:
  apoelstra:
    ACK 18b2788a5a

Tree-SHA512: 6b7a8d8a8501e981416d767040e5bd9fa8d1134be2ca133b5c53aa55f65c8456dccb63b642e30d0d571ca838c6f9eaeff6527d92a9b4212819a49ce619c4e093
2024-06-14 16:30:52 +00:00
Tobin C. Harding 9f01871c11
api: Run just check-api 2024-06-14 14:19:07 +10:00
Tobin C. Harding 18b2788a5a
api: Run just check-api 2024-06-14 10:51:01 +10:00
Divyansh Gupta fcf27a62a2 update api 2024-06-12 09:23:53 +05:30
Liu-Cheng Xu ce585dc529 api: Run just check-api 2024-06-07 08:59:38 +08:00
Andrew Poelstra ee68e80315
Merge rust-bitcoin/rust-bitcoin#2535: Move `read_scriptint` to `PushBytes` & create `read_int` function
d6ef16af30 update api (Divyansh Gupta)
a336ec0dda refactor(script): move `read_scriptint` to `PushBytes` & create `read_int` function (Divyansh Gupta)

Pull request description:

  * Moved `read_scriptint` method to `Push_Bytes` struct
  * Created `Instruction::read_int` method which acts as a wrappper around this  function.

  Done as part of #1547

ACKs for top commit:
  apoelstra:
    ACK d6ef16af30
  tcharding:
    ACK d6ef16af30

Tree-SHA512: e33df8adcb1c23351da303f6bad1ea4a8eae30e65943d230ae886183a01f970aecd0c8c8fd3a6c337cfe6dde1b7590778d88c308415e393f137065ef7da4b29c
2024-06-01 22:38:44 +00:00
Nick Johnson c9d1ff7037 Update hashes API changes 2024-05-30 15:50:51 -07:00
Andrew Poelstra aabaf6f2a3
Merge rust-bitcoin/rust-bitcoin#2815: Add `const` modifier to `Magic::from_bytes`
d2be969a51 Add `const fn Magic::from_bytes` patch for API files (Velnbur)
b7458256af Add `const` modifier to `Magic::from_bytes` (Velnbur)

Pull request description:

  Resolves: rust-bitcoin/rust-bitcoin#2814

ACKs for top commit:
  apoelstra:
    ACK d2be969a51

Tree-SHA512: 4e8f24b665a2919bcf135333be097114d72f473684b14a8fdd4e8d82bf57e89b4166352f75f744105f76eddc9ffabcb07971a669a7c93dfff6928a3fe519a38f
2024-05-30 16:34:53 +00:00
Velnbur d2be969a51
Add `const fn Magic::from_bytes` patch for API files
To reflect changes from b7458256af
2024-05-30 13:23:37 +03:00
Tobin C. Harding eb723740f1
api: Run just check-api 2024-05-30 16:50:02 +10:00
Tobin C. Harding 18d298ab4f
api: Run just check-api
During a bunch of merges the api/ files have gotten out of sync.

Run just check-api, no other changes.
2024-05-30 07:34:29 +10:00
Divyansh Gupta d6ef16af30 update api 2024-05-28 15:36:17 +05:30
Andrew Poelstra 1741229526
Merge rust-bitcoin/rust-bitcoin#2808: Add an `AddressData` type
b5ef7db3c0 api: Run just check-api (Tobin C. Harding)
1b40550ce8 Add an AddressData type (Tobin C. Harding)

Pull request description:

  In the 0.32.0 release we removed the `address::Payload` struct because it was deemed an implementation detail. As a byproduct of doing so we made it impossible for users to match on an enum and get the address payload (or data).

  - Add a public `AddressData` enum that holds an address' encoded data.
  - Add a conversion function to `Address` that returns the data enum.

  This patch is additive and is expected to be backported and release as a `0.32` point release.

ACKs for top commit:
  apoelstra:
    ACK b5ef7db3c0 I still feel a little partial to calling the struct "DecodedAddress" and the method "decode"...but this is good, and I do not want to bikeshed

Tree-SHA512: d97836bb2d7fc0f6e9fbba2afb30eeefefc88e7105d4765a146dd444c8397dd4d1ef4fd3e3eb925589294d46bfc8a66d33797a05dbc2131923534364424c135c
2024-05-27 16:29:06 +00:00
Tobin C. Harding b5ef7db3c0
api: Run just check-api 2024-05-27 14:50:55 +10:00
Andrew Poelstra 4fde89f77c
Merge rust-bitcoin/rust-bitcoin#2795: Make `Address:p2sh_from_hash` public
3615410d21 api: Run just check-api (Tobin C. Harding)
a3d2d1a184 Make Address:p2sh_from_hash public (Tobin C. Harding)

Pull request description:

  We previously made this function Private and added a comment that doing so was somehow better to remove the footgun of hashing the wrong length script. However in hindsight this was a bad idea and users want the functionality.

  Make the `Address:p2sh_from_hash` public and document it as we do for `Address::p2sh`.

  This is an additive change and is expected to be backported to `v0.32`, as part of the fix to #2784. Please note it introduces the footgun that is described in the function rustdoc. This will be improved as a separate patch and added to the current release.

ACKs for top commit:
  apoelstra:
    ACK 3615410d21

Tree-SHA512: 535bb7894eeef8ecb5afb7bf6e5c483cd42c6a4282d1c116e5bf86cd1364a8327bbec1efb8634a578f07ad2832c1e5daf7fe7e844574b88b1ad355a443627bef
2024-05-25 21:12:12 +00:00
Andrew Poelstra 8d5399f881
Merge rust-bitcoin/rust-bitcoin#2765: Flesh out hex unit parsing API
cf3e1eb198 api: Run just check-api (Tobin C. Harding)
98bf213c52 bitcoin: Remove error module (Tobin C. Harding)
a5b93cb159 Flesh out hex unit parsing API (Tobin C. Harding)

Pull request description:

  Add to `units::parse` the complete suit of hex unit parsing functions:

  - remove prefix
  - assert without prefix
  - parse with or without prefix
  - parse with prefix
  - parse without prefix
  - parse prefix unchecked

  Refactor `bitcoin` to use the exact function we need, removing code duplication.

  This is a breaking change to `units`, it does however keep the current re-exports from the public, now empty, `bitcoin::error` module.

ACKs for top commit:
  apoelstra:
    ACK cf3e1eb198

Tree-SHA512: 1778108d4364e290e8956cfea6f23fcdd82c835844d034a00b4cf5cab5552e3efbe853dfbf8a3e0a4bd53a8e3da9d6f7c7408d332d18cd7090aec16fc1f02fe7
2024-05-25 13:32:52 +00:00
Tobin C. Harding 3615410d21
api: Run just check-api 2024-05-25 07:55:21 +10:00
Tobin C. Harding cf3e1eb198
api: Run just check-api 2024-05-24 14:48:48 +10:00
Tobin C. Harding 7f29313d36
Update API 2024-05-23 13:04:22 +10:00
Tobin C. Harding 9e7cd97c25
Add a script to check the public API
We would like to check for API changes during development and in CI so
that such changes can be discussed separately from the code.

Add tooling and documentation for creating API listings for the public
crates within the workspace (i.e., not `internals`).

Add API text files from an initial run of the script.
2024-05-18 09:54:52 +10:00