fix: fix lints

This commit is contained in:
Daniil Polyakov 2026-03-13 22:56:14 +03:00
parent b254ebb185
commit 9d87e3b046
9 changed files with 24 additions and 38 deletions

View File

@ -402,7 +402,7 @@ impl TryFrom<WitnessSet> for nssa::privacy_preserving_transaction::witness_set::
signatures_and_public_keys,
proof
.map(Into::into)
.ok_or_else(|| nssa::error::NssaError::InvalidInput("Missing proof".to_string()))?,
.ok_or_else(|| nssa::error::NssaError::InvalidInput("Missing proof".to_owned()))?,
))
}
}

View File

@ -38,7 +38,7 @@ pub struct TestContext {
indexer_client: IndexerClient,
wallet: WalletCore,
wallet_password: String,
/// Optional to move out value in Drop
/// Optional to move out value in Drop.
sequencer_handle: Option<SequencerHandle>,
indexer_handle: IndexerHandle,
bedrock_compose: DockerCompose,

View File

@ -15,6 +15,7 @@ use logos_blockchain_key_management_system_service::keys::{ED25519_SECRET_KEY_SI
use mempool::{MemPool, MemPoolHandle};
#[cfg(feature = "mock")]
pub use mock::SequencerCoreWithMockClients;
pub use storage::error::DbError;
use crate::{
block_settlement_client::{BlockSettlementClient, BlockSettlementClientTrait, MsgId},
@ -27,8 +28,6 @@ pub mod block_store;
pub mod config;
pub mod indexer_client;
pub use storage::error::DbError;
#[cfg(feature = "mock")]
pub mod mock;

View File

@ -34,7 +34,7 @@ pub struct SequencerHandle {
}
impl SequencerHandle {
fn new(
const fn new(
addr: SocketAddr,
server_handle: ServerHandle,
main_loop_handle: JoinHandle<Result<Never>>,
@ -67,7 +67,7 @@ impl SequencerHandle {
let server_handle = server_handle.take().expect("Server handle is set");
tokio::select! {
_ = server_handle.stopped() => {
() = server_handle.stopped() => {
Err(anyhow!("RPC Server stopped"))
}
res = main_loop_handle => {

View File

@ -23,6 +23,8 @@ use sequencer_core::{
};
use tokio::sync::Mutex;
const NOT_FOUND_ERROR_CODE: i32 = -31999;
pub struct SequencerService<BC: BlockSettlementClientTrait, IC: IndexerClientTrait> {
sequencer: Arc<Mutex<SequencerCore<BC, IC>>>,
mempool_handle: MemPoolHandle<NSSATransaction>,
@ -30,7 +32,7 @@ pub struct SequencerService<BC: BlockSettlementClientTrait, IC: IndexerClientTra
}
impl<BC: BlockSettlementClientTrait, IC: IndexerClientTrait> SequencerService<BC, IC> {
pub fn new(
pub const fn new(
sequencer: Arc<Mutex<SequencerCore<BC, IC>>>,
mempool_handle: MemPoolHandle<NSSATransaction>,
max_block_size: u64,
@ -109,19 +111,17 @@ impl<BC: BlockSettlementClientTrait + Send + 'static, IC: IndexerClientTrait + S
let sequencer = self.sequencer.lock().await;
(start_block_id..=end_block_id)
.map(|block_id| {
sequencer
let block = sequencer
.block_store()
.get_block_at_id(block_id)
.map_err(|err| internal_error(&err))
.and_then(|opt| {
opt.ok_or_else(|| {
ErrorObjectOwned::owned(
NOT_FOUND_ERROR_CODE,
format!("Block with id {block_id} not found"),
None::<()>,
)
})
})
.map_err(|err| internal_error(&err))?;
block.ok_or_else(|| {
ErrorObjectOwned::owned(
NOT_FOUND_ERROR_CODE,
format!("Block with id {block_id} not found"),
None::<()>,
)
})
})
.collect::<Result<Vec<_>, _>>()
}
@ -139,10 +139,10 @@ impl<BC: BlockSettlementClientTrait + Send + 'static, IC: IndexerClientTrait + S
async fn get_transaction(
&self,
hash: HashType,
tx_hash: HashType,
) -> Result<Option<NSSATransaction>, ErrorObjectOwned> {
let sequencer = self.sequencer.lock().await;
Ok(sequencer.block_store().get_transaction_by_hash(hash))
Ok(sequencer.block_store().get_transaction_by_hash(tx_hash))
}
async fn get_accounts_nonces(
@ -196,8 +196,6 @@ impl<BC: BlockSettlementClientTrait + Send + 'static, IC: IndexerClientTrait + S
}
}
const NOT_FOUND_ERROR_CODE: i32 = -31999;
fn internal_error(err: &DbError) -> ErrorObjectOwned {
ErrorObjectOwned::owned(ErrorCode::InternalError.code(), err.to_string(), None::<()>)
}

View File

@ -3,7 +3,7 @@ use clap::Subcommand;
use itertools::Itertools as _;
use key_protocol::key_management::key_tree::chain_index::ChainIndex;
use nssa::{Account, PublicKey, program::Program};
use sequencer_service_rpc::RpcClient;
use sequencer_service_rpc::RpcClient as _;
use token_core::{TokenDefinition, TokenHolding};
use crate::{

View File

@ -3,7 +3,7 @@ use std::{io::Write as _, path::PathBuf};
use anyhow::{Context as _, Result};
use clap::{Parser, Subcommand};
use common::{HashType, transaction::NSSATransaction};
use futures::TryFutureExt;
use futures::TryFutureExt as _;
use nssa::{ProgramDeploymentTransaction, program::Program};
use sequencer_service_rpc::RpcClient as _;

View File

@ -146,13 +146,12 @@ impl WalletCore {
let mut builder = SequencerClientBuilder::default();
if let Some(basic_auth) = &config.basic_auth {
builder = builder.set_headers(
[(
std::iter::once((
"Authorization".parse().expect("Header name is valid"),
format!("Basic {}", basic_auth)
format!("Basic {basic_auth}")
.parse()
.context("Invalid basic auth format")?,
)]
.into_iter()
))
.collect(),
);
}
@ -341,11 +340,6 @@ impl WalletCore {
Ok(())
}
// TODO: handle large Err-variant properly
#[expect(
clippy::result_large_err,
reason = "ExecutionFailureKind is large, tracked by TODO"
)]
pub async fn send_privacy_preserving_tx(
&self,
accounts: Vec<PrivacyPreservingAccount>,

View File

@ -14,11 +14,6 @@ pub mod shielded;
)]
pub struct NativeTokenTransfer<'wallet>(pub &'wallet WalletCore);
// TODO: handle large Err-variant properly
#[expect(
clippy::result_large_err,
reason = "ExecutionFailureKind is large, tracked by TODO"
)]
fn auth_transfer_preparation(
balance_to_move: u128,
) -> (