Skip to content

Resubmit#1695

Closed
frankiebee wants to merge 4 commits intononce-trackerfrom
resubmit
Closed

Resubmit#1695
frankiebee wants to merge 4 commits intononce-trackerfrom
resubmit

Conversation

@frankiebee
Copy link
Copy Markdown
Contributor

create a button for resubmitting transactions with the same nonce

screen shot 2017-06-28 at 7 17 56 pm

@frankiebee
Copy link
Copy Markdown
Contributor Author

Dapps should not be allowed to specify nonce only metamask. insure that this is the case.

await this.publishTransaction(txId, rawTx)
// must set transaction to submitted/failed before releasing lock
nonceLock.releaseLock()
if (nonceLock) nonceLock.releaseLock()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why would we not have a nonceLock here

return new Promise((resolve, reject) => {
this.addUnapprovedTransaction(txMeta.txParams, (err, newTxMeta) => {
if (err) {
delete txMeta.ignore
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why would we have txMeta.ignore here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we agreed to remove

if (err) {
delete txMeta.ignore
this.updateTx(txMeta)
reject(err)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should we return here or do you intend to keep going and set the ignore to true and resolve the tx

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we agreed to return here

})
}

_updateNonceDuplicates () {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please add comments explaining what this does

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we agreed that it would be easier to not maintain this list but just create in on demand
so we should create a new fn for nullifying txs from the same address with the same nonce

const pendingTransactions = this.getPendingTransactions(address)
// await lock free
await this.lockMap[address]
if (pendingTransactions.length) await this.lockMap[address]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

use brackets for if-else statements
prolly should put this.lockMap[address] into a var before using it since you look it up many times

this looks suspect

await this.lockMap[address]
vs
await this.lockMap[address]()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lockMap is promise, shouldnt be called

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we agreed to remove the pendingTransactions check before awaiting the nonce lock
(but you didnt remember why you put this here)
basically this (line 17-18) should look as it did before, simply await this.lockMap[address]


TransactionIcon.prototype.render = function () {
const { transaction, txParams, isMsg } = this.props
const isIgnored = (transaction.ignore && transaction.status === 'submitted')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is the status relevant if the flag is set to ignore?

const nonce = txParams.nonce ? numberToBN(txParams.nonce).toString(10) : ''

const isClickable = ('hash' in transaction && isLinkable) || isPending
const isIgnored = (transaction.ignore && transaction.status === 'submitted')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same as above,

why is the status relevant if the flag is set to ignore?

this.addUnapprovedTransaction(txMeta.txParams, (err, newTxMeta) => {
if (err) {
delete txMeta.ignore
this.updateTx(txMeta)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

wont need to update the tx either

const blockNumber = currentBlock.number
const pendingTransactions = this.getPendingTransactions(address)
const baseCount = await this._getTxCount(address, blockNumber)
const baseCount = await this._getTxCount(address)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the order of requests here is really important:

  • get current block
  • get pending transactions
  • get base tx count @ block
  • calculate new nonce
    we should add comments explaining why this is:

we need to make sure our base count and pending count are from the same block

@frankiebee frankiebee added the DO-NOT-MERGE Pull requests that should not be merged label Jul 5, 2017
@frankiebee frankiebee closed this Jul 11, 2017
@frankiebee frankiebee deleted the resubmit branch July 11, 2017 19:09
segun added a commit that referenced this pull request Jan 24, 2024
…etwork coverage on extension (#22618)

## **Description**
- What's new copy should be updated to:
> Steer clear of known scams while still preserving your privacy with
security alerts powered by Blockaid. This feature is available on
Arbitrum, Avalanche, BNB chain, Ethereum Mainnet, Linea, Optimism and
Polygon.
> 
> Always do your own due diligence before approving requests.

- Settings copy should be updated to:
> Privacy preserving - no data is shared with third parties. Available
on Arbitrum, Avalanche, BNB chain, Ethereum Mainnet, Linea, Optimism and
Polygon.

## **Related issues**

Fixes:
[#1695](https://github.com/MetaMask/MetaMask-planning/issues/1695)

Blocked By: #22070 

## **Screenshots/Recordings**

### **Before**


https://github.com/MetaMask/metamask-extension/assets/44811/0e6b6103-efb0-4ed8-94c2-44ac0f281ff8

### **After**


https://github.com/MetaMask/metamask-extension/assets/44811/36740992-0af2-44c5-b62b-0ac522df4d17

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've clearly explained what problem this PR is solving and how it
is solved.
- [x] I've linked related issues
- [x] I've included manual testing steps
- [x] I've included screenshots/recordings if applicable
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [x] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
montelaidev pushed a commit that referenced this pull request Jan 25, 2024
…etwork coverage on extension (#22618)

## **Description**
- What's new copy should be updated to:
> Steer clear of known scams while still preserving your privacy with
security alerts powered by Blockaid. This feature is available on
Arbitrum, Avalanche, BNB chain, Ethereum Mainnet, Linea, Optimism and
Polygon.
> 
> Always do your own due diligence before approving requests.

- Settings copy should be updated to:
> Privacy preserving - no data is shared with third parties. Available
on Arbitrum, Avalanche, BNB chain, Ethereum Mainnet, Linea, Optimism and
Polygon.

## **Related issues**

Fixes:
[#1695](MetaMask/MetaMask-planning#1695)

Blocked By: #22070 

## **Screenshots/Recordings**

### **Before**


https://github.com/MetaMask/metamask-extension/assets/44811/0e6b6103-efb0-4ed8-94c2-44ac0f281ff8

### **After**


https://github.com/MetaMask/metamask-extension/assets/44811/36740992-0af2-44c5-b62b-0ac522df4d17

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've clearly explained what problem this PR is solving and how it
is solved.
- [x] I've linked related issues
- [x] I've included manual testing steps
- [x] I've included screenshots/recordings if applicable
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [x] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
dbrans pushed a commit that referenced this pull request Jan 25, 2024
…etwork coverage on extension (#22618)

## **Description**
- What's new copy should be updated to:
> Steer clear of known scams while still preserving your privacy with
security alerts powered by Blockaid. This feature is available on
Arbitrum, Avalanche, BNB chain, Ethereum Mainnet, Linea, Optimism and
Polygon.
> 
> Always do your own due diligence before approving requests.

- Settings copy should be updated to:
> Privacy preserving - no data is shared with third parties. Available
on Arbitrum, Avalanche, BNB chain, Ethereum Mainnet, Linea, Optimism and
Polygon.

## **Related issues**

Fixes:
[#1695](https://github.com/MetaMask/MetaMask-planning/issues/1695)

Blocked By: #22070 

## **Screenshots/Recordings**

### **Before**


https://github.com/MetaMask/metamask-extension/assets/44811/0e6b6103-efb0-4ed8-94c2-44ac0f281ff8

### **After**


https://github.com/MetaMask/metamask-extension/assets/44811/36740992-0af2-44c5-b62b-0ac522df4d17

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've clearly explained what problem this PR is solving and how it
is solved.
- [x] I've linked related issues
- [x] I've included manual testing steps
- [x] I've included screenshots/recordings if applicable
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.
- [x] I’ve properly set the pull request status:
  - [ ] In case it's not yet "ready for review", I've set it to "draft".
- [x] In case it's "ready for review", I've changed it from "draft" to
"non-draft".

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO-NOT-MERGE Pull requests that should not be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants