-
-
Notifications
You must be signed in to change notification settings - Fork 241
fix: don't poll indefinitely for bridge status if 500 errors #6149
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
Merged
infiniteflower
merged 27 commits into
main
from
swaps-655-bridge-status-indefinite-poll-2
Jul 21, 2025
Merged
fix: don't poll indefinitely for bridge status if 500 errors #6149
infiniteflower
merged 27 commits into
main
from
swaps-655-bridge-status-indefinite-poll-2
Jul 21, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… of tx activity item
7 tasks
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
micaelae
reviewed
Jul 21, 2025
packages/bridge-status-controller/src/bridge-status-controller.ts
Outdated
Show resolved
Hide resolved
micaelae
reviewed
Jul 21, 2025
packages/bridge-status-controller/src/bridge-status-controller.ts
Outdated
Show resolved
Hide resolved
micaelae
previously approved these changes
Jul 21, 2025
micaelae
approved these changes
Jul 21, 2025
github-merge-queue bot
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Jul 30, 2025
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR fixes an issue where the Bridge API would be polled indefinitely even if the txHash would never be found (due to a bug where it was submitted on the wrong chain). ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/SWAPS-2010 Related to MetaMask/core#6149 Patch is from this branch: MetaMask/core@main...patch/bridge-status-controller-36.1.0-mobile-ledger-fix ## **Manual testing steps** 1. Modify `node_modules/@metamask/bridge-status-controller/dist/utils/bridge-status.mjs` to fetch a fake txHash ``` const fetchBridgeTxStatus = async (statusRequest, clientId, fetchFn, bridgeApiBaseUrl) => { const statusRequestDto = (0, exports.getStatusRequestDto)(statusRequest); statusRequestDto.srcTxHash = '0xfake'; ``` 3. Observe that after a failure, polls will follow an exponential backoff interval (10 sec, 20 sec, etc...) 4. Click on a failed to fetch tx history item (after 7 attempts) to restart polling. The video below modified the max attempts to 3 for the sake of a shorter video. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> https://github.com/user-attachments/assets/14a2b293-94f8-475a-88b1-bc4ac4684f27 ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
This PR fixes an issue where we would poll indefinitely if the Bridge API keeps returning a 500 error. The original bug was that the tx was submitted on the wrong chain and therefore the txHash would never appear on the chain we are querying for, so we would poll the Bridge API indefinitely.
References
Original issue: https://consensyssoftware.atlassian.net/browse/SWAPS-655
Mobile implementation: MetaMask/metamask-mobile#17396
Changelog
Checklist