Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tapdb/universe: fix universe event logging for grouped assets #348

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Jun 8, 2023

In this commit, we fix the universe event logging for grouped assets. As is, when we go to insert assets with a group, then the "first" inserted asset is what's known as the asset_id in the universe_roots table. When we go to log a proof insert/sync event, and the even only has an asset ID, we may end up with a failed query, as only the "first" asset ID would return the row we want.

In order to fix this, rather than trying to match the asset ID with a root, we instead find the leaf for that asset ID, then use that to get the primary key of the universe root via it's foreign key ref.

Fixes #313

In this commit, we fix the universe event logging for grouped assets. As
is, when we go to insert assets with a group, then the "first" inserted
asset is what's known as the `asset_id` in the `universe_roots` table.
When we go to log a proof insert/sync event, and the even only has an
asset ID, we may end up with a failed query, as only the "first" asset
ID would return the row we want.

In order to fix this, rather than trying to match the asset ID with a
root, we instead find the _leaf_ for that asset ID, then use that to get
the primary key of the universe root via it's foreign key ref.
@jharveyb
Copy link
Collaborator

jharveyb commented Jun 9, 2023

These errors are no longer present when registering asset issuance after minting, but I still see them for universe sync events.

Can reproduce with make itest icase=universe_sync, source:

_, err = s.cfg.LocalRegistrar.RegisterIssuance(

Copy link
Collaborator

@jharveyb jharveyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@jharveyb jharveyb added this pull request to the merge queue Jun 12, 2023
@jharveyb jharveyb merged commit f46f3f1 into lightninglabs:main Jun 12, 2023
@dstadulis
Copy link
Collaborator

These errors are no longer present when registering asset issuance after minting, but I still see them for universe sync events.

Can reproduce with make itest icase=universe_sync, source:

_, err = s.cfg.LocalRegistrar.RegisterIssuance(

JHB didn't block PR but will need to continue #354

@ffranr
Copy link
Contributor

ffranr commented Jun 15, 2023

This has been deployed to testnet and staging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

tarogarden: universe stats DB issues after batch confirmation
5 participants