tari-project / tari

The Tari protocol
https://tari.com
BSD 3-Clause "New" or "Revised" License
354 stars 219 forks source link

feat!: add new header field #6686

Closed SWvheerden closed 1 week ago

SWvheerden commented 1 week ago

Description

Add new header field, block output mmr which only tracks outputs in current block

Motivation and Context

This is needed in order to validate that all outputs included in the block is correctly captured in the pow of the header. The current strategy is to only use the output smt, which commits to all outputs on the blockchain. This is required for horizon sync and prune mode to verify the blockchain as we sync. But someone else wants to verify the block outputs, they have to have the entire outputs set aka entire blockchain in order to verify that the outputs are indeed locked behind pow. This addition allows any person to take only the block and know that the outputs contained in that block, is correctly locked behind the pow of the header.

The output field is constructed as two merkle mountain ranges. the primary one used in the header field is constructed as [coinbase_1, coinbase_2, .., coinbase_x, non_coinbase_ouputs_merkle_root] with the non_coinbase_ouputs_merkle_root constructed as [output_1, output_2, .., output_x]

This double mountain range approach allows you to prove the output are in the block header, as well as create a proof for a specific output. But separating them allows p2pool to only need to store a single hash + list of all outputs in order to verify all coin bases are correctly included in the header. Rather than all outputs or before this pr, the entire block.

Breaking change

Need to resync database

github-actions[bot] commented 1 week ago

Test Results (CI)

    3 files    129 suites   35m 36s ⏱️ 1 344 tests 1 344 ✅ 0 💤 0 ❌ 4 030 runs  4 030 ✅ 0 💤 0 ❌

Results for commit 389c3d26.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 1 week ago

Test Results (Integration tests)

 2 files  + 2  11 suites  +11   25m 18s ⏱️ + 25m 18s 36 tests +36  34 ✅ +34  0 💤 ±0  2 ❌ +2  38 runs  +38  36 ✅ +36  0 💤 ±0  2 ❌ +2 

For more details on these failures, see this check.

Results for commit 389c3d26. ± Comparison against base commit a2aa20e4.

:recycle: This comment has been updated with latest results.