Skip to content

Conversation

@FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented May 2, 2022

Explanation

This PR fixes a bug where we would try to show called method names for contract deployments. Since contract deployments have the bytecode as the data we can't look up method signatures using the first 4 bytes as you can with a normal contract interaction.

Screenshots/Screencaps

Before

After

Manual Testing Steps

  1. Go to the test dapp
  2. Deploy a contract
  3. See that the transaction title is "contract deployment"

Pre-Merge Checklist

  • PR template is filled out
  • Manual testing complete & passed
  • IF this PR fixes a bug, a test that would have caught the bug has been added
  • PR is linked to the appropriate GitHub issue
  • IF QA attention is required, "QA Board" label has been applied
  • PR has been added to the appropriate release Milestone

@FrederikBolding FrederikBolding requested a review from a team as a code owner May 2, 2022 18:02
@FrederikBolding FrederikBolding requested a review from jpuri May 2, 2022 18:02
@github-actions
Copy link
Contributor

github-actions bot commented May 2, 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.

kumavis
kumavis previously approved these changes May 2, 2022
@jpuri
Copy link
Contributor

jpuri commented May 2, 2022

Can you plz add some description to the PR and if possible test coverage.

@metamaskbot
Copy link
Collaborator

Builds ready [23b7571]
Page Load Metrics (1773 ± 41 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint83135109168
domContentLoaded1628195617639344
load1628195617738641
domInteractive1628195617639344

highlights:

storybook

Comment on lines 223 to 225
title =
(methodData?.name && camelCaseToCapitalize(methodData.name)) ||
transactionTypeTitle;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we ever add methodData to a transaction where the to address is null/undefined?

Copy link
Member Author

Choose a reason for hiding this comment

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

We shouldn't. We should only use it for valid method calls to a contract.

Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like ideally we would guarantee that methodData won't be attached to a transaction where address is empty or zero address further upstream (maybe in the TransactionsController), but won't block on it here...

Copy link
Contributor

Choose a reason for hiding this comment

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

in what scenario would we have a transaction without a 'to' address?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think when you deploy a contract no?

Copy link
Contributor

Choose a reason for hiding this comment

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

🤦🏻 yeah. that makes sense...

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't attach methoData anywhere, its fetched at that top of the useTransactionDisplayData hook.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's not affiliated with the transaction outside of this hook afaik @adonesky1

@FrederikBolding
Copy link
Member Author

FrederikBolding commented May 2, 2022

Can you plz add some description to the PR and if possible test coverage.

Added a description and test coverage! 👍

Copy link
Contributor

@brad-decker brad-decker left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 223 to 225
title =
(methodData?.name && camelCaseToCapitalize(methodData.name)) ||
transactionTypeTitle;
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like ideally we would guarantee that methodData won't be attached to a transaction where address is empty or zero address further upstream (maybe in the TransactionsController), but won't block on it here...

@metamaskbot
Copy link
Collaborator

Builds ready [13d7fe4]
Page Load Metrics (1717 ± 29 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint86132101136
domContentLoaded1612179516964321
load1621183317176029
domInteractive1612179516964321

highlights:

storybook

@brad-decker brad-decker merged commit 3b3a680 into develop May 2, 2022
@brad-decker brad-decker deleted the fb/dont-use-4bytes-for-deployment branch May 2, 2022 21:49
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants