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

Fix creators re-ordering bug #162

Merged

Conversation

NicolasPennie
Copy link
Collaborator

Overview

A DB conflict would happen when the same creator would change positions in the creators array. This caused the update to drop and the NFT indexing to fail:

Original state:

(A, 1)
(B, 2)
(C, 3)
(D, 4)
(E, 5)

New data:

(A, 1)
(C, 2)  // This conflicts with (C, 3)
(D, 3)  // This conflicts with (D, 4)
(E, 4)  // This conflicts with (E, 5)

The fix is to remove the unique constraint. We do not need it. The explanation is included in the code, under the migration changes. I'll copy them here for clarity:

We no longer want to enforce uniques on the (asset_id, creator) pairs. We may end up with duplicate (asset_id, creator) pairs during indexing, because a creator can change position. Any stale rows (older seq/slot_updated) will be ignored, meaning the API users will never see duplicate creators.

We are adding a new index on (asset_id, creator, verified) for getAssetsByCreator.

Testing

Running in Helius prod

@NicolasPennie NicolasPennie changed the title Nick/creators reordering fix creators re-ordering bug Jan 23, 2024
@NicolasPennie NicolasPennie changed the title fix creators re-ordering bug Fix creators re-ordering bug Jan 23, 2024
@NicolasPennie NicolasPennie merged commit 5d0177a into metaplex-foundation:main Jan 24, 2024
3 checks passed
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.

2 participants