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

tari-project / tari / 43822446542
79%

Build:
DEFAULT BRANCH: development
Ran 16 Nov 2026 09:00AM 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

16 Nov 2026 07:14AM UTC coverage: 79.018% (+0.1%) from 78.875%
43822446542

push

github

web-flow
fix(mmr): validate PrunedHashSet on deserialize and return errors instead of panicking (#8363)

## Description

`PrunedHashSet` is the kernel MMR backend stored in LMDB as
`BlockAccumulatedData.kernels`. Its `Deserialize` derive accepted any
field values. A corrupted or tampered row decoded without error and then
crashed the node:
- the `expect` in `MerkleMountainRange::hash_to_root` panicked;
- the `unwrap` in `MerkleMountainRange::push` panicked;
- an unsorted `peak_indices` silently broke the `binary_search` in
`get`.

The set is only ever built from a verified MMR and is never received
from a peer. The threat is local corruption, and the effect was a crash
loop rather than a database error.

## Fix

- `PrunedHashSet` now deserializes through a private `RawPrunedHashSet`
shadow struct with the same fields in the same order, using
`#[serde(try_from = ...)]`. Serialization is unchanged, so existing
records keep loading.
- New `pub fn validate()` checks:
  1. `base_offset` is a valid MMR size (0 included);
  2. `peak_indices == find_peaks(base_offset)` exactly;
  3. `peak_hashes.len() == peak_indices.len()`;
4. `base_offset + hashes.len()` does not overflow and is a valid MMR
size.
- `TryFrom<&MerkleMountainRange>` asserts `validate()` in debug builds,
so the constructor and the decoder cannot drift apart.
- Failures use the existing
`MerkleMountainRangeError::BackendError("PrunedHashSet: <field> ...")`,
so the error enum gets no new variant. Through `lmdb_get` they surface
as `ChainStorageError::ConversionError`, which does not ban peers.
- `hash_to_root` and `push` return `HashNotFound(i)` instead of
panicking when the backend is missing a node. With invariants 1-3 this
cannot happen for a validated `PrunedHashSet`; it covers other
`ArrayLike` backends. No `unwrap` or `expect` remains in
`merkle_mountain_range.rs` outside tests.
- Rustdoc lists the invariants and documents `HashNotFound` on `push`
and `get_merkle_root`.

Invariant 4 is stricter than... (continued)

166 of 177 new or added lines in 2 files covered. (93.79%)

824 existing lines in 26 files now uncovered.

154139 of 195067 relevant lines covered (79.02%)

474343.14 hits per line

Uncovered Changes

Lines Coverage ∆ File
11
85.71
25.71% base_layer/mmr/src/pruned_hashset.rs

Coverage Regressions

Lines Coverage ∆ File
309
57.12
1.78% base_layer/wallet/src/output_manager_service/service.rs
160
78.88
1.29% base_layer/wallet/src/transaction_service/storage/sqlite_db.rs
69
34.92
10.56% base_layer/wallet/src/transaction_service/protocols/transaction_validation_protocol.rs
64
9.11
-0.17% base_layer/wallet/src/utxo_scanner_service/utxo_scanner_task.rs
63
66.94
-0.17% base_layer/core/src/chain_storage/blockchain_database.rs
33
78.56
-4.85% base_layer/core/src/base_node/rpc/query_service.rs
22
54.46
4.46% base_layer/p2p/src/dns/client.rs
21
19.28
19.28% comms/core/src/socks/client.rs
14
37.25
-4.58% base_layer/wallet/src/transaction_service/protocols/transaction_broadcast_protocol.rs
10
95.04
-1.01% base_layer/core/src/mempool/service/inbound_handlers.rs
10
86.18
3.83% comms/core/src/tor/control_client/commands/add_onion.rs
10
41.14
41.14% comms/core/src/tor/hidden_service/controller.rs
6
94.09
-0.14% comms/dht/src/outbound/broadcast.rs
4
87.0
-0.95% base_layer/core/src/mempool/service/service.rs
4
72.88
0.22% base_layer/wallet/src/output_manager_service/storage/sqlite_db/mod.rs
4
86.84
-5.26% comms/core/src/pipeline/inbound.rs
3
97.67
0.5% common/src/configuration/dns_name_server_list.rs
3
83.53
13.96% common/src/configuration/serializers.rs
3
77.5
-7.5% comms/core/src/peer_manager/error.rs
3
96.12
11.18% comms/core/src/utils/multiaddr.rs
2
93.63
-0.03% base_layer/core/src/base_node/sync/horizon_state_sync/synchronizer.rs
2
88.97
-0.18% base_layer/core/src/proof_of_work/cuckaroo_pow.rs
2
84.43
-1.2% comms/core/src/protocol/messaging/inbound.rs
1
97.76
-0.15% base_layer/core/src/proof_of_work/monero_rx/merkle_tree.rs
1
81.99
-0.1% base_layer/wallet/src/storage/sqlite_db/wallet.rs
1
39.34
-0.03% base_layer/wallet/src/transaction_service/service.rs
Jobs
ID Job ID Ran Files Coverage
1 43822446542.1 16 Nov 2026 09:00AM UTC 803
79.02
GitHub Action Run
Source Files on build 43822446542
  • Tree
  • List 803
  • Changed 51
  • Source Changed 15
  • Coverage Changed 51
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #43822446542
  • 66bf6c7c on github
  • Prev Build on development (#43440192169)
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