Commit Graph

3505 Commits

Author SHA1 Message Date
Tobin C. Harding 3a562db39d
docs: Remove pinning from hashes readme
We do not need to pin with the current MSRV, remove the stale mention of
it from the `hashes` readme file.
2024-01-11 15:08:44 +11:00
Andrew Poelstra de9f20a620
Merge rust-bitcoin/rust-bitcoin#2321: Derive `Copy` for `WitnessProgram`
b02c7d1d33 Derive Copy for WitnessProgram (Tobin C. Harding)

Pull request description:

  Recently we started using our custom `ArrayVec` for the `program` field of `WitnessProgram`, this means we can now derive `Copy`.

  Fix: #2313

ACKs for top commit:
  apoelstra:
    ACK b02c7d1d33
  sanket1729:
    ACK b02c7d1d33

Tree-SHA512: 5741081d578f7b056c156d046dc3b0817b4b13cf69dcc1dfb8c7f4dbe8a4f9ed6c8802aaaf2b0084dbf3984d3fde807a02dbaa8c3bd29c220b3b32d3cb7c9f38
2024-01-08 20:44:06 +00:00
Andrew Poelstra 8aab550e97
Merge rust-bitcoin/rust-bitcoin#2322: Remove Push enum
a8d50a5541 Remove Push enum (Tobin C. Harding)

Pull request description:

  The `Push` enum is only ever used to get access to one of its variants. Since it is a private type we can remove it entirely and just return `PushBytes` from the `last_pushdata` function.

  Needs careful review but I believe the function name is still correctly descriptive.

  This was discovered by of a new nightly clippy warning.

ACKs for top commit:
  apoelstra:
    ACK a8d50a5541 Looks good to me. The latest compiler complains about the currently-unused variants.
  sanket1729:
    ACK a8d50a5541.

Tree-SHA512: 7f96057b0f6f5673252578253ad4f1789793dbf6e917d3974274dedf942da27e6247946262a0669eb500d47987788fcca0e020ed16c0d672188e95ee31163242
2024-01-08 20:29:02 +00:00
Andrew Poelstra 6aaaae6ffc
Merge rust-bitcoin/rust-bitcoin#2294: Deprecate `Script::is_provably_unspendable`
089ce8f0fb Deprecate `Script::is_provably_unspendable` (Martin Habovstiak)

Pull request description:

  This method is not really that useful because it checked an arbitrary condition. There already exists `OP_RETURN` semantics and the method didn't cover all possible ways the script may be invalid.

  This deprecates the method and documents why.

  Closes #2191

ACKs for top commit:
  apoelstra:
    ACK 089ce8f0fb
  tcharding:
    ACK 089ce8f0fb
  sanket1729:
    ACK 089ce8f0fb

Tree-SHA512: 044f1c06fb8cbea4f84817be41bf10315f690b2a42748a07c1dd1eb0ba10932456780956fc628fec4bf57fe0722129537874a77be482d6660f9e02de5fc5a8a0
2024-01-08 15:12:50 +00:00
Andrew Poelstra 17146b0884
Merge rust-bitcoin/rust-bitcoin#2317: Automated nightly rustfmt (2024-01-07)
774b405ba9 2024-01-07 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  Kixunil:
    ACK 774b405ba9
  sanket1729:
    ACK 774b405ba9. I was missing for 3 months and we have cool new stuff

Tree-SHA512: ff905c8971bc92c0716c969222d5425715773803ea05336e1bbae35c4e5cfb5cf975451452ebb769296fa84eabbbfa03672bbc0aa161f871edeefaaeb594c2ca
2024-01-08 15:06:03 +00:00
Tobin C. Harding a8d50a5541
Remove Push enum
The `Push` enum is only ever used to get access to one of its variants.
Since it is a private type we can remove it entirely and just return
`PushBytes` from the `last_pushdata` function.

Needs careful review but I believe the function name is still correctly
descriptive.
2024-01-08 14:04:55 +11:00
Tobin C. Harding b02c7d1d33
Derive Copy for WitnessProgram
Recently we started using our custom `ArrayVec` for the `program` field
of `WitnessProgram`, this means we can now derive `Copy`.

Fix: #2313
2024-01-08 13:51:12 +11:00
Fmt Bot 774b405ba9 2024-01-07 automated rustfmt nightly 2024-01-07 00:59:57 +00:00
Andrew Poelstra d5c7061ae4
Merge rust-bitcoin/rust-bitcoin#2316: Fix some typos
cc45cfe3fe Fix typos (shuoer86)
3568b9b546 Fix typos (shuoer86)

Pull request description:

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

Tree-SHA512: a4abe767f07ee4120a1c9024fb6e5aa355918be451b28ee7efcdae05ce44aa63e2aa49e631ef734ea9190d137474345b0620c497b37ef1e66f383270759fa04c
2024-01-06 16:58:16 +00:00
shuoer86 cc45cfe3fe
Fix typos 2024-01-05 23:10:52 +08:00
shuoer86 3568b9b546
Fix typos 2024-01-05 23:10:31 +08:00
Andrew Poelstra b63921d625
Merge rust-bitcoin/rust-bitcoin#2306: Improve address conversion docs
03bfe1d433 Impove rustdoc on assume_checked_ref (Tobin C. Harding)
769809f1f2 Improve the docs on as_unchecked function (Tobin C. Harding)

Pull request description:

  In #1765 we added a couple of new functions.

  - Patch 1: Fix mis-documented function.
  - Patch 2: Do trivial rustdocs fix.

ACKs for top commit:
  apoelstra:
    ACK 03bfe1d433
  Kixunil:
    ACK 03bfe1d433

Tree-SHA512: 5be6b2d288c1f4e9096014acd8618dc84a3ec6f45ae38b5d44ef7f95eccc268021bc8e8435152166606d893d4238b03e59e8f9d4fc67ba9a6c33194f3f54fc40
2024-01-04 15:59:33 +00:00
Andrew Poelstra 5108f6ecdd
Merge rust-bitcoin/rust-bitcoin#2310: use arrayvec to represent witness programs internally
01df1417c7 use arrayvec to represent witness programs (conduition)

Pull request description:

  Fixes https://github.com/rust-bitcoin/rust-bitcoin/issues/2261

  Introduces a new constructor, `WitnessProgram::from_bytes`, which creates a witness program by copying the program content from a byte slice.

ACKs for top commit:
  Kixunil:
    ACK 01df1417c7
  apoelstra:
    ACK 01df1417c7

Tree-SHA512: 73b8f2785674cd99c3f5dfe0e2180ed256942a0c29bcb1d357e0bd84fddee5e62f3f230c6cd55a37322bc3a6011467e9b7dcf24d903b20f35c095a1a1f9a29ce
2024-01-03 19:41:00 +00:00
conduition 01df1417c7
use arrayvec to represent witness programs 2024-01-03 17:10:57 +00:00
Andrew Poelstra 471da86e5a
Merge rust-bitcoin/rust-bitcoin#2309: Add the implementation of `Display` for `transaction::Version`
429a3ecec4 Add the implementation of `Display` for `transaction::Version` (harshit933)

Pull request description:

  Adds the implementation of `Display` trait for `transaction::Version`

  fixes #2308

  This is unrelated to the issue but can anyone suggest some good issues that needs to be fixed. I am also taking a look but I am confused as to which I would be able to solve. I am here to learn more.
  Thank you.

ACKs for top commit:
  apoelstra:
    ACK 429a3ecec4 Merry Christmas
  tcharding:
    ACK 429a3ecec4

Tree-SHA512: 9e59a8fe494b01caa8f211441744709f26df03891be171242bea4f7ccd7c3cc58b548cad241cab5270ad66fc9bb33ea7d6f98cc60d496c47647fb3396db9410f
2024-01-02 16:37:56 +00:00
Andrew Poelstra 26195570d9
Merge rust-bitcoin/rust-bitcoin#2312: Add allow for out of bounds indexing
278229def5 Add allow for out of bounds indexing (yancy)

Pull request description:

  Out of bounds indexing is a workaround for const panic until MSRV +1.57

ACKs for top commit:
  apoelstra:
    ACK 278229def5 Happy New Year! Will merge based on CI one-ack carveout.

Tree-SHA512: 5d525b682c28407e910ae45e8999fe6c95226d5079db917ccda296c68d4ed7a204c9ff1c5ea36d0ae647ee605780939028bf04a3948b1034c71e88cf6f03c782
2024-01-02 15:49:03 +00:00
yancy 278229def5 Add allow for out of bounds indexing
Out of bounds indexing is a workaround for const panic until MSRV +1.57
2024-01-01 10:35:52 +01:00
harshit933 429a3ecec4 Add the implementation of `Display` for `transaction::Version` 2023-12-22 21:08:26 +05:30
Andrew Poelstra 9ea3e29d61
Merge rust-bitcoin/rust-bitcoin#2304: Whitelist some recent clippy lints
504f77adca ci: revert #2301 "update download-artifact to v4" (Andrew Poelstra)
5fd731f095 Don't match on complex expression (Martin Habovstiak)
6cdbb04820 clippy: whitelist uninhabited_references lint (Andrew Poelstra)

Pull request description:

  Clippy has introduced a couple new lints that are causing our CI to fail. `allow` them.

ACKs for top commit:
  tcharding:
    ACK 504f77adca
  Kixunil:
    ACK 504f77adca

Tree-SHA512: 4b2312dcd1645792fa7c08ca02e8ec9f6a13fc5c275559e78293bb55be93997e21f952cf1ac66c1291c4699b6c2976289222201d7e9bbf68349030d83804f8f7
2023-12-20 20:40:01 +00:00
Tobin C. Harding 03bfe1d433
Impove rustdoc on assume_checked_ref
Add a newline to separate the body and heading of function rustdoc.
2023-12-20 09:34:53 +11:00
Tobin C. Harding 769809f1f2
Improve the docs on as_unchecked function
The `as_unchecked` method is never dangerous to call because an
`Address<UncheckedNetwork>` provides a subset of functionality that is
always ok to use. It is only dangerous to go the other way unchecked to
checked.
2023-12-20 09:34:24 +11:00
Andrew Poelstra 504f77adca
ci: revert #2301 "update download-artifact to v4" 2023-12-19 19:28:44 +00:00
Martin Habovstiak 5fd731f095
Don't match on complex expression
Passing a complex expression to `match` is hard to read. Assign it to a
variable first.
2023-12-19 19:28:44 +00:00
Andrew Poelstra 6cdbb04820
clippy: whitelist uninhabited_references lint
This lint triggers on `fn input_len(&self) -> usize { match *self {} }`
where Self is an infallible type, claiming that the dereference of self
is UB. Maybe it would be, if this were possible. But it's not, and this
is literally the only point of using infallible types, so this lint is
always wrong.

Enabled in rustc 1.76 as warn by default.
2023-12-19 16:38:56 +00:00
Andrew Poelstra 8315760403
Merge rust-bitcoin/rust-bitcoin#2301: Bump actions/download-artifact from 3 to 4
7e2321de75 Bump actions/download-artifact from 3 to 4 (dependabot[bot])

