Skip to content

remove transactionCategory in favor of more types#10615

Merged
brad-decker merged 2 commits intodevelopfrom
simplify-tx-types
Mar 10, 2021
Merged

remove transactionCategory in favor of more types#10615
brad-decker merged 2 commits intodevelopfrom
simplify-tx-types

Conversation

@brad-decker
Copy link
Contributor

@brad-decker brad-decker commented Mar 9, 2021

Rationale

Our Transaction object has keys for both type and transactionCategory but the following are true:

  1. Incoming transactions had no type, only a transactionCategory.
  2. Cancel and retry transactions were special case types.
  3. All other transactions were standard type which just meant to look at the transactionCategory

This pull request attempts to simplify the process of getting a view of what a transaction is by eliminating the transactionCategory field in preference of the type field.

There is only one additional case that needs to be covered in the future possibly: Signature requests, which currently have no category or type.

Supersedes #9545

@metamaskbot
Copy link
Collaborator

Builds ready [c07abb4]
Page Load Metrics (722 ± 22 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint47796294
domContentLoaded6368287214722
load6378297224722
domInteractive6358287214722

@brad-decker brad-decker marked this pull request as ready for review March 9, 2021 20:39
@brad-decker brad-decker requested a review from a team as a code owner March 9, 2021 20:39
@brad-decker brad-decker requested a review from danjm March 9, 2021 20:39
@brad-decker brad-decker force-pushed the simplify-tx-types branch 2 times, most recently from 6367332 to e74cc64 Compare March 9, 2021 20:46
@metamaskbot
Copy link
Collaborator

Builds ready [e74cc64]
Page Load Metrics (624 ± 41 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint50746173
domContentLoaded3157416228641
load3167426248641
domInteractive3157416228641

@brad-decker brad-decker requested review from ryanml and removed request for danjm March 9, 2021 21:13
ryanml
ryanml previously approved these changes Mar 9, 2021
Copy link
Contributor

@ryanml ryanml left a comment

Choose a reason for hiding this comment

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

looks like a well applied sweeping update of categories -> types ++

@brad-decker
Copy link
Contributor Author

@ryanml had to rebase, no changes were made :)

ryanml
ryanml previously approved these changes Mar 9, 2021
@metamaskbot
Copy link
Collaborator

Builds ready [1ca9abe]
Page Load Metrics (834 ± 52 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint55223823617
domContentLoaded456101983310752
load457102083410752
domInteractive456101883210752

@brad-decker brad-decker added the DO-NOT-MERGE Pull requests that should not be merged label Mar 9, 2021
@brad-decker
Copy link
Contributor Author

Waiting for other reviewers to surface until tomorrow, at which point I'll remove the do not merge label and merge.

@Gudahtt Gudahtt self-requested a review March 10, 2021 19:37
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.

Looks great! I found one minor issue with a stubs file, but everything looks good aside from that.

I found a few remaining references to a "transaction category" but they were in reference to the transaction group category, which is still a thing that exists. We might want to consider changing the nomenclature there at some point to avoid this confusion, but that can happen at another time.

contractDeployment, contractMethodCall
*/
async _determineTransactionCategory(txParams) {
* @typedef { 'transfer' | 'approve' | 'transferfrom' | 'contractInteraction'| 'sentEther' } InferrableTransactionTypes
Copy link
Member

Choose a reason for hiding this comment

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

Neat! This is appreciated.

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

I didn't do a full review, so I won't throw in my full weight with an approval, but the changes make sense to me and the migration looks good 👍

@brad-decker
Copy link
Contributor Author

I found a few remaining references to a "transaction category" but they were in reference to the transaction group category, which is still a thing that exists. We might want to consider changing the nomenclature there at some point to avoid this confusion, but that can happen at another time.

@Gudahtt 100% agree. I almost did that here but changed my mind haha. I will eliminate this as part of my proposal for regrouping transactions

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!

@Gudahtt
Copy link
Member

Gudahtt commented Mar 10, 2021

I investigated the impact this might have on mobile, since we do sync some transactions.

They use our transactions here: https://github.com/MetaMask/metamask-mobile/blob/develop/app/core/Engine.js#L394

It looks like they don't use the type field or the transactionCategory field, so this change should have no impact.

@brad-decker brad-decker removed the DO-NOT-MERGE Pull requests that should not be merged label Mar 10, 2021
@metamaskbot
Copy link
Collaborator

Builds ready [577f9df]
Page Load Metrics (607 ± 27 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint447957105
domContentLoaded4347086065627
load4367086075627
domInteractive4347076065627

@brad-decker brad-decker merged commit 2ed5baf into develop Mar 10, 2021
@brad-decker brad-decker deleted the simplify-tx-types branch March 10, 2021 20:16
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 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.

5 participants