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

tari-project / tari / 40295814016
79%

Build:
DEFAULT BRANCH: development
Ran 26 Oct 2026 10:59AM 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

26 Oct 2026 08:56AM UTC coverage: 77.106% (-0.07%) from 77.18%
40295814016

push

github

web-flow
fix(chain-storage): keep walking an orphan's ancestry above the main tip (#8174)

Description
---

When a block's parent is a stored orphan that sits above the local tip,
`get_vm_key_for_candidate_header` looked up the main-chain header at the
parent's height. There is no header there yet, so the lookup returned
`ValueNotFound` and the block was rejected without being stored. The
sender wasn't blamed. A fork delivered one block at a time, which is the
normal announcement path, was therefore dropped at local tip+2 and could
not grow past it, even if it later had more accumulated work.

This PR makes a missing main-chain header at a height mean "this
ancestor is not on the main chain" and the walk continues down to the
fork point:

```rust
let chain_header = db.fetch_chain_header_by_height(h.height()).optional()?;
if chain_header.is_some_and(|c| *h.header() == *c.header()) {
```

Only `ValueNotFound` is turned into "not here". Other storage errors
still fail the walk. The returned fork height can still only be a height
where the candidate's ancestor equals the stored main-chain header, so
nothing above the real common height is trusted.

**Test helpers**
- `BlockSpec` gains a `pow_algo` field (default `Sha3x`, the same as
before), a `with_pow_algo` builder method and a `pow_algo:` key in
`block_spec!`. Existing tests build the same blocks.

Motivation and Context
---

The total accumulated difficulty is the product of the per-algorithm
totals, so a fork can be one block longer than the local chain and still
be weaker. That fork is held as an orphan at tip+1, and its next block
was then rejected. The node only reached the fork through header sync.

Known and not changed here:
- The VM-key lookups in `find_orphan_descendant_tips_of` (the existing
TODO) and `validation/difficulty_calculator.rs` take the key from the
main chain. They can also ask for a height above the tip, but only for a
fork more than 65 blocks above the tip that crosses a 2048-block band... (continued)

105 of 105 new or added lines in 3 files covered. (100.0%)

521 existing lines in 19 files now uncovered.

137502 of 178329 relevant lines covered (77.11%)

242934.45 hits per line

Coverage Regressions

Lines Coverage ∆ File
257
67.83
-3.13% base_layer/core/src/chain_storage/blockchain_database.rs
73
71.5
5.73% base_layer/core/src/base_node/sync/header_sync/synchronizer.rs
56
73.83
1.18% base_layer/core/src/base_node/sync/block_sync/synchronizer.rs
39
94.16
2.66% base_layer/core/src/mempool/service/inbound_handlers.rs
35
60.9
-0.39% base_layer/core/src/chain_storage/lmdb_db/lmdb_db.rs
17
77.33
-0.14% comms/core/src/connectivity/manager.rs
13
28.26
1.59% base_layer/core/src/base_node/sync/block_sync/error.rs
7
92.24
-0.55% comms/core/src/multiplexing/yamux.rs
5
77.49
0.0% base_layer/wallet/src/transaction_service/storage/sqlite_db.rs
4
66.27
-1.18% base_layer/core/src/chain_storage/db_transaction.rs
3
73.22
0.07% base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs
3
96.58
-0.73% comms/dht/src/dedup/dedup_cache.rs
2
89.18
0.16% comms/core/src/connection_manager/peer_connection.rs
2
84.68
-0.29% comms/core/src/protocol/rpc/client/mod.rs
1
59.04
-1.2% base_layer/core/src/chain_storage/block_add_result.rs
1
99.48
-0.52% base_layer/core/src/test_helpers/mod.rs
1
55.26
0.0% base_layer/core/src/validation/error.rs
1
90.92
-0.16% base_layer/p2p/src/services/liveness/service.rs
1
91.09
-0.11% comms/dht/src/actor.rs
Jobs
ID Job ID Ran Files Coverage
1 40295814016.1 26 Oct 2026 10:59AM UTC 799
77.11
GitHub Action Run
Source Files on build 40295814016
  • Tree
  • List 799
  • Changed 34
  • Source Changed 7
  • Coverage Changed 34
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #40295814016
  • a6e32316 on github
  • Prev Build on development (#39768864813)
  • Next Build on development (#40313433085)
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