Skip to content

Conversation

@rickyrombo
Copy link
Contributor

@rickyrombo rickyrombo commented Jul 20, 2024

Description

tl;dr - this PR will give us better analytics in amplitude and more information at a glance in Sentry, helping us do better debugging of the claim success rate.

After a grueling battle getting @solana/web3.js updated across the monorepo, I think I've managed to get all the package.json/package-lock.json changes right. There's one conflict that needs to be managed separately in @audius/fetch-nft that I'll open a sister PR for that will need to merge first I believe.

Some scary-ish changes: ⚠️

  • Updates @solana/web3.js to 1.93.4 (previously 1.78.4) to get the updated SendTransactionError type
  • Updates @audius/sdk's tsconfig to target ES2022 (previously ES5) to get access to cause for errors. This thing is too damn useful. Also fixes the instanceof checks for Errors

Core changes:

  • Updates the DN Solana Relay to provide enough error details to reconstruct a SendTransactionError within SDK to transparently behave the same as though the client sent the transaction itself without a relay
  • Updates the SDK Solana Relay service to do said reconstruction
  • Updates the RewardManagerClient to parse that SendTransactionError and see if it knows what the error was, and if so, creates a new friendly RewardManagerError with useful props like instructionName and customErrorName
  • Adds handling of RewardManagerError in the client to apply those analytics to the Rewards Claim: Failure amplitude event, which will let us bucket better by failure type

How Has This Been Tested?

Ran locally against local stack, and edited the ChallengesApi to not send enough attestations.

Turned on Sentry for localhost to make sure we got good reporting there, and looked at the console for tracking what the analytics looked like for Amplitude.

