Skip to content
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

Remove hexdata field from token send #12565

Merged
merged 3 commits into from Nov 3, 2021

Conversation

hmalik88
Copy link
Contributor

@hmalik88 hmalik88 commented Nov 3, 2021

Fixes: #10194

Explanation: Added asset as another piece of state mapped to props for the SendContent component. Then used asset to implement logic to not render the SendHexDataRow component for assets of type TOKEN (ERC-20).

Manual testing steps:

  • Hit send on main screen (make sure "Show Hex Data" is enabled in Advanced settings prior to this step)
  • Enter recipient address
  • Observe that the Hex Data field is no longer visible

@hmalik88 hmalik88 requested a review from a team as a code owner November 3, 2021 03:41
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2021

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.

@hmalik88
Copy link
Contributor Author

hmalik88 commented Nov 3, 2021

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

@rekmarks rekmarks requested a review from danjm November 3, 2021 07:49
} = this.props;

let gasError;
if (gasIsExcessive) gasError = GAS_PRICE_EXCESSIVE_ERROR_KEY;
else if (noGasPrice) gasError = GAS_PRICE_FETCH_FAILURE_ERROR_KEY;
else if (getIsBalanceInsufficient)
gasError = INSUFFICIENT_FUNDS_FOR_GAS_ERROR_KEY;
const showHexData =
this.props.showHexData &&
asset.type !== ASSET_TYPES.NATIVE &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we want to showHexData is the asset type is NATIVE?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I added in hex data for an Ether send it no longer showed the transaction as a transfer on etherscan. I'm also not sure why we would want to allow hex data for a NATIVE token send, open to hearing your thoughts :)

image

Copy link
Member

Choose a reason for hiding this comment

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

But... this would disable custom hex data for all transactions 😅 There are only two types - native and token.

The sole purpose of this field is to add additional data to simple send transactions. Sometimes people want to attach messages to their transfers, and sometimes they just want a way to embed a message on the blockchain. Maybe there are other reasons, I'm not sure.

Either way, I don't see why we'd care how Etherscan displays such transactions.

Copy link
Contributor

@danjm danjm Nov 3, 2021

Choose a reason for hiding this comment

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

Okay, yeah, you can just hide hex data if asset.type !== ASSET_TYPES.TOKEN but continue to show it for ether sends.

In addition to the users that @Gudahtt mentioned, this is also how people can manually make calls to smart contract methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Gudahtt That's true, I suppose hex data wouldn't matter for a native token send, I hadn't realized we were not wanting to enable hex data for ERC-20 was because the hex data would potentially mess up the transfer invocation 😅. A transfer can be successful with hex data if the ERC20 has extra functions with an extra field on transfer but I guess that would be too much of a pain to deal with. Update coming in a few!

Copy link
Member

@Gudahtt Gudahtt Nov 3, 2021

Choose a reason for hiding this comment

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

I hadn't realized we were not wanting to enable hex data for ERC-20 was because the hex data would potentially mess up the transfer invocation

To clarify that a little bit, it's not so much that it would mess up the transfer invocation. But rather that right now we overwrite the custom hex data entered by the user with the transfer invocation. So it's misleading to include the field when it just gets overwritten.

If there's a demand, we can definitely consider allowing users to add additional fields as you're suggesting here, as a later feature. That seems like a reasonable request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To clarify that a little bit, it's not so much that it would mess up the transfer invocation. But rather that right now we overwrite the custom hex data entered by the user with the transfer invocation. So it's misleading to include the filed when it just gets overwritten.

Good to know, thanks!

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@metamaskbot
Copy link
Collaborator

Builds ready [4806c7b]
Page Load Metrics (593 ± 81 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint14184155718488
domContentLoaded31484358617584
load33084359316881
domInteractive31484358617584

highlights:

storybook

@hmalik88 hmalik88 merged commit baa4eb2 into develop Nov 3, 2021
@hmalik88 hmalik88 deleted the remove-hexdata-field-from-token-send branch November 3, 2021 19:03
@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2021
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.

'Show Hex Data' field ignored for token sends
5 participants