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

tari-project / tari / 40846571167
79%

Build:
DEFAULT BRANCH: development
Ran 29 Oct 2026 11:11AM UTC
Jobs 1
Files 799
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Oct 2026 09:02AM UTC coverage: 76.992% (-0.1%) from 77.127%
40846571167

push

github

web-flow
fix(sync): keep median timestamp windows in height order (#8195)

Description
---
Keeps the 11-entry median-timestamp windows used by header sync and by
orphan-descendant validation in height order, so that adding a new
timestamp evicts the oldest one.

- `RollingVec`: removes `insert()` and `sort_unstable()`, the two
methods that broke oldest-first order, and stores an explicit `max_len`
instead of relying on `Vec::capacity()`, which is only guaranteed to be
at least the requested size.
- Header sync (`header_sync/validator.rs`): pushes each validated
header's timestamp instead of inserting it at its sorted position.
- `get_previous_timestamps` (`blockchain_database.rs`): returns the
window oldest-first instead of sorted. `calc_median_timestamp` already
sorts a copy, so nothing needs a sorted window.

Motivation and Context
---
Block validation computes the median over the previous 11 headers by
height. Header sync kept its window sorted by value, and
`RollingVec::insert` evicted index 0 after computing the insert
position, so once timestamps were out of order the window kept stale
entries and dropped recent ones. The orphan-descendant path sorted its
window and then pushed, which evicted the smallest timestamp rather than
the oldest.

In both cases the median could differ from block validation's in either
direction. Header sync could reject a valid header (record it as a bad
block and ban the peer) or accept a header that block validation
rejects. This needs unusual out-of-order timestamps and only affects
nodes that are catching up.

The consensus rule itself (block validation) is unchanged, so this is
not gated.

How Has This Been Tested?
---
New tests, each failing on the previous code:
- `RollingVec` unit tests: insertion order, oldest-first eviction with
out-of-order values, clone keeps the limit.
- Header sync: after every header the window equals the last 11
timestamps by height.
- Header sync: a valid header that the old window rejected (tru... (continued)

161 of 162 new or added lines in 3 files covered. (99.38%)

359 existing lines in 15 files now uncovered.

138311 of 179644 relevant lines covered (76.99%)

300698.23 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
97.37
7.55% base_layer/core/src/common/rolling_vec.rs

Coverage Regressions

Lines Coverage ∆ File
274
63.75
-3.57% base_layer/core/src/chain_storage/blockchain_database.rs
44
57.57
-1.07% base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs
9
64.79
-2.66% base_layer/core/src/chain_storage/db_transaction.rs
4
72.94
-0.14% base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs
4
78.3
0.97% comms/core/src/connectivity/manager.rs
4
69.46
-1.48% comms/core/src/connectivity/requester.rs
3
32.99
-3.09% base_layer/core/src/chain_storage/error.rs
3
98.98
-0.76% base_layer/core/src/consensus/base_node_consensus_manager.rs
3
76.97
-0.36% base_layer/core/src/test_helpers/blockchain.rs
3
90.76
-0.33% comms/dht/src/actor.rs
3
80.86
-0.1% comms/dht/src/connectivity/mod.rs
2
87.03
-0.22% base_layer/core/src/base_node/service/service.rs
1
98.88
-1.12% base_layer/common_types/src/dammsum.rs
1
93.23
-0.38% comms/core/src/connectivity/proactive_dialer.rs
1
92.24
-0.08% comms/core/src/multiplexing/yamux.rs
Jobs
ID Job ID Ran Files Coverage
1 40846571167.1 29 Oct 2026 11:11AM UTC 799
76.99
GitHub Action Run
Source Files on build 40846571167
  • Tree
  • List 799
  • Changed 27
  • Source Changed 3
  • Coverage Changed 27
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #40846571167
  • 1b0cdfe1 on github
  • Prev Build on development (#40791459365)
  • Next Build on development (#41092230564)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc