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

[PAY-3881][PAY-3883] Add indexing/endpoints for separated collectibles data #11287

Merged
merged 9 commits into from
Feb 14, 2025

Conversation

schottra
Copy link
Contributor

@schottra schottra commented Feb 6, 2025

Description

This is the discovery-side work for splitting collectibles info out of cid_data. Since the primary goal is to get us off cid_data, I opted not to do a big redesign of how we store or return this info and left it in the format we use inside of cid_data.

  • Added a table to store the raw collectibles data objects that would normally live inside cid_data for users.
    • This is a 1:1 relationship so user_id is the primary key
    • Using the same blocknumber foreign key behavior to allow us to revert/cascade delete.
  • Added a migration to pull out the existing collectibles objects into rows for their corresponding users. This is < 400 users on prod at the moment.
  • Added endpoint for fetching collectibles for a given user. It will just look up the data and return the object or null
  • Added indexing logic for creating/updating. Either action is supported since they both result in the same operation.
    • There is no support for Delete. The existing paradigm is to just set it to an empty object.
    • Similar to the existing user update indexing, we will set has_collectibles on the user based on whether the data has any keys in it
    • User update indexing will also update the collectibles_data table for now until we remove support for that (which will be a few client releases after we start using these new transactions)

How Has This Been Tested?

  • Integration tests
  • Used local client against local dev to send existing user update transactions and new style of transactions to verify that both methods are supported.

Copy link

changeset-bot bot commented Feb 6, 2025

🦋 Changeset detected

Latest commit: 0138d35

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@audius/sdk Minor
@audius/sdk-legacy Patch
@audius/sp-actions Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@schottra schottra force-pushed the new-collectibles-indexing branch from ecea2af to c6870de Compare February 6, 2025 20:41
@schottra schottra assigned alecsavvy and unassigned alecsavvy Feb 6, 2025
@schottra schottra changed the title [PAY-3881] Add indexing/endpoints for separated collectibles data [PAY-3881][PAY-3883] Add indexing/endpoints for separated collectibles data Feb 6, 2025
Copy link
Member

@raymondjacobson raymondjacobson left a comment

Choose a reason for hiding this comment

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

LGTM, though I do think we need to probably have some logic in here

def revert_block(session: Session, block_to_revert: Block):

We might not handle reverts elegantly in general, and this actually should go away once we're on core b/c of instant finality. Anyway... just putting for posterity

@schottra
Copy link
Contributor Author

LGTM, though I do think we need to probably have some logic in here

def revert_block(session: Session, block_to_revert: Block):

We might not handle reverts elegantly in general, and this actually should go away once we're on core b/c of instant finality. Anyway... just putting for posterity

If I understand how revert works (and it's possible I don't), I think it's handling it correctly. Since we're using the add_records functionality and we have a defined entity type, it should generate an entry for it in the revert_blocks row at the end of processing the block. And we use cascade delete on the new table to make sure we remove any records that were inserted when the block is deleted.
I think the only specialized logic that is left in revert_blocks is for tracks/playlists which are still using is_current?

But I will take a deep dive on it and see if I can verify that it's doing what we need it to.

…xing

* origin/main:
  Audius Protocol v0.7.87
  Small fix for the associated wallet logic update (#11324)
  Fix audius-cmd turbo args (#11323)
  Update the logic for associated wallets to not brick DNs due to the db level constraint (#11322)
  Audius Client (Web and Mobile) v1.5.121
  [PAY-3926] Fix mobile-web header notif/reward count positions (#11313)
  fix local dev (#11317)
  Fix bulk query fetching order (#11315)
  [C-5765] Profile nav fixes (#11311)
  Add turbo remote caching to solana-relay, verified-notifications, and audius-cmd (#11314)
  [PAY-3899] Fix reward modal padding and claim progress styling on web (#11309)
  [QA-1962] Update the get verified modal to keep the X button when loading (#11310)
  [PAY-3929] Fix claiming reward button state on mobile (#11308)
Copy link

gitguardian bot commented Feb 10, 2025

⚠️ GitGuardian has uncovered 4 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
11648676 Triggered Generic High Entropy Secret e6eda81 dev-tools/environment/audiusd-1.env View secret
11648678 Triggered Generic High Entropy Secret e6eda81 dev-tools/environment/audiusd-4.env View secret
11648679 Triggered Generic High Entropy Secret e6eda81 dev-tools/environment/audiusd-3.env View secret
11648680 Triggered Generic High Entropy Secret e6eda81 dev-tools/environment/audiusd-2.env View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@schottra schottra merged commit c8a0e06 into main Feb 14, 2025
8 checks passed
@schottra schottra deleted the new-collectibles-indexing branch February 14, 2025 14:38
schottra added a commit that referenced this pull request Feb 14, 2025
…ibles

* origin/main: (71 commits)
  [PAY-3881][PAY-3883] Add indexing/endpoints for separated collectibles data (#11287)
  [C5778] Update web profile page layout (#11374)
  Test listen streak challenge 2 listens in 1 day (#11373)
  Listen streak challenge fix 2 plays in one day (#11372)
  Randomize storage node ordering in StorageNodeSelector. (#11371)
  Disable endless listen streak challenge, delete rows (#11369)
  Fix user-link overflow (#11370)
  MRVR country fixes (#11118)
  [C-5270 C-5269 C-5268 C-5629] Comment layout improvements (#11360)
  🪦 poa ganache (#11367)
  Fix playlist invalid sort test (#11368)
  core block diff health check (#11365)
  Audius Protocol v0.7.90
  Hide endless challenge audio (#11364)
  [C-5769] Use batch fetching to normalize core entity hooks (#11355)
  entity manager through core on dev (#11359)
  fix lint (#11362)
  Fix plays indexing starvation (#11361)
  Revert "filter chain health on these nodes" (#11358)
  Tag audiusd with protocol releases to allow reverts (#11347)
  ...
audius-infra pushed a commit that referenced this pull request Feb 14, 2025
[c8a0e06] [PAY-3881][PAY-3883] Add indexing/endpoints for separated collectibles data (#11287) Randy Schott
[1b39bfc] Test listen streak challenge 2 listens in 1 day (#11373) Reed
[f854639] Listen streak challenge fix 2 plays in one day (#11372) Reed
[c62caf6] Disable endless listen streak challenge, delete rows (#11369) Reed
[4773a86] MRVR country fixes (#11118) Steve Perkins
[73d3ad1] 🪦 poa ganache (#11367) alecsavvy
[f74778f] Fix playlist invalid sort test (#11368) Isaac Solo
[1c65e9c] core block diff health check (#11365) alecsavvy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants