From e26c5acb38e1afe605297454b878cf0fdf807a08 Mon Sep 17 00:00:00 2001 From: Haardik Date: Sun, 10 Dec 2023 13:44:45 -0500 Subject: [PATCH] Run cargo fix and update readme to remove RocksDB reference --- README.md | 4 ++-- lib/hub/src/main.rs | 17 +++++++---------- lib/hub/src/p2p/event_loop.rs | 20 ++++++++++---------- lib/hub/src/p2p/gossip_node.rs | 6 +++--- lib/hub/src/sync/trienode.rs | 2 +- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index fe841f4..11fa171 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ There are a few things Teleport is currently capable of, and a lot more it is no - [x] Start a libp2p gossip node and connect to other peers - [x] Broadcast Gossip Messages to enable features like posting casts -- [-] Do pubsub peer discovery over gossipsub (partial support) +- [-] Do PubSub peer discovery over GossipSub (partial support) A lot is still left to do: @@ -27,7 +27,7 @@ Persistent Storage, handling received messages from peers, and historical data s - Rust - Protobufs Compiler (`brew install protobuf` or `apt install -y protobuf-compiler`) -- RocksDB binaries ([Instructions here](https://github.com/facebook/rocksdb/blob/master/INSTALL.md)) +- SQLx CLI (`cargo install sqlx-cli`) ## Prost Patch diff --git a/lib/hub/src/main.rs b/lib/hub/src/main.rs index ace8441..0e411be 100644 --- a/lib/hub/src/main.rs +++ b/lib/hub/src/main.rs @@ -4,15 +4,12 @@ pub mod storage; pub mod sync; pub mod validation; -use ethers::providers::Middleware; + use teleport_common::protobufs::generated::hub_service_server::HubServiceServer; -use teleport_common::protobufs::generated::{cast_add_body, CastId, FarcasterNetwork, PeerIdProto}; -use teleport_common::protobufs::{ - self, - generated::{HashScheme, SignatureScheme}, -}; -use teleport_common::time::get_farcaster_time; +use teleport_common::protobufs::generated::{FarcasterNetwork, PeerIdProto}; + + //use crate::{HubOptions}; use std::fs::{self, canonicalize}; use std::path::PathBuf; @@ -90,7 +87,7 @@ async fn main() { // tokio::time::sleep(std::time::Duration::from_secs(0)).await; - let state = gossip_node.get_state().await.unwrap(); + let _state = gossip_node.get_state().await.unwrap(); tokio::time::sleep(std::time::Duration::from_secs(150)).await; @@ -128,13 +125,13 @@ fn start(args: teleport_cli::start::StartCommand) { peer_id = PeerId::random(); - let rpc_auth: String; + let _rpc_auth: String; if args.debugging_options.rpc_auth.is_some() { } else if std::env::var("RPC_AUTH").is_ok() { } else { } - let rpc_rate_limit: i32; + let _rpc_rate_limit: i32; if args.networking_options.rpc_rate_limit.is_some() { } else { } diff --git a/lib/hub/src/p2p/event_loop.rs b/lib/hub/src/p2p/event_loop.rs index 5f93f4c..2602baa 100644 --- a/lib/hub/src/p2p/event_loop.rs +++ b/lib/hub/src/p2p/event_loop.rs @@ -258,7 +258,7 @@ impl EventLoop { let validator = Validator::new(&message); match validator.validate() { Ok(_) => { - let db = self.state.db.as_mut().unwrap(); + let _db = self.state.db.as_mut().unwrap(); } Err(err) => { println!("Failed to validate message: {:?}", err); @@ -299,31 +299,31 @@ impl EventLoop { SwarmEvent::ConnectionEstablished { peer_id, connection_id, - endpoint, - num_established, - concurrent_dial_errors, - established_in, + endpoint: _, + num_established: _, + concurrent_dial_errors: _, + established_in: _, } => println!("Connection established: {:?}", (peer_id, connection_id)), SwarmEvent::ConnectionClosed { peer_id, connection_id, - endpoint, - num_established, - cause, + endpoint: _, + num_established: _, + cause: _, } => { println!("Connection closed: {:?}", (peer_id, connection_id)) } SwarmEvent::IncomingConnection { connection_id, local_addr, - send_back_addr, + send_back_addr: _, } => { println!("Incoming connection: {:?}", (connection_id, local_addr)) } SwarmEvent::IncomingConnectionError { connection_id, local_addr, - send_back_addr, + send_back_addr: _, error, } => { println!( diff --git a/lib/hub/src/p2p/gossip_node.rs b/lib/hub/src/p2p/gossip_node.rs index 3310d47..11c31d5 100644 --- a/lib/hub/src/p2p/gossip_node.rs +++ b/lib/hub/src/p2p/gossip_node.rs @@ -9,7 +9,7 @@ use libp2p::{ }, gossipsub::{self, Message as GossipSubMessage, MessageAuthenticity, MessageId}, identify, identity, noise, ping, - swarm::{derive_prelude::Either, SwarmBuilder, SwarmEvent}, + swarm::{SwarmBuilder}, Multiaddr, PeerId, Swarm, Transport, }; use prost::Message; @@ -23,11 +23,11 @@ use teleport_common::{ }; use teleport_storage::Store; use tokio::spawn; -use void::Void; + use super::{ event_loop::{EventLoop, EventLoopState}, - gossip_behaviour::{GossipBehaviour, GossipBehaviourEvent}, + gossip_behaviour::{GossipBehaviour}, }; const MULTI_ADDR_LOCAL_HOST: &str = "/ip4/127.0.0.1"; diff --git a/lib/hub/src/sync/trienode.rs b/lib/hub/src/sync/trienode.rs index 37e1c36..518e910 100644 --- a/lib/hub/src/sync/trienode.rs +++ b/lib/hub/src/sync/trienode.rs @@ -1,5 +1,5 @@ use std::collections::HashMap; -use teleport_storage::Store; + enum TrieNodeLike { Serialized(SerializedTrieNode),