Check out this awesome sentry trace (note that the signature doesn't exist on mainnet since I was using local validator)
https://audius.sentry.io/issues/5624825875/events/ee6883b1f3e24949b533c69af8f47b6e/?project=1851611
image

image

@changeset-bot
Copy link

changeset-bot bot commented Jul 20, 2024

🦋 Changeset detected

Latest commit: 9f3ceb5

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

This PR includes changesets to release 2 packages
Name Type
@audius/sdk Major
@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

[RewardManagerErrorCode.SignCollision]:
'Signature with an already met principal',
[RewardManagerErrorCode.WrongSigner]: 'Unexpected signer met',
[RewardManagerErrorCode.NotEnoughSigners]: "Isn't enough signers keys",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I know the grammar here is wrong. It's a direct 1:1 copy from the program itself, which outputs this in the program logs on chain.

})
)
} else if (error instanceof RewardManagerError) {
await track(
Copy link
Member

Choose a reason for hiding this comment

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

probably doesn't have to be awaited

@raymondjacobson
Copy link
Member

upgrade away 🚀

"compilerOptions": {
"lib": ["ES2020", "dom"],
"target": "es5",
"module": "ES2022",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

for verify to pass, i had to do this. Not entirely certain of the implications... cc: @sliptype / @dylanjeffers fyi

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would mainly affect the vanilla js bundle, essentially anyone that isn't using a bundler could no longer use sdk in older browers. But anyone that is bundling can still transpile down and polyfill things for older browsers. So we should be good

Also es5 is just a relic of the initial version of libs, so this upgrade needed to happen at some point anyway

@audius-infra
Copy link
Collaborator

It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @nicoback2 @sliptype

@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/mjp-challenge-analytics-2

@audius-infra
Copy link
Collaborator

It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @nicoback2 @sliptype

"compilerOptions": {
"lib": ["ES2020", "dom"],
"target": "es5",
"module": "ES2022",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would mainly affect the vanilla js bundle, essentially anyone that isn't using a bundler could no longer use sdk in older browers. But anyone that is bundling can still transpile down and polyfill things for older browsers. So we should be good

Also es5 is just a relic of the initial version of libs, so this upgrade needed to happen at some point anyway

}

/**
* Override the sendTransaction method to provide some more friendly errors
Copy link
Contributor

Choose a reason for hiding this comment

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

not needed for this PR but is this something that can be generalized for other programs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I think so - I think each client should do similar things here

Copy link
Contributor

@dharit-tan dharit-tan left a comment

Choose a reason for hiding this comment

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

tysm this will improve life much

@audius-infra
Copy link
Collaborator

It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @nicoback2 @sliptype

@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/mjp-challenge-analytics-2

@audius-infra
Copy link
Collaborator

It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @nicoback2 @sliptype

@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/mjp-challenge-analytics-2

@audius-infra
Copy link
Collaborator

It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @nicoback2 @sliptype

@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/mjp-challenge-analytics-2

@gitguardian
Copy link

gitguardian bot commented Aug 2, 2024

⚠️ GitGuardian has uncovered 8 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 13ac2af core/infra/dev_config/discovery-one.docker.env View secret
11648676 Triggered Generic High Entropy Secret 13ac2af core/infra/dev_config/discovery-one.env View secret
11648678 Triggered Generic High Entropy Secret 13ac2af core/infra/dev_config/content-three.env View secret
11648678 Triggered Generic High Entropy Secret 13ac2af core/infra/dev_config/content-three.docker.env View secret
11648679 Triggered Generic High Entropy Secret 13ac2af core/infra/dev_config/content-two.docker.env View secret
11648679 Triggered Generic High Entropy Secret 13ac2af core/infra/dev_config/content-two.env View secret
11648680 Triggered Generic High Entropy Secret 13ac2af core/infra/dev_config/content-one.docker.env View secret
11648680 Triggered Generic High Entropy Secret 13ac2af core/infra/dev_config/content-one.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.

@audius-infra
Copy link
Collaborator

It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @dylanjeffers @sliptype

@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/mjp-challenge-analytics-2

@audius-infra
Copy link
Collaborator

It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @dylanjeffers @sliptype

@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/mjp-challenge-analytics-2

@audius-infra
Copy link
Collaborator

It looks like there may be some changes to native mobile code, which requires triggering a full app release. Please follow the instructions here: https://www.notion.so/audiusproject/When-to-bump-app-version-2644a8f772364a4d91f44abcba44ce0b?pvs=4. cc @dylanjeffers @sliptype

@audius-infra
Copy link
Collaborator

Preview this change https://demo.audius.co/mjp-challenge-analytics-2

@rickyrombo rickyrombo enabled auto-merge (squash) August 2, 2024 20:25
@rickyrombo rickyrombo disabled auto-merge August 2, 2024 20:26
@rickyrombo rickyrombo enabled auto-merge (squash) August 2, 2024 20:39
@rickyrombo rickyrombo merged commit 1b494ff into main Aug 2, 2024
@rickyrombo rickyrombo deleted the mjp-challenge-analytics-2 branch August 2, 2024 20:43
audius-infra pushed a commit that referenced this pull request Aug 3, 2024
[7e9ef50] [C-4681] [C-4680] Add analytics for search v2 (#9363) Sebastian Klingler
[d9b0c78] [PAY-3279] Fix misc web album UI issues (#9362) Raymond Jacobson
[1b494ff] Improve SDK rewards claiming errors with RewardManagerError abstraction (#9214) Marcus Pasell
[05720e3] [C-4891] Add artist pick to mobile (#9359) Dylan Jeffers
[932ddc7] Add cors headers for actions (#9360) Raymond Jacobson
[56409de] [C-4798] Filter all categories by verified (#9353) Sebastian Klingler
[048a4d8] [PAY-3253] Fix confirmation drawer height (#9310) Dylan Jeffers
[245baf4] [C-4915] Fix create collection card height (#9357) Dylan Jeffers
[216a3fb] [C-4895] Fix profile screen verified badge (#9356) Dylan Jeffers
[9500340] [C-4899] Fix isrc and iswc validation (#9352) Dylan Jeffers
[7c780e8] Fix sign in (#9355) Dylan Jeffers
[654e7a1] Add IconTowerBroadcast to harmony (#9354) Andrew Mendelsohn
[a225c68] [PAY-3311] Create one_to_many_dms flag (#9351) Andrew Mendelsohn
[6271d09] [C-4896] [C-4893] [C-4913] BPM precision adjustments (#9349) Sebastian Klingler
[dc2a681] Remove null checks for metadata items in useXMetadata (#9350) Reed
[06cbc13] Hide play counts for all gated content in TracksTable (#9347) Reed
[4de149f] [C-4897] Improve empty edit collection page (#9346) Dylan Jeffers
[67cbdfe] Update dapp-store build artifacts audius-infra
[f1d908b] Fix show premium downloads message (#9344) Saliou Diallo
[34445b8] [C-3907] Add empty state for artist results in sign up flow (#9343) Kyle Shanks
[dc84357] add bpm edit flag col (#9324) Michelle Brier
[b50abba] Add actions.json to cloudflare (#9341) Raymond Jacobson
[8e9f6c3] [PAY-3283] Show high res artwork in edit (#9342) Raymond Jacobson
[e91b12a] [C-4905] Fix app crash when navigating to let them dj when signed out (#9340) Kyle Shanks
[8dbbd21] Add actions.json for solana blink support (#9331) Raymond Jacobson
[3e70a7f] [QA-1374] Fix play/preview logic on track page (#9337) Dylan Jeffers
[1e35fc3] [PAY-3298] Fix track preview generation (#9339) Dylan Jeffers
[6867056] [C-4903] Update icon sizes for collection card actions and notifications (#9338) Kyle Shanks
[6c7a231] [PAY-3271] Prevent navigation prompt from showing on delete (#9336) Andrew Mendelsohn
[e1b8690] PAY-3290 Special Access should disable entirely (#9334) Marcus Pasell
[0a64f84] PAY-3291 Don't show purchase in overflow menu for non-purchase-gated tracks (#9335) Marcus Pasell
[0b2c061] PAY-3287 Validate main form on submitting access gate subform mobile (#9332) Marcus Pasell
[9e81415] PAY-3288 Fix edit collection confirmations on mobile (#9330) Marcus Pasell
[a3bfb57] Fix CollectionCard test (#9329) Sebastian Klingler
[e6374bc] [PAY-3282] Prevent publishing 0 length playlist (#9328) Raymond Jacobson
[b799fcb] typescript impl of R2(crc32) + R2(sha256) ordering. (#8942) Steve Perkins
[eb8724e] PAY-3275 Portal drawers to the correct location (#9325) Marcus Pasell
[f404f01] Remove legacy edit track (#9323) Andrew Mendelsohn
[11f0ed5] [PAY-3274] Show 'releases today' on mobile (#9314) Andrew Mendelsohn
[18f4bea] [PAY-3197] Remove gated-content-upload-prompt drawer (#9318) Reed
[c36b94c] C-4894 Make edit track/edit collection use same buttons (#9321) Marcus Pasell
[1b6a1b7] Migrate sign out confirmation drawer to harmony (#9320) Reed
[7c8a654] [PAY-3254] Fix edit remix (#9322) Dylan Jeffers
[9bd24c8] [C-4885] [C-4888] [C-4889] [C-4882] [C-4883] Advanced search UI fixes pt 3 (#9317) Sebastian Klingler
[619da11] Fix "date required" error when selecting date (#9315) Dylan Jeffers
[c29f8f8] [PAY-3277] Show release date for all public tracks/collections (#9313) Reed
[885479a] Update users endpoints: round 1 (#9166) Randy Schott
[8618e3c] PAY-3280 Fix gated access display (#9311) Marcus Pasell
[69e76c7] [PAY-3276] No scheduled playlists (#9312) Dylan Jeffers
[91197d4] [PAY-3262] Fix edit new playlist (#9309) Dylan Jeffers
[1c61e0b] Update dn models (#9291) Randy Schott
[cf20265] [PAY-3260] Use 'Today' for matching release dates (#9292) Andrew Mendelsohn
[3290d1e] [PAY-3258] BoxedTextField can error before form submission (#9305) Saliou Diallo
[1dd131f] [PAY-3248][PAY-3256][PAY-3234] Fix misc android issues (#9307) Raymond Jacobson
[782e9d9] Premium extras updates (#9306) Dylan Jeffers
[61cc53a] Small FilterButton hover style tweak (#9303) Sebastian Klingler
[f7cf7d1] [QA-1448] Fix user badge spacing (#9302) Kyle Shanks
[5af538a] [C-4868] BPM validation (#9295) Sebastian Klingler
[22ca755] [C-4854] Add Premium Extras label (#9294) Dylan Jeffers
[b66ca17] [PAY-3261] Update remix settings copy (#9299) Raymond Jacobson
[f713455] [PAY-3236][PAY-3242][PAY-3259] Fix play button in tracks table (#9288) Saliou Diallo
[d87357e] [PAY-3240] Prevent wrong users from seeing /edit pages (#9298) Raymond Jacobson
[8b92b23] PAY-3233 Disable reset on select field for AM/PM (#9296) Marcus Pasell
[3a63fbb] [PAY-3257] Default prices for premium albums/tracks (#9293) Andrew Mendelsohn
[7d41d87] [C-4836] Adjust FilterButton active states (#9289) Sebastian Klingler
[f680c81] [QA-1473] Fix duplicate purchase button in TracksTable row (#9284) Sebastian Klingler
[97bf97d] Fix use-revert-on-cancel (#9286) Dylan Jeffers
[2b9b811] Bump mobile to 109 (#9283) Dylan Jeffers
[68ebca7] Update copy for preview length (#9280) Sebastian Klingler
audius-infra pushed a commit that referenced this pull request Aug 5, 2024
[1b494ff] Improve SDK rewards claiming errors with RewardManagerError abstraction (#9214) Marcus Pasell
[56409de] [C-4798] Filter all categories by verified (#9353) Sebastian Klingler
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.

7 participants