Commit Graph

3610 Commits

Author SHA1 Message Date
Noah Lanson 947dcf5675 Add new type for block version 2022-09-06 13:27:52 +10:00
Tobin C. Harding 37cd6503f1 ci: Remove TOOLCHAIN env var
Cargo already has an env var for controlling the toolchain, we should
use it instead of our current custom `TOOLCHAIn`.

While we are at it fix the missing `$` from variables (found by
`shellcheck`).

Use RUSTUP_TOOLCHAIN to allow control of the toolchain.
2022-09-05 10:48:47 +10:00
Tobin C. Harding 8eb6c23eaf ci: Remove inner quotes from shell variable
shellcheck emits:

 SC2027: The surrounding quotes actually unquote this. Remove or escape them.

Remove inner quotes from shell variable so the feature is correctly printed.
2022-09-05 10:48:47 +10:00
Tobin C. Harding 58ede47ef1 ci: Use set -ex instead of /bin/sh -ex
Setting `-ex` in the shebang makes it a little hard to see since folks
are used to glancing up and looking for `set -ex`. Both styles achieve
the same result, so this does not change the logic of the script.
2022-09-05 10:48:47 +10:00
Tobin C. Harding 4c4846f82a Remove double blank line at EOF
There should only be a single blank line at end of file.
2022-09-05 10:48:47 +10:00
Andrew Poelstra 1d8d04dd59
Merge rust-bitcoin/rust-bitcoin#1235: Correctly handle bicoinconsensus::Error
a013847bd3 Correctly handle bicoinconsensus::Error (Tobin C. Harding)

Pull request description:

  With the latest release of `rust-bitcoinconsensus` the
  `bicoinconsensus::Error` now implements `std::error::Error`.

  Correctly handle `bicoinconsensus::Error` by returning `Some(e)` and
  using `write_err` as is standard across the code base.

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

Tree-SHA512: d9ea4ce0b01277f7c6e2f1a8b877720dba111ecfbb5de7fe5bb35bf659f5c47ee4436f021f9293717000b4cc3ccfc5dc6a893e879aca4db12bb7570be8ccaee0
2022-09-02 14:31:49 +00:00
Tobin C. Harding a013847bd3 Correctly handle bicoinconsensus::Error
With the latest release of `rust-bitcoinconsensus` the
`bicoinconsensus::Error` now implements `std::error::Error`.

Correctly handle `bicoinconsensus::Error` by returning `Some(e)` and
using `write_err` as is standard across the code base.
2022-09-02 13:19:02 +10:00
Andrew Poelstra 556f85d993
Merge rust-bitcoin/rust-bitcoin#1227: Remove some easy todo's
fea908c8af Add private::Sealed trait bound to SerdeAmount (Tobin C. Harding)
08e4b28dd0 Add integer serialization tests (Tobin C. Harding)
a8f9e8ad96 Add serde roundtrip tests (Tobin C. Harding)

Pull request description:

  Remove some easy todos from the code. The three patches are unrelated except each removes a single `TODO`. Patch 1 and 2 are unit tests and trivial to review. Patch 3 requires more thought, it was't clear exactly why it was left as a todo and not done at the time.

  cc JeremyRubin for patch 3 as the original author of that code.

ACKs for top commit:
  apoelstra:
    utACK fea908c8af

Tree-SHA512: 70a041820fe52bc3d70cc110c16acfa86469fd8556793c4204671ddcb7457f336e57b43b0f03cb68d3c6b96217502f29f1628d1acbe7381a9e9d8d21c67759d2
2022-09-01 14:53:06 +00:00
Andrew Poelstra 7efe30c5e8
Merge rust-bitcoin/rust-bitcoin#1196: Add relative lock time type
da95c3a489 Add newtype `relative::LockTime` (Tobin C. Harding)
cbfa8cff4c Improve lock time docs (Tobin C. Harding)
9f7d934f5d Move the locktime module to absolute (Tobin C. Harding)

Pull request description:

  Patches 1 and 2 are preparation. Patch 3 adds a new `relative::LockTime` type.

  Please see https://github.com/rust-bitcoin/rust-miniscript/pull/455 for demo of use of the new API in miniscript.

  ### Some links to help during review
  - https://medium.com/summa-technology/bitcoins-time-locks-27e0c362d7a1
  - https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki
  - https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki

ACKs for top commit:
  apoelstra:
    ACK da95c3a489
  sanket1729:
    ACK da95c3a489. Left a minor nit

Tree-SHA512: 00137161eee354faa803f74dd33dbaaf58ced58cf54d334200be28e10281bb98cb72dff38b3205d1741b8d42100c3b8229e4cfa2155e46bb74b418b612c12dec
2022-09-01 14:51:25 +00:00
Tobin C. Harding fea908c8af Add private::Sealed trait bound to SerdeAmount
As suggested by the todo seal the `SerdeAmount` so users of the library
explicitly cannot implement it.

Its not obvious to me why this wasn't done at the time.

Remove the associated TODO from the code.
2022-09-01 16:53:33 +10:00
Tobin C. Harding 08e4b28dd0 Add integer serialization tests
Add some negative integer unit tests and remove the TODO.

Note, this is not really that necessary because we are going to move to
using the stdlib `to_le_bytes` methods so we don't really need any of
these test except to test that we are calling the correct be/le method.
They do no harm however.
2022-09-01 16:47:50 +10:00
Tobin C. Harding a8f9e8ad96 Add serde roundtrip tests
We have a TODO in the code to add serde roundtrip unit tests, seems
reasonable so do it and remove the TODO.
2022-09-01 16:08:12 +10:00
Andrew Poelstra 75949355a4
Merge rust-bitcoin/rust-bitcoin#1217: Add multithreading for the pmt_tests execution
f924e1451e Enhance pmt_tests execution time (hrouis)

Pull request description:

  An attempt to enhance pmt_tests execution time.
  fixes: https://github.com/rust-bitcoin/rust-bitcoin/issues/1214

  cargo test result :

  > test result: ok. 356 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.74s

ACKs for top commit:
  Kixunil:
    ACK f924e1451e
  RCasatta:
    ACK f924e1451e
  tcharding:
    ACK f924e1451e
  apoelstra:
    utACK f924e1451e

Tree-SHA512: d8341778aa7b9e09014d3392962a9bf844fe7870c158d835f667161d6da2e741ba42088c053979fd76154a89996aaa02f8dcb7c1705271d9dff8e10248931459
2022-09-01 00:07:23 +00:00
Andrew Poelstra d37fb99c96
Merge rust-bitcoin/rust-bitcoin#1191: Hex macros cleanup
43827a1e1c Hex macro clean up (Martin Habovstiak)
4dedf7d555 Remove duplicated `#[cfg(test)]` conditions (Martin Habovstiak)

Pull request description:

  Few cleanups of hex macros. Preparation for #1189

ACKs for top commit:
  apoelstra:
    ACK 43827a1e1c
  tcharding:
    ACK 43827a1e1c

Tree-SHA512: ba59b8bd1bc4cbf4914b000918f685edec18f58f9ea4cfbe918dad54b62767d34fdef2d2e4233ebdd66193cb7253c3ebc6f315a23e70a9cdd2316d96a0a9dce4
2022-08-31 23:39:24 +00:00
Andrew Poelstra 24b9b419e5
Merge rust-bitcoin/rust-bitcoin#1219: Revert "Temporarily disable fuzzing"
d25aba8ca0 fuzz: use travis-fuzz.sh in CI (Andrew Poelstra)
407cbca111 fuzz: remove mysteriously-not-necessary quotes from gh action script (Andrew Poelstra)
0a32525862 fuzz: disable features in honggfuzz (Andrew Poelstra)
c7910f4561 Revert "Temporarily disable fuzzing" (Andrew Poelstra)

Pull request description:

  This reverts commit 720ea29865.

  There is a new version of honggfuzz out. Maybe things work now.

ACKs for top commit:
  sanket1729:
    utACK d25aba8ca0
  tcharding:
    ACK d25aba8ca0

Tree-SHA512: d9d5cb89e5bcacfdd84bf293267ee558cffed4454908add9b6c4a172d3d06404564d1bb8c3f59f29a621369b901a9cdf31b8229b299320ac061f378a73bfa80c
2022-08-31 14:56:35 +00:00
hrouis f924e1451e Enhance pmt_tests execution time
pmt_tests with different tx counts were  executed in a single test, not taking advantage of the parallelism provided by unit tests.
A macro was added to define a unit test per transaction count.
2022-08-31 12:49:48 +02:00
Tobin C. Harding da95c3a489 Add newtype `relative::LockTime`
We recently added the `Sequence` type and we explicitly did not include
relative lock time logic.

Add a new module `relative` and new type `LockTime` to represent
relative lock times as defined by BIP 68.
2022-08-31 09:20:15 +10:00
Andrew Poelstra d25aba8ca0 fuzz: use travis-fuzz.sh in CI 2022-08-30 21:51:42 +00:00
Andrew Poelstra 407cbca111
fuzz: remove mysteriously-not-necessary quotes from gh action script 2022-08-30 20:42:28 +00:00
Andrew Poelstra 0a32525862
fuzz: disable features in honggfuzz 2022-08-30 20:42:28 +00:00
Andrew Poelstra c7910f4561
Revert "Temporarily disable fuzzing"
This reverts commit 720ea29865.
2022-08-30 20:42:28 +00:00
Martin Habovstiak 43827a1e1c Hex macro clean up
There were some duplicated hex macros in the `address` module as well as
several macros outputing specific types instead of working with any type
deserializable from hex.

This cleanup moves the macros and deduplicates them, introduces a new
`TestFromHex` trait to generalize parsing hex and rewrites the code to
use hex parsing generally. `hex_script` is still kept because its usage
is very frequent.
2022-08-30 15:04:31 +02:00
Martin Habovstiak 4dedf7d555 Remove duplicated `#[cfg(test)]` conditions
Several macros used in tests had `#[cfg(test)]` condition on each of
them. This deduplicates them by putting them into a separate module and
reexporting (with one condition for module and one for re-export).
2022-08-30 15:04:31 +02:00
Andrew Poelstra 5548696521
Merge rust-bitcoin/rust-bitcoin#1216: consensus::Params should be non_exhaustive
445037fb70 consensus::Params should be non_exhaustive (hrouis)

Pull request description:

  fixes: https://github.com/rust-bitcoin/rust-bitcoin/issues/1213

ACKs for top commit:
  apoelstra:
    ACK 445037fb70
  tcharding:
    ACK 445037fb70
  Kixunil:
    ACK 445037fb70

Tree-SHA512: a68fef69c58790caff7fc76ec780e04cd044d8f0037ecb0b93bcc3c71f9a64b9cfbc66cee51944583a311b122c1a7a25f7f434a45232ba9928b53011180fa1bc
2022-08-29 17:40:33 +00:00
hrouis 445037fb70 consensus::Params should be non_exhaustive 2022-08-26 15:49:27 +02:00
Tobin C. Harding 01161e66ee Run formmater on bip158
Run the formmater on the newly moved `bip158` module. No changes other
than those introduced by `cargo +nightly fmt`.
2022-08-26 08:30:38 +10:00
Tobin C. Harding 95393aadbc Move bip158 module to crate root
We are attempting to flatten the `util` module; move the `bip158` module
to the crate root out of `util`.

Currently `src/util/` is ignored by the formatter so this move causes
the `bip32` module to be formatted.
2022-08-26 08:30:38 +10:00
sanket1729 5e67419b14
Merge rust-bitcoin/rust-bitcoin#1200: Temporarily disable fuzzing in CI
720ea29865 Temporarily disable fuzzing (Tobin C. Harding)

Pull request description:

  Honggfuzz is broken, I have no idea why but no PRs can merge while its broken.

  (I tried a bunch of other things but could not debug this issue.)

ACKs for top commit:
  apoelstra:
    ACK 720ea29865
  sanket1729:
    ACK ACK 720ea29865

Tree-SHA512: f6c10ce38fb20c0d9593a4cc3c6d2a6e7ae8bd4cf1608a96278725ed1268bdb9f732b2616b534be9f219042942818aca6c7d6af87079b6a0533f9f795fabbe27
2022-08-24 16:15:36 -07:00
Andrew Poelstra 5a98e4a5a5
Merge rust-bitcoin/rust-bitcoin#1204: [update] macro to implement Debug from Display and add Display implementation where needed
4c1dc4594d  Implementing a macro to define debug from display and adding  Display trait implementation where needed (hrouis)

