• 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/base_node/sync/horizon_state_sync/error.rs
1
//  Copyright 2022, 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::{num::TryFromIntError, time::Duration};
24

25
use tari_common_types::types::FixedHashSizeError;
26
use tari_comms::{
27
    connectivity::ConnectivityError,
28
    peer_manager::NodeId,
29
    protocol::rpc::{RpcError, RpcStatus},
30
};
31
use tari_crypto::errors::RangeProofError;
32
use tari_mmr::error::MerkleMountainRangeError;
33
use tari_transaction_components::{
34
    transaction_components::TransactionError,
35
    validation::AggregatedBodyValidationError,
36
    BanPeriod,
37
    BanReason,
38
};
39
use tari_utilities::ByteArrayError;
40
use thiserror::Error;
41
use tokio::task;
42

43
use crate::{chain_storage::ChainStorageError, validation::ValidationError, MrHashError};
44

45
#[derive(Debug, Error)]
46
pub enum HorizonSyncError {
47
    #[error("Peer sent an invalid response: {0}")]
48
    IncorrectResponse(String),
49
    #[error("Chain storage error: {0}")]
50
    ChainStorageError(#[from] ChainStorageError),
51
    #[error("Final state validation failed: {0}")]
52
    FinalStateValidationFailed(ValidationError),
53
    #[error("Join error: {0}")]
54
    JoinError(#[from] task::JoinError),
55
    #[error("A range proof verification has produced an error: {0}")]
56
    RangeProofError(String),
57
    #[error("An invalid transaction has been encountered: {0}")]
58
    TransactionError(#[from] TransactionError),
59
    #[error(
60
        "Merkle root did not match for {mr_tree} at height {at_height}. Expected {actual_hex} to equal {expected_hex}"
61
    )]
62
    InvalidMrRoot {
63
        mr_tree: String,
64
        at_height: u64,
65
        expected_hex: String,
66
        actual_hex: String,
67
    },
68
    #[error("Invalid MMR position {mmr_position} at height {at_height}")]
69
    InvalidMmrPosition { at_height: u64, mmr_position: u64 },
70
    #[error("RPC error: {0}")]
71
    RpcError(#[from] RpcError),
72
    #[error("RPC status: {0}")]
73
    RpcStatus(#[from] RpcStatus),
74
    #[error("Could not convert data:{0}")]
75
    ConversionError(String),
76
    #[error("MerkleMountainRangeError: {0}")]
77
    MerkleMountainRangeError(#[from] MerkleMountainRangeError),
78
    #[error("Connectivity error: {0}")]
79
    ConnectivityError(#[from] ConnectivityError),
80
    #[error("Validation error: {0}")]
81
    ValidationError(#[from] ValidationError),
82
    #[error("No sync peers")]
83
    NoSyncPeers,
84
    #[error("Sync failed for all peers")]
85
    FailedSyncAllPeers,
86
    #[error("Peer {peer} exceeded maximum permitted sync latency. latency: {latency:.2?}s, max: {max_latency:.2?}s")]
87
    MaxLatencyExceeded {
88
        peer: NodeId,
89
        latency: Duration,
90
        max_latency: Duration,
91
    },
92
    #[error("All sync peers exceeded max allowed latency")]
93
    AllSyncPeersExceedLatency,
94
    #[error("FixedHash size error: {0}")]
95
    FixedHashSizeError(#[from] FixedHashSizeError),
96
    #[error("No more sync peers available: {0}")]
97
    NoMoreSyncPeers(String),
98
    #[error("Could not find peer info")]
99
    PeerNotFound,
100
    #[error("Sparse Merkle Tree error: {0}")]
101
    SMTError(anyhow::Error),
102
    #[error("ByteArrayError error: {0}")]
103
    ByteArrayError(String),
104
    #[error("FixedHash size error: {0}")]
105
    MrHashError(#[from] MrHashError),
106
    #[error("Validation error: {0}")]
107
    AggregatedBodyValidation(#[from] AggregatedBodyValidationError),
108
}
109

110
impl From<ByteArrayError> for HorizonSyncError {
111
    fn from(e: ByteArrayError) -> Self {
×
UNCOV
112
        HorizonSyncError::ByteArrayError(e.to_string())
×
UNCOV
113
    }
×
114
}
115

116
impl From<TryFromIntError> for HorizonSyncError {
117
    fn from(err: TryFromIntError) -> Self {
×
UNCOV
118
        HorizonSyncError::ConversionError(err.to_string())
×
UNCOV
119
    }
×
120
}
121

122
impl From<RangeProofError> for HorizonSyncError {
123
    fn from(e: RangeProofError) -> Self {
×
UNCOV
124
        HorizonSyncError::RangeProofError(e.to_string())
×
UNCOV
125
    }
×
126
}
127

128
impl HorizonSyncError {
UNCOV
129
    pub fn get_ban_reason(&self) -> Option<BanReason> {
×
130
        match self {
×
131
            // no ban
UNCOV
132
            HorizonSyncError::ChainStorageError(e) => e.get_ban_reason(),
×
133
            HorizonSyncError::NoSyncPeers |
134
            HorizonSyncError::FailedSyncAllPeers |
135
            HorizonSyncError::AllSyncPeersExceedLatency |
136
            HorizonSyncError::ConnectivityError(_) |
137
            HorizonSyncError::NoMoreSyncPeers(_) |
138
            HorizonSyncError::PeerNotFound |
139
            HorizonSyncError::JoinError(_) |
UNCOV
140
            HorizonSyncError::MrHashError(_) => None,
×
141

142
            // short ban
143
            err @ HorizonSyncError::MaxLatencyExceeded { .. } |
×
144
            err @ HorizonSyncError::RpcError { .. } |
×
145
            err @ HorizonSyncError::RpcStatus { .. } => Some(BanReason {
×
146
                reason: format!("{err}"),
×
UNCOV
147
                ban_duration: BanPeriod::Short,
×
UNCOV
148
            }),
×
149

150
            // long ban
151
            err @ HorizonSyncError::IncorrectResponse(_) |
×
152
            err @ HorizonSyncError::FinalStateValidationFailed(_) |
×
153
            err @ HorizonSyncError::RangeProofError(_) |
×
154
            err @ HorizonSyncError::InvalidMrRoot { .. } |
×
155
            err @ HorizonSyncError::SMTError(_) |
×
156
            err @ HorizonSyncError::InvalidMmrPosition { .. } |
×
157
            err @ HorizonSyncError::ConversionError(_) |
×
158
            err @ HorizonSyncError::MerkleMountainRangeError(_) |
×
159
            err @ HorizonSyncError::FixedHashSizeError(_) |
×
160
            err @ HorizonSyncError::TransactionError(_) |
×
161
            err @ HorizonSyncError::AggregatedBodyValidation(_) |
×
162
            err @ HorizonSyncError::ByteArrayError(_) => Some(BanReason {
×
UNCOV
163
                reason: format!("{err}"),
×
164
                ban_duration: BanPeriod::Long,
×
UNCOV
165
            }),
×
166

UNCOV
167
            HorizonSyncError::ValidationError(err) => ValidationError::get_ban_reason(err),
×
168
        }
UNCOV
169
    }
×
170
}
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