Skip to content

Conversation

@isaacsolo
Copy link

@isaacsolo isaacsolo commented Jun 14, 2023

Description

Currently, signup takes multiple user txs. This change will allow signups from a single create user tx with metadata.

Libs change in progress: 2c1a0c8

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide repro instructions & any configuration.

Added test and tested e2e with libs change on stage

@isaacsolo isaacsolo requested review from michellebrier and removed request for michellebrier June 14, 2023 01:20
@isaacsolo isaacsolo force-pushed the is-single-tx-signup-indexing branch from aca2614 to e7e0155 Compare June 14, 2023 02:04
@isaacsolo isaacsolo requested a review from theoilie June 14, 2023 02:04
Copy link
Contributor

@theoilie theoilie left a comment

Choose a reason for hiding this comment

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

glad to see it working on staging 🔥 I'm curious about the case where libs has this change and Discovery doesn't, or vice-versa. it looks like it should just fallback to the 2-step flow and work, but signup is all complicated with these different v1 and v2 paths so worth calling out

"_entityType": "User",
"_userId": USER_ID_OFFSET + 3,
"_action": "Create",
"_metadata": f'{{"data": {create_user3_json}}}',
Copy link
Contributor

Choose a reason for hiding this comment

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

no cid prop?

Copy link
Author

Choose a reason for hiding this comment

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

do we need CID still? for v2 @michellebrier

Copy link
Contributor

Choose a reason for hiding this comment

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

yes need cid for both v1 and v2

Copy link
Author

Choose a reason for hiding this comment

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

oh yea for that CID table right?

@isaacsolo isaacsolo requested a review from michellebrier June 14, 2023 16:32
# fallback to multi tx signup
pass

if params.metadata_cid == "v2":
Copy link
Contributor

Choose a reason for hiding this comment

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

should be params.metadata now bc of this change f17be75

if params.metadata_cid == "v2":
user_record.is_storage_v2 = True
else:
elif not user_metadata: # update replica set case
Copy link
Contributor

@michellebrier michellebrier Jun 14, 2023

Choose a reason for hiding this comment

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

couple questions:

  1. whats the old multi tx flow? a CREATE USER event followed by an UPDATE USER event?
  2. if so, with the single tx flow i assume we want the cid metadata that would normally be in the UPDATE USER event to be persisted in cid_data so the client can query it later?
    • in which case we either need to add special cases for different metadata formats in CREATE USER events to expect_cid_metadata_json and parse_metadata in entity manager utils.py
    • or
    • handle that here and persist to cid_data appropriately
    • feels convoluted trying to handle all possible CREATE USER cases upstream in entity_manager.py as we migrate from multi->single tx and also from storage v1->v2 so would prefer the latter, with the custom logic here
  3. what are all the possible metadata values that we want to handle here? (considering old multi tx path, new single tx path, and v2)

Copy link
Author

@isaacsolo isaacsolo Jun 20, 2023

Choose a reason for hiding this comment

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

  1. Yea, it's a create user, update for the handle, update for profile picture.
  2. Yeah sg, updating it to treat this case as a user update and parse.
  3. This will just be for storage v2 so I think the only cases we will have are v2 single tx and v2 multi tx. We can def clean it up once v2 and libs changes go out.

Copy link
Contributor

@michellebrier michellebrier left a comment

Choose a reason for hiding this comment

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

see comments!

@isaacsolo isaacsolo requested a review from michellebrier June 20, 2023 19:17
Copy link
Contributor

@michellebrier michellebrier left a comment

Choose a reason for hiding this comment

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

lgtm!

@isaacsolo isaacsolo merged commit 59b365f into main Jun 21, 2023
@isaacsolo isaacsolo deleted the is-single-tx-signup-indexing branch June 21, 2023 15:55
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