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

tari-project / tari / 26096857381

19 May 2026 12:22PM UTC coverage: 60.295% (-0.9%) from 61.163%
26096857381

push

github

web-flow
chore(deps): bump azure/trusted-signing-action from 1.2.0 to 2.0.0 (#7840)

Bumps
[azure/trusted-signing-action](https://github.com/azure/trusted-signing-action)
from 1.2.0 to 2.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/azure/trusted-signing-action/releases">azure/trusted-signing-action's
releases</a>.</em></p>
<blockquote>
<h2>v2.0.0</h2>
<h2>What's Changed</h2>
<ul>
<li>refactor: migrate to new artifactsigning module by <a
href="https://github.com/Jaxelr"><code>@​Jaxelr</code></a> in <a
href="https://redirect.github.com/Azure/artifact-signing-action/pull/133">Azure/artifact-signing-action#133</a></li>
<li>docs: update README runtime version and action references by <a
href="https://github.com/Jaxelr"><code>@​Jaxelr</code></a> in <a
href="https://redirect.github.com/Azure/artifact-signing-action/pull/139">Azure/artifact-signing-action#139</a></li>
<li>refactor: upgrade packages to the latest versions by <a
href="https://github.com/Jaxelr"><code>@​Jaxelr</code></a> in <a
href="https://redirect.github.com/Azure/artifact-signing-action/pull/135">Azure/artifact-signing-action#135</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/Azure/artifact-signing-action/compare/v1.2.0...v2.0.0">https://github.com/Azure/artifact-signing-action/compare/v1.2.0...v2.0.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/Azure/artifact-signing-action/commit/c7ab2a863"><code>c7ab2a8</code></a>
refactor: upgrade packages to the latest versions (<a
href="https://redirect.github.com/azure/trusted-signing-action/issues/135">#135</a>)</li>
<li><a
href="https://github.com/Azure/artifact-signing-action/commit/7664cea6a"><code>7664cea</code></a>
docs: update README runtime version and action references (<a
href="https://redirect.github.com/azure/trusted-signing-action/issues/139">#1... (continued)

70325 of 116635 relevant lines covered (60.29%)

222837.88 hits per line

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

44.16
/base_layer/core/src/validation/mocks.rs
1
// Copyright 2019. 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::sync::{
24
    Arc,
25
    atomic::{AtomicBool, Ordering},
26
};
27

28
use tari_common_types::{
29
    chain_metadata::ChainMetadata,
30
    types::{CompressedCommitment, FixedHash},
31
};
32
use tari_node_components::blocks::{Block, BlockHeader, ChainBlock};
33
use tari_transaction_components::{tari_proof_of_work::Difficulty, transaction_components::Transaction};
34
use tari_utilities::epoch_time::EpochTime;
35

36
use super::{
37
    BlockBodyValidator,
38
    HeaderChainLinkedValidator,
39
    InternalConsistencyValidator,
40
    TransactionValidator,
41
    traits::CandidateBlockValidator,
42
};
43
use crate::{
44
    chain_storage::BlockchainBackend,
45
    proof_of_work::{AchievedTargetDifficulty, randomx_factory::RandomXFactory},
46
    test_helpers::create_consensus_rules,
47
    validation::{DifficultyCalculator, FinalHorizonStateValidation, error::ValidationError},
48
};
49

50
#[derive(Clone)]
51
pub struct MockValidator {
52
    is_valid: Arc<AtomicBool>,
53
}
54

55
pub struct SharedFlag(Arc<AtomicBool>);
56

57
impl SharedFlag {
58
    pub fn set(&self, v: bool) {
×
59
        self.0.store(v, Ordering::SeqCst);
×
60
    }
×
61
}
62

63
impl MockValidator {
64
    pub fn new(is_valid: bool) -> Self {
525✔
65
        Self {
525✔
66
            is_valid: Arc::new(AtomicBool::new(is_valid)),
525✔
67
        }
525✔
68
    }
525✔
69

70
    pub fn shared_flag(&self) -> SharedFlag {
×
71
        SharedFlag(self.is_valid.clone())
×
72
    }
×
73
}
74

75
impl<B: BlockchainBackend> BlockBodyValidator<B> for MockValidator {
76
    fn validate_body(&self, _: &B, block: &Block) -> Result<Block, ValidationError> {
17✔
77
        if self.is_valid.load(Ordering::SeqCst) {
17✔
78
            Ok(block.clone())
17✔
79
        } else {
80
            Err(ValidationError::ConsensusError(
×
81
                "This mock validator always returns an error".to_string(),
×
82
            ))
×
83
        }
84
    }
17✔
85
}
86

87
impl<B: BlockchainBackend> CandidateBlockValidator<B> for MockValidator {
88
    fn validate_body_with_metadata(&self, _: &B, _: &ChainBlock, _: &ChainMetadata) -> Result<(), ValidationError> {
193✔
89
        if self.is_valid.load(Ordering::SeqCst) {
193✔
90
            Ok(())
193✔
91
        } else {
92
            Err(ValidationError::ConsensusError(
×
93
                "This mock validator always returns an error".to_string(),
×
94
            ))
×
95
        }
96
    }
193✔
97

98
    fn validate_body_at_height(&self, _: &B, _: &ChainBlock) -> Result<(), ValidationError> {
×
99
        if self.is_valid.load(Ordering::SeqCst) {
×
100
            Ok(())
×
101
        } else {
102
            Err(ValidationError::ConsensusError(
×
103
                "This mock validator always returns an error".to_string(),
×
104
            ))
×
105
        }
106
    }
×
107
}
108

109
// #[async_trait]
110
impl InternalConsistencyValidator for MockValidator {
111
    fn validate_internal_consistency(&self, _item: &Block) -> Result<(), ValidationError> {
×
112
        if self.is_valid.load(Ordering::SeqCst) {
×
113
            Ok(())
×
114
        } else {
115
            Err(ValidationError::ConsensusError(
×
116
                "This mock validator always returns an error".to_string(),
×
117
            ))
×
118
        }
119
    }
×
120
}
121

122
impl<B: BlockchainBackend> HeaderChainLinkedValidator<B> for MockValidator {
123
    fn validate(
239✔
124
        &self,
239✔
125
        db: &B,
239✔
126
        header: &BlockHeader,
239✔
127
        _: &BlockHeader,
239✔
128
        _: &[EpochTime],
239✔
129
        _: Option<Difficulty>,
239✔
130
        _: FixedHash,
239✔
131
    ) -> Result<AchievedTargetDifficulty, ValidationError> {
239✔
132
        if self.is_valid.load(Ordering::SeqCst) {
239✔
133
            // this assumes consensus rules are the same as the test rules which is a little brittle
134
            let difficulty_calculator = DifficultyCalculator::new(create_consensus_rules(), RandomXFactory::default());
237✔
135
            let achieved_target_diff = difficulty_calculator.check_achieved_and_target_difficulty(db, header)?;
237✔
136
            Ok(achieved_target_diff)
237✔
137
        } else {
138
            Err(ValidationError::ConsensusError(
2✔
139
                "This mock validator always returns an error".to_string(),
2✔
140
            ))
2✔
141
        }
142
    }
239✔
143
}
144

145
impl TransactionValidator for MockValidator {
146
    fn validate(&self, _transaction: &Transaction) -> Result<(), ValidationError> {
30✔
147
        if self.is_valid.load(Ordering::SeqCst) {
30✔
148
            Ok(())
30✔
149
        } else {
150
            Err(ValidationError::ConsensusError(
×
151
                "This mock validator always returns an error".to_string(),
×
152
            ))
×
153
        }
154
    }
30✔
155
}
156

157
impl<B: BlockchainBackend> FinalHorizonStateValidation<B> for MockValidator {
158
    fn validate(
×
159
        &self,
×
160
        _backend: &B,
×
161
        _height: u64,
×
162
        _total_utxo_sum: &CompressedCommitment,
×
163
        _total_kernel_sum: &CompressedCommitment,
×
164
        _total_burned_sum: &CompressedCommitment,
×
165
    ) -> Result<(), ValidationError> {
×
166
        if self.is_valid.load(Ordering::SeqCst) {
×
167
            Ok(())
×
168
        } else {
169
            Err(ValidationError::ConsensusError(
×
170
                "This mock validator always returns an error".to_string(),
×
171
            ))
×
172
        }
173
    }
×
174
}
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