• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tari-project / tari / 16200110666

10 Jul 2025 04:01PM UTC coverage: 58.097% (-6.2%) from 64.296%
16200110666

push

github

web-flow
chore: fix tests (#7300)

Description
---
removes uncalled tests,
fixes some tests

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added the ability to save the last scanned blockchain height in the
output manager's storage backend.

* **Refactor**
* Generalized wallet service initializers to support custom HTTP client
factories, improving flexibility for connectivity and transaction
services.
* Updated wallet startup and service initialization to use new generic
parameters for HTTP client factories.

* **Bug Fixes**
* Corrected balance assertions in tests to reflect updated time-locked
balance handling.
* Fixed the `submit_transaction` method in the HTTP base node mock to
return a valid response.

* **Tests**
* Removed comprehensive test suites for transaction protocols and UTXO
scanner services.
* Updated and streamlined test setups to match new service initializer
signatures and database usage.
  * Marked a broken transaction service test as ignored.
* Removed unused module declarations and imports in integration and
wallet tests.

* **Chores**
* Removed deprecated FFI function and related wallet methods for adding
base node peers.
* Removed step definitions related to ffi wallet lifecycle and
connectivity management in integration tests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

0 of 33 new or added lines in 6 files covered. (0.0%)

7429 existing lines in 95 files now uncovered.

69707 of 119984 relevant lines covered (58.1%)

226952.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/base_layer/core/src/base_node/rpc/mod.rs
1
// Copyright 2025 The Tari Project
2
// SPDX-License-Identifier: BSD-3-Clause
3
#[cfg(feature = "base_node")]
4
mod service;
5
#[cfg(feature = "base_node")]
6
pub mod sync_utxos_by_block_task;
7
#[cfg(feature = "base_node")]
8
pub use service::BaseNodeWalletRpcService;
9
pub mod models;
10

11
#[cfg(feature = "base_node")]
12
pub mod query_service;
13

14
use std::{error::Error, fmt::Debug};
15

16
use tari_comms::protocol::rpc::{Request, Response, RpcStatus, Streaming};
17
use tari_comms_rpc_macros::tari_rpc;
18
#[cfg(feature = "base_node")]
19
use url::Url;
20

21
#[cfg(feature = "base_node")]
22
use crate::base_node::StateMachineHandle;
23
use crate::proto::{
24
    self,
25
    base_node::{
26
        FetchMatchingUtxos,
27
        FetchUtxosResponse,
28
        GetMempoolFeePerGramStatsRequest,
29
        GetMempoolFeePerGramStatsResponse,
30
        GetWalletQueryHttpServiceAddressResponse,
31
        QueryDeletedRequest,
32
        QueryDeletedResponse,
33
        Signatures,
34
        SyncUtxosByBlockRequest,
35
        SyncUtxosByBlockResponse,
36
        TipInfoResponse,
37
        TxQueryBatchResponses,
38
        TxQueryResponse,
39
        TxSubmissionResponse,
40
        UtxoQueryRequest,
41
        UtxoQueryResponses,
42
    },
43
    types::{Signature, Transaction},
44
};
45
#[cfg(feature = "base_node")]
46
use crate::{
47
    chain_storage::{async_db::AsyncBlockchainDb, BlockchainBackend},
48
    mempool::service::MempoolHandle,
49
};
50

51
/// Trait that a base node wallet query service must implement.
52
/// Please note that this service is to fetch data, so read-only queries.
53
#[async_trait::async_trait]
54
pub trait BaseNodeWalletQueryService: Send + Sync + 'static {
55
    type Error: Error + 'static;
56

57
    async fn get_tip_info(&self) -> Result<models::TipInfoResponse, Self::Error>;
58

59
    async fn get_header_by_height(&self, height: u64) -> Result<models::BlockHeader, Self::Error>;
60

61
    async fn get_height_at_time(&self, epoch_time: u64) -> Result<u64, Self::Error>;
62

63
    async fn get_utxos_mined_info(
64
        &self,
65
        request: models::GetUtxosMinedInfoRequest,
66
    ) -> Result<models::GetUtxosMinedInfoResponse, Self::Error>;
67

68
    async fn get_utxos_by_block(
69
        &self,
70
        request: models::GetUtxosByBlockRequest,
71
    ) -> Result<models::GetUtxosByBlockResponse, Self::Error>;
72

73
    async fn transaction_query(&self, signature: models::Signature) -> Result<models::TxQueryResponse, Self::Error>;
74

75
    async fn sync_utxos_by_block(
76
        &self,
77
        request: models::SyncUtxosByBlockRequest,
78
    ) -> Result<models::SyncUtxosByBlockResponse, Self::Error>;
79

80
    async fn get_utxos_deleted_info(
81
        &self,
82
        request: models::GetUtxosDeletedInfoRequest,
83
    ) -> Result<models::GetUtxosDeletedInfoResponse, Self::Error>;
84
}
85

UNCOV
86
#[tari_rpc(protocol_name = b"t/bnwallet/1", server_struct = BaseNodeWalletRpcServer, client_struct = BaseNodeWalletRpcClient
×
UNCOV
87
)]
×
88
pub trait BaseNodeWalletService: Send + Sync + 'static {
89
    #[rpc(method = 1)]
90
    async fn submit_transaction(
91
        &self,
92
        request: Request<Transaction>,
93
    ) -> Result<Response<TxSubmissionResponse>, RpcStatus>;
94

95
    #[rpc(method = 2)]
96
    async fn transaction_query(&self, request: Request<Signature>) -> Result<Response<TxQueryResponse>, RpcStatus>;
97

98
    #[rpc(method = 3)]
99
    async fn transaction_batch_query(
100
        &self,
101
        request: Request<Signatures>,
102
    ) -> Result<Response<TxQueryBatchResponses>, RpcStatus>;
103

104
    #[rpc(method = 4)]
105
    async fn fetch_matching_utxos(
106
        &self,
107
        request: Request<FetchMatchingUtxos>,
108
    ) -> Result<Response<FetchUtxosResponse>, RpcStatus>;
109

110
    #[rpc(method = 5)]
111
    async fn get_tip_info(&self, request: Request<()>) -> Result<Response<TipInfoResponse>, RpcStatus>;
112

113
    #[rpc(method = 6)]
114
    async fn get_header(&self, request: Request<u64>) -> Result<Response<proto::core::BlockHeader>, RpcStatus>;
115

116
    #[rpc(method = 7)]
117
    async fn utxo_query(&self, request: Request<UtxoQueryRequest>) -> Result<Response<UtxoQueryResponses>, RpcStatus>;
118

119
    #[rpc(method = 8)]
120
    async fn query_deleted(
121
        &self,
122
        request: Request<QueryDeletedRequest>,
123
    ) -> Result<Response<QueryDeletedResponse>, RpcStatus>;
124

125
    #[rpc(method = 9)]
126
    async fn get_header_by_height(
127
        &self,
128
        request: Request<u64>,
129
    ) -> Result<Response<proto::core::BlockHeader>, RpcStatus>;
130

131
    #[rpc(method = 10)]
132
    async fn get_height_at_time(&self, request: Request<u64>) -> Result<Response<u64>, RpcStatus>;
133

134
    #[rpc(method = 11)]
135
    async fn sync_utxos_by_block(
136
        &self,
137
        request: Request<SyncUtxosByBlockRequest>,
138
    ) -> Result<Streaming<SyncUtxosByBlockResponse>, RpcStatus>;
139

140
    #[rpc(method = 12)]
141
    async fn get_mempool_fee_per_gram_stats(
142
        &self,
143
        request: Request<GetMempoolFeePerGramStatsRequest>,
144
    ) -> Result<Response<GetMempoolFeePerGramStatsResponse>, RpcStatus>;
145

146
    #[rpc(method = 13)]
147
    async fn get_wallet_query_http_service_address(
148
        &self,
149
        request: Request<()>,
150
    ) -> Result<Response<GetWalletQueryHttpServiceAddressResponse>, RpcStatus>;
151
}
152

153
#[cfg(feature = "base_node")]
154
pub fn create_base_node_wallet_rpc_service<B: BlockchainBackend + 'static>(
×
155
    db: AsyncBlockchainDb<B>,
×
156
    mempool: MempoolHandle,
×
157
    state_machine: StateMachineHandle,
×
158
    wallet_query_service_address: Option<Url>,
×
159
) -> BaseNodeWalletRpcServer<BaseNodeWalletRpcService<B>> {
×
160
    BaseNodeWalletRpcServer::new(BaseNodeWalletRpcService::new(
×
161
        db,
×
162
        mempool,
×
163
        state_machine,
×
164
        wallet_query_service_address,
×
165
    ))
×
166
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc