Skip to content
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

Clean up #347

Closed
wants to merge 41 commits into from
Closed

Clean up #347

wants to merge 41 commits into from

Conversation

tcharding
Copy link
Member

Do repo wide cleanup, clear lint warnings, etc.

tcharding added 30 commits May 1, 2024 15:35
I am forking this crate because of differing views with the original
author. In particular Steven wants to support async.

I will be providing this fork explicitly for integration testing of
crates in the `rust-bitcoin` eccosystem.

Please be aware that I will be:

- Merging code with no acks.
- Moving fast and breaking things.
- Not guaranteeing anything because basically I have zero interest in
  JSON-RPC I just want to be able to test our code against Bitcoin Core.

PRs welcome, use at your own risk.
MSRV build just broke because of a bunch of dependencies. I did not
investigate why I just found a set of versions that builds.
In rust-bitcoin#326 we changed a function to use
`bitcoin::sign_message::MessageSignature` but doing so requires the
"base64" feature to be on for `bitcoin`. This did not get caught by CI
but improvements to CI in rust-bitcoin#338 will now catch this.

Add a feature to `json` and `client` that allows enabling "base64" if
the `verifymessage` RPC call is required.
We deprecate a variant in `GetPeerInfoResultNetwork` that causes clippy
to give a false positive. Adding an attribute on the enum does not
quitet it down, just add a module level attribute.

This warning has been here for ever.
CI appears to run the formatter but even when `cargo --check` returns 1
the current CI script returns 0 so the formatting fail is not being
enforced. In preparation for improving the CI script run the formatter.

Run `cargo fmt`, no other manual changes.
Re-write CI in a similar manner to what we did in `rust-bitcoin`
recently. Some benefits:

- The `contrib/run_task.sh` can be used from the command line.
- GitHub action is dumber i.e., all the logic is in the shell script
  instead of spread between the action and the script.
- The action yaml is [hopefully] a bit cleaner.

Covearge is the same, three toolchains, linter, integration tests for
various Core versions.

Includes a bunch of pinning for MSRV that seems to currently be broken,
I'm not exactly sure when it broke.
Depend on the latest release of `rust-bitcoin`.
`just` makes invocations of various tools more discoverable and gives a
quick way to run them.
Currently we activate the "bitcoin/rand-std" feature unconditionally
in `json`. Some users may not wish to use the bitcoin "rand" feature.

Add a "rand" feature to `json` and `client` and use it to activate
"rand-std" in `bitcoin`.
Upgrade to the latest released `jsonrpc` version.
Recently in `jsonrpc` we added an HTTP client that uses `minreq`. Since
we now use a version of `jsonrpc` with this feature we can now use
`minreq` here.
We use a single changlog for both `client` and `json` but there is an
old stale changelog file sitting inside `client/` - remove it.
The `client` crate uses a path dependency for `bitcoincore-rpc-json`,
there is no need to explicitly mention the version, doing so just makes
more maintenance work.
Use the `bitcoin` re-export from `bitcoincore-rpc` instead of depending
on `bitcoin` directly, this helps ensure we have feature gating correct.
Copy the rustfmt config from `rust-bitcoin`, update the `justfile`, and
also CI (note we had a mistake in the job title with nightly in it
already).
In preparation for release add a changelog entry and bump the version
number.
Markdown files should only have a single level one heading, use level
two for the others.
With Rust 1.56.1 as the MSRV we no longer need to do crate name/type
stuff, these are all default values now.
No need to include integration code when publishing.
Our MSRV is stated as Rust 1.56.1 and is enforced in `json` but we
forgot to do it in `client` and `integration_test` - do so.
Clear warning by explicitly setting the resolver version for the
workspace.
Currently we are re-exporting the `bitcoincore-rpc-json` crate under two
names, this is unnecessary. Just use the terse `json` name for the
re-export.

While we are at it add rustdocs to all crate re-exports and use the
`json` re-export in the `integration_test` crate.
`rustfmt` is not parsing files, I'm doing a bunch of random cleanups to
try and work out why.

Put all the members on a single line in the workspace manifest.
Fix the headings in the `json` and `client` crate readmes.
We do not need this attribute, nor the `allow(unused)`. Found by
`clippy`.
Clippy emits:

  warning: this pattern creates a reference to a reference

As suggested, remove the `ref`.
Clippy emits:

  warning: this expression creates a reference which is immediately
  dereferenced by the compiler

As suggested, remove explicit reference.
tcharding added 11 commits May 1, 2024 17:03
Clippy emits:

  warning: this import is redundant

As suggested remove redundant imports.
Feature gate import and clear `clippy` warning.
Clippy emits:

  warning: redundant field names in struct initialization

As suggested, remove redundant field names.
Clippy emits:

  error: useless lint attribute

As suggested, remove useless lint attribute.
We get `Into` for free if we implement `From`.
Clippy emits:

  warning: this `.into_iter()` call is equivalent to `.iter()` and will
  not consume the `slice`

As suggested, use `iter`.
Clippy emits:

  warning: unnecessary use of `to_vec`

As suggested, use `cloned`.
Clippy emits:

  warning: useless conversion to the same type: `error::Error`

As suggested, remove useless conversion.
For now just shoosh clippy, include a todo.
Something is wrong with `rustfmt`, it is not correcting import
statements.

Run the formatter and fix the import statements manually.
@tcharding
Copy link
Member Author

tcharding commented May 1, 2024

Woops, wrong target repo.

@tcharding tcharding closed this May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant