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

tari-project / tari / 17152995555

22 Aug 2025 10:35AM UTC coverage: 59.322% (+3.4%) from 55.905%
17152995555

push

github

web-flow
feat!: update c29 fork block (#7434)

Description
---

Updated the c29 fork block to be at height `95180` and approximately
`target_time = Tue, 16 Aug 2025 10:00:00 +0000`. This has been
calculated as follows:

- Get block timings from the base node for the last 10,000 blocks.

```
11:24 v5.0.0-pre.4 mainnet State: Listening Tip: 77442 (Fri, 22 Aug 2025 09:22:28 +0000) ...
>>
>> block-timing 10000
Timing for blocks #77442 - #67443
Max block time: 1443
Min block time: 1
Avg block time: 121.8988898889889
>>
>>
>> watch status
11:24 v5.0.0-pre.4 mainnet State: Listening Tip: 77442 (Fri, 22 Aug 2025 09:22:28 +0000) ...
```

Our start time is the time published by the base node:
- `start_time = Fri, 22 Aug 2025 09:22:28 +0000`

Our start block is the block published by the base node:
- `start_block = 77442`

Approximate time difference in seconds: `target_time - start_time =
2162147 seconds`. Using average block time, we get `77442 + 2162147 /
121.899 = 95179.2` then rounded up to `95180`.

Motivation and Context
---
The fork block height was wrong.

How Has This Been Tested?
---
See the calculation above.

What process can a PR reviewer use to test or verify this change?
---
Code review and review the calculation in the PR description.

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
BREAKING CHANGE: Consensus constant change to
`con_5.effective_from_height = 95_180;`.


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

* **Chores**
* Postponed the mainnet V2 network upgrade to block height 95... (continued)

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

5077 existing lines in 113 files now uncovered.

70233 of 118392 relevant lines covered (59.32%)

538661.6 hits per line

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

0.0
/base_layer/core/src/validation/error.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
use tari_common_types::{epoch::VnEpoch, types::HashOutput};
23
use tari_sidechain::SidechainProofValidationError;
24
use tari_transaction_components::{
25
    tari_amount::MicroMinotari,
26
    tari_proof_of_work::{DifficultyError, PowError},
27
    transaction_components::{covenants::CovenantError, OutputType, RangeProofType, TransactionError},
28
    validation::AggregatedBodyValidationError,
29
    BanPeriod,
30
    BanReason,
31
};
32
use tari_utilities::ByteArrayError;
33
use thiserror::Error;
34

35
use crate::{
36
    blocks::{BlockHeaderValidationError, BlockValidationError},
37
    chain_storage::ChainStorageError,
38
    proof_of_work::{cuckaroo_pow::CuckarooVerificationError, monero_rx::MergeMineError},
39
};
40

41
#[derive(Debug, Error)]
42
pub enum ValidationError {
43
    #[error("Serialization failed: {0}")]
44
    SerializationError(String),
45
    #[error("Block header validation failed: {0}")]
46
    BlockHeaderError(#[from] BlockHeaderValidationError),
47
    #[error("Block validation error: {0}")]
48
    BlockError(#[from] BlockValidationError),
49
    #[error("Contains kernels or inputs that are not yet spendable")]
50
    MaturityError,
51
    #[error("The block weight ({actual_weight}) is above the maximum ({max_weight})")]
52
    BlockTooLarge { actual_weight: u64, max_weight: u64 },
53
    #[error("Contains {} unknown inputs", .0.len())]
54
    UnknownInputs(Vec<HashOutput>),
55
    #[error("Contains an unknown input")]
56
    UnknownInput,
57
    #[error("The transaction is invalid: {0}")]
58
    TransactionError(#[from] TransactionError),
59
    #[error("Fatal storage error during validation: {0}")]
60
    FatalStorageError(String),
61
    #[error(
62
        "The total expected supply plus the total accumulated (offset) excess does not equal the sum of all UTXO \
63
         commitments."
64
    )]
65
    InvalidAccountingBalance,
66
    #[error("Transaction contains already spent inputs")]
67
    ContainsSTxO,
68
    #[error("Transaction contains outputs that already exist")]
69
    ContainsTxO,
70
    #[error("Transaction contains an output commitment that already exists")]
71
    ContainsDuplicateUtxoCommitment,
72
    #[error("Final state validation failed: The UTXO set did not balance with the expected emission at height {0}")]
73
    ChainBalanceValidationFailed(u64),
74
    #[error("The total value + fees of the block exceeds the maximum allowance on chain")]
75
    CoinbaseExceedsMaxLimit,
76
    #[error("Proof of work error: {0}")]
77
    ProofOfWorkError(#[from] PowError),
78
    #[error("Attempted to validate genesis block")]
79
    ValidatingGenesis,
80
    #[error("Duplicate or unsorted input found in block body")]
81
    UnsortedOrDuplicateInput,
82
    #[error("Duplicate or unsorted output found in block body")]
83
    UnsortedOrDuplicateOutput,
84
    #[error("Duplicate or unsorted kernel found in block body")]
85
    UnsortedOrDuplicateKernel,
86
    #[error("Error in merge mine data:{0}")]
87
    MergeMineError(#[from] MergeMineError),
88
    #[error("Maximum transaction weight exceeded")]
89
    MaxTransactionWeightExceeded,
90
    #[error("Expected block height to be {expected}, but was {block_height}")]
91
    IncorrectHeight { expected: u64, block_height: u64 },
92
    #[error("Expected block previous hash to be {expected}, but was {block_hash}")]
93
    IncorrectPreviousHash { expected: String, block_hash: String },
94
    #[error("Bad block with hash '{hash}' and reason '{reason}' found")]
95
    BadBlockFound { hash: String, reason: String },
96
    #[error("Script exceeded maximum script size, expected less than {max_script_size} but was {actual_script_size}")]
97
    TariScriptExceedsMaxSize {
98
        max_script_size: usize,
99
        actual_script_size: usize,
100
    },
101
    #[error(
102
        "Encrypted data exceeded maximum encrytped data size, expected less than {max_encrypted_data_size} but was \
103
         {actual_encrypted_data_size}"
104
    )]
105
    EncryptedDataExceedsMaxSize {
106
        max_encrypted_data_size: usize,
107
        actual_encrypted_data_size: usize,
108
    },
109
    #[error("Consensus Error: {0}")]
110
    ConsensusError(String),
111
    #[error("Duplicate kernel Error: {0}")]
112
    DuplicateKernelError(String),
113
    #[error("Covenant failed to validate: {0}")]
114
    CovenantError(#[from] CovenantError),
115
    #[error("Invalid or unsupported blockchain version {version}")]
116
    InvalidBlockchainVersion { version: u16 },
117
    #[error("Contains Invalid Burn: {0}")]
118
    InvalidBurnError(String),
119
    #[error("Output type '{output_type}' is not permitted")]
120
    OutputTypeNotPermitted { output_type: OutputType },
121
    #[error("Range proof type '{range_proof_type}' is not permitted")]
122
    RangeProofTypeNotPermitted { range_proof_type: RangeProofType },
123
    #[error("Output type '{output_type}' is not matched to any range proof type")]
124
    OutputTypeNotMatchedToRangeProofType { output_type: OutputType },
125
    #[error("Validator registration has invalid minimum amount {actual}, must be at least {min}")]
126
    ValidatorNodeRegistrationMinDepositAmount { min: MicroMinotari, actual: MicroMinotari },
127
    #[error("Validator registration has invalid maturity {actual}, must be at least {min}")]
128
    ValidatorNodeRegistrationMinLockHeight { min: u64, actual: u64 },
129
    #[error("Sidechain ID knowledge proof not valid for template registration")]
130
    TemplateInvalidSidechainIdKnowledgeProof,
131
    #[error("Author signature not valid for template registration")]
132
    TemplateAuthorSignatureNotValid,
133
    #[error("Sidechain ID knowledge proof not valid for confidential output")]
134
    ConfidentialOutputSidechainIdKnowledgeProofNotValid,
135
    #[error("Validator node registration signature failed verification")]
136
    InvalidValidatorNodeSignature,
137
    #[error("Sidechain ID knowledge proof not valid for validator node registration")]
138
    ValidatorNodeInvalidSidechainIdKnowledgeProof,
139
    #[error(
140
        "An unexpected number of timestamps were provided to the header validator. THIS IS A BUG. Expected \
141
         {expected}, got {actual}"
142
    )]
143
    IncorrectNumberOfTimestampsProvided { expected: u64, actual: u64 },
144
    #[error("Invalid difficulty: {0}")]
145
    DifficultyError(#[from] DifficultyError),
146
    #[error("Covenant too large. Max size: {max_size}, Actual size: {actual_size}")]
147
    CovenantTooLarge { max_size: usize, actual_size: usize },
148
    #[error("Invalid Serialized Public key: {0}")]
149
    InvalidSerializedPublicKey(String),
150
    #[error("Sidechain proof invalid: `{0}`")]
151
    SidechainProofInvalid(#[from] SidechainProofValidationError),
152
    #[error("Sidechain eviction proof submitted for unregistered validator {validator_pk}")]
153
    SidechainEvictionProofValidatorNotFound { validator_pk: String },
154
    #[error(
155
        "Sidechain eviction proof invalid: given epoch {epoch} is greater than the epoch at tip height {tip_height}"
156
    )]
157
    SidechainEvictionProofInvalidEpoch { epoch: VnEpoch, tip_height: u64 },
158
    #[error("Validator node already registered: {public_key}")]
159
    ValidatorNodeAlreadyRegistered { public_key: String },
160
    #[error("Validator node {public_key} not registered: {details}")]
161
    ValidatorNodeNotRegistered { public_key: String, details: String },
162
    #[error("Validator registration {public_key} invalid: max epoch {max_epoch} < current epoch {current_epoch}")]
163
    ValidatorNodeRegistrationMaxEpoch {
164
        public_key: String,
165
        current_epoch: VnEpoch,
166
        max_epoch: VnEpoch,
167
    },
168
    #[error("{output_type} output rule disallows the spend: {details}")]
169
    OutputSpendRuleDisallow { output_type: OutputType, details: String },
170
    #[error("Output type '{output_type}' does not match sidechain data")]
171
    OutputTypeNotMatchSidechainData { output_type: OutputType, details: String },
172
    #[error("Validation error: {0}")]
173
    AggregatedBodyValidationError(#[from] AggregatedBodyValidationError),
174
    #[error("Cuckaroo POW error: {0}")]
175
    CuckarooPowError(#[from] CuckarooVerificationError),
176
}
177

178
// ChainStorageError has a ValidationError variant, so to prevent a cyclic dependency we use a string representation in
179
// for storage errors that cause validation failures.
180
impl From<ChainStorageError> for ValidationError {
UNCOV
181
    fn from(err: ChainStorageError) -> Self {
×
UNCOV
182
        Self::FatalStorageError(err.to_string())
×
UNCOV
183
    }
×
184
}
185

186
impl From<ByteArrayError> for ValidationError {
UNCOV
187
    fn from(err: ByteArrayError) -> Self {
×
UNCOV
188
        Self::InvalidSerializedPublicKey(err.to_string())
×
UNCOV
189
    }
×
190
}
191

192
impl ValidationError {
193
    pub fn get_ban_reason(&self) -> Option<BanReason> {
×
194
        match self {
×
195
            ValidationError::ProofOfWorkError(e) => e.get_ban_reason(),
×
196
            err @ ValidationError::SerializationError(_) |
×
197
            err @ ValidationError::BlockHeaderError(_) |
×
198
            err @ ValidationError::BlockError(_) |
×
199
            err @ ValidationError::MaturityError |
×
200
            err @ ValidationError::BlockTooLarge { .. } |
×
201
            err @ ValidationError::UnknownInputs(_) |
×
202
            err @ ValidationError::UnknownInput |
×
203
            err @ ValidationError::TransactionError(_) |
×
204
            err @ ValidationError::InvalidAccountingBalance |
×
205
            err @ ValidationError::ContainsSTxO |
×
206
            err @ ValidationError::ContainsTxO |
×
207
            err @ ValidationError::ContainsDuplicateUtxoCommitment |
×
208
            err @ ValidationError::ChainBalanceValidationFailed(_) |
×
209
            err @ ValidationError::ValidatingGenesis |
×
210
            err @ ValidationError::UnsortedOrDuplicateInput |
×
211
            err @ ValidationError::UnsortedOrDuplicateOutput |
×
212
            err @ ValidationError::UnsortedOrDuplicateKernel |
×
213
            err @ ValidationError::MaxTransactionWeightExceeded |
×
214
            err @ ValidationError::IncorrectHeight { .. } |
×
215
            err @ ValidationError::IncorrectPreviousHash { .. } |
×
UNCOV
216
            err @ ValidationError::BadBlockFound { .. } |
×
217
            err @ ValidationError::TariScriptExceedsMaxSize { .. } |
×
218
            err @ ValidationError::EncryptedDataExceedsMaxSize { .. } |
×
219
            err @ ValidationError::ConsensusError(_) |
×
220
            err @ ValidationError::DuplicateKernelError(_) |
×
221
            err @ ValidationError::CovenantError(_) |
×
222
            err @ ValidationError::InvalidBlockchainVersion { .. } |
×
223
            err @ ValidationError::InvalidBurnError(_) |
×
224
            err @ ValidationError::OutputTypeNotPermitted { .. } |
×
225
            err @ ValidationError::RangeProofTypeNotPermitted { .. } |
×
226
            err @ ValidationError::OutputTypeNotMatchedToRangeProofType { .. } |
×
227
            err @ ValidationError::ValidatorNodeRegistrationMinDepositAmount { .. } |
×
228
            err @ ValidationError::ValidatorNodeRegistrationMinLockHeight { .. } |
×
229
            err @ ValidationError::InvalidValidatorNodeSignature |
×
230
            err @ ValidationError::ValidatorNodeInvalidSidechainIdKnowledgeProof |
×
231
            err @ ValidationError::TemplateInvalidSidechainIdKnowledgeProof |
×
232
            err @ ValidationError::TemplateAuthorSignatureNotValid |
×
233
            err @ ValidationError::ConfidentialOutputSidechainIdKnowledgeProofNotValid |
×
234
            err @ ValidationError::DifficultyError(_) |
×
235
            err @ ValidationError::CoinbaseExceedsMaxLimit |
×
236
            err @ ValidationError::CovenantTooLarge { .. } |
×
237
            err @ ValidationError::InvalidSerializedPublicKey(_) |
×
238
            err @ ValidationError::SidechainEvictionProofValidatorNotFound { .. } |
×
239
            err @ ValidationError::SidechainProofInvalid(_) |
×
240
            err @ ValidationError::SidechainEvictionProofInvalidEpoch { .. } |
×
241
            err @ ValidationError::ValidatorNodeAlreadyRegistered { .. } |
×
242
            err @ ValidationError::ValidatorNodeNotRegistered { .. } |
×
UNCOV
243
            err @ ValidationError::ValidatorNodeRegistrationMaxEpoch { .. } |
×
UNCOV
244
            err @ ValidationError::OutputTypeNotMatchSidechainData { .. } |
×
UNCOV
245
            err @ ValidationError::AggregatedBodyValidationError(_) |
×
UNCOV
246
            err @ ValidationError::CuckarooPowError(_) |
×
247
            err @ ValidationError::OutputSpendRuleDisallow { .. } => Some(BanReason {
×
248
                reason: err.to_string(),
×
UNCOV
249
                ban_duration: BanPeriod::Long,
×
UNCOV
250
            }),
×
UNCOV
251
            ValidationError::MergeMineError(e) => e.get_ban_reason(),
×
UNCOV
252
            ValidationError::FatalStorageError(_) | ValidationError::IncorrectNumberOfTimestampsProvided { .. } => None,
×
253
        }
UNCOV
254
    }
×
255
}
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