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

tari-project / tari / 14753654574

30 Apr 2025 11:37AM UTC coverage: 68.838% (-0.3%) from 69.141%
14753654574

push

github

web-flow
feat(dns): update tari pulse DNS for esmeralda (#7004)

Description
Update the tari pulse DNS for esmeralda


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

## Summary by CodeRabbit

- **Bug Fixes**
- Corrected the DNS name for the Esmeralda network to ensure proper
connectivity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

0 of 1 new or added line in 1 file covered. (0.0%)

377 existing lines in 25 files now uncovered.

76460 of 111072 relevant lines covered (68.84%)

238067.58 hits per line

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

75.56
/base_layer/core/src/base_node/sync/rpc/tests.rs
1
//  Copyright 2020, The Tari Project
2
//
3
//  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
4
//  following conditions are met:
5
//
6
//  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
7
//  disclaimer.
8
//
9
//  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
10
//  following disclaimer in the documentation and/or other materials provided with the distribution.
11
//
12
//  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
13
//  products derived from this software without specific prior written permission.
14
//
15
//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
//  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
//  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18
//  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
//  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
//  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21
//  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22

23
use futures::StreamExt;
24
use tari_comms::protocol::rpc::{mock::RpcRequestMock, RpcStatusCode};
25
use tari_service_framework::reply_channel;
26
use tari_test_utils::{streams::convert_mpsc_to_stream, unpack_enum};
27
use tempfile::{tempdir, TempDir};
28
use tokio::sync::broadcast;
29

30
use super::BaseNodeSyncRpcService;
31
use crate::{
32
    base_node::{BaseNodeSyncService, LocalNodeCommsInterface},
33
    chain_storage::BlockchainDatabase,
34
    proto::base_node::{SyncBlocksRequest, SyncUtxosRequest},
35
    test_helpers::{
36
        blockchain::{create_main_chain, create_new_blockchain, TempDatabase},
37
        create_peer_manager,
38
    },
39
};
40

41
fn setup() -> (
5✔
42
    BaseNodeSyncRpcService<TempDatabase>,
5✔
43
    BlockchainDatabase<TempDatabase>,
5✔
44
    RpcRequestMock,
5✔
45
    TempDir,
5✔
46
) {
5✔
47
    let tmp = tempdir().unwrap();
5✔
48
    let peer_manager = create_peer_manager(&tmp);
5✔
49
    let request_mock = RpcRequestMock::new(peer_manager);
5✔
50

5✔
51
    let db = create_new_blockchain();
5✔
52
    let (req_tx, _) = reply_channel::unbounded();
5✔
53
    let (block_tx, _) = reply_channel::unbounded();
5✔
54
    let (block_event_tx, _) = broadcast::channel(1);
5✔
55
    let service = BaseNodeSyncRpcService::new(
5✔
56
        db.clone().into(),
5✔
57
        LocalNodeCommsInterface::new(req_tx, block_tx, block_event_tx),
5✔
58
    );
5✔
59
    (service, db, request_mock, tmp)
5✔
60
}
5✔
61

62
mod sync_blocks {
63
    use super::*;
64

65
    #[tokio::test]
66
    async fn it_returns_not_found_if_unknown_hash() {
1✔
67
        let (service, _, rpc_request_mock, _tmp) = setup();
1✔
68
        let msg = SyncBlocksRequest {
1✔
69
            start_hash: vec![0; 32],
1✔
70
            end_hash: vec![0; 32],
1✔
71
        };
1✔
72
        let req = rpc_request_mock.request_with_context(Default::default(), msg);
1✔
73
        let err = service.sync_blocks(req).await.unwrap_err();
1✔
74
        unpack_enum!(RpcStatusCode::NotFound = err.as_status_code());
1✔
75
    }
1✔
76

77
    #[tokio::test]
78
    async fn it_sends_bad_request_on_bad_response() {
1✔
79
        let (service, db, rpc_request_mock, _tmp) = setup();
1✔
80

1✔
81
        let (_, chain) = create_main_chain(&db, block_specs!(["A->GB"])).await;
1✔
82

1✔
83
        let block = chain.get("A").unwrap();
1✔
UNCOV
84
        let msg = SyncBlocksRequest {
×
UNCOV
85
            start_hash: block.hash().to_vec(),
×
UNCOV
86
            end_hash: block.hash().to_vec(),
×
UNCOV
87
        };
×
UNCOV
88
        let req = rpc_request_mock.request_with_context(Default::default(), msg);
×
UNCOV
89
        assert!(service.sync_blocks(req).await.is_err());
×
90
    }
1✔
91

92
    #[tokio::test]
93
    async fn it_streams_blocks_until_end() {
1✔
94
        let (service, db, rpc_request_mock, _tmp) = setup();
1✔
95

1✔
96
        let (_, chain) = create_main_chain(&db, block_specs!(["A->GB"], ["B->A"], ["C->B"], ["D->C"], ["E->D"])).await;
1✔
97

1✔
98
        let first_block = chain.get("A").unwrap();
1✔
99
        let last_block = chain.get("E").unwrap();
×
100

×
101
        let msg = SyncBlocksRequest {
×
102
            start_hash: first_block.hash().to_vec(),
×
103
            end_hash: last_block.hash().to_vec(),
×
104
        };
×
105
        let req = rpc_request_mock.request_with_context(Default::default(), msg);
×
106
        let mut streaming = service.sync_blocks(req).await.unwrap().into_inner();
1✔
107
        let blocks = convert_mpsc_to_stream(&mut streaming)
1✔
108
            .map(|block| block.unwrap())
×
109
            .collect::<Vec<_>>()
×
110
            .await;
×
111

1✔
112
        assert_eq!(blocks.len(), 4);
1✔
113
        blocks.iter().zip(["B", "C", "D", "E"]).for_each(|(block, name)| {
1✔
114
            assert_eq!(*chain.get(name).unwrap().hash(), block.hash);
×
115
        });
1✔
116
    }
1✔
117
}
118

119
mod sync_utxos {
120
    use super::*;
121

122
    #[tokio::test]
123
    async fn it_returns_not_found_if_unknown_hash() {
1✔
124
        let (service, db, rpc_request_mock, _tmp) = setup();
1✔
125
        let gen_block_hash = db.fetch_header(0).unwrap().unwrap().hash();
1✔
126
        let msg = SyncUtxosRequest {
1✔
127
            start_header_hash: gen_block_hash.to_vec(),
1✔
128
            end_header_hash: vec![0; 32],
1✔
129
        };
1✔
130
        let req = rpc_request_mock.request_with_context(Default::default(), msg);
1✔
131
        let err = service.sync_utxos(req).await.unwrap_err();
1✔
132
        unpack_enum!(RpcStatusCode::NotFound = err.as_status_code());
1✔
133
    }
1✔
134

135
    #[tokio::test]
136
    async fn it_returns_not_found_if_start_not_found() {
1✔
137
        let (service, db, rpc_request_mock, _tmp) = setup();
1✔
138
        let (_, chain) = create_main_chain(&db, block_specs!(["A->GB"])).await;
1✔
139
        let gb = chain.get("GB").unwrap();
1✔
UNCOV
140
        let msg = SyncUtxosRequest {
×
UNCOV
141
            start_header_hash: vec![0; 32],
×
UNCOV
142
            end_header_hash: gb.hash().to_vec(),
×
UNCOV
143
        };
×
UNCOV
144
        let req = rpc_request_mock.request_with_context(Default::default(), msg);
×
145
        let err = service.sync_utxos(req).await.unwrap_err();
1✔
146
        unpack_enum!(RpcStatusCode::NotFound = err.as_status_code());
1✔
147
    }
1✔
148
}
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