Skip to content

determine tx type using normalised tx params#17055

Merged
ryanml merged 4 commits intoMetaMask:developfrom
witmicko:fix-normalisedTx
Jan 6, 2023
Merged

determine tx type using normalised tx params#17055
ryanml merged 4 commits intoMetaMask:developfrom
witmicko:fix-normalisedTx

Conversation

@witmicko
Copy link
Copy Markdown
Contributor

@witmicko witmicko commented Dec 22, 2022

Explanation

Fixes issue where transaction data with omitted 0x will cause wrong transaction type (contract interaction when doing setApprovalForAll, this in turn is causing NFT transfer popup warning to not show up.

Manual Testing Steps

  • in test dapp run "set approval for all"
  • you should see warning popup
// should show warning confirmation screen after initial confirm
await window.ethereum.request({
  method: 'eth_sendTransaction',
  params: [{
    gas: '0xb403',
    value: '0x0',
    from: ethereum.selectedAddress,
    to: '0x39ec448b891c476e166b3c3242a90830db556661',
    data: '0xa22cb46500000000000000000000000039ec448b891c476e166b3c3242a90830db5566610000000000000000000000000000000000000000000000000000000000000001',
  }],
});

// should show warning confirmation screen after initial confirm, notice data is missisng 0x
await window.ethereum.request({
  method: 'eth_sendTransaction',
  params: [{
    gas: '0xb403',
    value: '0x0',
    from: ethereum.selectedAddress,
    to: '0x39ec448b891c476e166b3c3242a90830db556661',
    data: 'a22cb46500000000000000000000000039ec448b891c476e166b3c3242a90830db5566610000000000000000000000000000000000000000000000000000000000000001'
  }],
});
      

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@witmicko witmicko requested a review from a team as a code owner December 22, 2022 19:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 22, 2022

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@witmicko
Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown
Contributor

@danjm danjm left a comment

Choose a reason for hiding this comment

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

LGTM, nice fix

@ryanml ryanml merged commit b125484 into MetaMask:develop Jan 6, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jan 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants