Skip to content

universe: key leaves by asset id - #2402

Open
jtobin wants to merge 4 commits into
lightninglabs:mainfrom
jtobin:universe-asset-leaf-keys
Open

jtobin wants to merge 4 commits into
lightninglabs:mainfrom
jtobin:universe-asset-leaf-keys

Conversation

@jtobin

@jtobin jtobin commented Nov 30, 2026

Copy link
Copy Markdown
Member

Fixes #2381.

This adds the asset ID to universe tree leaf keys, making them now:

 sha256(outpoint || script_key || asset ID)

The effect is that grouped assets at the same outpoint and script key can no longer collide, obviating the need for the "duplicate" asset ID-indexed trees introduced by #2350.

I initially thought this was going to be a difficult migration, but it's not, really. Old universe trees just get migrated to a V1 version under this key format, with any "duplicated" asset ID-indexed trees getting pruned in the process. The initial migration should be most burdensome on our mainnet universe server, which is big (every V0 tree needs to be recalculated), but I don't expect it should take more than a few minutes to run. Most clients shouldn't notice anything. I have some benchmarks running, I'll post the results when they finish.

Re: dealing with unupgraded clients, servers can continue to serve both V0 and V1 trees. Unupgraded nodes can still send or receive proofs through an upgraded proof courier, but must upgrade to sync with one, which seems proper behaviour. Eventually in v0.10 or so we can just retire the V0 trees altogether.

Issuance and transfer universes key each leaf by its asset ID as well as
its outpoint and script key, and a universe leaf row is identified by
its tree key. A grouped asset's proofs are held only by its group
universe, which inserts, queries and deletions naming the asset's ID
universe resolve to. Leaf keys carry their asset ID over RPC.
A programmatic migration rebuilds every issuance and transfer universe
tree with asset ID leaf keys, folds grouped assets' asset ID universes
into their group universes, and rebuilds both multiverse trees.
@jtobin
jtobin force-pushed the universe-asset-leaf-keys branch from bf89532 to ebd1b48 Compare November 30, 2026 11:47
The universe server reports its tree version and refuses requests that
compare universe trees without naming tree version 1. The syncer only
syncs with servers that serve that version, and tapcli and the itests
name it in their requests.
@jtobin
jtobin force-pushed the universe-asset-leaf-keys branch from ebd1b48 to 72e3286 Compare November 30, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 🆕 New

Development

Successfully merging this pull request may close these issues.

universe: incorporate asset id in leaf key

1 participant