diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 997ce3dc..0e0bdfde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,10 @@ jobs: run: sudo apt install -y libboost-dev - name: Clippy - run: cargo clippy + run: cargo clippy --workspace --all-targets --all-features -- -D warnings + + - name: Fmt + run: cargo fmt --all --check - name: Test run: cargo test diff --git a/consensus/src/lib.rs b/consensus/src/lib.rs index 4dca640d..2e04ddcf 100644 --- a/consensus/src/lib.rs +++ b/consensus/src/lib.rs @@ -4,7 +4,7 @@ use std::{ sync::Arc, }; -mod batch_verifier; +//mod batch_verifier; pub mod block; pub mod context; pub mod genesis; diff --git a/consensus/src/rpc.rs b/consensus/src/rpc.rs index fba6b29a..bb2a0257 100644 --- a/consensus/src/rpc.rs +++ b/consensus/src/rpc.rs @@ -13,7 +13,7 @@ use futures::{ FutureExt, StreamExt, TryFutureExt, TryStreamExt, }; use tokio::sync::RwLock; -use tower::{balance::p2c::Balance, util::BoxService, ServiceExt}; +use tower::{balance::p2c::Balance, ServiceExt}; use crate::{helper::rayon_spawn_async, DatabaseRequest, DatabaseResponse}; diff --git a/consensus/src/rpc/connection.rs b/consensus/src/rpc/connection.rs index 8660e45d..5f2eed98 100644 --- a/consensus/src/rpc/connection.rs +++ b/consensus/src/rpc/connection.rs @@ -20,9 +20,9 @@ use rayon::prelude::*; use serde::{Deserialize, Serialize}; use serde_json::json; use tokio::{ + sync::RwLock, task::JoinHandle, time::{timeout, Duration}, - sync::RwLock }; use tower::Service; use tracing::{instrument, Instrument}; diff --git a/consensus/src/transactions/inputs.rs b/consensus/src/transactions/inputs.rs index 1edf0c80..253eec17 100644 --- a/consensus/src/transactions/inputs.rs +++ b/consensus/src/transactions/inputs.rs @@ -56,29 +56,6 @@ fn check_decoy_info(decoy_info: &DecoyInfo, hf: &HardFork) -> Result<(), Consens Ok(()) } -/// Checks that the key image is torsion free. -/// -/// https://cuprate.github.io/monero-book/consensus_rules/transactions.html#torsion-free-key-image -pub(crate) fn check_key_images_torsion(input: &Input) -> Result<(), ConsensusError> { - match input { - Input::ToKey { key_image, .. } => { - // this happens in monero-serai but we may as well duplicate the check. - if !key_image.is_torsion_free() { - return Err(ConsensusError::TransactionHasInvalidInput( - "key image has torsion", - )); - } - } - _ => { - return Err(ConsensusError::TransactionHasInvalidInput( - "Input not ToKey", - )) - } - } - - Ok(()) -} - /// Checks the inputs key images for torsion and for duplicates in the transaction. /// /// The `spent_kis` parameter is not meant to be a complete list of key images, just a list of related transactions @@ -234,37 +211,6 @@ fn sum_inputs_v1(inputs: &[Input]) -> Result { Ok(sum) } -/// Checks the inputs semantics are valid. -/// -/// This does all the checks that don't need blockchain context. -/// -/// Although technically hard-fork is contextual data we class it as not because -/// blocks keep their hf in the header. -pub fn check_inputs_semantics( - inputs: &[Input], - hf: &HardFork, - tx_version: &TxVersion, -) -> Result { - if inputs.is_empty() { - return Err(ConsensusError::TransactionHasInvalidInput("no inputs")); - } - - for input in inputs { - check_input_type(input)?; - check_input_has_decoys(input)?; - - check_ring_members_unique(input, hf)?; - check_key_images_torsion(input)?; - } - - check_inputs_sorted(inputs, hf)?; - - match tx_version { - TxVersion::RingSignatures => sum_inputs_v1(inputs), - _ => panic!("TODO: RCT"), - } -} - /// Checks all input consensus rules. /// /// TODO: list rules. diff --git a/p2p/monero-peer/tests/utils.rs b/p2p/monero-peer/tests/utils.rs index 6ff1cd48..da524800 100644 --- a/p2p/monero-peer/tests/utils.rs +++ b/p2p/monero-peer/tests/utils.rs @@ -85,11 +85,11 @@ impl Service for DummyPeerRequestHandlerSvc { type Future = Pin> + Send + 'static>>; - fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { + fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll> { todo!() } - fn call(&mut self, req: PeerRequest) -> Self::Future { + fn call(&mut self, _: PeerRequest) -> Self::Future { todo!() } }