audius-protocol icon indicating copy to clipboard operation
audius-protocol copied to clipboard

[WIP][PAY-3414] Remove UserStateManager and switch to loading account from v1 endpoint

Open schottra opened this issue 1 year ago • 1 comments

Description

NOTE: WIP PR, not everything below is true yet!

While it would be nice to fully remove the stateful ID references in libs, I got about 1/3 of the way down this path before realizing it would mean half-migrating pretty much everything to passing in userIds directly. Many calls are in places that are not properly type-checked due to libs often being typed as any, so it was wildly unsafe to try and do that.

However! We can update the two classes in libs that even care about the current user id and/or wallet to just accept them via config. And since we already call AudiusBackend.setup as part of our account fetching flow, it's easy enough to read those values off the newly fetched account and pass them in.

Functionally equivalent, moves us to the new /account endpoint, gets rids of UserStateManager, and sets us up to continue deleting AudiusBackend endpoints and their corresponding libs dependencies.

How Has This Been Tested?

TBD. 😅

schottra avatar Sep 06 '24 23:09 schottra

⚠️ No Changeset found

Latest commit: fa534e0b3d3c3ec5860cd5ef0d4136c74230bd32

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

changeset-bot[bot] avatar Sep 06 '24 23:09 changeset-bot[bot]

⚠️ GitGuardian has uncovered 7 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
9412812 Triggered Generic Password f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 cmd/core/infra/docker-compose.yml View secret
11648676 Triggered Generic High Entropy Secret f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 cmd/core/infra/dev_config/dev-sandbox.env View secret
11648679 Triggered Generic High Entropy Secret f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 cmd/core/infra/dev_config/standalone-console.env View secret
11648676 Triggered Generic High Entropy Secret f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 cmd/core/infra/dev_config/sandbox-one.env View secret
11648676 Triggered Generic High Entropy Secret f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 cmd/core/infra/dev_config/stage-sandbox.env View secret
11648676 Triggered Generic High Entropy Secret f1fd16fe56fdf225790d1edd8a6fdb0c57d9d450 cmd/core/infra/dev_config/prod-sandbox.env View secret
14086629 Triggered Generic Password 4a48adbd7e25374e30113dfe3342e3428d198680 cmd/audiusd/entrypoint.sh 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.

gitguardian[bot] avatar Oct 21 '24 14:10 gitguardian[bot]

Preview this change https://demo.audius.co/switch-account-endpoint

audius-infra avatar Oct 28 '24 21:10 audius-infra

I ran this against staging, and reposting isn't working at all -- nothing even makes it to the confirmer. is there some connection that's missing somewhere? strange :(

staging.audius.co seems ok though

Good catch. I missed initializing EntityManager with the current user information in the case that we use a cached account. FIx incoming

schottra avatar Oct 29 '24 16:10 schottra

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 avatar Oct 29 '24 17:10 audius-infra

Preview this change https://demo.audius.co/switch-account-endpoint

audius-infra avatar Oct 29 '24 17:10 audius-infra

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 avatar Oct 29 '24 20:10 audius-infra

Preview this change https://demo.audius.co/switch-account-endpoint

audius-infra avatar Oct 29 '24 21:10 audius-infra

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 avatar Oct 29 '24 21:10 audius-infra

Preview this change https://demo.audius.co/switch-account-endpoint

audius-infra avatar Oct 29 '24 21:10 audius-infra

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 avatar Oct 30 '24 15:10 audius-infra

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 avatar Oct 30 '24 15:10 audius-infra

Preview this change https://demo.audius.co/switch-account-endpoint

audius-infra avatar Oct 30 '24 15:10 audius-infra