refactor: Replace remaining bincode calls with wire. (#946)

This commit is contained in:
Álex 2024-12-18 17:37:41 +01:00 committed by GitHub
parent d5d87b094c
commit 044fd4c8ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 10 additions and 9 deletions

View File

@ -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"

View File

@ -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<

View File

@ -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"

View File

@ -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,
},

View File

@ -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),

View File

@ -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 {

View File

@ -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" }