Skip to content

Commit

Permalink
Bump up versions and cleanup most of warnings (#1037)
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n authored Apr 14, 2024
1 parent d01f814 commit 1fc7456
Show file tree
Hide file tree
Showing 28 changed files with 391 additions and 164 deletions.
452 changes: 357 additions & 95 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ bs58 = "0.5"
chacha20poly1305 = "0.10"
chrono = { version = "0.4", default-features = true }
clap = "4"
crossbeam = "0.8.2"
crossbeam = "0.8"
ctrlc = { version = "3.4" }
dashmap = "^5.5"
either = "1.8"
either = "1.11"
futures = "0.3"
rand = { version = "0.8" }
semver = { version = "1.0.14", features = ["serde"] }
semver = { version = "1", features = ["serde"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_with = "3"
tracing = "0.1"
tracing-subscriber = "0.3"
wasmer = "4.2.0"
wasmer = "4.2"

freenet-stdlib = { path = "./stdlib/rust/", features = ["unstable"] }
# freenet-stdlib = { version = "0.0.8" }
Expand Down
33 changes: 17 additions & 16 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ path = "src/bin/freenet.rs"

[dependencies]
anyhow = "1"
arc-swap = "1.6"
arc-swap = "1.7"
asynchronous-codec = "0.7"
aes-gcm = "0.10.3"
async-trait = "0.1"
Expand All @@ -24,38 +24,38 @@ blake3 = { workspace = true }
bs58 = "0.5"
byteorder = "1"
bytes = "1"
cache-padded = "1.1.1"
cache-padded = "1.3"
chacha20poly1305 = { workspace = true }
chrono = { workspace = true }
clap = { features = ["derive", "env"], workspace = true }
config = { features = ["toml"], version = "0.13.0" }
config = { features = ["toml"], version = "0.14" }
cookie = "0.18"
crossbeam = { workspace = true }
ctrlc = { features = ["termination"], workspace = true }
dashmap = { workspace = true }
delegate = "0.12"
directories = "5"
either = { features = ["serde"], workspace = true }
flatbuffers = "23.5.26"
futures = "0.3.21"
flatbuffers = "24.3"
futures = "0.3"
headers = "0.4"
itertools = "0.12.1"
itertools = "0.12"
libp2p = { default-features = false, features = ["autonat", "dns", "ed25519", "identify", "macros", "noise", "ping", "tcp", "tokio", "yamux"], version = "0.52.3" }
libp2p-identity = { features = ["ed25519", "rand"], version = "0.2.7" }
notify = "6"
once_cell = "1"
ordered-float = "4.1.1"
ordered-float = "4.2"
pav_regression = "0.4.0"
parking_lot = "0.12.0"
parking_lot = "0.12"
rand = { features = ["small_rng"], workspace = true }
rocksdb = { default-features = false, optional = true, version = "0.21.0" }
rocksdb = { default-features = false, optional = true, version = "0.22" }
serde = { features = ["derive", "rc"], workspace = true }
serde_json = { workspace = true }
serde_with = { workspace = true }
sqlx = { features = ["runtime-tokio-rustls", "sqlite"], optional = true, version = "0.7" }
stretto = { features = ["async", "sync"], version = "0.8" }
tar = { version = "0.4.38" }
time = "0.3.30"
tar = { version = "0.4" }
time = "0.3"
thiserror = "1"
tokio = { features = ["fs", "macros", "rt-multi-thread", "sync", "process"], version = "1" }
tokio-tungstenite = "0.21"
Expand All @@ -64,15 +64,16 @@ ulid = { features = ["serde"], version = "1.1" }
unsigned-varint = { version = "0.8", features = ["codec", "asynchronous_codec"] }
wasmer = { features = ["sys"], workspace = true }
xz2 = { version = "0.1" }
reqwest = { version = "0.11.23", features = ["json"] }
reqwest = { version = "0.12", features = ["json"] }
rsa = { version = "0.9.6", features = ["serde"] }

# Tracing deps
opentelemetry = "0.21.0"
opentelemetry-jaeger = { features = ["collector_client", "isahc", "rt-tokio"], optional = true, version = "0.20.0" }
opentelemetry = "0.22"
opentelemetry-jaeger = { features = ["collector_client", "isahc", "rt-tokio"], optional = true, version = "0.21" }
tracing = { version = "0.1" }
tracing-opentelemetry = { optional = true, version = "0.22.0" }
tracing-opentelemetry = { optional = true, version = "0.23.0" }
tracing-subscriber = { optional = true, version = "0.3.16" }
opentelemetry-otlp = { optional = true, version = "0.15" }

# internal deps
freenet-stdlib = { features = ["net"], workspace = true }
Expand All @@ -95,5 +96,5 @@ network-mode = []
rocks_db = ["rocksdb"]
sqlite = ["sqlx"]
trace = ["tracing-subscriber"]
trace-ot = ["opentelemetry-jaeger", "trace", "tracing-opentelemetry"]
trace-ot = ["opentelemetry-jaeger", "trace", "tracing-opentelemetry", "opentelemetry-otlp"]
websocket = ["axum/ws"]
1 change: 0 additions & 1 deletion crates/core/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
convert::TryFrom,
fs::{self, File},
future::Future,
io::Read,
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/contract/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ pub(crate) trait ContractExecutor: Send + 'static {
key: ContractKey,
fetch_contract: bool,
) -> Result<(WrappedState, Option<ContractContainer>), ExecutorError>;

async fn store_contract(&mut self, contract: ContractContainer) -> Result<(), ExecutorError>;

async fn upsert_contract_state(
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/contract/executor/mock_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ impl ContractExecutor for Executor<MockRuntime> {
#[cfg(test)]
mod test {
use super::*;
use crate::wasm_runtime::{ContractStore, StateStore};

#[tokio::test(flavor = "multi_thread")]
async fn local_node_handle() -> Result<(), Box<dyn std::error::Error>> {
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/contract/storages/rocks_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::path::Path;
use freenet_stdlib::prelude::*;
use rocksdb::{Options, DB};

use crate::contract::ContractKey;
use crate::wasm_runtime::StateStorage;

pub struct RocksDb(DB);
Expand Down
5 changes: 1 addition & 4 deletions crates/core/src/contract/storages/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ use sqlx::{
ConnectOptions, Row, SqlitePool,
};

use crate::{
contract::ContractKey,
wasm_runtime::{ContractError, StateStorage, StateStoreError},
};
use crate::wasm_runtime::{ContractError, StateStorage, StateStoreError};

async fn create_contracts_table(pool: &SqlitePool) -> Result<(), SqlDbError> {
sqlx::query(
Expand Down
2 changes: 0 additions & 2 deletions crates/core/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ where
}

mod sealed_msg_type {
use crate::operations::update::UpdateMsg;

use super::*;

pub(crate) trait SealedTxType {
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/node/p2p_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ mod test {
use super::*;
use crate::{
client_events::test::MemoryEventsGen,
config::GlobalExecutor,
contract::MemoryContractHandler,
node::{testing_impl::get_free_port, InitPeerNode},
ring::Location,
Expand Down
2 changes: 0 additions & 2 deletions crates/core/src/operations/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,9 +1066,7 @@ mod messages {
use std::fmt::Display;

use super::*;
use crate::ring::{Location, PeerKeyLocation};

use crate::message::InnerMessage;
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
Expand Down
2 changes: 0 additions & 2 deletions crates/core/src/operations/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,8 +835,6 @@ mod messages {

use serde::{Deserialize, Serialize};

use crate::{contract::StoreResponse, message::InnerMessage};

use super::*;

#[derive(Debug, Serialize, Deserialize)]
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/operations/put.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,6 @@ mod messages {

use super::*;

use crate::message::InnerMessage;
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/operations/subscribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,6 @@ fn build_op_result(
}

mod messages {
use crate::message::InnerMessage;
use std::fmt::Display;

use super::*;
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::hash::Hash;
use std::{
cmp::Reverse,
collections::BTreeMap,
convert::TryFrom,
fmt::Display,
hash::Hasher,
ops::Add,
Expand Down
6 changes: 1 addition & 5 deletions crates/core/src/topology.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,6 @@ pub(crate) enum ConnectionAcquisitionStrategy {

#[cfg(test)]
mod tests {
use super::{Limits, TopologyManager};
use crate::topology::rate::Rate;
use crate::{message::TransactionType, ring::Location};

#[test]
fn test_topology() {
const NUM_REQUESTS: usize = 1_000;
Expand Down Expand Up @@ -608,7 +604,7 @@ mod tests {
use super::*;
use crate::ring::Distance;
use crate::test_utils::with_tracing;
use std::time::{Duration, Instant};
use std::time::Duration;

#[test]
fn test_resource_manager_report() {
Expand Down
2 changes: 0 additions & 2 deletions crates/core/src/topology/running_average.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ impl RunningAverage {

#[cfg(test)]
mod tests {
use std::time::{Duration, Instant};

use super::*;

#[test]
Expand Down
9 changes: 2 additions & 7 deletions crates/core/src/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1229,17 +1229,12 @@ pub(crate) mod tracer {
}

pub(super) mod test {
use dashmap::DashMap;
use std::{
collections::HashMap,
sync::{
atomic::{AtomicUsize, Ordering::SeqCst},
Arc,
},
sync::atomic::{AtomicUsize, Ordering::SeqCst},
};

use dashmap::DashMap;
use tokio_tungstenite::WebSocketStream;

use super::*;
use crate::{node::testing_impl::NodeLabel, ring::Distance};

Expand Down
4 changes: 1 addition & 3 deletions crates/core/src/transport/connection_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::pin::Pin;
use std::sync::atomic::AtomicU32;
use std::sync::Arc;
use std::time::Duration;
use std::vec::Vec;

use crate::transport::crypto::TransportSecretKey;
use crate::transport::packet_data::{AssymetricRSA, UnknownEncryption};
Expand Down Expand Up @@ -413,7 +412,7 @@ impl<S: Socket> UdpPacketsListener<S> {
&mut self,
remote_addr: SocketAddr,
remote_public_key: TransportPublicKey,
remote_is_gateway: bool,
_remote_is_gateway: bool,
) -> (
impl Future<Output = Result<(RemoteConnection, InboundRemoteConnection), TransportError>>
+ Send
Expand Down Expand Up @@ -741,7 +740,6 @@ impl InboundRemoteConnection {
mod test {
use std::{
collections::HashMap,
net::Ipv4Addr,
ops::Range,
sync::{
atomic::{AtomicU16, AtomicU64, AtomicUsize, Ordering},
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/transport/packet_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<DT: Encryption, const N: usize> PartialEq for PacketData<DT, N> {
mod tests {
use super::*;
use aes_gcm::aead::rand_core::RngCore;
use aes_gcm::{Aes128Gcm, KeyInit};
use aes_gcm::KeyInit;
use rand::rngs::OsRng;

#[test]
Expand Down
4 changes: 1 addition & 3 deletions crates/core/src/transport/peer_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::pin::Pin;
use std::sync::atomic::AtomicU32;
use std::sync::Arc;
use std::time::Duration;
use std::vec::Vec;

use crate::transport::packet_data::UnknownEncryption;
use aes_gcm::Aes128Gcm;
Expand Down Expand Up @@ -390,8 +389,7 @@ async fn packet_sending(
mod tests {
use aes_gcm::KeyInit;
use futures::TryFutureExt;
use std::net::{Ipv4Addr, SocketAddr};
use tokio::sync::mpsc;
use std::net::Ipv4Addr;

use super::{
inbound_stream::{recv_stream, InboundStream},
Expand Down
3 changes: 1 addition & 2 deletions crates/core/src/transport/peer_connection/outbound_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ pub(super) async fn send_stream(
#[cfg(test)]
mod tests {
use aes_gcm::KeyInit;
use std::net::{Ipv4Addr, SocketAddr};
use std::net::Ipv4Addr;
use tests::packet_data::MAX_PACKET_SIZE;
use tokio::sync::mpsc;

use super::{
symmetric_message::{SymmetricMessage, SymmetricMessagePayload},
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ impl<T> IterExt for T where T: Iterator {}
#[cfg(test)]
pub(crate) mod test {
use super::*;
use rand::Rng;

#[test]
fn randomize_iter() {
Expand Down
1 change: 0 additions & 1 deletion crates/core/src/util/time_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ impl TimeSource for MockTimeSource {
#[cfg(test)]
pub mod tests {
use super::*;
use std::time::Duration;

#[test]
fn test_instant_is_updated() {
Expand Down
2 changes: 0 additions & 2 deletions crates/core/src/wasm_runtime/native_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ fn compute_ptr<T>(ptr: i64, start_ptr: i64) -> *mut T {
}

pub(crate) mod log {
use wasmer::Function;

use super::*;

pub(crate) fn prepare_export(store: &mut wasmer::Store, imports: &mut Imports) {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/wasm_runtime/secrets_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ impl SecretsStore {
#[cfg(test)]
mod test {
use super::*;
use chacha20poly1305::aead::{AeadCore, KeyInit, OsRng};
use chacha20poly1305::aead::{AeadCore, OsRng};

#[test]
fn store_and_load() -> Result<(), Box<dyn std::error::Error>> {
Expand Down
3 changes: 1 addition & 2 deletions crates/core/src/wasm_runtime/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ impl<S: StoreFsManagement> SafeWriter<S> {
}
}
traversed += 1 + 32; // key + type marker
self.file
.write_u32::<BigEndian>(value.as_ref().len() as u32)?;
self.file.write_u32::<BigEndian>(value.len() as u32)?;
traversed += std::mem::size_of::<u32>();
self.file.write_all(value)?;
traversed += value.len();
Expand Down
4 changes: 2 additions & 2 deletions crates/fdev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }
xz2 = "0.1"
libp2p-identity = { features = ["ed25519", "rand"], version = "0.2.7" }
reqwest = { version = "0.11.23", features = ["json"] }
http = "1.0.0"
reqwest = { version = "0.12", features = ["json"] }
http = "1.1"

# internal
freenet = { path = "../core" }
Expand Down

0 comments on commit 1fc7456

Please sign in to comment.