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

Implement stark key registration #362

Merged
merged 43 commits into from Apr 14, 2023
Merged

Conversation

torztomasz
Copy link
Contributor

@torztomasz torztomasz commented Mar 23, 2023

Resolves L2B-798, L2B-1303, L2B-1302

@linear
Copy link

linear bot commented Mar 23, 2023

L2B-798 Implement stark key registration

Doing this right is actually quite tricky, because what you need to do varies depending on what system you are using and we only know the correct steps for dYdX and dYdX doesn't need registration.

Registration is a multi step process:

  1. The user logs in and clicks on their profile button in the top right
  2. Because we don't know their stark key we display a page that says that they should register. This is actually not the user page, it just sorta looks similar.
  3. User clicks register and signs one or more messages. Using those we derive a stark key and all necessary details for the registration transaction.
  4. We show the user their stark key and their user page with both their stark key and ethereum address. Unfortunately since they aren't registered yet they cannot send forced transactions. We shouldn't display any buttons on asset list, even though it is their user page.
  5. The user can click register and they are prompted to send a registration transaction via metamask. Once the registration completes we show the regular user page.

To help with implementing this the "hard part" is already done:

  • the packages/frontend/src/scripts/keys/recovery.ts file includes functions to sign messages and derive keys for step 3
  • the Wallet.sendRegistrationTransaction function can be used to complete step 5

The missing parts are:

  • remembering the result of recoverKeysDydx, recoverKeysDydxLegacy or any future recoverKeys function to local storage
  • choosing the correct recover… function based on which system we are using. I imagine we're going to have recoverKeysMyria and recoverKeysGammaX but because we don't know what the specifics are for those systems we do not have those functions. This should be flexible so that it's easy to add new ones.
  • passing the values read from local storage to Wallet.sendRegistrationTransaction
  • when user logs in using an account for which we remembered a stark key we need to set an appropriate cookie. Similarly when they change account / log out we need to unset the cookie
  • all visuals

Currently there is no transaction page planned for registration.

@torztomasz torztomasz force-pushed the implement-stark-key-registration branch 2 times, most recently from aa73140 to c1cf04e Compare March 30, 2023 08:51
@torztomasz torztomasz force-pushed the implement-stark-key-registration branch from 3065554 to c4cb3c7 Compare April 7, 2023 08:32
@torztomasz torztomasz force-pushed the implement-stark-key-registration branch from 3ab2848 to 895064e Compare April 11, 2023 17:33
@torztomasz torztomasz force-pushed the implement-stark-key-registration branch from 89e8ba5 to 4112c5a Compare April 12, 2023 09:20
@torztomasz torztomasz force-pushed the implement-stark-key-registration branch from 3e395c5 to 5330e86 Compare April 12, 2023 11:08
@torztomasz torztomasz force-pushed the implement-stark-key-registration branch from 10c130b to 1d9531b Compare April 12, 2023 11:44
@torztomasz torztomasz force-pushed the implement-stark-key-registration branch from 8680e6d to beb71cd Compare April 13, 2023 10:14
@torztomasz torztomasz added this pull request to the merge queue Apr 14, 2023
Merged via the queue into master with commit 582a3ee Apr 14, 2023
4 checks passed
@torztomasz torztomasz deleted the implement-stark-key-registration branch April 14, 2023 09:26
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.

None yet

2 participants