Skip to content

Commit

Permalink
Address compiler warnings (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
ligustah authored May 7, 2024
2 parents 08566c8 + 3da5ce2 commit 30db530
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl AppState {
}
}

pub fn router_with_defaults(config: &Config) -> Router<AppState> {
pub fn router_with_defaults(_config: &Config) -> Router<AppState> {
Router::new()
.route("/health", get(routes::health))
.route("/list-all", get(routes::list_all))
Expand Down
3 changes: 0 additions & 3 deletions src/api/routes.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use std::path::Display;

use axum::extract::{Path, Query, State};
use axum::http::StatusCode;
use axum::Json;
use const_hex::ToHexExt;
use itertools::Itertools;
use libp2p::autonat::NatStatus;
use serde::Serialize;
use sqlx::{Executor, Row};
Expand Down
1 change: 0 additions & 1 deletion src/chain_list.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use alloy::network::Network;
use alloy::providers::{ProviderBuilder, RootProvider};
use alloy::pubsub::PubSubFrontend;
use alloy::rpc::client::WsConnect;
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ pub fn init() -> Config {

#[cfg(test)]
mod test {
use crate::config::{BootNodes, ChainInclusionMode, Config};
use crate::config::{BootNodes, Config};
use std::env;
use std::str::FromStr;

Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use mintpool::rules::RulesEngine;
use mintpool::run::{start_p2p_services, start_watch_chain};
use mintpool::stdin::watch_stdin;
use tokio::signal::unix::{signal, SignalKind};
use tracing_subscriber::EnvFilter;

#[tokio::main]
async fn main() -> eyre::Result<()> {
Expand Down
7 changes: 3 additions & 4 deletions src/p2p.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::borrow::Cow;
use std::collections::HashMap;
use std::hash::Hasher;
use std::time::Duration;

use eyre::WrapErr;
Expand Down Expand Up @@ -34,8 +32,8 @@ use crate::multi_ticker::MultiTicker;
use crate::multiaddr_ext::MultiaddrExt;
use crate::storage::QueryOptions;
use crate::types::{
claims_topic_hashes, InclusionClaim, MintpoolNodeInfo, PeerInclusionClaim, Premint,
PremintName, PremintTypes,
claims_topic_hashes, InclusionClaim, MintpoolNodeInfo, PeerInclusionClaim, PremintName,
PremintTypes,
};

#[derive(NetworkBehaviour)]
Expand Down Expand Up @@ -853,6 +851,7 @@ impl SwarmController {
Ok(())
}

#[allow(dead_code)]
fn gossip_unsubscribe(&mut self, topic: &IdentTopic) -> eyre::Result<()> {
let b = self.swarm.behaviour_mut();

Expand Down
23 changes: 0 additions & 23 deletions src/premints/metadata.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/premints/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod metadata;
pub mod zora_premint;
1 change: 0 additions & 1 deletion src/premints/zora_premint/erc20v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::{implement_zora_premint_traits, typed_rule};
use alloy::primitives::Address;

use crate::premints::zora_premint::contract::IZoraPremintERC20V1;
use crate::premints::zora_premint::contract::IZoraPremintV2::IZoraPremintV2Errors;

use crate::rules::Rule;
use crate::storage::Reader;
Expand Down
5 changes: 0 additions & 5 deletions src/premints/zora_premint/rules.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
use crate::premints::zora_premint::v2::V2;
use crate::rules::Rule;
use crate::storage::Reader;
use crate::typed_rule;
use crate::types::PremintTypes;
#[macro_export]
macro_rules! zora_premint_rules {
($namespace:tt, $typ:ty, $version:literal) => {
Expand Down
10 changes: 6 additions & 4 deletions src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use serde::{Serialize, Serializer};

use crate::chain_list::{ChainListProvider, CHAINS};
use crate::config::Config;
use crate::storage::{PremintStorage, Reader};
use crate::storage::Reader;
use crate::types::PremintTypes;

#[derive(Debug, PartialEq, Eq, Clone)]
Expand Down Expand Up @@ -171,6 +171,9 @@ impl<T: Reader> RuleContext<T> {
}
}

#[cfg(test)]
use crate::storage::PremintStorage;

#[cfg(test)]
impl RuleContext<PremintStorage> {
pub async fn test_default() -> Self {
Expand Down Expand Up @@ -482,8 +485,8 @@ mod test {
}

async fn simple_rule<T: Reader>(
item: &PremintTypes,
context: &RuleContext<T>,
_item: &PremintTypes,
_context: &RuleContext<T>,
) -> eyre::Result<Evaluation> {
Ok(Accept)
}
Expand Down Expand Up @@ -546,7 +549,6 @@ mod test {
#[tokio::test]
async fn test_typed_rules_engine() {
let (mut engine, storage) = test_rules_engine().await;
let context = RuleContext::test_default().await;

let rule: Box<dyn Rule<PremintStorage>> =
typed_rule!(PremintTypes::Simple, simple_typed_rule);
Expand Down
3 changes: 1 addition & 2 deletions src/run.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use alloy::hex;
use libp2p::identity;
use libp2p::identity::Keypair;
use std::time::Duration;
use tracing::{info_span, Instrument};
Expand All @@ -10,7 +9,7 @@ use crate::config::{BootNodes, ChainInclusionMode, Config};
use crate::controller::{Controller, ControllerCommands, ControllerInterface};
use crate::p2p::SwarmController;
use crate::rules::RulesEngine;
use crate::storage::{PremintStorage, Reader};
use crate::storage::PremintStorage;
use crate::types::Premint;

/// Starts the libp2p swarm, the controller, and the checkers if applicable, then wires them all up.
Expand Down
4 changes: 2 additions & 2 deletions src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use sqlx::Row;
use sqlx::{QueryBuilder, Sqlite, SqlitePool};

use crate::config::Config;
use crate::types::{InclusionClaim, Premint, PremintName, PremintTypes};
use crate::types::{InclusionClaim, PremintName, PremintTypes};

async fn init_db(config: &Config) -> SqlitePool {
let expect_msg =
Expand Down Expand Up @@ -334,7 +334,7 @@ mod test {
use crate::storage::{
list_all, list_all_with_options, PremintStorage, QueryOptions, Reader, Writer,
};
use crate::types::{InclusionClaim, Premint, PremintTypes};
use crate::types::{InclusionClaim, PremintTypes};

#[tokio::test]
async fn test_insert_and_get() {
Expand Down
2 changes: 1 addition & 1 deletion tests/common/factories.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy::primitives::{Address, U256};
use alloy::primitives::Address;
use mintpool::types::SimplePremint;
use rand::{Rng, RngCore};

Expand Down
4 changes: 4 additions & 0 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pub mod factories;

#[allow(dead_code)]
pub mod mintpool_build {
use mintpool::config::Config;
use mintpool::controller::{ControllerCommands, ControllerInterface};
Expand Down Expand Up @@ -105,6 +107,7 @@ pub mod mintpool_build {
}
}

#[allow(dead_code)]
pub mod helpers {
use mintpool::controller::ControllerCommands;
use mintpool::types::PremintTypes;
Expand All @@ -126,6 +129,7 @@ pub mod helpers {
}
}

#[allow(dead_code)]
pub mod asserts {
pub async fn expect_n_connections(ctl: &mintpool::controller::ControllerInterface, n: usize) {
let state = ctl
Expand Down
4 changes: 1 addition & 3 deletions tests/e2e_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use alloy::signers::wallet::LocalWallet;
use alloy::signers::Signer;
use alloy::sol_types::{SolCall, SolValue};
use alloy::transports::{RpcError, TransportErrorKind};
use mintpool::config::{BootNodes, ChainInclusionMode, Config};
use mintpool::config::{ChainInclusionMode, Config};
use mintpool::controller::{ControllerCommands, DBQuery};
use mintpool::premints::zora_premint::contract::IZoraPremintV2::MintArguments;
use mintpool::premints::zora_premint::contract::{IZoraPremintV2, PREMINT_FACTORY_ADDR};
Expand All @@ -23,8 +23,6 @@ use mintpool::rules::RulesEngine;
use mintpool::run;
use mintpool::types::PremintTypes;
use std::env;
use std::fmt::Debug;
use std::str::FromStr;
use std::time::Duration;

/// This test does the full round trip lifecycle of a premint
Expand Down
4 changes: 2 additions & 2 deletions tests/p2p_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ async fn test_list_all_premints() {

let nodes = mintpool_build::gen_fully_connected_swarm(2310, num_nodes).await;
let (first, nodes) = mintpool_build::split_first_rest(nodes).await;
let (snd, rcv) = tokio::sync::oneshot::channel();
let (snd, _rcv) = tokio::sync::oneshot::channel();
first
.send_command(Broadcast {
message: PremintTypes::ZoraV2(Default::default()),
channel: snd,
})
.await
.unwrap();
let (snd, rcv) = tokio::sync::oneshot::channel();
let (snd, _rcv) = tokio::sync::oneshot::channel();

first
.send_command(Broadcast {
Expand Down

0 comments on commit 30db530

Please sign in to comment.