Skip to content

multi: implement IgnoreChecker for Supply Commitment System #1684

@Roasbeef

Description

@Roasbeef

Context

PR #1674 is introducing a supply commitment verifier system that tracks asset supply through three sub-trees: mint, burn, and ignore. Currently, the IgnoreChecker interface (defined in proof/verifier.go) only has a mock implementation, and no production IgnoreChecker instance is passed during proof verification.

Problem

The proof verification system lacks integration with the supply commitment ignore tree. This means:

  • Proofs for assets in the ignore tree are still fully validated (performance impact)
  • No enforcement of supply commitment ignore rules during proof verification
  • Inconsistency between supply tracking and proof validation systems

Proposed Solution

Create a concrete IgnoreChecker implementation that queries the ignore sub-tree of the supply commitment system. This will automatically reject proofs for assets that have been marked as ignored in the supply tree.

Technical Details

  1. Interface to implement:

    type IgnoreChecker interface {
        IsIgnored(prevID AssetPoint) bool
    }
  2. Integration points where VerifierCtx needs updating:

    • rpcserver.go - RPC proof verification
    • tapfreighter/chain_porter.go - Chain porter proof handling
    • tapchannel/aux_funding_controller.go - Channel funding proof verification
    • Any other locations creating VerifierCtx instances
  3. Architecture:

    • New file: tapdb/supply_ignore_checker.go
    • Query the ignore sub-tree from tapdb/ignore_tree.go
    • Wire up supply tree store access to verification contexts
    • Implement caching layer to avoid repeated database hits for frequently checked assets

Implementation Steps

  1. Create SupplyIgnoreChecker struct implementing IgnoreChecker
  2. Add method to query ignore tree for asset points
  3. Implement in-memory cache (e.g., LRU cache) for ignore tree lookups
  4. Update all VerifierCtx creation sites to include the new checker
  5. Add unit tests for the new implementation
  6. Add integration tests verifying ignored assets are rejected
  7. Add benchmarks to verify cache effectiveness
  8. Update documentation for the new behavior

Caching Strategy

To optimize performance and reduce database load:

  • Implement an LRU cache for ignore tree lookups
  • Cache both positive (ignored) and negative (not ignored) results
  • Consider cache invalidation strategy when ignore tree is updated
  • Make cache size configurable via startup parameters
  • Add metrics for cache hit/miss rates

References

Metadata

Metadata

Assignees

Labels

supply commitWork on the supply commitment feature, enabling issuers to attest to total asset supply on-chain.universe

Type

No type

Projects

Status

🏗 In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions