Skip to content

Commit

Permalink
feat(network): initial gossip implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
dancoombs committed Oct 12, 2023
1 parent 6c48301 commit 9d38cc8
Show file tree
Hide file tree
Showing 16 changed files with 1,012 additions and 244 deletions.
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

0 comments on commit 9d38cc8

Please sign in to comment.