Repository: maidsafe/blsttc (language: rust)

Issue:
`Bitvec` Dependency Bug
**Describe the bug**
`cargo building` in some use cases, for example with the conjunction of the `near-sdk-rs` crate, of this crate causes rust error E0034 caused by a dependency.

**To Reproduce**
The code:
```rust

use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
use near_sdk::near_bindgen;
use blsttc::{Signature, PublicKey};

#[near_bindgen]
#[derive(Default, BorshDeserialize, BorshSerialize)]
pub struct VerifySignature;
#[near_bindgen]
impl VerifySignature {
    #[payable]
    pub fn verify_sig(&mut self, message: Vec<u8>, signature: Vec<u8>, public_key: Vec<u8>) -> bool {   
        let signature: [u8; 96] = signature.try_into().expect("invalid signature");
        let public_key: [u8; 48] = public_key.try_into().expect("invalid pk");
        let sig = Signature::from_bytes(signature).expect("couldn't read signature");
        let pk = PublicKey::from_bytes(public_key).expect("couldn't read pk");
        pk.verify(&sig, message)
        
    }
}

#[cfg(not(target_arch = "wasm32"))]
#[cfg(test)]
mod tests {
    use super::*;
    use near_sdk::test_utils::VMContextBuilder;
    use near_sdk::{testing_env, VMContext};

    use blsttc::{PublicKey, SecretKey};


    fn get_context(is_view: bool) -> VMContext {
        VMContextBuilder::new()
            .signer_account_id("bob_near".parse().unwrap())
            .is_view(is_view)
            .build()
    }

    #[test]
    fn verify_msg() {
        let context = get_context(false);
        testing_env!(context);
        let mut contract = VerifySignature::default();

        let sk = SecretKey::random();
        let pk = sk.public_key();
        let message = "hello".try_to_vec().unwrap();
        let sig = sk.sign(message.clone());
        
        println!("sk: {:?}", sk);
        println!("pk: {:?}", pk);
        println!("sig: {:?}", sig);

        println!("pk_bytes: {:?}", pk.as_bytes());
        println!("sig_bytes: {:?}", sig.as_bytes());
        println!("sig_bytes: {:?}", sig.as_bytes());

        let sig_bytes = sig.to_bytes().to_vec();
        let pk_bytes= pk.to_bytes().to_vec();
        let verified = contract.verify_sig(message, sig_bytes, pk_bytes);

        println!("verified: {:?}", verified);

    }

}```

Deps:
```toml
near-sdk = "4.0.0"
blsttc = {version = "8.0.0"}
getrandom = {version = "0.2.8", features = ["js"]}
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
![image](https://user-images.githubusercontent.com/16431709/200024220-d0ca6965-4485-4165-96eb-5499cb324e5e.png)

**Versions**
near-sdk: 4.0
blsttc: 8.0.0(this crate has since updated to version 8.0.0, but this still remains an issue).

Happens on linux and windows.

**Additional context**
Seems to be a known [bug ](https://github.com/myrrlyn/funty/issues/3) that affects older versions of the `bitvec` crate. I think since both crates import different versions somewhere down the line the issue is exposed when compiling. 

This can be fixed by updating the version of the `blstrs` crate in the direct dependencies list and would be greatly appreciated :)


Discussion / hints:

Fix patch:
diff --git a/Cargo.toml b/Cargo.toml
index 298bd1b..80336ba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,22 +9,22 @@ repository = "https://github.com/maidsafe/blsttc"
 version = "8.0.0"
 
 [dependencies]
-ff = "0.11.0"
-group = "0.11.0"
+ff = "0.12.0"
+group = "0.12.0"
 hex = "0.4.3"
 hex_fmt = "0.3.0"
-pairing = "0.21.0"
+pairing = "0.22.0"
 rand = "0.8.5"
 rand_chacha = "0.3.1"
 thiserror = "1.0.22"
-zeroize = "1.3.0"
+zeroize = "1.5.7"
 
   [dependencies.blst]
   version = "0.3.7"
   features = [ "portable" ]
 
   [dependencies.blstrs]
-  version = "0.4.2"
+  version = "0.6.1"
   features = [ "portable" ]
 
   [dependencies.serde]
@@ -37,7 +37,7 @@ zeroize = "1.3.0"
 
 [dev-dependencies]
 bincode = "1.3.3"
-criterion = "0.3.1"
+criterion = "0.4"
 eyre = "0.6.5"
 rand_core = "0.6.3"
 rand_xorshift = "0.3.0"


Test patch: