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

tari-project / tari / 16123384529

07 Jul 2025 05:11PM UTC coverage: 64.327% (-7.6%) from 71.89%
16123384529

push

github

web-flow
chore: new release v4.9.0-pre.0 (#7289)

Description
---
new release esmeralda

77151 of 119935 relevant lines covered (64.33%)

227108.34 hits per line

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

0.0
/base_layer/core/src/base_node/sync/validators.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 std::{fmt, sync::Arc};
24

25
use crate::{
26
    chain_storage::BlockchainBackend,
27
    consensus::ConsensusManager,
28
    transactions::CryptoFactories,
29
    validation::{
30
        block_body::BlockBodyFullValidator,
31
        BlockBodyValidator,
32
        ChainBalanceValidator,
33
        FinalHorizonStateValidation,
34
    },
35
};
36

37
#[derive(Clone)]
38
pub struct SyncValidators<B> {
39
    pub block_body: Arc<dyn BlockBodyValidator<B>>,
40
    pub final_horizon_state: Arc<dyn FinalHorizonStateValidation<B>>,
41
}
42

43
impl<B: BlockchainBackend + 'static> SyncValidators<B> {
44
    pub fn new<TBody, TFinal>(block_body: TBody, final_state: TFinal) -> Self
×
45
    where
×
46
        TBody: BlockBodyValidator<B> + 'static,
×
47
        TFinal: FinalHorizonStateValidation<B> + 'static,
×
48
    {
×
49
        Self {
×
50
            block_body: Arc::new(block_body),
×
51
            final_horizon_state: Arc::new(final_state),
×
52
        }
×
53
    }
×
54

55
    pub fn full_consensus(
×
56
        rules: ConsensusManager,
×
57
        factories: CryptoFactories,
×
58
        bypass_range_proof_verification: bool,
×
59
    ) -> Self {
×
60
        Self::new(
×
61
            BlockBodyFullValidator::new(rules.clone(), bypass_range_proof_verification),
×
62
            ChainBalanceValidator::<B>::new(rules, factories),
×
63
        )
×
64
    }
×
65
}
66

67
impl<B: BlockchainBackend> fmt::Debug for SyncValidators<B> {
68
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
×
69
        f.debug_struct("HorizonHeaderValidators")
×
70
            .field("header", &"...")
×
71
            .field("final_state", &"...")
×
72
            .finish()
×
73
    }
×
74
}
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