Skip to content

[WIP] FCMP++ integration documentation#110

Draft
j-berman wants to merge 44 commits intoseraphis-migration:fcmp++-stagefrom
j-berman:fcmp++-documentation
Draft

[WIP] FCMP++ integration documentation#110
j-berman wants to merge 44 commits intoseraphis-migration:fcmp++-stagefrom
j-berman:fcmp++-documentation

Conversation

@j-berman
Copy link
Collaborator

I figure it would be good to get feedback on this documentation approach sooner rather than later, this takes a while to write.

Here are the sections:

  • A. Rust FFI
  • B. Curve trees merkle tree
    • a. Preparing locked outputs for insertion to the tree upon unlock
    • b. grow_tree algorithm
    • c. Grow the tree as the node syncs
    • d. Trim the tree on reorg and on pop blocks
    • e. LMDB changes
    • f. Migrating cryptonote outputs into the tree
  • C. Transaction struct changes for FCMP++
  • D. Constructing FCMP++ transactions
  • E. Verifying FCMP++ transactions
  • F. Consensus changes for FCMP++
  • G. Wallet sync
    • a. Tree cache
    • b. Handling restore from arbitrary restore height
  • H. Daemon RPC: fetching outputs by output ID
  • I. scan_tx

@j-berman j-berman mentioned this pull request Sep 24, 2025
74 tasks
jeffro256 and others added 3 commits October 27, 2025 16:33
This replaces `ver_rct_non_semantics_simple_cached()` with an API that offloads
the responsibility of tracking input verification successes to the caller. The
main caller of this function in the codebase, `cryptonote::Blockchain()` instead
keeps track of the verification results for transaction in the mempool by
storing a "verification ID" in the mempool metadata table (with `txpool_tx_meta_t`).
This has several benefits, including:

* When the mempool is large (>8192 txs), we no longer experience cache misses and unnecessarily re-verify ring signatures. This greatly improves block propagation time for FCMP++ blocks under load
* For the same reason, reorg handling can be sped up by storing verification IDs of transactions popped from the chain
* Speeds up re-validating every mempool transaction on fork change (monerod revalidates the whole tx-pool on HFs monero-project#10142)
* Caches results for every single type of Monero transaction, not just latest RCT type
* Cache persists over a node restart
* Uses 512KiB less RAM (8192*2*32B)
* No additional storage or DB migration required since `txpool_tx_meta_t` already had padding allocated
* Moves more verification logic out of `cryptonote::Blockchain`

Furthermore, this opens the door to future multi-threaded block verification
speed-ups. Right now, transactions' input proof verification is limited to one
transaction at a time. However, one can imagine a scenario with verification IDs
where input proofs are optimistically multi-threaded in advance of block
processing. Then, even though ring member fetching and verification is
single-threaded inside of `cryptonote::Blockchain::check_tx_inputs()`, the
single thread can skip the CPU-intensive cryptographic code if the verification
ID allows it.

Also changes the default log category in `tx_verification_utils.cpp` from "blockchain" to "verify".
Co-authored-by: j-berman <justinberman@protonmail.com>
Co-authored-by: jeffro256 <jeffro256@tutanota.com>
Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
Co-authored-by: SyntheticBird45 <someoneelse.is_on.github.rio7x@simplelogin.com>
j-berman and others added 25 commits October 30, 2025 15:09
Otherwise we can end up double counting txs towards the weight,
which can over-state the pool weight. E.g. relay tx to node in
stem phase, add its weight to pool weight, then receive tx
from another node, then bump the pool weight again. That double
counts the tx towards the pool weight.

If the weight exceeds the max, the node will "prune" txs from the
pool. Thus, over-counting is probably a cause of, but perhaps
not the only cause of:
seraphis-migration#148
Curve Trees: handle get_max_concurrency() == 0
tx pool: only increment m_txpool_weight for newly added pool txs
Fixes pruning the database under FCMP++ and prevents future corruption by
checking the version value inside the properties table.
…prune

blockchain_prune: add FCMP tables and check DB version
…ver-ids

Fix FCMP++ batch verification collecting ver ID's
…arrot_devs

carrot_impl: refactor scanning_tools to use Carrot devices
…rint

cryptonote_basic: remove BP+ clawback debug print in weight func
…d_designator

carrot_impl: specify all fields in aggregate init (1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants