-
Notifications
You must be signed in to change notification settings - Fork 393
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
RSK ledger
integration
#2577
base: main
Are you sure you want to change the base?
RSK ledger
integration
#2577
Conversation
f7b2260
to
c1316e2
Compare
cc: @0xDaedalus @alepc253 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From @zondax/ledger-icp
's docs...
Please:
- Do not use in production
- Do not use a Ledger device with funds for development purposes.
- Have a separate and marked device that is used ONLY for development and testing
We should aim to do this without additional outside dependencies, especially not experimental dependencies.
@@ -167,7 +168,10 @@ function LedgerAccountList({ | |||
{balance === null && <div className="balance_loading" />} | |||
{balance !== null && ( | |||
<div className="balance"> | |||
{balance} {selectedNetwork.baseAsset.symbol} | |||
{balance}{" "} | |||
{appInfo?.appName === "RSK" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the approach we want here, otherwise we'd do the same thing for Polygon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, we should make sure that the selected network and Ledger app match. If they don't, we should ask the user if they'd like to switch to the RSK network... or tell them to switch Ledger apps (to either Ethereum or Polygon, based on the selected network).
This edge case probably needs some design thinking @VladUXUI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can i get a little bit more context here?
Is this part of the onboarding or something else? asking because in onboarding we don't currently have option for users to change networks (although it's on the way).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for context - Polygon app on Ledger is really bad (and seems to be just a fork/extension of Ethereum app), was throwing weird errors and it was just a more stable approach to encourage users to use the Ethereum app for both ETH and Polygon. Maybe Rsk app is more stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jagodarybacka the problem is that you have to use the right app with the right network because the Ledger app only works with the right derivation path (ETH/Polygon and RSK have different dpath)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that we do not have any UI to select network/derivation path when user clicks on "connect to ledger" button. Tally wallet is assuming ethereum
network by default here and attempt the connect with ledger using ethereum
derivation path. In case of other networks like RSK
connection get rejected by ledger app (RSK in this case) because tally wallet is passing hardcoded derivation path here
I can think of below two approaches to solve this issue:
Approach 1: Auto detect which app is running on device and use dPath w.r.t that app
Like in this PR i am auto detecting the active app on ledger and then passing dPath dynamically according to connected app.
Approach 2: Provide a UI to select network or derivation path before connecting to ledger so that user can select right network according to running app on ledger device.
So when user clicks on "connect to ledger" button, then user will be taken to derivation path selection screen instead of directly connecting to ledger as its doing right now and assuming ethereum
derivation path
IMO, second approach is better and i can update the pull request with this approach.
Most welcome in case of any other thought's 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provide a UI to select network or derivation path before connecting to ledger
@VladUXUI I remember you were thinking about something similar before right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow-up question both for @alepc253 and @mr-michael - Are we OK turning on RSK without this PR being merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xDaedalus yes, we are OK. This feature is important but can be supported in next releases. Launching RSK asap is the main goal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ready for review.
fc7fabf
to
f6ccb1a
Compare
Tally Team 👋 I have updated the pull request with See Demo video here: Untitled.mp4
|
background/constants/networks.ts
Outdated
@@ -85,7 +85,7 @@ export const TEST_NETWORK_BY_CHAIN_ID = new Set( | |||
[GOERLI].map((network) => network.chainID) | |||
) | |||
|
|||
export const NETWORK_FOR_LEDGER_SIGNING = [ETHEREUM, POLYGON] | |||
export const NETWORK_FOR_LEDGER_SIGNING = [ETHEREUM, POLYGON, RSK] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have renamed RSK
> ROOTSTOCK
in #2625
and this breaks the build and also the tests.
Sorry for this issue!
Are you ok fixing this, or would you prefer me to do it?
The fix patch is attached.
RSKtoROOTSTOCK.patch.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -23,6 +23,7 @@ export default (prevState: Record<string, unknown>): NewState => { | |||
currentDeviceID: null, | |||
devices: {}, | |||
usbDeviceCount: 0, | |||
derivationPath: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not necessary but ❤️ the details
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
This is looking awesome! 👏 😍 |
81abd08
to
d69c094
Compare
Hi Tally team 👋 Feel free to share if there are any further thoughts on this PR. |
const DERIVATION_PATH_TO_NETWORK: { [key: string]: EVMNetwork } = { | ||
"m/44'/137'/0'/0": ROOTSTOCK, | ||
"m/44'/60'/0'/0": ETHEREUM, | ||
"m/44'/1'/0'/0": ETHEREUM, | ||
"m/44'/60'/0'": ETHEREUM, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like the ledger lib should have some way to resolve this somewhere...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion @Shadowfiend. Purpose of this mapping is to get the right network against the derivation path that is returned by derivation path dropdown. Here i am setting the network selected by the user.
Objective here is to set the right network based on derivation path selected by user.
Feels like the ledger lib should have some way to resolve this somewhere...
I looked into tally codebase (ledger related files) to find something as you suggested. But i think such mapping or something related is not there unless there is some other intelligent way of achieving this.
Would be great if you can share some hint 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like the ledger lib should have some way to resolve this somewhere...
@Shadowfiend Resolved this concern
d69c094
to
7c1afd3
Compare
Hi Tally team 👋 Updated this pull request and implemented the Reference issue: #2623 Demo: Demo video: ledgerdemo.movFeel free to review the pull request and share thought's if anything needs to changed. 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const DEFAULT_DERIVATION_PATH = "44'/60'/0'/0/0" | ||
const ROOTSTOCK_DERIVATION_PATH = "44'/137'/0'/0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We declare these values in several places. Let's make it const so that if there is a change, it takes place in one place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion to make it part of network. Let me know if this idea makes sense or should i move it somewhere else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I think it can be a part of the network but probably we don't want to mix this thing. Let's wait for @0xDaedalus opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have the derivation path on the Rootstock const 😄 For the default one I think we shouldn't just add it as a global const and use where needed and as a fallback.
fdd260a
to
0cb729d
Compare
This is looking good! |
Hey hey, so i just tested out the network selector from a ui pov, and added a few clean-up things. Pasting this as an image as it was easier for me to do. Also i moved the Figma to a public file so you can access it and look at stuff. Do let me know if it isn't working |
Looking very good on my end! Awesome job @ahsan-javaiid! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're really close 🚀 I left a few tiny comments.
Let's still wait for @0xDaedalus final feedback. 😀
I wonder about one more thing. BSC and AVAX have feature flags. In this case, should we add the ability to switch off/on these networks?
const DEFAULT_DERIVATION_PATH = "44'/60'/0'/0/0" | ||
const ROOTSTOCK_DERIVATION_PATH = "44'/137'/0'/0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm I think it can be a part of the network but probably we don't want to mix this thing. Let's wait for @0xDaedalus opinion.
2bfe6b2
to
df317c6
Compare
df317c6
to
84f5555
Compare
Hi Tally team 👋 Users are eager to use Tally wallet with Roostock <> Ledger. I would be happy to do any further changes to get this pull request considered. Feel free to share further thoughts on this pull request. |
9eaa7e4
to
512dc72
Compare
hey @kkosiorowska @jagodarybacka, any update on this feature? is there anything else we could help with from Rootstock team? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay 😭 Awesome job was done here!
From UI testing:
- I think this selector should be hidden for now as it is bugged and is not really changing dpath but is going back to network selector sceen
- with tabbed onboarding turned on
SUPPORT_TABBED_ONBOARDING=true
we should support a similar flow 🤔 but it shouldn't block this PR IMO
A couple of comments, mostly non-blocking, besides hiding bugged dpath selector
const DEFAULT_DERIVATION_PATH = "44'/60'/0'/0/0" | ||
const ROOTSTOCK_DERIVATION_PATH = "44'/137'/0'/0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have the derivation path on the Rootstock const 😄 For the default one I think we shouldn't just add it as a global const and use where needed and as a fallback.
fixed, no external dependencies
5ed8a8f
to
051d76e
Compare
With the addition of network selection at the beginning of the screen. Do we still need dpath selection? |
@VladUXUI I would say we do need it for the convenience of more advanced users, it would be a nice improvement here. For seed path import there is no way to choose the network there so we can either do it based on dpath selector or network selector 🤔 @ahsan-javaiid ty for fixes! @0xDaedalus could you take a look - I think it's good to go and we can take care of tabbed onboarding later |
Yeah, agreed. But i would rather fix than hide? |
Hi team: 👋 Just a reminder to consider this pull request.🎗 Feel free to share if anything blocking on this pull request. 🚧 Hope to get this PR considered soon. 🙏 |
Hey @ahsan-javaiid I checked it yesterday and overall it looks nice. One thing I noticed we missed is that now we are missing Ledger live dpath when Ethereum is selected while importing Ledger. We will figure that out with @VladUXUI. We are planning to release tabbed onboarding soon so we think its best to merge this PR after the initial release of tabbed onboarding is done 🔜 |
3609d9c
to
7534e0e
Compare
7534e0e
to
22f1574
Compare
Hi Taho Team: 👀 Eyes on this pull request if it can be prioritised. 👀 🙏 |
Hey folks, I wanted to poke at what is now #3385 before going deep on review here. Now that 3385 is written up, I'm going to try and give this some deep 👀 so we can get over the finish line 💪 |
Description
ledger
integration forRSK
RSK
app will simply reject it.RSK
Demo
Type of Change
Testing information
SUPPORT_RSK
env flagRSK
app on ledgerTesting Environment
Checklist
Latest build: extension-builds-2577 (as of Mon, 20 Mar 2023 10:35:42 GMT).