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, signatures_and_public_keys,
proof proof
.map(Into::into) .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, indexer_client: IndexerClient,
wallet: WalletCore, wallet: WalletCore,
wallet_password: String, wallet_password: String,
/// Optional to move out value in Drop /// Optional to move out value in Drop.
sequencer_handle: Option<SequencerHandle>, sequencer_handle: Option<SequencerHandle>,
indexer_handle: IndexerHandle, indexer_handle: IndexerHandle,
bedrock_compose: DockerCompose, 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}; use mempool::{MemPool, MemPoolHandle};
#[cfg(feature = "mock")] #[cfg(feature = "mock")]
pub use mock::SequencerCoreWithMockClients; pub use mock::SequencerCoreWithMockClients;
pub use storage::error::DbError;
use crate::{ use crate::{
block_settlement_client::{BlockSettlementClient, BlockSettlementClientTrait, MsgId}, block_settlement_client::{BlockSettlementClient, BlockSettlementClientTrait, MsgId},
@ -27,8 +28,6 @@ pub mod block_store;
pub mod config; pub mod config;
pub mod indexer_client; pub mod indexer_client;
pub use storage::error::DbError;
#[cfg(feature = "mock")] #[cfg(feature = "mock")]
pub mod mock; pub mod mock;

View File

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

View File

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

View File

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

View File

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

View File

@ -146,13 +146,12 @@ impl WalletCore {
let mut builder = SequencerClientBuilder::default(); let mut builder = SequencerClientBuilder::default();
if let Some(basic_auth) = &config.basic_auth { if let Some(basic_auth) = &config.basic_auth {
builder = builder.set_headers( builder = builder.set_headers(
[( std::iter::once((
"Authorization".parse().expect("Header name is valid"), "Authorization".parse().expect("Header name is valid"),
format!("Basic {}", basic_auth) format!("Basic {basic_auth}")
.parse() .parse()
.context("Invalid basic auth format")?, .context("Invalid basic auth format")?,
)] ))
.into_iter()
.collect(), .collect(),
); );
} }
@ -341,11 +340,6 @@ impl WalletCore {
Ok(()) 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( pub async fn send_privacy_preserving_tx(
&self, &self,
accounts: Vec<PrivacyPreservingAccount>, accounts: Vec<PrivacyPreservingAccount>,

View File

@ -14,11 +14,6 @@ pub mod shielded;
)] )]
pub struct NativeTokenTransfer<'wallet>(pub &'wallet WalletCore); 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( fn auth_transfer_preparation(
balance_to_move: u128, balance_to_move: u128,
) -> ( ) -> (