Pull request description:

  Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
  <details>
  <summary>Release notes</summary>
  <p><em>Sourced from <a href="https://github.com/actions/download-artifact/releases">actions/download-artifact's releases</a>.</em></p>
  <blockquote>
  <h2>v4.0.0</h2>
  <h2>What's Changed</h2>
  <p>The release of upload-artifact@v4 and download-artifact@v4 are major changes to the backend architecture of Artifacts. They have numerous performance and behavioral improvements.</p>
  <p>For more information, see the <a href="https://github.com/actions/toolkit/tree/main/packages/artifact"><code>@actions/artifact</code></a> documentation.</p>
  <h2>New Contributors</h2>
  <ul>
  <li><a href="https://github.com/bflad"><code>@bflad</code></a> made their first contribution in <a href="https://redirect.github.com/actions/download-artifact/pull/194">actions/download-artifact#194</a></li>
  </ul>
  <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/download-artifact/compare/v3...v4.0.0">https://github.com/actions/download-artifact/compare/v3...v4.0.0</a></p>
  <h2>v3.0.2</h2>
  <ul>
  <li>Bump <code>@actions/artifact</code> to v1.1.1 - <a href="https://redirect.github.com/actions/download-artifact/pull/195">actions/download-artifact#195</a></li>
  <li>Fixed a bug in Node16 where if an HTTP download finished too quickly (&lt;1ms, e.g. when it's mocked) we attempt to delete a temp file that has not been created yet <a href="hhttps://redirect.github.com/actions/toolkit/pull/1278">actions/toolkit#1278</a></li>
  </ul>
  <h2>v3.0.1</h2>
  <ul>
  <li><a href="https://redirect.github.com/actions/download-artifact/pull/178">Bump <code>@actions/core</code> to 1.10.0</a></li>
  </ul>
  </blockquote>
  </details>
  <details>
  <summary>Commits</summary>
  <ul>
  <li><a href="7a1cd3216c"><code>7a1cd32</code></a> Merge pull request <a href="https://redirect.github.com/actions/download-artifact/issues/246">#246</a> from actions/v4-beta</li>
  <li><a href="8f32874a49"><code>8f32874</code></a> licensed cache</li>
  <li><a href="b5ff8444b1"><code>b5ff844</code></a> Merge pull request <a href="https://redirect.github.com/actions/download-artifact/issues/245">#245</a> from actions/robherley/v4-documentation</li>
  <li><a href="f07a0f73f5"><code>f07a0f7</code></a> Update README.md</li>
  <li><a href="7226129829"><code>7226129</code></a> update test workflow to use different artifact names for matrix</li>
  <li><a href="ada9446619"><code>ada9446</code></a> update docs and bump <code>@actions/artifact</code></li>
  <li><a href="7eafc8b729"><code>7eafc8b</code></a> Merge pull request <a href="https://redirect.github.com/actions/download-artifact/issues/244">#244</a> from actions/robherley/bump-toolkit</li>
  <li><a href="3132d12662"><code>3132d12</code></a> consume latest toolkit</li>
  <li><a href="5be1d38671"><code>5be1d38</code></a> Merge pull request <a href="https://redirect.github.com/actions/download-artifact/issues/243">#243</a> from actions/robherley/v4-beta-updates</li>
  <li><a href="465b526e63"><code>465b526</code></a> consume latest <code>@actions/toolkit</code></li>
  <li>Additional commits viewable in <a href="https://github.com/actions/download-artifact/compare/v3...v4">compare view</a></li>
  </ul>
  </details>
  <br />

  [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/download-artifact&package-manager=github_actions&previous-version=3&new-version=4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

  Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

  [//]: # (dependabot-automerge-start)
  [//]: # (dependabot-automerge-end)

  ---

  <details>
  <summary>Dependabot commands and options</summary>
  <br />

  You can trigger Dependabot actions by commenting on this PR:
  - `@dependabot rebase` will rebase this PR
  - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
  - `@dependabot merge` will merge this PR after your CI passes on it
  - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
  - `@dependabot cancel merge` will cancel a previously requested merge and block automerging
  - `@dependabot reopen` will reopen this PR if it is closed
  - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
  - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

  </details>

ACKs for top commit:
  apoelstra:
    ACK 7e2321de75 and will use CI-only one-ack carveout

Tree-SHA512: 8eb6c18ce8c2b99721f134a26e7407c8ebc1d6af4999a013ed395b52795852ddee1c24b1f8aaf60487f13a0c1288d6b496c34d0dbfe20f806fd6fe5643e02250
2023-12-18 18:01:26 +00:00
dependabot[bot] 7e2321de75
Bump actions/download-artifact from 3 to 4
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 10:36:58 +00:00
Andrew Poelstra 4fd88e2f30
Merge rust-bitcoin/rust-bitcoin#2298: Automated nightly rustfmt (2023-12-17)
5af7727250 2023-12-17 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  Kixunil:
    ACK 5af7727250
  apoelstra:
    ACK 5af7727250

Tree-SHA512: f3a4c7e80cc7d30eb10572bf44f3a0cd44748dd4f24a0d9f0fcf7de4f5c351c1dd17cbd80253b074f9fdac7e1bcf4bab7b0fbe61067e9a9dafc4fe5c25f1ab52
2023-12-17 15:03:24 +00:00
Fmt Bot 5af7727250 2023-12-17 automated rustfmt nightly 2023-12-17 00:59:05 +00:00
Martin Habovstiak 089ce8f0fb Deprecate `Script::is_provably_unspendable`
This method is not really that useful because it checked an arbitrary
condition. There already exists `OP_RETURN` semantics and the method
didn't cover all possible ways the script may be invalid.

This deprecates the method and documents why.
2023-12-15 23:55:21 +01:00
Andrew Poelstra eadc6a6c9e
Merge rust-bitcoin/rust-bitcoin#2207: policy: Add section on standard set of derives
cb42c74f58 policy: Add section on standard set of derives (Tobin C. Harding)
ec1a5a25c7 CONTRIBUTING: Remove stale links (Tobin C. Harding)

Pull request description:

  We can have a standard set of derives to make it easier for new devs to work out what to use and also to help us move towards a uniform set in preparation for crate stabilization.

  This is not me imposing my view but rather a place for the discussion to happen, could have been a discussions topic also? Using "open" instead of "draft" to aid visibility. Probably requires more than the usual amount of acks.

ACKs for top commit:
  apoelstra:
    ACK cb42c74f58
  Kixunil:
    ACK cb42c74f58

Tree-SHA512: b4c4094ea3652e92a5bea90e16f13971202710166524cc15abef5e8318ba5f59df084f5246331870fc641456b49d4e35d266c937375bdc5035f03699a7d4c1b9
2023-12-15 22:47:57 +00:00
Andrew Poelstra 9f68e6a6b5
Merge rust-bitcoin/rust-bitcoin#2286: fix : adds the arrayvec dependency
8783d526bd fix : adds the arrayvec dependency (harshit933)

Pull request description:

  This commit adds the arrayvec dependency to the sortKey.

  Potential fix #2276

ACKs for top commit:
  Kixunil:
    ACK 8783d526bd
  apoelstra:
    ACK 8783d526bd

Tree-SHA512: 35f28ade02dd526ce5dfa2f42578b36cd5af29a5a9f409da70a775bc12046674737e9bce9fabcc87f1b4669080ad10465c75601342f280c11eab11f791f44c36
2023-12-15 22:37:00 +00:00
Andrew Poelstra a90104af2d
Merge rust-bitcoin/rust-bitcoin#2232: Add `NetworkKind`
4354f37f51 Use NetworkKind in bip32 module (Tobin C. Harding)
35bbfcded7 Use NetworkKind in PrivateKey (Tobin C. Harding)
d22f3828f6 Use NetworkKind in address module (Tobin C. Harding)
6d5ef23e61 Add NetworkKind (Tobin C. Harding)

Pull request description:

  Add a new type `NetworkKind` the describes the kind of network we are on, ether mainnet or one of the test nets (testnet, regtest, signet).

  Use it in `Address`, `PrivateKey`, and `bip32`.

ACKs for top commit:
  Kixunil:
    ACK 4354f37f51
  apoelstra:
    ACK 4354f37f51

Tree-SHA512: d015283b55b2dc68c0a5cc5f17332fce648d3e4fb4e63e0b61943b7edfe4112e8ace760cb743cd3fd5ad0c34636e51a6a12382b34b6e62dfd7dab894d2ceefc0
2023-12-15 21:08:36 +00:00
harshit933 8783d526bd fix : adds the arrayvec dependency
This commit adds the arrayvec dependency to the sortKey.
2023-12-15 23:46:12 +05:30
Andrew Poelstra 37a6b48933
Merge rust-bitcoin/rust-bitcoin#2284: policy: Add section on returning `Self`
472da02c58 policy: Add section on returning Self (Tobin C. Harding)

Pull request description:

  Returning `Self` instead of the actual type makes refactoring easier, especially for error enums.

ACKs for top commit:
  Kixunil:
    ACK 472da02c58
  apoelstra:
    ACK 472da02c58

Tree-SHA512: 22c74ed02b06907a3e2d79e82620e90e5cad2bd64322fc87ce01640c1ca51907c43329211952c62776834bbdce936f312f82ab166e85a8559614cfa25c0db708
2023-12-15 15:07:30 +00:00
Andrew Poelstra 12e11a089c
Merge rust-bitcoin/rust-bitcoin#2287: Implement custom `ArrayVec` that is `Copy`
7c3b198127 Add a simple `Copy`-able `ArrayVec` (Martin Habovstiak)
f17c0402b7 Add tools that help with making code `const` (Martin Habovstiak)

Pull request description:

  While we decided to use `arrayvec::ArrayVec`, unfortunately it currently isn't `Copy` even if `T` is because of unfortunate interactions with the `Drop` trait. So this adds a super-simple custom version that is `Copy` and may be extended if we need to or replaced with `arrayvec` if they start supporting `Copy`.

ACKs for top commit:
  tcharding:
    ACK 7c3b198127
  apoelstra:
    ACK 7c3b198127

Tree-SHA512: 545cb99c910f9455185a78a77a1110374e45a11e374c698316a222e599737b82ec2ac5c8ef1a8fe7037f20d938b1a4061685b6c673061b706dc9df9478de2b48
2023-12-15 14:47:06 +00:00
Tobin C. Harding cb42c74f58
policy: Add section on standard set of derives
We can have a standard set of derives to make it easier for new devs to
work out what to use and also to help us move towards a uniform set in
preparation for crate stabilization. Mention the new `ordered` crate.
2023-12-15 12:06:37 +11:00
Tobin C. Harding ec1a5a25c7
CONTRIBUTING: Remove stale links
These sections have been removed but still have links in the index.
2023-12-15 12:06:36 +11:00
Tobin C. Harding 4354f37f51
Use NetworkKind in bip32 module
BIP-32 only differentiates between mainnet and some testnet when
encoding and decoding xpubs and xprivs. As such we can use the new
`NetworkKind` type instead of `Network` throughout the `bip32` module.
2023-12-15 11:50:50 +11:00
Tobin C. Harding 35bbfcded7
Use NetworkKind in PrivateKey
We only use the network to serialize and deserialize from WIF.
For this we only really need network kind since WIF only differentiates
between mainnet and non-mainnet.
2023-12-15 11:49:43 +11:00
Tobin C. Harding d22f3828f6
Use NetworkKind in address module 2023-12-15 11:49:41 +11:00
Tobin C. Harding 6d5ef23e61
Add NetworkKind
Add a new type `NetworkKind` the describes the kind of network we are
on, ether mainnet or one of the test nets (testnet, regtest, signet).

Do not use the type yet.
2023-12-15 11:40:38 +11:00
Martin Habovstiak 7c3b198127 Add a simple `Copy`-able `ArrayVec`
The `arrayvec::ArrayVec` type is not `Copy` which is not nice and we
would like to have a `Copy` type in our crates. While the PR to add
support to the `arrayvec` crate is not merged we implement our own
simplified version.

This one acts mostly as a dumb storage - it has just a few methods and
traits. The new ones can be added as needed later.
2023-12-15 01:37:53 +01:00
Martin Habovstiak f17c0402b7 Add tools that help with making code `const`
There are various challenges when making code `const`: making it
conditional, awkward copying of slices... This change adds tools that
help dealing with these challenges.
2023-12-15 01:37:33 +01:00
Tobin C. Harding 472da02c58
policy: Add section on returning Self
Returning `Self` instead of the actual type makes refactoring easier,
especially for error enums.
2023-12-15 10:44:34 +11:00
Andrew Poelstra 3d6151b9e1
Merge rust-bitcoin/rust-bitcoin#2277: Implement `CompressedPublicKey`
a92d49fe33 Implement `CompressedPublicKey` (Martin Habovstiak)

Pull request description:

  P2WPKH requires keys to be compressed which introduces error handling even in cases when it's statically known that a key is compressed. To avoid it, this change introduces `CompressedPublicKey` which is similar to `PublicKey` except it's statically known to be compressed.

  This also changes relevant code to use `CompressedPublicKey` instead of `PublicKey`.

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

Tree-SHA512: ff5ff8f0cf81035f042dd8fdd52a0801f0488aea56f3cdd840663abaf7ac1d25a0339cd8d1b00f1f92878c5bd55881bc1740424683cde0c28539b546f171ed4b
2023-12-14 00:08:46 +00:00
Andrew Poelstra e5272f3467
Merge rust-bitcoin/rust-bitcoin#2283: Remove unnecessary private extern crate
0d9c7add4a Remove unnecessary private extern crate (Tobin C. Harding)

Pull request description:

  In #2278 I mistakenly left in the `use extern crate` after removing the `pub` from it - while not incorrect it is unnecessary.

ACKs for top commit:
  apoelstra:
    ACK 0d9c7add4a

Tree-SHA512: 60a2638feda2ca5aea234de74fc751c8c140a47946f20cac95d804099f0ba7c78d8eef51912446024e2aafa97008bb93334c0fd3e97267a7f91c4ab86ffcd908
2023-12-13 23:05:26 +00:00
Tobin C. Harding 0d9c7add4a
Remove unnecessary private extern crate
In #2278 I mistakenly left in the `use extern crate` after removing the
`pub` from it - while not incorrect it is unnecessary.
2023-12-14 08:49:44 +11:00
Andrew Poelstra 8afa379f39
Merge rust-bitcoin/rust-bitcoin#2264: Improve the `io` crate
b58c235733 io: Make crate MSRV 1.56.1 (Tobin C. Harding)
063dac03bd Import core::cmp (Tobin C. Harding)
c038d00bd1 io: Move use statement (Tobin C. Harding)
21c44df76e inline sink function (Tobin C. Harding)
5610b9a6b6 Remove unnecessary rustdoc (Tobin C. Harding)

Pull request description:

  In preparation for adding the `BufRead` trait do a few improvements, the first ones are all trivial, the last sets the MSRV to Rust 1.56.1

ACKs for top commit:
  Kixunil:
    ACK b58c235733
  apoelstra:
    ACK b58c235733

Tree-SHA512: e750cd615d9423f4a581b80acb8c928d537538703e2079d7bb700e6155eee4bd9b768c1eb53b0b2aa841497474460ec5926ac59c11eea1722f028efacc87c813
2023-12-13 18:28:23 +00:00
Andrew Poelstra 6b9f927f7f
Merge rust-bitcoin/rust-bitcoin#2278: Fully encapsulate bitcoinconsensus
43b1ed1b86 Fully encapsulate bitcoinconsensus (Tobin C. Harding)

Pull request description:

  The `bitcoinconsensus` crate is not fully under our control because it exposes code from Core, so we cannot guarantee its stability across versions. To make our semver compliance easier we can fully encapsulate the `bitcoinconsensus` crate so it does not appear in our public API.

  ### Please note that with this applied:

  - The `bitcoinconsenus` crate is no longer exported at the crate root
  - No `bitcoinconsensus` types appear in our public API

ACKs for top commit:
  Kixunil:
    ACK 43b1ed1b86
  apoelstra:
    ACK 43b1ed1b86

Tree-SHA512: 9fc4f01a35396562e980a647784b22667cbd289e45b5c122610d23a1f8bcf0fe8b9c27e33745f14ee010050d4c2d2669b679fb39c7a108e4e86d2c14fd60571a
2023-12-13 15:07:41 +00:00
Tobin C. Harding b58c235733
io: Make crate MSRV 1.56.1
Same as for `rust-bitcoin`, make the MSRV of the `io` crate Rust 1.56.1
2023-12-13 14:22:01 +11:00