mirror of
https://github.com/fluencelabs/trust-graph
synced 2024-12-04 23:30: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"] }
|
serde = { version = "1.0.118", features = ["derive"] }
|
||||||
|
|
||||||
fluence-keypair = { path = "./keypair", version = "0.9.0" }
|
fluence-keypair = { path = "./keypair", version = "0.9.0" }
|
||||||
serde_json = "1.0.58"
|
bs58 = "0.4.0"
|
||||||
bs58 = "0.3.1"
|
|
||||||
failure = "0.1.6"
|
failure = "0.1.6"
|
||||||
log = "0.4.11"
|
log = "0.4.11"
|
||||||
ref-cast = "1.0.2"
|
ref-cast = "1.0.2"
|
||||||
derivative = "2.1.1"
|
derivative = "2.1.1"
|
||||||
signature = "1.3.0"
|
|
||||||
serde_with = "1.6.0"
|
|
||||||
thiserror = "1.0.23"
|
thiserror = "1.0.23"
|
||||||
sha2 = "0.9.5"
|
sha2 = "0.10.6"
|
||||||
rand = "0.7.0"
|
rand = "0.8.5"
|
||||||
nonempty = "0.7.0"
|
nonempty = "0.8.1"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
@ -31,4 +28,4 @@ members = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[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]
|
[dependencies]
|
||||||
serde = { version = "1.0.118", features = ["derive"] }
|
serde = { version = "1.0.118", features = ["derive"] }
|
||||||
serde_json = "1.0.58"
|
bs58 = "0.4.0"
|
||||||
bs58 = "0.3.1"
|
|
||||||
ed25519-dalek = { version = "1.0.1", features = ["serde", "std"] }
|
ed25519-dalek = { version = "1.0.1", features = ["serde", "std"] }
|
||||||
rand = "0.7.0"
|
rand = "0.8.5"
|
||||||
signature = "1.3.0"
|
|
||||||
ed25519 = "1.0.3"
|
|
||||||
serde_with = "1.6.0"
|
|
||||||
thiserror = "1.0.23"
|
thiserror = "1.0.23"
|
||||||
lazy_static = "1.2"
|
lazy_static = "1.2"
|
||||||
libsecp256k1 = "0.7.1"
|
libsecp256k1 = "0.7.1"
|
||||||
asn1_der = "0.6.1"
|
asn1_der = "0.6.1"
|
||||||
sha2 = "0.9.1"
|
sha2 = "0.10.6"
|
||||||
zeroize = "1"
|
zeroize = "1"
|
||||||
serde_bytes = "0.11"
|
serde_bytes = "0.11"
|
||||||
libp2p-core = { workspace = true }
|
|
||||||
eyre = "0.6.5"
|
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]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
ring = { version = "0.16.9", features = ["alloc", "std"], default-features = false }
|
ring = { version = "0.16.9", features = ["alloc", "std"], default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
quickcheck = "0.9.0"
|
quickcheck = "1.0.3"
|
||||||
|
@ -26,7 +26,7 @@ use crate::public_key::PublicKey;
|
|||||||
use crate::rsa;
|
use crate::rsa;
|
||||||
use crate::secp256k1;
|
use crate::secp256k1;
|
||||||
use crate::signature::Signature;
|
use crate::signature::Signature;
|
||||||
use libp2p_core::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
@ -235,16 +235,17 @@ impl KeyPair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<libp2p_core::identity::Keypair> for KeyPair {
|
impl From<libp2p_identity::Keypair> for KeyPair {
|
||||||
fn from(key: libp2p_core::identity::Keypair) -> Self {
|
fn from(key: libp2p_identity::Keypair) -> Self {
|
||||||
use libp2p_core::identity::Keypair::*;
|
use libp2p_identity::Keypair::*;
|
||||||
|
|
||||||
|
#[allow(deprecated)] //TODO: fix it later
|
||||||
match key {
|
match key {
|
||||||
Ed25519(kp) => KeyPair::Ed25519(ed25519::Keypair::decode(&mut kp.encode()).unwrap()),
|
Ed25519(kp) => KeyPair::Ed25519(ed25519::Keypair::decode(&mut kp.encode()).unwrap()),
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
// safety: these Keypair structures are identical
|
// safety: these Keypair structures are identical
|
||||||
Rsa(kp) => KeyPair::Rsa(unsafe {
|
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(kp) => KeyPair::Secp256k1(secp256k1::Keypair::from(
|
||||||
secp256k1::SecretKey::from_bytes(kp.secret().to_bytes()).unwrap(),
|
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 {
|
fn from(key: KeyPair) -> Self {
|
||||||
use libp2p_core::identity;
|
use libp2p_identity::Keypair;
|
||||||
use libp2p_core::identity::Keypair;
|
|
||||||
use KeyPair::*;
|
use KeyPair::*;
|
||||||
|
|
||||||
|
#[allow(deprecated)] //TODO: fix it later
|
||||||
match key {
|
match key {
|
||||||
Ed25519(kp) => Keypair::Ed25519(
|
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"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
// safety: these Keypair structures are identical
|
// safety: these Keypair structures are identical
|
||||||
Rsa(kp) => Keypair::Rsa(unsafe {
|
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(
|
Secp256k1(kp) => Keypair::Secp256k1(libp2p_identity::secp256k1::Keypair::from(
|
||||||
identity::secp256k1::SecretKey::from_bytes(kp.secret().to_bytes()).unwrap(),
|
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 use key_pair::KeyPair;
|
||||||
|
|
||||||
pub mod peerid_serializer {
|
pub mod peerid_serializer {
|
||||||
use libp2p_core::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ use crate::secp256k1;
|
|||||||
use crate::signature::Signature;
|
use crate::signature::Signature;
|
||||||
|
|
||||||
use crate::key_pair::KeyFormat;
|
use crate::key_pair::KeyFormat;
|
||||||
use libp2p_core::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
@ -124,10 +124,11 @@ impl PublicKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<libp2p_core::identity::PublicKey> for PublicKey {
|
impl From<libp2p_identity::PublicKey> for PublicKey {
|
||||||
fn from(key: libp2p_core::identity::PublicKey) -> Self {
|
fn from(key: libp2p_identity::PublicKey) -> Self {
|
||||||
use libp2p_core::identity::PublicKey::*;
|
use libp2p_identity::PublicKey::*;
|
||||||
|
|
||||||
|
#[allow(deprecated)] //TODO: fix it later
|
||||||
match key {
|
match key {
|
||||||
Ed25519(key) => {
|
Ed25519(key) => {
|
||||||
PublicKey::Ed25519(ed25519::PublicKey::decode(&key.encode()[..]).unwrap())
|
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 {
|
fn from(key: PublicKey) -> Self {
|
||||||
use libp2p_core::identity as libp2p_identity;
|
#[allow(deprecated)] //TODO: fix it later
|
||||||
|
|
||||||
match key {
|
match key {
|
||||||
PublicKey::Ed25519(key) => libp2p_identity::PublicKey::Ed25519(
|
PublicKey::Ed25519(key) => libp2p_identity::PublicKey::Ed25519(
|
||||||
libp2p_identity::ed25519::PublicKey::decode(&key.encode()[..]).unwrap(),
|
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;
|
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(as_public_key(&peer_id)
|
||||||
.ok_or_else(|| DecodingError::PublicKeyNotInlined(peer_id.to_base58()))?
|
.ok_or_else(|| DecodingError::PublicKeyNotInlined(peer_id.to_base58()))?
|
||||||
.into())
|
.into())
|
||||||
@ -171,14 +171,12 @@ impl TryFrom<libp2p_core::PeerId> for PublicKey {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Convert PeerId to libp2p's PublicKey
|
/// Convert PeerId to libp2p's PublicKey
|
||||||
fn as_public_key(peer_id: &PeerId) -> Option<libp2p_core::PublicKey> {
|
fn as_public_key(peer_id: &PeerId) -> Option<libp2p_identity::PublicKey> {
|
||||||
use libp2p_core::multihash;
|
|
||||||
|
|
||||||
let mhash = peer_id.as_ref();
|
let mhash = peer_id.as_ref();
|
||||||
|
|
||||||
match multihash::Code::try_from(mhash.code()) {
|
match multihash::Code::try_from(mhash.code()) {
|
||||||
Ok(multihash::Code::Identity) => {
|
Ok(multihash::Code::Identity) => {
|
||||||
libp2p_core::PublicKey::from_protobuf_encoding(mhash.digest()).ok()
|
libp2p_identity::PublicKey::from_protobuf_encoding(mhash.digest()).ok()
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
@ -209,7 +207,7 @@ mod tests {
|
|||||||
fn public_key_peer_id_conversions() {
|
fn public_key_peer_id_conversions() {
|
||||||
let kp = KeyPair::generate_secp256k1();
|
let kp = KeyPair::generate_secp256k1();
|
||||||
let fluence_pk = kp.public();
|
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 peer_id = PeerId::from_public_key(&libp2p_pk);
|
||||||
let fluence_pk_converted = PublicKey::try_from(peer_id).unwrap();
|
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 = "../." }
|
trust-graph = { version = "0.3.0", path = "../." }
|
||||||
fluence-keypair = { version = "0.9.0", path = "../keypair" }
|
fluence-keypair = { version = "0.9.0", path = "../keypair" }
|
||||||
marine-rs-sdk = { version = "0.7.1", features = ["logger"] }
|
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"
|
log = "0.4.8"
|
||||||
anyhow = "1.0.31"
|
anyhow = "1.0.31"
|
||||||
boolinator = "2.4.0"
|
|
||||||
once_cell = "1.4.1"
|
once_cell = "1.4.1"
|
||||||
parking_lot = "0.11.1"
|
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
bs58 = "0.3.1"
|
bs58 = "0.4.0"
|
||||||
rmp-serde = "0.15.0"
|
rmp-serde = "1.1.1"
|
||||||
bincode = "1.3.1"
|
bincode = "1.3.1"
|
||||||
serde_bencode = "^0.2.3"
|
|
||||||
thiserror = "1.0.23"
|
thiserror = "1.0.23"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
marine-rs-sdk-test = "0.8.1"
|
marine-rs-sdk-test = "0.8.1"
|
||||||
rusqlite = "0.26.1"
|
rusqlite = "0.28.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
marine-rs-sdk-test = "0.8.1"
|
marine-rs-sdk-test = "0.8.1"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::dto::DtoConversionError::PeerIdDecodeError;
|
use crate::dto::DtoConversionError::PeerIdDecodeError;
|
||||||
use fluence_keypair::error::DecodingError;
|
use fluence_keypair::error::DecodingError;
|
||||||
use fluence_keypair::{KeyFormat, PublicKey, Signature};
|
use fluence_keypair::{KeyFormat, PublicKey, Signature};
|
||||||
use libp2p_core::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use marine_rs_sdk::marine;
|
use marine_rs_sdk::marine;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
@ -18,7 +18,7 @@ use crate::error::ServiceError::*;
|
|||||||
use crate::storage_impl::{SQLiteStorage, DB_PATH};
|
use crate::storage_impl::{SQLiteStorage, DB_PATH};
|
||||||
use crate::TRUSTED_TIMESTAMP;
|
use crate::TRUSTED_TIMESTAMP;
|
||||||
use fluence_keypair::PublicKey;
|
use fluence_keypair::PublicKey;
|
||||||
use libp2p_core::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use marine_rs_sdk::CallParameters;
|
use marine_rs_sdk::CallParameters;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
@ -46,7 +46,7 @@ pub(crate) fn check_timestamp_tetraplets(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn parse_peer_id(peer_id: String) -> Result<PeerId, ServiceError> {
|
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:?}")))
|
.map_err(|e| ServiceError::PeerIdParseError(format!("{e:?}")))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ mod service_tests {
|
|||||||
use crate::storage_impl::DB_PATH;
|
use crate::storage_impl::DB_PATH;
|
||||||
use crate::TRUSTED_TIMESTAMP;
|
use crate::TRUSTED_TIMESTAMP;
|
||||||
use fluence_keypair::KeyPair;
|
use fluence_keypair::KeyPair;
|
||||||
use libp2p_core::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use marine_rs_sdk::{CallParameters, SecurityTetraplet};
|
use marine_rs_sdk::{CallParameters, SecurityTetraplet};
|
||||||
use marine_test_env::trust_graph::{Certificate, Revocation, ServiceInterface, Trust};
|
use marine_test_env::trust_graph::{Certificate, Revocation, ServiceInterface, Trust};
|
||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
|
Loading…
Reference in New Issue
Block a user