New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run clippy from the test script #1079
Run clippy from the test script #1079
Conversation
851df5c
to
9e777c1
Compare
Ha win! It found a bunch of warnings already, will fix and re-spin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
This LGTM (with the linting addressed)
cd2369b Run ecdsa-psbt example in test script (Tobin C. Harding) 6967c0e Add psbt example (Tobin Harding) Pull request description: Add an example PSBT workflow. The workflow we simulate is that of a setup using a watch-only online wallet (contains only public keys) and a cold-storage wallet (contains the private keys). We create and update a PSBT using the watch-only wallet then pass the PSBT to the cold-storage wallet to sign. Partially resolves #892 (more done in #935). ## Note This PR includes a sub-module in `examples/psbt.rs` that implements ECDSA signing. This will hopefully eventually be merged into the main crate by way of #957. We have three PRs that add examples/tests of PSBTs that need to do signing, in order to help us design a good AP in #957 I think it would be beneficial to complete and merge these three PRs. 1. This PR (PSBT ECDSA example) 2. PBST ECDSA integration test: #935 3. PSBT taproot example: #999 Note to self, this will need a change to `test.sh` if #1079 merges. ACKs for top commit: apoelstra: ACK cd2369b sanket1729: ACK cd2369b. The example is clean, you can address the comments in followups. Tree-SHA512: c4fb8ec631bf8bfc30534e8974b1f6c4bb7cc6def165a4ee2bb7aa73f5aa7fdc11d2000ca25792a4b534b2c5bf1592efe542ada14a9d702c7dfacbaa808f3aea
9e777c1
to
f43542c
Compare
Looks good! I notice that the commit message for f43542c says you don't lint the tests or examples, as you would need |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK f43542c
Drats, that's stale. I have a tendency to not read my own commit logs during rebase, chance to lift my game :) |
oh, turns out it wasn't stale, just hard to read. I didn't bother changing the commit log and force pushing but I did update the PR description. |
|
If #999 goes in before this, then we will need to add an additional call to clippy to lint the taproot-psbt example. |
f43542c
to
5134ba3
Compare
Changes in force push:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 5134ba3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first commit looks wrong, the rest looks OK.
src/util/misc.rs
Outdated
let msg_hash = super::signed_msg_hash(&message); | ||
let msg = secp256k1::Message::from(msg_hash); | ||
let msg_hash = super::signed_msg_hash(message); | ||
let msg = secp256k1::Message::from_slice(&msg_hash).expect("message"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What? This looks like a step back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, I don't know how I missed this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh boy, that's a bad mistake, thanks @Kixunil. I did not check over my rebase well enough.
Clippy emits various warnings of type: warning: this expression creates a reference which is immediately dereferenced by the compiler As suggested, remove the unnecessary explicit reference.
Clippy emits: warning: used `assert_eq!` with a literal bool As suggested, use `assert` instead of `assert_eq`.
Clippy emits various warnings of form: warning: redundant clone As suggested, remove the redundant calls to `clone`.
Clippy emits two warnings of form: warning: redundant field names in struct initialization Remove the redundant field names and use struct short initialization form.
Currently we run clippy in CI using a github action. The invocation has a couple of shortcomings 1. it does not lint the tests (this requires `--all-targets`) 2. it does not lint the examples I could not find a way to lint the examples without explicitly linting each example by name. Move the clippy control to `test.sh` and add an env var `DO_LINT` to control it. Remove the explicit CI job and run the linter during the `Test` job using the stable toolchain.
5134ba3
to
74f3a5a
Compare
Changes in force push: Remove re-introduction of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 74f3a5a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 74f3a5a
74f3a5a Run clippy from the test script (Tobin C. Harding) aa8109a Use struct field short form (Tobin C. Harding) d1a0540 Remove redundant calls to clone (Tobin C. Harding) 1964925 Use assert instead of assert_eq (Tobin C. Harding) 3173ef9 Remove unnecessary explicit reference (Tobin C. Harding) Pull request description: Currently we run clippy in CI using a github action. The invocation has a couple of shortcomings 1. it does not lint the tests (this requires `--all-targets`) 2. it does not lint the examples I could not find a way to lint the examples without explicitly linting each example by name. **This PR does the following:** - Fix clippy issues (patch 1-4) - Move the clippy control to `test.sh` - Add an env var `DO_LINT` to control it - Remove the separate CI job - Run the linter during the `Test` job using the stable toolchain. - Run clippy with ` --all-features` AND `--all-targets` (only recently made possible). - Run each example explicitly Thanks to dunxen for noticing all the errors in my psbt example on review and prompting me to work out why clippy was not running :) ACKs for top commit: apoelstra: ACK 74f3a5a Kixunil: ACK 74f3a5a Tree-SHA512: 56dc6262144f4caa5efa6fdc46aeecf7bddc050ef134a639b31a34d4c5e01abcdeda18a00f4ded443866bbdfc982b4e5b67b0089639e0c253e207f0b54777f57
Currently we run clippy in CI using a github action. The invocation has a couple of shortcomings
--all-targets
)I could not find a way to lint the examples without explicitly linting each example by name.
This PR does the following:
test.sh
DO_LINT
to control itTest
job using the stable toolchain.--all-features
AND--all-targets
(only recently made possible).Thanks to dunxen for noticing all the errors in my psbt example on review and prompting me to work out why clippy was not running :)