diff --git a/nodes/nomos-node/Cargo.toml b/nodes/nomos-node/Cargo.toml index 4167f34b..1f1cf2cb 100644 --- a/nodes/nomos-node/Cargo.toml +++ b/nodes/nomos-node/Cargo.toml @@ -8,7 +8,6 @@ edition = "2021" [dependencies] async-trait = "0.1" blake2 = "0.10" -bincode = "2.0.0-rc.2" bytes = "1.3" clap = { version = "4", features = ["derive", "env"] } chrono = "0.4" @@ -22,7 +21,7 @@ overwatch-rs = { git = "https://github.com/logos-co/Overwatch", rev = "2f70806" overwatch-derive = { git = "https://github.com/logos-co/Overwatch", rev = "ac28d01" } tracing = "0.1" multiaddr = "0.18" -nomos-core = { path = "../../nomos-core/chain-defs"} +nomos-core = { path = "../../nomos-core/chain-defs" } nomos-da-sampling = { path = "../../nomos-services/data-availability/sampling", features = ["rocksdb-backend"] } nomos-da-verifier = { path = "../../nomos-services/data-availability/verifier", features = ["rocksdb-backend", "libp2p"] } nomos-da-indexer = { path = "../../nomos-services/data-availability/indexer", features = ["rocksdb-backend"] } diff --git a/nomos-core/chain-defs/src/wire.rs b/nomos-core/chain-defs/src/wire.rs index 7b42a0df..30764d26 100644 --- a/nomos-core/chain-defs/src/wire.rs +++ b/nomos-core/chain-defs/src/wire.rs @@ -15,6 +15,8 @@ use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; pub type Error = bincode::Error; +pub type ErrorKind = bincode::ErrorKind; + // type composition is cool but also makes naming types a bit akward type BincodeOptions = WithOtherTrailing< WithOtherIntEncoding< diff --git a/nomos-da/network/core/Cargo.toml b/nomos-da/network/core/Cargo.toml index e6bd331e..a059e291 100644 --- a/nomos-da/network/core/Cargo.toml +++ b/nomos-da/network/core/Cargo.toml @@ -4,7 +4,6 @@ version = "0.1.0" edition = "2021" [dependencies] -bincode = "1.3" libp2p = { version = "0.53", features = ["macros", "tokio", "quic"] } libp2p-stream = "0.1.0-alpha" futures = "0.3" diff --git a/nomos-da/network/core/src/protocols/dispersal/executor/behaviour.rs b/nomos-da/network/core/src/protocols/dispersal/executor/behaviour.rs index 233d2f98..a2078964 100644 --- a/nomos-da/network/core/src/protocols/dispersal/executor/behaviour.rs +++ b/nomos-da/network/core/src/protocols/dispersal/executor/behaviour.rs @@ -29,6 +29,7 @@ use crate::protocols::clone_deserialize_error; use crate::SubnetworkId; use kzgrs_backend::common::blob::DaBlob; use nomos_core::da::BlobId; +use nomos_core::wire; use nomos_da_messages::common::Blob; use nomos_da_messages::dispersal; use nomos_da_messages::packing::{pack_to_writer, unpack_from_reader}; @@ -44,7 +45,7 @@ pub enum DispersalError { }, #[error("Could not serialized: {error}")] Serialization { - error: bincode::Error, + error: wire::Error, blob_id: BlobId, subnetwork_id: SubnetworkId, }, diff --git a/nomos-da/network/core/src/protocols/mod.rs b/nomos-da/network/core/src/protocols/mod.rs index 547535ae..e5b5d2ca 100644 --- a/nomos-da/network/core/src/protocols/mod.rs +++ b/nomos-da/network/core/src/protocols/mod.rs @@ -1,10 +1,10 @@ pub mod dispersal; pub mod replication; pub mod sampling; +use nomos_core::wire; -use bincode::ErrorKind; - -fn clone_deserialize_error(error: &bincode::Error) -> bincode::Error { +fn clone_deserialize_error(error: &wire::Error) -> wire::Error { + use wire::ErrorKind; Box::new(match error.as_ref() { ErrorKind::Io(error) => ErrorKind::Io(std::io::Error::new(error.kind(), error.to_string())), ErrorKind::InvalidUtf8Encoding(error) => ErrorKind::InvalidUtf8Encoding(*error), diff --git a/nomos-da/network/core/src/protocols/sampling/behaviour.rs b/nomos-da/network/core/src/protocols/sampling/behaviour.rs index ff22e9d0..43e8827a 100644 --- a/nomos-da/network/core/src/protocols/sampling/behaviour.rs +++ b/nomos-da/network/core/src/protocols/sampling/behaviour.rs @@ -19,6 +19,7 @@ use libp2p::swarm::{ use libp2p::{Multiaddr, PeerId, Stream}; use libp2p_stream::{Control, IncomingStreams, OpenStreamError}; use nomos_core::da::BlobId; +use nomos_core::wire; use nomos_da_messages::packing::{pack_to_writer, unpack_from_reader}; use nomos_da_messages::{common, sampling}; use subnetworks_assignations::MembershipHandler; @@ -56,7 +57,7 @@ pub enum SamplingError { blob_id: BlobId, subnetwork_id: SubnetworkId, peer_id: PeerId, - error: bincode::Error, + error: wire::Error, }, #[error("Error sending request: {request:?}")] RequestChannel { diff --git a/nomos-services/mempool/Cargo.toml b/nomos-services/mempool/Cargo.toml index b0b4051e..bcf04416 100644 --- a/nomos-services/mempool/Cargo.toml +++ b/nomos-services/mempool/Cargo.toml @@ -7,7 +7,6 @@ edition = "2021" [dependencies] async-trait = "0.1" -bincode = { version = "2.0.0-rc.2", features = ["serde"] } futures = "0.3" linked-hash-map = { version = "0.5.6", optional = true } nomos-network = { path = "../network" }