make CI more strict

This commit is contained in:
Boog900 2023-12-03 00:29:12 +00:00
parent f3d96ca2ce
commit 34dd105a0c
No known key found for this signature in database
GPG key ID: 5401367FB7302004
6 changed files with 9 additions and 60 deletions

View file

@ -42,7 +42,10 @@ jobs:
run: sudo apt install -y libboost-dev run: sudo apt install -y libboost-dev
- name: Clippy - name: Clippy
run: cargo clippy run: cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Fmt
run: cargo fmt --all --check
- name: Test - name: Test
run: cargo test run: cargo test

View file

@ -4,7 +4,7 @@ use std::{
sync::Arc, sync::Arc,
}; };
mod batch_verifier; //mod batch_verifier;
pub mod block; pub mod block;
pub mod context; pub mod context;
pub mod genesis; pub mod genesis;

View file

@ -13,7 +13,7 @@ use futures::{
FutureExt, StreamExt, TryFutureExt, TryStreamExt, FutureExt, StreamExt, TryFutureExt, TryStreamExt,
}; };
use tokio::sync::RwLock; 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}; use crate::{helper::rayon_spawn_async, DatabaseRequest, DatabaseResponse};

View file

@ -20,9 +20,9 @@ use rayon::prelude::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::json; use serde_json::json;
use tokio::{ use tokio::{
sync::RwLock,
task::JoinHandle, task::JoinHandle,
time::{timeout, Duration}, time::{timeout, Duration},
sync::RwLock
}; };
use tower::Service; use tower::Service;
use tracing::{instrument, Instrument}; use tracing::{instrument, Instrument};

View file

@ -56,29 +56,6 @@ fn check_decoy_info(decoy_info: &DecoyInfo, hf: &HardFork) -> Result<(), Consens
Ok(()) 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. /// 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 /// 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<u64, ConsensusError> {
Ok(sum) 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<u64, ConsensusError> {
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. /// Checks all input consensus rules.
/// ///
/// TODO: list rules. /// TODO: list rules.

View file

@ -85,11 +85,11 @@ impl Service<PeerRequest> for DummyPeerRequestHandlerSvc {
type Future = type Future =
Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'static>>; Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'static>>;
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
todo!() todo!()
} }
fn call(&mut self, req: PeerRequest) -> Self::Future { fn call(&mut self, _: PeerRequest) -> Self::Future {
todo!() todo!()
} }
} }