Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Replace remaining bincode calls with wire. #946

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions nodes/nomos-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"] }
Expand Down
2 changes: 2 additions & 0 deletions nomos-core/chain-defs/src/wire.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down
1 change: 0 additions & 1 deletion nomos-da/network/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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,
},
Expand Down
6 changes: 3 additions & 3 deletions nomos-da/network/core/src/protocols/mod.rs
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
3 changes: 2 additions & 1 deletion nomos-da/network/core/src/protocols/sampling/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion nomos-services/mempool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
Loading