Pull request description:

  Related to issue : [1201](https://github.com/rust-bitcoin/rust-bitcoin/issues/1201)

  > Replaced macro **impl_display_from_debug** with **impl_debug_from_display**

  > Added implementation of Display trait where needed.

ACKs for top commit:
  Kixunil:
    ACK 4c1dc4594d
  apoelstra:
    ACK 4c1dc4594d

Tree-SHA512: a240ccd507ac957ed82adf14623d2b77ee7a19458c2617b69f440eba8ebe52d4b45c1328198116ee720aeee418f6390238772eed002f850cc1bfbdc0248b606e
2022-08-24 17:07:13 +00:00
hrouis 4c1dc4594d Implementing a macro to define debug from display and adding Display trait implementation where needed
Display should not be implemented as Debug trait, but the existing macro promotes this figure of use.
The macro has been replaced with implement_debug_from_display and the Display trait has been implemented where needed.
The LowerHex trait has been implemented instead of Display for UintX types.
2022-08-24 14:04:11 +02:00
Tobin C. Harding cbfa8cff4c Improve lock time docs
Bitcoin lock times are easy to get confused, add absolute/relative in
various places to help clarify things.
2022-08-24 15:14:26 +10:00
Tobin C. Harding 9f7d934f5d Move the locktime module to absolute
In preparation for adding a relative lock time type move the `locktime`
module to a new module called `absolute`. Use qualified path for
locktime types (e.g. `absolute::PackedLockTime`) to improve readability.
2022-08-24 15:14:26 +10:00
Tobin C. Harding 720ea29865 Temporarily disable fuzzing
Honggfuzz is broken, I have no idea why but no PRs can merge while its
broken.
2022-08-24 08:34:57 +10:00
sanket1729 042235940f
Merge rust-bitcoin/rust-bitcoin#1172: Re-export blockdata modules
6095a4de9b Use blockdata exports (Tobin C. Harding)
4a119e5624 Re-export blockdata modules (Tobin C. Harding)

Pull request description:

  In an effort to make the library more ergonomic to use re-export modules from `blockdata` at the crate root level. This helps to decouple the internal code layout with the public API.

ACKs for top commit:
  apoelstra:
    ACK 6095a4de9b
  sanket1729:
    ACK 6095a4de9b

Tree-SHA512: d9e0af1fa237bf9ad730c40088fe951dbc97df5ef9407a7038c6dbeb2f7450b93b082a40d76f5c5559731ac530fd9849405afae090de9a565e312ac4951cc0d6
2022-08-19 12:48:46 -07:00
Andrew Poelstra 2b190d70b1
Merge rust-bitcoin/rust-bitcoin#1138: Introduce new canonical license blurb
34f955a073 Introduce new canonical license blurb (Tobin C. Harding)

Pull request description:

  Recently we introduced SPDX license ids but there was some confusion
  about the use, form, and purpose of lines before (library name, author).

  It was pointed out to me by Andrew that if/when folks cut'n'paste our
  code they often will keep the whole blurb. Design it with that in
  mind. FTR, Andrew also indicated that he did not mind his name being
  removed in favour of "The rust-bitcoin developers".

  At first I thought the term "The rust-bitcoin developers" was a bit
  wishy-washy but yesterday I realised that I am proud to be part of that
  crew, striving to deliver code to the highest possible standard.

  Introduce a canonical format for the licences blurb.

  - Use the name of the library
  - Use "The rust-bitcoin developers"
  - Use the SPDX ID

ACKs for top commit:
  apoelstra:
    ACK 34f955a073
  Kixunil:
    ACK 34f955a073

Tree-SHA512: d488bebe9f7a862aa353b1f15c29c47579715d7a9a35120d4b4a5846f0100f4be3e53e2a412f0edea426c276f39740bbf07771ee51e0532951403168ba2b1224
2022-08-19 19:03:20 +00:00
Tobin C. Harding 6095a4de9b Use blockdata exports
We now export `blockdata` submodules at the crate root level. Use the
new exports for all rustdoc tests/examples.
2022-08-17 09:33:24 +10:00
Tobin C. Harding 4a119e5624 Re-export blockdata modules
In an effort to make the library more ergonomic to use re-export modules
from `blockdata` at the crate root level. This helps to decouple the
internal code layout with the public API.
2022-08-17 08:46:36 +10:00
sanket1729 deb867e33d
Merge rust-bitcoin/rust-bitcoin#1077: Move sighash types to the sighash module
cc2c67fc2d Move sighash types to the sighash module (Tobin C. Harding)
7c040f4437 Refactor imports (Tobin C. Harding)
29f21d6ff5 Add additional sighash related pubic exports (Tobin C. Harding)

Pull request description:

  This is non-urgent work, something I've wanted to do for months now, please only review at your leisure :)

  Currently we have a bunch of sighash types defined in the `transaction` module and we have a newer `sighash` module that defines a bunch of related types. This is an artifact of the development process as we added the new types. If we put things that are related together it makes it easier for devs to find their way around the library and grok the code.

  Move all the sighash types from the `blockdata::transaction` module to the `sighash` module.

  The first two patches are preparatory cleanup.

  ### Labels

  I added "API break" because I move the types without adding a re-export from the original place. I believe this is correct because we are, hopefully, aiming to de-couple the public API from the internal module structure so there is going to be a load more of this.

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

Tree-SHA512: 62a586b63c388baf91655a9afc8595394565d6ea6eb9aa3bd4746f899c140f332999e886cd85b098ec01304d2b96a310848d42d5ae38af476d3a26496576e36c
2022-08-15 23:05:20 -07:00
Andrew Poelstra 9f37fdd7d8
Merge rust-bitcoin/rust-bitcoin#1139: Do error cleanups
abc014a079 Move rustdoc above attribute (Tobin C. Harding)
e9230019eb Implement std::error::Error::source for MerkleBlockError (Tobin C. Harding)
613f1cf2d5 Implement std::error::Error::source for bip152 (Tobin C. Harding)
a37ab82503 Add non_exhaustive to _all_ errors (Tobin C. Harding)

Pull request description:

  Do error cleanups, and add a script to help find missing `non_exhaustive` on error types

  - Patch 1: Audit the codebase and put `non_exhaustive` on all  error types.
  - Patch 2: Implement `std::error::Error::source` for `bip152::Error`
  - Patch 3: Implement `Display` and `std::error::Error::source` for `MerkleBlockError`
  - Patch 4: Move rustdocs to above attributes on one error type
  - ~Patch 5: Add a python script to `contrib` that checks the codebase for missing non exhaustive on the line above the results of regex `pub enum .*Error`~

  I removed the Python script patch, I can't be bothered working on this for now but the clean ups and `non_exhaustive` additions are useful IMO.

  ### labels
  - I added 'API break', I think the `non_exhaustive` addition requires major bump but not sure?
  - release notes mention is just for the `non_exhaustive` patch.

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

Tree-SHA512: 16ea15014eae97de7ac9cca1e9b76304aa3702a98cde577c2d71343022f840d3b33a39d2ab6d3fba0f0f1ebaa1631a0595eea1d794ba9727fe6ccfcf08e2feae
2022-08-15 22:12:13 +00:00
Tobin C. Harding abc014a079 Move rustdoc above attribute
It is customary in this repository to put the rustdoc above the
attributes.
2022-08-15 07:49:08 +10:00
Tobin C. Harding e9230019eb Implement std::error::Error::source for MerkleBlockError
The `MerkleBlockError` type does not implement `Display` or
`std::error::Error` - bad rust-bitcoin developers, no biscuit.
2022-08-15 07:49:06 +10:00
Andrew Poelstra 67e88e732c
Merge rust-bitcoin/rust-bitcoin#1170: Move `address` out of `util`
22fd107e16 Run rustfmt (Tobin C. Harding)
e1ae9d86bb Move the address module out of util (Tobin C. Harding)
6cc8b22f82 Run cargo fmt (Tobin C. Harding)

Pull request description:

  The identifier 'util' does not convey any real information. We have a whole bunch of modules inside the `util` module.

  As part of work to reduce the amount of arbitrary things in the `util` module move the `address` module to the crate root level.

  - Patch 1: fixes rustfmt issues currently on master, this patch is in heaps of my open PRs at the moment
  - Patch 2: Does the module move
  - Patch 3: Runs the formatter, done separately so reviewers can run `rustfmt +nightly fmt` and check the diff

ACKs for top commit:
  sanket1729:
    ACK 22fd107e16. Reviewed range diff from 9e7998897639ddcf115296b72fbb74ed5d4592c8 which I previously ACKed.
  Kixunil:
    ACK 22fd107e16
  apoelstra:
    ACK 22fd107e16

Tree-SHA512: b1e3384b79b61e2a27bb4afa0a1a37f9da359bd4ab0a2338a45aa29e1a64394a97b552beafa55a8540ed7dcbd99fe6e1aea573dd37648e705b96176a96e0e27f
2022-08-12 17:00:18 +00:00
Tobin C. Harding cc2c67fc2d Move sighash types to the sighash module
Currently we have a bunch of sighash types defined in the `transaction`
module and we have a newer `sighash` module that defines a bunch of
related types. This is kruft from the development process as we added
the new types. If we put things that are related together it makes it
easier for devs to find their way around the library and grok the code.

Move all the sighash types from the `blockdata::transaction` module to
the `sighash` module.

Refactor only, no logic changes.
2022-08-12 07:57:37 +10:00
Tobin C. Harding 7c040f4437 Refactor imports
Clean up some imports, only do the ones that we are about to touch.

- Remove/add whitespace to group by crate
- move modules/types to their module instead of using lib wide
  re-export (this helps minimise future merge conflicts)

Re-order imports, refactor only. No logic changes.
2022-08-12 07:39:51 +10:00
Tobin C. Harding 29f21d6ff5 Add additional sighash related pubic exports
We already export some of the sighash related types, there are others
that are uniquely named that can also be exported. Doing so makes use of
the library more ergonomic because devs do not have to know where types
are defined.
2022-08-12 07:38:11 +10:00
Tobin C. Harding 22fd107e16 Run rustfmt
We just moved the `address` module out of `util` which is currently
ignored by `rustfmt`.

Run `rustfmt`, no other changes other than those made by the tool.
2022-08-12 07:35:15 +10:00
Tobin C. Harding e1ae9d86bb Move the address module out of util
The identifier 'util' does not convey any information. We have a whole
bunch of modules inside the `util` module.

As part of work to reduce the amount of arbitrary things in the `util`
module move the `address` module to the crate root level.
2022-08-12 07:35:15 +10:00
Tobin C. Harding 6cc8b22f82 Run cargo fmt
We have formatting issues on master because we do not yet run the
formatter in CI (PR is open).

We are about to move the `address` module to `/src` which will require
running the formatter.

Run `cargo fmt` to fix formatting issues, no other changes.
2022-08-12 07:35:15 +10:00
sanket1729 0eff9eb94a
Merge rust-bitcoin/rust-bitcoin#1182: Fix clippy warnings
7001e93ad5 Fix clippy warnings (Tobin C. Harding)

Pull request description:

  We have a bunch of clippy warnings on master, at least one of them is from a patch dated from March, before we ran clippy on CI.

  Fix clippy warnings

  - warning: accessing first element with `self.0.get(0)`
  - warning: deref on an immutable reference
  - warning: you are deriving `PartialEq` and can implement `Eq`

  All one patch because clippy has to run cleanly for each patch on CI now.

  Please note the `Eq` change, adding this derive is an API change.

ACKs for top commit:
  apoelstra:
    ACK 7001e93ad5
  sanket1729:
    ACK 7001e93ad5

Tree-SHA512: b59bf92a8222d236538fe38951a92d0daaf86fc19e4ec4752c0eaf3e5b59025953560d089c72141d90f72ea137ec70425b4fa438ebfae65160fbd8799b95af7d
2022-08-11 14:31:42 -07:00
Tobin C. Harding 7001e93ad5 Fix clippy warnings
We have a bunch of clippy warnings on master, at least one of them is
from a patch dated from March, before we ran clippy on CI.

Fix clippy warnings

- warning: accessing first element with `self.0.get(0)`
- warning: deref on an immutable reference
- warning: you are deriving `PartialEq` and can implement `Eq`

All one patch because clippy has to run cleanly for each patch on CI
now.

Please note the `Eq` change, adding this derive is an API change.
2022-08-12 05:50:58 +10:00