-
Notifications
You must be signed in to change notification settings - Fork 433
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
Fix: show nonce warning when above current nonce #2625
Conversation
Branch preview✅ Deploy successful! |
const ADORNMENT_PADDING = '24px' | ||
|
||
const clamped = `clamp(calc(${MIN_CHARS}ch + 6px), calc(${Math.max(MIN_CHARS, value.length)}ch + 6px), ${MAX_WIDTH})` | ||
|
||
if (showRecommendedNonceButton) { | ||
return `calc(${clamped} + ${ADORNMENT_PADDING})` | ||
} | ||
|
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.
Removed this to avoid the jumping when the reset button appears, it was really annoying. I made it wider by default.
ESLint Summary View Full Report
Report generated by eslint-plus-action |
NONCE_MUST_BE_NUMBER = 'Nonce must be a number', | ||
NONCE_TOO_LOW = "Nonce can't be lower than %%nonce%%", | ||
NONCE_TOO_HIGH = 'Nonce is too high', | ||
NONCE_TOO_FAR = 'Nonce is very far from the current nonce', |
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.
Maybe something like "Nonce is much higher than the current nonce"? "very far" sounds ambiguous imo
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.
Maybe! What does BritGPT say, @iamacook?
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 suggestion sounds good to me.
useEffect(() => { | ||
let message = '' | ||
// Warnings | ||
if (Number(nonce) >= safe.nonce + MAX_NONCE_DIFFERENCE) { | ||
message = ErrorMessages.NONCE_TOO_FAR | ||
} | ||
|
||
if (Number(nonce) > Number(recommendedNonce)) { | ||
message = ErrorMessages.NONCE_GT_RECOMMENDED | ||
} | ||
|
||
setWarning(message) | ||
}, [nonce, recommendedNonce, safe.nonce]) |
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.
Why can't this be part of the validate
call where we also have the rest of the messages?
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.
Because in some cases this might be legit what the user wants to do. At least this was like this before the tx flow redesign, IIRC.
Verified.
|
What it solves
Resolves #2560
How this PR fixes it
Shows a warning if the nonce is above the recommended nonce, or if the nonce is more than 100 higher than the safe nonce.
How to test it
Enter a nonce that's higher than the recommended one.
Screenshots