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

Add error message for user when ledger fails when attempting to sign #692

Merged

Conversation

valefar-on-discord
Copy link
Contributor

Description

When a user attempts to perform a deposit with a Ledger device, if Blind Signing and Debug Data is not enabled, the transaction will fail with seemingly no reason. This has been a problem for years and still people ask about it on the EthStaker discord. Though this issue may be resolved by updating the web3-react library from v6 to v8, a brief attempt at doing so resulted in dependency hell and would be quite a drastic change for this one small issue. I had a quick chat with @wackerow about this and we agreed an error message is the best approach.

The error message will appear if either Blind Signing or Debug Data are disabled or, sadly, if the user simply rejects from the Ledger device. We have no way to differentiate but I feel the benefit of the guidance outweighs the false positive.

I am a little uncertain on exact wording or if there is a stylistic standard around presenting error messages but happy to update as necessary.

Related Issues

Copy link

netlify bot commented May 4, 2024

👷 Deploy request for dapper-rolypoly-9814ad pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9aa991d

@valefar-on-discord
Copy link
Contributor Author

Ledger_error

const isLedgerError = (error: any) => {
if (error.code === -32603) {
// Error message when rejecting from ledger or blind signing and debug not enabled
if (
Copy link
Contributor Author

@valefar-on-discord valefar-on-discord May 4, 2024

Choose a reason for hiding this comment

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

Obviously could do if (... && ...) but followed commenting pattern of isUserRejectionError
Happy to change if this is unnecessary.

Copy link
Member

Choose a reason for hiding this comment

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

Hey @valefar-on-discord do you happen to know the error code that results from not having the proper Ledger settings enabled? Adding error handling here seems like a minimally invasive and safe improvement.

@valefar-on-discord
Copy link
Contributor Author

Friendly ping on this.

I am still assisting users with this issue and though this isn't the optimal solution, it will still help.

Comment on lines 53 to 64
const isLedgerError = (error: any) => {
if (error.code === -32603) {
// Error message when rejecting from ledger or blind signing and debug not enabled
if (
error.message.includes('Ledger: Unknown error while signing transaction')
) {
return true;
}
}

return false;
};
Copy link
Member

@wackerow wackerow Jun 14, 2024

Choose a reason for hiding this comment

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

@valefar-on-discord Oops sorry, was on mobile and missed the context...

So -32603 is the error code... is there a reason we need to also check for the "Ledger:" string below? If so, I may consider just checking for .toLowerCase().includes("ledger") so any error message with "Ledger" in it will be flagged.

And also, we could simplify this to just return error.code === -32603 && error.message.toLowerCase().includes("ledger") as a boolean:

Suggested change
const isLedgerError = (error: any) => {
if (error.code === -32603) {
// Error message when rejecting from ledger or blind signing and debug not enabled
if (
error.message.includes('Ledger: Unknown error while signing transaction')
) {
return true;
}
}
return false;
};
// Error message when rejecting from ledger or blind signing and debug not enabled
const isLedgerError = (error: any) =>
error.code === -32603 && error.message.toLowerCase().includes("ledger")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup yup, sounds good.

Thanks for taking a look!

Comment on lines 169 to 170
blindSigning: <b>Blind Signing</b>,
debugData: <b>Debug Data</b>,
Copy link
Member

Choose a reason for hiding this comment

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

@valefar-on-discord Double checking here, do we want these to be translated? I'm not deeply familiar with any non-English Ledger interface. If we want these terms to be translated, we'll need to wrap them in their own FormattedMessage component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a great question but I don't believe they are translated.

If you take a look at the ledger documentation in a different language, it will show "Blind Signing"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to update the instructions based on this little discovery.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to extract hard-coded words and used <strong>

@valefar-on-discord
Copy link
Contributor Author

Screenshot 2024-06-14 at 7 24 55 PM

Updated version

Copy link
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

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

Lgtm! Thanks @valefar-on-discord

@wackerow wackerow mentioned this pull request Jun 16, 2024
@hwwhww hwwhww merged commit dc72f68 into ethereum:dev Jun 20, 2024
1 check passed
This was referenced Jun 20, 2024
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.

3 participants