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

[WIP] feat(network): initial gossip implementation #465

Closed
wants to merge 1 commit into from
Closed
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
91 changes: 72 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions crates/network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,27 @@ rundler-types = { path = "../types" }
ethereum_ssz = "0.5.3"
ethereum_ssz_derive = "0.5.3"
ethers.workspace = true
snap = "1.1.0"
ssz_types = "0.5.4"
discv5 = { version = "0.3.1", features = ["libp2p"] }
futures.workspace = true
hex = "0.4.3"
libp2p-mplex = "0.40.0"
sha2 = "0.10.8"
snap = "1.1.0"
ssz_types = "0.5.4"
tokio.workspace = true
tokio-io-timeout = "1.2.0"
tokio-util = { workspace = true, features = ["codec", "compat"] }
thiserror.workspace = true
tracing.workspace = true
unsigned-varint = { version = "0.7.2", features = ["codec"] }

# required version by gossipsub
getrandom = "0.2.10"

[dependencies.libp2p]
version = "0.52.3"
default-features = false
features = ["tokio", "noise", "macros", "tcp", "identify", "yamux", "secp256k1"]
features = ["tokio", "noise", "macros", "tcp", "identify", "yamux", "secp256k1", "gossipsub"]

[dev-dependencies]
rand.workspace = true
Expand Down
5 changes: 4 additions & 1 deletion crates/network/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ use libp2p::{
swarm::{keep_alive, NetworkBehaviour},
};

use crate::{discovery, rpc};
use crate::{discovery, gossip, rpc};

pub(crate) type GossipSub = libp2p::gossipsub::Behaviour<gossip::SnappyTransform>;

#[derive(NetworkBehaviour)]
pub(crate) struct Behaviour {
// TODO(danc): temp, remove when not needed
pub(crate) keep_alive: keep_alive::Behaviour,
pub(crate) gossipsub: GossipSub,
// Request/response protocol
pub(crate) rpc: rpc::Behaviour,
// Discv5 based discovery protocol
Expand Down
Loading
Loading