feat(mint): implement epoch-based proof of liabilities with compact merkle-sum trees#1046
feat(mint): implement epoch-based proof of liabilities with compact merkle-sum trees#1046a1denvalu3 wants to merge 1 commit into
Conversation
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
|
The protocol specification has been drafted and submitted as Draft Pull Request cashubtc/nuts#388. Updates Included:
|
⚡ Tree-Level Caching for Solvency Audits (PoL)Hi team, I have implemented an optimized Tree-Level Caching solution on the mint side to solve the performance and potential Denial of Service (DoS) vulnerability associated with on-the-fly tree reconstruction. 💡 The Problem with Endpoint-Level CachingNormally, we cache HTTP responses at the route level using 🚀 The Solution: Tree-Level CachingSince historical epoch trees are completely static and immutable once finalized, we can cache the constructed tree objects themselves instead of the final HTTP responses. We implemented a two-tier caching architecture directly inside the core tree builder:
With this optimization, database queries and tree-construction CPU loops are run exactly once per epoch rather than once per wallet! I have also added robust unit & integration tests covering both the Redis-primary and fallback in-memory caching layers ( Let me know if you have any feedback! |
360119b to
99a2f62
Compare
Description
This PR implements the Mint and Wallet sides of the Proof of Liabilities (PoL) scheme using synchronized epoch-based Sparse Merkle Sum Trees (MS-SMT) and OpenTimestamps (OTS) attestations.
Key Features:
final_expiryis reached.cashu pol manifestandcashu pol auditcommands. The wallet can trustlessly audit all its unspent tokens against both the Spent Tree (proving non-inclusion/double-spend protection) and the Issued Tree (proving 100% mint liability backing).respxmock HTTP calendar failovers and automated DB-backed transition validations. Runs fully offline with optional mock OTS mode (MINT_POL_MOCK_OTS=TRUE).