mirror of
https://github.com/fluencelabs/trust-graph
synced 2024-12-04 15:20:19 +00:00
feat(deps)!: update libp2p to 0.39.1 and other deps (#77)
Co-authored-by: folex <0xdxdy@gmail.com>
This commit is contained in:
parent
757145fffc
commit
080503dcfa
998
Cargo.lock
generated
998
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
13
Cargo.toml
13
Cargo.toml
@ -11,18 +11,15 @@ repository = "https://github.com/fluencelabs/trust-graph"
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
||||
|
||||
fluence-keypair = { path = "./keypair", version = "0.9.0" }
|
||||
serde_json = "1.0.58"
|
||||
bs58 = "0.3.1"
|
||||
bs58 = "0.4.0"
|
||||
failure = "0.1.6"
|
||||
log = "0.4.11"
|
||||
ref-cast = "1.0.2"
|
||||
derivative = "2.1.1"
|
||||
signature = "1.3.0"
|
||||
serde_with = "1.6.0"
|
||||
thiserror = "1.0.23"
|
||||
sha2 = "0.9.5"
|
||||
rand = "0.7.0"
|
||||
nonempty = "0.7.0"
|
||||
sha2 = "0.10.6"
|
||||
rand = "0.8.5"
|
||||
nonempty = "0.8.1"
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
@ -31,4 +28,4 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.dependencies]
|
||||
libp2p-core = { version = "0.38", default-features = false, features = [ "secp256k1", "rsa" ] }
|
||||
libp2p-identity = { version = "0.1.0", default-features = false, features = ["peerid", "rsa", "ed25519", "secp256k1", "multihash"] }
|
||||
|
@ -9,25 +9,22 @@ repository = "https://github.com/fluencelabs/trust-graph"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
||||
serde_json = "1.0.58"
|
||||
bs58 = "0.3.1"
|
||||
bs58 = "0.4.0"
|
||||
ed25519-dalek = { version = "1.0.1", features = ["serde", "std"] }
|
||||
rand = "0.7.0"
|
||||
signature = "1.3.0"
|
||||
ed25519 = "1.0.3"
|
||||
serde_with = "1.6.0"
|
||||
rand = "0.8.5"
|
||||
thiserror = "1.0.23"
|
||||
lazy_static = "1.2"
|
||||
libsecp256k1 = "0.7.1"
|
||||
asn1_der = "0.6.1"
|
||||
sha2 = "0.9.1"
|
||||
sha2 = "0.10.6"
|
||||
zeroize = "1"
|
||||
serde_bytes = "0.11"
|
||||
libp2p-core = { workspace = true }
|
||||
eyre = "0.6.5"
|
||||
libp2p-identity = { workspace = true, default-features = false, features = ["peerid", "rsa", "ed25519", "secp256k1", "multihash"] }
|
||||
multihash = { version = "0.18.0", features = ["identity"] }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
ring = { version = "0.16.9", features = ["alloc", "std"], default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
quickcheck = "0.9.0"
|
||||
quickcheck = "1.0.3"
|
||||
|
@ -26,7 +26,7 @@ use crate::public_key::PublicKey;
|
||||
use crate::rsa;
|
||||
use crate::secp256k1;
|
||||
use crate::signature::Signature;
|
||||
use libp2p_core::PeerId;
|
||||
use libp2p_identity::PeerId;
|
||||
use std::convert::TryFrom;
|
||||
use std::str::FromStr;
|
||||
|
||||
@ -235,16 +235,17 @@ impl KeyPair {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<libp2p_core::identity::Keypair> for KeyPair {
|
||||
fn from(key: libp2p_core::identity::Keypair) -> Self {
|
||||
use libp2p_core::identity::Keypair::*;
|
||||
impl From<libp2p_identity::Keypair> for KeyPair {
|
||||
fn from(key: libp2p_identity::Keypair) -> Self {
|
||||
use libp2p_identity::Keypair::*;
|
||||
|
||||
#[allow(deprecated)] //TODO: fix it later
|
||||
match key {
|
||||
Ed25519(kp) => KeyPair::Ed25519(ed25519::Keypair::decode(&mut kp.encode()).unwrap()),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
// safety: these Keypair structures are identical
|
||||
Rsa(kp) => KeyPair::Rsa(unsafe {
|
||||
std::mem::transmute::<libp2p_core::identity::rsa::Keypair, rsa::Keypair>(kp)
|
||||
std::mem::transmute::<libp2p_identity::rsa::Keypair, rsa::Keypair>(kp)
|
||||
}),
|
||||
Secp256k1(kp) => KeyPair::Secp256k1(secp256k1::Keypair::from(
|
||||
secp256k1::SecretKey::from_bytes(kp.secret().to_bytes()).unwrap(),
|
||||
@ -253,23 +254,24 @@ impl From<libp2p_core::identity::Keypair> for KeyPair {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<KeyPair> for libp2p_core::identity::Keypair {
|
||||
impl From<KeyPair> for libp2p_identity::Keypair {
|
||||
fn from(key: KeyPair) -> Self {
|
||||
use libp2p_core::identity;
|
||||
use libp2p_core::identity::Keypair;
|
||||
use libp2p_identity::Keypair;
|
||||
use KeyPair::*;
|
||||
|
||||
#[allow(deprecated)] //TODO: fix it later
|
||||
match key {
|
||||
Ed25519(kp) => Keypair::Ed25519(
|
||||
identity::ed25519::Keypair::decode(kp.encode().to_vec().as_mut_slice()).unwrap(),
|
||||
libp2p_identity::ed25519::Keypair::decode(kp.encode().to_vec().as_mut_slice())
|
||||
.unwrap(),
|
||||
),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
// safety: these Keypair structures are identical
|
||||
Rsa(kp) => Keypair::Rsa(unsafe {
|
||||
std::mem::transmute::<rsa::Keypair, libp2p_core::identity::rsa::Keypair>(kp)
|
||||
std::mem::transmute::<rsa::Keypair, libp2p_identity::rsa::Keypair>(kp)
|
||||
}),
|
||||
Secp256k1(kp) => Keypair::Secp256k1(identity::secp256k1::Keypair::from(
|
||||
identity::secp256k1::SecretKey::from_bytes(kp.secret().to_bytes()).unwrap(),
|
||||
Secp256k1(kp) => Keypair::Secp256k1(libp2p_identity::secp256k1::Keypair::from(
|
||||
libp2p_identity::secp256k1::SecretKey::from_bytes(kp.secret().to_bytes()).unwrap(),
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ pub use key_pair::KeyFormat;
|
||||
pub use key_pair::KeyPair;
|
||||
|
||||
pub mod peerid_serializer {
|
||||
use libp2p_core::PeerId;
|
||||
use libp2p_identity::PeerId;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use std::str::FromStr;
|
||||
|
||||
|
@ -21,7 +21,7 @@ use crate::secp256k1;
|
||||
use crate::signature::Signature;
|
||||
|
||||
use crate::key_pair::KeyFormat;
|
||||
use libp2p_core::PeerId;
|
||||
use libp2p_identity::PeerId;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
@ -124,10 +124,11 @@ impl PublicKey {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<libp2p_core::identity::PublicKey> for PublicKey {
|
||||
fn from(key: libp2p_core::identity::PublicKey) -> Self {
|
||||
use libp2p_core::identity::PublicKey::*;
|
||||
impl From<libp2p_identity::PublicKey> for PublicKey {
|
||||
fn from(key: libp2p_identity::PublicKey) -> Self {
|
||||
use libp2p_identity::PublicKey::*;
|
||||
|
||||
#[allow(deprecated)] //TODO: fix it later
|
||||
match key {
|
||||
Ed25519(key) => {
|
||||
PublicKey::Ed25519(ed25519::PublicKey::decode(&key.encode()[..]).unwrap())
|
||||
@ -141,10 +142,9 @@ impl From<libp2p_core::identity::PublicKey> for PublicKey {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PublicKey> for libp2p_core::identity::PublicKey {
|
||||
impl From<PublicKey> for libp2p_identity::PublicKey {
|
||||
fn from(key: PublicKey) -> Self {
|
||||
use libp2p_core::identity as libp2p_identity;
|
||||
|
||||
#[allow(deprecated)] //TODO: fix it later
|
||||
match key {
|
||||
PublicKey::Ed25519(key) => libp2p_identity::PublicKey::Ed25519(
|
||||
libp2p_identity::ed25519::PublicKey::decode(&key.encode()[..]).unwrap(),
|
||||
@ -160,10 +160,10 @@ impl From<PublicKey> for libp2p_core::identity::PublicKey {
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<libp2p_core::PeerId> for PublicKey {
|
||||
impl TryFrom<PeerId> for PublicKey {
|
||||
type Error = DecodingError;
|
||||
|
||||
fn try_from(peer_id: libp2p_core::PeerId) -> Result<Self, Self::Error> {
|
||||
fn try_from(peer_id: PeerId) -> Result<Self, Self::Error> {
|
||||
Ok(as_public_key(&peer_id)
|
||||
.ok_or_else(|| DecodingError::PublicKeyNotInlined(peer_id.to_base58()))?
|
||||
.into())
|
||||
@ -171,14 +171,12 @@ impl TryFrom<libp2p_core::PeerId> for PublicKey {
|
||||
}
|
||||
|
||||
/// Convert PeerId to libp2p's PublicKey
|
||||
fn as_public_key(peer_id: &PeerId) -> Option<libp2p_core::PublicKey> {
|
||||
use libp2p_core::multihash;
|
||||
|
||||
fn as_public_key(peer_id: &PeerId) -> Option<libp2p_identity::PublicKey> {
|
||||
let mhash = peer_id.as_ref();
|
||||
|
||||
match multihash::Code::try_from(mhash.code()) {
|
||||
Ok(multihash::Code::Identity) => {
|
||||
libp2p_core::PublicKey::from_protobuf_encoding(mhash.digest()).ok()
|
||||
libp2p_identity::PublicKey::from_protobuf_encoding(mhash.digest()).ok()
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
@ -209,7 +207,7 @@ mod tests {
|
||||
fn public_key_peer_id_conversions() {
|
||||
let kp = KeyPair::generate_secp256k1();
|
||||
let fluence_pk = kp.public();
|
||||
let libp2p_pk: libp2p_core::PublicKey = fluence_pk.clone().into();
|
||||
let libp2p_pk: libp2p_identity::PublicKey = fluence_pk.clone().into();
|
||||
let peer_id = PeerId::from_public_key(&libp2p_pk);
|
||||
let fluence_pk_converted = PublicKey::try_from(peer_id).unwrap();
|
||||
|
||||
|
@ -15,25 +15,22 @@ path = "src/main.rs"
|
||||
trust-graph = { version = "0.3.0", path = "../." }
|
||||
fluence-keypair = { version = "0.9.0", path = "../keypair" }
|
||||
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
||||
marine-sqlite-connector = "0.6.0"
|
||||
marine-sqlite-connector = "0.8.0"
|
||||
|
||||
libp2p-core = { workspace = true }
|
||||
libp2p-identity = { workspace = true }
|
||||
|
||||
log = "0.4.8"
|
||||
anyhow = "1.0.31"
|
||||
boolinator = "2.4.0"
|
||||
once_cell = "1.4.1"
|
||||
parking_lot = "0.11.1"
|
||||
serde_json = "1.0"
|
||||
bs58 = "0.3.1"
|
||||
rmp-serde = "0.15.0"
|
||||
bs58 = "0.4.0"
|
||||
rmp-serde = "1.1.1"
|
||||
bincode = "1.3.1"
|
||||
serde_bencode = "^0.2.3"
|
||||
thiserror = "1.0.23"
|
||||
|
||||
[dev-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
rusqlite = "0.26.1"
|
||||
rusqlite = "0.28.0"
|
||||
|
||||
[build-dependencies]
|
||||
marine-rs-sdk-test = "0.8.1"
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::dto::DtoConversionError::PeerIdDecodeError;
|
||||
use fluence_keypair::error::DecodingError;
|
||||
use fluence_keypair::{KeyFormat, PublicKey, Signature};
|
||||
use libp2p_core::PeerId;
|
||||
use libp2p_identity::PeerId;
|
||||
use marine_rs_sdk::marine;
|
||||
use std::convert::TryFrom;
|
||||
use std::str::FromStr;
|
||||
|
@ -18,7 +18,7 @@ use crate::error::ServiceError::*;
|
||||
use crate::storage_impl::{SQLiteStorage, DB_PATH};
|
||||
use crate::TRUSTED_TIMESTAMP;
|
||||
use fluence_keypair::PublicKey;
|
||||
use libp2p_core::PeerId;
|
||||
use libp2p_identity::PeerId;
|
||||
use marine_rs_sdk::CallParameters;
|
||||
use std::cell::RefCell;
|
||||
use std::convert::TryFrom;
|
||||
@ -46,7 +46,7 @@ pub(crate) fn check_timestamp_tetraplets(
|
||||
}
|
||||
|
||||
fn parse_peer_id(peer_id: String) -> Result<PeerId, ServiceError> {
|
||||
libp2p_core::PeerId::from_str(&peer_id)
|
||||
libp2p_identity::PeerId::from_str(&peer_id)
|
||||
.map_err(|e| ServiceError::PeerIdParseError(format!("{e:?}")))
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ mod service_tests {
|
||||
use crate::storage_impl::DB_PATH;
|
||||
use crate::TRUSTED_TIMESTAMP;
|
||||
use fluence_keypair::KeyPair;
|
||||
use libp2p_core::PeerId;
|
||||
use libp2p_identity::PeerId;
|
||||
use marine_rs_sdk::{CallParameters, SecurityTetraplet};
|
||||
use marine_test_env::trust_graph::{Certificate, Revocation, ServiceInterface, Trust};
|
||||
use rusqlite::Connection;
|
||||
|
Loading…
Reference in New Issue
Block a user