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

tari-project / tari / 42604330087
79%

Build:
DEFAULT BRANCH: development
Ran 09 Nov 2026 01:00PM UTC
Jobs 1
Files 803
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

09 Nov 2026 10:51AM UTC coverage: 78.4% (+0.1%) from 78.301%
42604330087

push

github

web-flow
fix(base-node): cache per-algorithm targets for the new-block difficulty check and bound the walk (#8318)

## Description

The pre-filter that checks a gossiped block's difficulty before proof of
work (`check_min_block_difficulty`) used to read headers back from the
tip on every new-block message until it found one of the same algorithm,
with no limit. It now reuses a per-tip cache and refreshes it with one
bounded walk.

- **Cache:** the latest target difficulty of each permitted algorithm is
cached against the current tip hash, shared across handler clones. A
check at an unchanged tip reads no headers. A new tip, reorg or rewind
changes the tip hash, and the next check refreshes the cache.
- **Bounded walk:** a refresh is one walk back from the tip that fills
every permitted algorithm at once and stops early once all are found. It
is capped at `difficulty_block_window × permitted algorithms` headers
(the window that defines each algorithm's difficulty, once per
algorithm). An algorithm not seen within the cap is cached as not found
and falls back to `min_pow_difficulty`.
- **Walk along the tip's own ancestry:** the walk fetches each parent by
`prev_hash`, so it cannot mix headers from two chains if the main chain
changes while it runs. If a parent is no longer stored, the walk stops
and its result is not cached.
- **Unchanged:** the threshold itself, `max(target / 2,
min_pow_difficulty)` with the consensus constants for `max(tip, claimed
height)`, and the RandomX / Cuckaroo checks that follow.

## Motivation and Context

On networks where an algorithm is rarely mined, the walk could read far
back towards genesis, and it repeated for every gossip message.

## How Has This Been Tested?

New unit tests in `inbound_handlers.rs`:
- a second check at the same tip does no walk;
- a new tip and a reorg refresh the cache;
- an algorithm beyond the cap gets the minimum difficulty and is not
walked again;
- an algorithm inside the cap gets half the target of i... (continued)

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

149 existing lines in 24 files now uncovered.

148092 of 188893 relevant lines covered (78.4%)

1050771.96 hits per line

Coverage Regressions

Lines Coverage ∆ File
40
66.34
1.85% base_layer/core/src/chain_storage/blockchain_database.rs
37
93.3
0.03% base_layer/core/src/chain_storage/lmdb_db/validator_node_store.rs
13
62.89
-3.68% comms/dht/src/network_discovery/state_machine.rs
8
77.26
-0.35% comms/core/src/connectivity/manager.rs
7
92.12
-2.9% comms/core/src/protocol/rpc/status.rs
6
89.37
-0.52% comms/core/src/connection_manager/dialer.rs
5
67.38
0.05% base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs
5
77.46
-0.03% base_layer/wallet/src/transaction_service/storage/sqlite_db.rs
3
66.51
-1.42% base_layer/core/src/base_node/sync/rpc/service.rs
3
36.63
-2.97% base_layer/core/src/chain_storage/error.rs
3
91.26
-0.46% comms/core/src/connection_manager/listener.rs
3
83.19
-0.87% comms/core/src/connection_manager/manager.rs
2
87.24
0.0% base_layer/core/src/base_node/service/service.rs
2
96.8
-0.91% comms/core/src/utils/mpsc.rs
2
91.09
-0.22% comms/dht/src/actor.rs
2
87.15
-0.47% comms/dht/src/network_discovery/rebootstrap.rs
1
85.13
2.14% base_layer/core/src/base_node/comms_interface/inbound_handlers.rs
1
94.57
-0.12% base_layer/core/src/mempool/service/inbound_handlers.rs
1
86.99
-0.23% base_layer/core/src/mempool/service/service.rs
1
80.82
-1.37% base_layer/node_components/src/blocks/chain_block.rs
1
73.15
0.14% base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs
1
49.06
-0.94% comms/core/src/connectivity/selection.rs
1
92.24
-0.08% comms/core/src/multiplexing/yamux.rs
1
90.43
-1.06% comms/core/src/protocol/protocols.rs
Jobs
ID Job ID Ran Files Coverage
1 42604330087.1 09 Nov 2026 01:00PM UTC 803
78.4
GitHub Action Run
Source Files on build 42604330087
  • Tree
  • List 803
  • Changed 38
  • Source Changed 2
  • Coverage Changed 38
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #42604330087
  • b9d254e1 on github
  • Prev Build on development (#42575445992)
  • Next Build on development (#42668960498)
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