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

fix: app crash due to minimal input must be string error #10842

Merged
merged 9 commits into from
Sep 11, 2024

Conversation

vinnyhoward
Copy link
Contributor

@vinnyhoward vinnyhoward commented Aug 27, 2024

Description

This PR addresses the "minimal input must be string" error thrown by the fromTokenMinimalUnitString function when its first argument is not a string. This error causes a crash on the user's device.

Error logs from Senty point to the Send Flow. These changes help ensure that the fromTokenMinimalUnitString function always receives a string by using the hex fallback 0x0. This will stop the minimal input must be string error and associated app crashes

Related issues

Fixes: #9077

Manual testing steps

  1. Go to the Send flow
  2. Select an address to send to.
  3. Select a token (Select a non Ethereum token)
  4. Tap the MAX button
  5. Verify that no errors occur and the maximum amount is correctly displayed

Screenshots/Recordings

NA

Before

NA

After

NA

Pre-merge author checklist

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.

@vinnyhoward vinnyhoward added Run Smoke E2E Triggers smoke e2e on Bitrise team-wallet-ux labels Aug 27, 2024
Copy link
Contributor

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.

Copy link
Contributor

github-actions bot commented Aug 27, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 360e1de
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/b650ff03-adf2-4131-a34e-d46bd9d98261

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@vinnyhoward vinnyhoward force-pushed the fix-9077-minimal-input-must-be-string branch from 1389d37 to 16adeec Compare September 4, 2024 00:26
@vinnyhoward vinnyhoward added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Sep 4, 2024
Copy link
Contributor

github-actions bot commented Sep 4, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 16adeec
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/91fec3bd-60cc-410f-a6ef-b73ab50444d0

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 52.83%. Comparing base (8dcdd3c) to head (16adeec).
Report is 33 commits behind head on main.

Files with missing lines Patch % Lines
.../UI/Ramp/Views/SendTransaction/SendTransaction.tsx 0.00% 0 Missing and 1 partial ⚠️
...nents/Views/confirmations/SendFlow/Amount/index.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10842      +/-   ##
==========================================
+ Coverage   52.75%   52.83%   +0.07%     
==========================================
  Files        1534     1542       +8     
  Lines       36777    36887     +110     
  Branches     4335     4361      +26     
==========================================
+ Hits        19403    19488      +85     
- Misses      16058    16071      +13     
- Partials     1316     1328      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vinnyhoward vinnyhoward force-pushed the fix-9077-minimal-input-must-be-string branch from 16adeec to f630624 Compare September 4, 2024 18:19
@vinnyhoward vinnyhoward marked this pull request as ready for review September 4, 2024 19:16
@vinnyhoward vinnyhoward requested review from a team as code owners September 4, 2024 19:16
@vinnyhoward vinnyhoward added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Sep 4, 2024
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Sep 4, 2024
Copy link
Contributor

github-actions bot commented Sep 4, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: f630624
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/86ceea8e-d1ec-4d7c-9ebd-706602019ae6

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Copy link
Contributor

@gambinish gambinish left a comment

Choose a reason for hiding this comment

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

This kind of bug definitely makes me want to get util/number/index.js refactored to Typescript 😅 but, it seems like this would be a tough file to convert.

Your description makes sense. I wonder if a more long term fix would be to address this in the fromTokenMinimalUnitString function itself? I'm not sure if forcing a fallback to '0' is acceptable here during send flow (maybe someone on Txn team can confirm if it is).

In any case, I think that we should probably write some unit tests to check for the cases you described in your PR description in util/number/index.test.ts to make sure that each function gets evaluated as we'd expect them to.

@vinnyhoward vinnyhoward force-pushed the fix-9077-minimal-input-must-be-string branch from 9893448 to 8fa9175 Compare September 5, 2024 15:53
@vinnyhoward vinnyhoward added Run Smoke E2E Triggers smoke e2e on Bitrise and removed INVALID-PR-TEMPLATE PR's body doesn't match template Run Smoke E2E Triggers smoke e2e on Bitrise labels Sep 5, 2024
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Sep 5, 2024
Copy link
Contributor

github-actions bot commented Sep 5, 2024

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 8fa9175
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/cad85517-75b3-44db-9d51-c598a69b8b4b

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@vinnyhoward vinnyhoward added Run Smoke E2E Triggers smoke e2e on Bitrise and removed INVALID-PR-TEMPLATE PR's body doesn't match template Run Smoke E2E Triggers smoke e2e on Bitrise labels Sep 5, 2024
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Sep 5, 2024
@vinnyhoward vinnyhoward added the Sev1-high An issue that may have caused fund loss or access to wallet in the past & may still be ongoing label Sep 5, 2024
@vinnyhoward vinnyhoward changed the title fix: minimal input must be string fix: app crash due to minimal input must be string error Sep 5, 2024
@vinnyhoward vinnyhoward added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Sep 6, 2024
Copy link
Contributor

github-actions bot commented Sep 6, 2024

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 3ae5fbb
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/6231978a-758b-4836-b1d6-99be5c31e511

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@vinnyhoward vinnyhoward added Run Smoke E2E Triggers smoke e2e on Bitrise and removed INVALID-PR-TEMPLATE PR's body doesn't match template Run Smoke E2E Triggers smoke e2e on Bitrise labels Sep 6, 2024
Copy link

Copy link
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

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

LGTM

@vinnyhoward vinnyhoward merged commit 821b24e into main Sep 11, 2024
36 checks passed
@vinnyhoward vinnyhoward deleted the fix-9077-minimal-input-must-be-string branch September 11, 2024 16:23
@github-actions github-actions bot locked and limited conversation to collaborators Sep 11, 2024
@metamaskbot metamaskbot added the release-7.32.0 Issue or pull request that will be included in release 7.32.0 label Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.32.0 Issue or pull request that will be included in release 7.32.0 Run Smoke E2E Triggers smoke e2e on Bitrise Sev1-high An issue that may have caused fund loss or access to wallet in the past & may still be ongoing team-wallet-ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Sentry] TypeError: minimalInput must be a string
7 participants