Add advanced setting to enable editing nonce on confirmation screens#7089
Add advanced setting to enable editing nonce on confirmation screens#7089danjm merged 51 commits intoMetaMask:developfrom rickycodes:add-advanced-setting-to-enable-editing-nonce
Conversation
rickycodes
left a comment
There was a problem hiding this comment.
This is almost done, just a couple things need to be tied together
There was a problem hiding this comment.
I tried doing: nonce: customNonceValue to see if i could get the nonce into the transaction that way, but it didn't appear to work as expected...
There was a problem hiding this comment.
This is due to how the nonce is set when a transaction is approved. See line 379 of the transactions controller: https://github.com/MetaMask/metamask-extension/pull/7089/files/5e653e49f9376c12a33b77ce5813bb30468c2c33#diff-97c997fde8231c768b7f2393fd3012e1L379
It looks like you were on your way to updating that code based on your comment in that file
There was a problem hiding this comment.
I'd assume this property exists at this point, but I don't see this log anywhere? not sure what makes the most sense to debug this?
There was a problem hiding this comment.
Were you looking in the background console for the log? To see it you need to:
- go to
chrome://extensions/or the Brave equivalent - turn "Developer Mode" on
- under the MetaMask app you are building, inspect the "Background page"
- click the "console" tab
There was a problem hiding this comment.
Okay, I got things sorta working... was able to kick off a transaction with a custom nonce of 4:
however it's just been pending this whole time... I'm not sure what the requirements of nonce are... trying strings like 'testing123' (as an example) just seems to break things (transaction doesn't go through and I get a bunch of errors).
There was a problem hiding this comment.
In fact, I think what you have is working. That the tx is in pending the whole time is due to how transactions are handled by the ethereum blockchain. If the network only has record of nonces 1 and 2 for your account, and you custom edit a new transaction to nonce 5, that new one will remain pending until transactions with nonces 3 and 4 are successfully confirmed.
Read this for a helpful explanation: https://www.reddit.com/r/ethereum/comments/6ihw6p/can_someone_please_explain_nonce_to_me/dj6r1lk/
You are right, however, that a nonce cannot just be any arbitrary string. It must be a natural number >= 0. So we should prevent other values from being entered in this input field.
There was a problem hiding this comment.
- Ensure inputs can only be submitted if nonce is a whole number >= 0, or ensure those are the only input possible in the nonce field
|
We should move the toggle to the "Advanced" settings page.
|
|
I've moved the nonce toggle to the Advanced settings page, I've added some additional styles and things, but I am sure there is still more to do around where to reset the |
|
Oh also there might need to be more of a sanity check on |
|
Thanks for this! I'am looking forward to use it. I got a stuck tx since more then 4 days, metamask not showing speed up or cancel on this one. (Browser freeze, so tx somewhat lost) |
|
Updated demo: https://streamable.com/noij3 And screen shot: |
|
The nonce input field is very wide. Probably could reduce the width by 1/2 it's current size. I noticed the placeholder text "automatically calculate", however, I'd suggest populating the custom nonce field with the nonce calculated by MM as opposed to an empty field w/placeholder. I'd update the text in settings to something like this instead. cc @danjm |
|
@cjeria Made changes according to your suggestions: |
ui/app/pages/confirm-transaction-base/confirm-transaction-base.component.js
Outdated
Show resolved
Hide resolved
|
There's a lot of emphasis on the component "nonce field" in the title. Titles should help answer user questions like what the feature will enable them to do. In this case, the "nonce field" lets users "customize transaction nonces". More broadly this feature will let users "Edit transaction nonces on confirm screens". Also, remove the period at the end of the title. WDYT? |
There was a problem hiding this comment.
add this value to nonce details
There was a problem hiding this comment.
id like it if we still got are calculated nonce for debug purposes
|
QUESTION: should we address the showing of a warning if the custom nonce is distance one or greater from our suggested nonce feel free to ignore this question this is mainly a reminder that the question was brought up |
| this.setState({ submitWarning: '' }) | ||
| } | ||
| updateCustomNonce(String(newCustomNonce)) | ||
| getNextNonce() |
There was a problem hiding this comment.
If this results in the nextNonce changing to one that would invalidate the custom nonce, it won't result in a warning. I think this case could be caught by re-validating the custom nonce field in the lifecycle function when the nextNonce prop changes
* origin/develop: (56 commits) Add advanced setting to enable editing nonce on confirmation screens (MetaMask#7089) Add migration on 3box imports and remove feature flag (MetaMask#7209) ci - install deps - limit install scripts to whitelist (MetaMask#7208) Add a/b test for full screen transaction confirmations (MetaMask#7162) Update minimum Firefox verison to 56.0 (MetaMask#7213) mesh-testing - submit infura rpc requests to mesh-testing container (MetaMask#7031) obs-store/local-store should upgrade webextension error to real error (MetaMask#7207) sesify-viz - bump dep for visualization enhancement (MetaMask#7175) address book entries by chainId (MetaMask#7205) Optimize images only during production build (MetaMask#7194) Use common test build during CI (MetaMask#7196) Report missing `en` locale messages to Sentry (MetaMask#7197) Verify locales on CI (MetaMask#7199) updated ganache and addons-linter (MetaMask#7204) fixup! add user rejected errors add user rejected errors update json-rpc-engine use eth-json-rpc-errors Remove unused locale messages (MetaMask#7190) Remove unused components (MetaMask#7191) ...
|
@danjm this is not implemented for ERC20 "approve" transactions, am I right? |






re: #6757
This gives us a new nonce toggle in settings:
Which enables adding one to the transaction: