refactor: Replace remaining bincode calls with wire. (#946)
This commit is contained in:
parent
d5d87b094c
commit
044fd4c8ee
|
@ -8,7 +8,6 @@ edition = "2021"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
blake2 = "0.10"
|
blake2 = "0.10"
|
||||||
bincode = "2.0.0-rc.2"
|
|
||||||
bytes = "1.3"
|
bytes = "1.3"
|
||||||
clap = { version = "4", features = ["derive", "env"] }
|
clap = { version = "4", features = ["derive", "env"] }
|
||||||
chrono = "0.4"
|
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" }
|
overwatch-derive = { git = "https://github.com/logos-co/Overwatch", rev = "ac28d01" }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
multiaddr = "0.18"
|
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-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-verifier = { path = "../../nomos-services/data-availability/verifier", features = ["rocksdb-backend", "libp2p"] }
|
||||||
nomos-da-indexer = { path = "../../nomos-services/data-availability/indexer", features = ["rocksdb-backend"] }
|
nomos-da-indexer = { path = "../../nomos-services/data-availability/indexer", features = ["rocksdb-backend"] }
|
||||||
|
|
|
@ -15,6 +15,8 @@ use serde::de::DeserializeOwned;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
pub type Error = bincode::Error;
|
pub type Error = bincode::Error;
|
||||||
|
pub type ErrorKind = bincode::ErrorKind;
|
||||||
|
|
||||||
// type composition is cool but also makes naming types a bit akward
|
// type composition is cool but also makes naming types a bit akward
|
||||||
type BincodeOptions = WithOtherTrailing<
|
type BincodeOptions = WithOtherTrailing<
|
||||||
WithOtherIntEncoding<
|
WithOtherIntEncoding<
|
||||||
|
|
|
@ -4,7 +4,6 @@ version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bincode = "1.3"
|
|
||||||
libp2p = { version = "0.53", features = ["macros", "tokio", "quic"] }
|
libp2p = { version = "0.53", features = ["macros", "tokio", "quic"] }
|
||||||
libp2p-stream = "0.1.0-alpha"
|
libp2p-stream = "0.1.0-alpha"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
|
|
|
@ -29,6 +29,7 @@ use crate::protocols::clone_deserialize_error;
|
||||||
use crate::SubnetworkId;
|
use crate::SubnetworkId;
|
||||||
use kzgrs_backend::common::blob::DaBlob;
|
use kzgrs_backend::common::blob::DaBlob;
|
||||||
use nomos_core::da::BlobId;
|
use nomos_core::da::BlobId;
|
||||||
|
use nomos_core::wire;
|
||||||
use nomos_da_messages::common::Blob;
|
use nomos_da_messages::common::Blob;
|
||||||
use nomos_da_messages::dispersal;
|
use nomos_da_messages::dispersal;
|
||||||
use nomos_da_messages::packing::{pack_to_writer, unpack_from_reader};
|
use nomos_da_messages::packing::{pack_to_writer, unpack_from_reader};
|
||||||
|
@ -44,7 +45,7 @@ pub enum DispersalError {
|
||||||
},
|
},
|
||||||
#[error("Could not serialized: {error}")]
|
#[error("Could not serialized: {error}")]
|
||||||
Serialization {
|
Serialization {
|
||||||
error: bincode::Error,
|
error: wire::Error,
|
||||||
blob_id: BlobId,
|
blob_id: BlobId,
|
||||||
subnetwork_id: SubnetworkId,
|
subnetwork_id: SubnetworkId,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
pub mod dispersal;
|
pub mod dispersal;
|
||||||
pub mod replication;
|
pub mod replication;
|
||||||
pub mod sampling;
|
pub mod sampling;
|
||||||
|
use nomos_core::wire;
|
||||||
|
|
||||||
use bincode::ErrorKind;
|
fn clone_deserialize_error(error: &wire::Error) -> wire::Error {
|
||||||
|
use wire::ErrorKind;
|
||||||
fn clone_deserialize_error(error: &bincode::Error) -> bincode::Error {
|
|
||||||
Box::new(match error.as_ref() {
|
Box::new(match error.as_ref() {
|
||||||
ErrorKind::Io(error) => ErrorKind::Io(std::io::Error::new(error.kind(), error.to_string())),
|
ErrorKind::Io(error) => ErrorKind::Io(std::io::Error::new(error.kind(), error.to_string())),
|
||||||
ErrorKind::InvalidUtf8Encoding(error) => ErrorKind::InvalidUtf8Encoding(*error),
|
ErrorKind::InvalidUtf8Encoding(error) => ErrorKind::InvalidUtf8Encoding(*error),
|
||||||
|
|
|
@ -19,6 +19,7 @@ use libp2p::swarm::{
|
||||||
use libp2p::{Multiaddr, PeerId, Stream};
|
use libp2p::{Multiaddr, PeerId, Stream};
|
||||||
use libp2p_stream::{Control, IncomingStreams, OpenStreamError};
|
use libp2p_stream::{Control, IncomingStreams, OpenStreamError};
|
||||||
use nomos_core::da::BlobId;
|
use nomos_core::da::BlobId;
|
||||||
|
use nomos_core::wire;
|
||||||
use nomos_da_messages::packing::{pack_to_writer, unpack_from_reader};
|
use nomos_da_messages::packing::{pack_to_writer, unpack_from_reader};
|
||||||
use nomos_da_messages::{common, sampling};
|
use nomos_da_messages::{common, sampling};
|
||||||
use subnetworks_assignations::MembershipHandler;
|
use subnetworks_assignations::MembershipHandler;
|
||||||
|
@ -56,7 +57,7 @@ pub enum SamplingError {
|
||||||
blob_id: BlobId,
|
blob_id: BlobId,
|
||||||
subnetwork_id: SubnetworkId,
|
subnetwork_id: SubnetworkId,
|
||||||
peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
error: bincode::Error,
|
error: wire::Error,
|
||||||
},
|
},
|
||||||
#[error("Error sending request: {request:?}")]
|
#[error("Error sending request: {request:?}")]
|
||||||
RequestChannel {
|
RequestChannel {
|
||||||
|
|
|
@ -7,7 +7,6 @@ edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
bincode = { version = "2.0.0-rc.2", features = ["serde"] }
|
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
linked-hash-map = { version = "0.5.6", optional = true }
|
linked-hash-map = { version = "0.5.6", optional = true }
|
||||||
nomos-network = { path = "../network" }
|
nomos-network = { path = "../network" }
|
||||||
|
|
Loading…
Reference in New Issue