Skip to content

Commit

Permalink
Fix lints, CI etc
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Nov 20, 2022
1 parent df3be11 commit 3912699
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 26 deletions.
20 changes: 1 addition & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
strategy:
fail-fast: false
matrix:
toolchain: [ nightly, beta, stable ]
toolchain: [ nightly, beta, stable, 1.59.0 ]
steps:
- uses: actions/checkout@v2
- name: Install rust ${{ matrix.toolchain }}
Expand All @@ -81,24 +81,6 @@ jobs:
with:
command: check
args: --workspace --all-targets --all-features
toolchains-old:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [ 1.51.0 ]
steps:
- uses: actions/checkout@v2
- name: Install rust ${{ matrix.toolchain }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: All features
uses: actions-rs/cargo@v1
with:
command: check
args: --workspace --all-targets --features all_msrv47
dependency:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ serde = ["serde_crate", "serde_with", "amplify/serde",
identity = ["lnpbp_identity"]
elgamal = ["lnpbp_elgamal"] # Provides ElGamal encryption module from this library
zip = ["lnpbp_bech32/zip"]
all_msrv47 = ["serde", "elgamal", "zip"] # Used in testing against MSRV 1.47

[workspace]
members = [".", "bech32", "chain", "elgamal", "identity"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ The development of the libraries is supported by LNP/BP Standards Association.

### Clone and compile library

Minimum supported rust compiler version (MSRV): 1.51.0 (if command-line tool is not used) and 1.54.0 (otherwise).
Minimum supported rust compiler version (MSRV): 1.59.0.

```shell script
git clone https://github.com/lnp-bp/rust-lnpbp
Expand Down
11 changes: 6 additions & 5 deletions identity/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ pub enum HashAlgo {
}

impl HashAlgo {
#[allow(clippy::len_without_is_empty)]
pub fn len(self) -> u8 {
match self {
Self::Sha256d => 32,
Expand Down Expand Up @@ -197,7 +198,7 @@ impl StrictDecode for IdentitySigner {

impl IdentitySigner {
pub fn new_bip340() -> Self {
let pair = secp256k1::KeyPair::new(&SECP256K1, &mut rand::thread_rng());
let pair = secp256k1::KeyPair::new(SECP256K1, &mut rand::thread_rng());
let cert = IdentityCert::from(pair);
Self {
cert,
Expand All @@ -210,7 +211,7 @@ impl IdentitySigner {
EcAlgo::Bip340 => {
let sk = secp256k1::SecretKey::from_slice(&self.prvkey)
.expect("invalid private key");
let pair = secp256k1::KeyPair::from_secret_key(&SECP256K1, &sk);
let pair = secp256k1::KeyPair::from_secret_key(SECP256K1, &sk);
let msg =
Message::from_hashed_data::<sha256d::Hash>(msg.as_ref());
let sig = pair.sign_schnorr(msg);
Expand All @@ -229,7 +230,7 @@ impl IdentitySigner {
EcAlgo::Bip340 => {
let sk = secp256k1::SecretKey::from_slice(&self.prvkey)
.expect("invalid private key");
let pair = secp256k1::KeyPair::from_secret_key(&SECP256K1, &sk);
let pair = secp256k1::KeyPair::from_secret_key(SECP256K1, &sk);
let mut engine = sha256d::Hash::engine();
let mut buf = [0u8; 64];
loop {
Expand Down Expand Up @@ -582,7 +583,7 @@ sig a711 0f0e 0068 2f01 aa74 c96b 97b3 84e3 3b19 283f 101f 9a67 dd02 e9ac 2ba1
}

#[test]
#[should_panic(expected = "InvalidSig)")]
#[should_panic(expected = "InvalidSig")]
fn wrong_sig_msg() {
let me = IdentitySigner::new_bip340();
let msg = "This is me";
Expand All @@ -591,7 +592,7 @@ sig a711 0f0e 0068 2f01 aa74 c96b 97b3 84e3 3b19 283f 101f 9a67 dd02 e9ac 2ba1
}

#[test]
#[should_panic(expected = "InvalidSig)")]
#[should_panic(expected = "InvalidSig")]
fn wrong_sig_key() {
let me = IdentitySigner::new_bip340();
let other = IdentitySigner::new_bip340();
Expand Down

0 comments on commit 3912699

Please sign in to comment.