Skip to content

hashes: Fix a bunch of bugs caused by broken CI script#3200

Merged
apoelstra merged 8 commits intorust-bitcoin:masterfrom
tcharding:08-21-ci-bug-fixes
Aug 22, 2024
Merged

hashes: Fix a bunch of bugs caused by broken CI script#3200
apoelstra merged 8 commits intorust-bitcoin:masterfrom
tcharding:08-21-ci-bug-fixes

Conversation

@tcharding
Copy link
Copy Markdown
Member

This is just the bug fixes pulled out of #2861

The root problem here is the bug described in rust-bitcoin/rust-bitcoin-maintainer-tools#10

This PR works around the bug by putting fuzz last in the list.

@github-actions github-actions bot added C-hashes PRs modifying the hashes crate test doc labels Aug 21, 2024
The `hash_reader` function is new and unreleased, it should never have
been put into the `sha256t_hash_newtype` macro, and its broken.
The `hash_reader` function is only available when `bitcoin-io` is
enabled - it should be feature gated.
We lost this impl at some stage in the last few weeks and did not notice
because of a bug in `run_task` [0].

Implement `JsonSchema` for `siphash` as we do for all the other hash
types.

[0] rust-bitcoin/rust-bitcoin-maintainer-tools#10
In rust-bitcoin#3010 we added a `length` field to the `sha256::Midstate` which broke
the `schemars` test but we did not notice because of the current bug [0]
in the `run_task` CI script.

[0] rust-bitcoin/rust-bitcoin-maintainer-tools#10
Note:

- The `extra_test.sh` script runs for all toolchains.
- The `schemars` crate does not use the repo lock files.
- We need to pin some deps when building the `schemars` test.

Pin in the `extra_test.sh` script, and mention it in the docs so the
docs don't go stale next MSRV update.

This was previously unnoticed because of the `run_task` bug.

ref: rust-bitcoin/rust-bitcoin-maintainer-tools#10
In recent work making functions on hash types inherent it seems we
missed `siphash`. Add inherent getters/setters to the `siphash::Hash`
type and call through to them from the `Hash` trait impl.
The `serde` impls and `FromStr` are missing from `siphash`, add them.
There is a bug in `run_task` [0] that drastically reduces our test
coverage. We can bypass it by putting `fuzz` last in the list.

[0] rust-bitcoin/rust-bitcoin-maintainer-tools#10
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 009e747 successfully ran local tests

@apoelstra
Copy link
Copy Markdown
Member

Hmm, I was not expecting that to pass since I enabled the cargo test --doc test so I believe that only the final commit should succeed. Lemme dig further.

@apoelstra
Copy link
Copy Markdown
Member

Oof, I had disabled testing non-default features on this repo at some point between June 8 and Aug 10, and did not comment a reason or anything. Fixed.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 009e747; confirmed that local CI STILL does not pass after this; needs #3195 as well; but it is improved

@apoelstra apoelstra mentioned this pull request Aug 21, 2024
@yancyribbens
Copy link
Copy Markdown
Contributor

This fixed the test failure for me.

@tcharding tcharding mentioned this pull request Aug 22, 2024
@tcharding
Copy link
Copy Markdown
Member Author

I created #3206 in case its easier for you to merge as a single PR.

Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 009e747 but I'd much rather see the siphash problems addressed by splitting up the macro. I can make a PR for that (but just that) later.

}));
schema.into()
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather fix it by splitting the macro since that will just blanket-solve everything related to that problem.

```
To run the tests with the current MSRV you will need to pin some
dependencies. See the `hashes/contrib/extra_tests.sh` script for the
current list of pins.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A declarative solution would be nice.

fn as_byte_array(&self) -> &Self::Bytes { self.as_byte_array() }

fn from_byte_array(bytes: Self::Bytes) -> Self { Hash(bytes) }
fn from_byte_array(bytes: Self::Bytes) -> Self { Self::from_byte_array(bytes) }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this is caused by not using the macro.

@apoelstra apoelstra merged commit fda76d9 into rust-bitcoin:master Aug 22, 2024
This was referenced Aug 22, 2024
apoelstra added a commit that referenced this pull request Aug 23, 2024
d03e545 ci: fix `rev` to be `ref` when pinning bitcoin-maintainer-tools (Andrew Poelstra)
d04b6aa bitcoin: add a couple missing prelude imports (Andrew Poelstra)
30f6bd4 Add primitives to the CRATES list (Andrew Poelstra)
e1e0230 primitives: Enable alloc from serde (Tobin C. Harding)
ce36a37 primitives: Test ordered feature (Tobin C. Harding)

Pull request description:

  This is a rebase of #3195 on master (since #3200 was merged) and adds one commit which fixes a few missing imports, which it appears was missed in the other "fix CI" PRs.

ACKs for top commit:
  Kixunil:
    ACK d03e545
  tcharding:
    ACK d03e545

Tree-SHA512: 6f5dc5c2cbb42716e83e46e70dbf4d644f9e80f6b3d2e75a276e37d33d461f4a86e67eb5c32444dbd23bb9767abedc88bfe958b1beba39852c382cf73736711f
@tcharding tcharding deleted the 08-21-ci-bug-fixes branch September 3, 2024 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-hashes PRs modifying the hashes crate doc test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants