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

chore: limit bridge quote request frequency and cancel requests #27237

Merged
merged 10 commits into from
Nov 12, 2024

Conversation

micaelae
Copy link
Member

@micaelae micaelae commented Sep 18, 2024

Description

Changes

  • fetch-with-timeout.ts: accept additional abort signals as arguments and apply them
  • reset bridge state on page load and unload
  • reset quotes when inputs change
  • abort getQuote requests when inputs change or when page loads/unloads
  • limit quote refreshes based on feature flag

Open in GitHub Codespaces

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MMS-1448

Manual testing steps

  1. Request bridge quotes
  2. Click "Switch" button and verify that new quotes with updated params are requested/shown
  3. Verify that bridge parameters are reset when extension is reopened
  4. Verify that requests are cancelled in the background when the inputs are updated
  5. Quotes should only be fetched once if srcAmount > balance

Screenshots/Recordings

Before

N/A

After

Screen.Recording.2024-10-21.at.4.39.47.PM.mov

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.

@micaelae micaelae requested review from a team as code owners September 18, 2024 05:39
@micaelae micaelae marked this pull request as draft September 18, 2024 05:39
@micaelae micaelae changed the base branch from develop to mb890-src-and-dest-asset-pickers-backup-0828 September 18, 2024 05:40
@micaelae micaelae changed the base branch from mb890-src-and-dest-asset-pickers-backup-0828 to mb890-src-and-dest-asset-pickers-backup-0927 October 1, 2024 20:12
@micaelae micaelae changed the base branch from mb890-src-and-dest-asset-pickers-backup-0927 to mb890-src-and-dest-asset-pickers-backup-0828 October 1, 2024 20:13
Copy link
Contributor

github-actions bot commented Oct 9, 2024

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.

@micaelae micaelae changed the base branch from mb890-src-and-dest-asset-pickers-backup-0828 to mb890-src-and-dest-asset-pickers-backup-0927 October 9, 2024 16:28
@micaelae micaelae removed request for a team October 9, 2024 16:34
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch 2 times, most recently from 7c2f8e0 to 3222e6d Compare October 9, 2024 18:03
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch from 3222e6d to 6506bef Compare October 9, 2024 18:22
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch 4 times, most recently from 78bcf71 to 403d594 Compare October 10, 2024 22:06
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch 2 times, most recently from 46529fe to fe7840e Compare October 15, 2024 22:23
@micaelae micaelae force-pushed the mb890-src-and-dest-asset-pickers-backup-0927 branch from fe7840e to 107470c Compare October 16, 2024 16:07
Base automatically changed from mb890-src-and-dest-asset-pickers-backup-0927 to develop October 16, 2024 16:50
@micaelae micaelae force-pushed the mb891-fetch-bridge-quotes branch 2 times, most recently from 24cf78d to a8d45e0 Compare November 7, 2024 00:24
@metamaskbot
Copy link
Collaborator

Builds ready [a8d45e0]
Page Load Metrics (1871 ± 147 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32528471707545262
domContentLoaded156027381849305146
load156927851871307147
domInteractive16132552613
backgroundConnect765302110
firstReactRender472871175526
getState45616189
initialActions00000
loadScripts111820391370235113
setupStore106326209
uiStartup177131492125352169
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.76 KiB (0.04%)
  • ui: 326 Bytes (0.00%)
  • common: 1.54 KiB (0.02%)

@micaelae micaelae changed the title chore: bridge quote polling cancellation/limiting and state resets chore: limit bridge quote request frequency and cancel requests Nov 7, 2024
infiniteflower
infiniteflower previously approved these changes Nov 12, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [7e32668]
Page Load Metrics (1814 ± 83 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16222451181516881
domContentLoaded16022373178216177
load16202461181417283
domInteractive16223504321
backgroundConnect985372211
firstReactRender502081063919
getState487202411
initialActions01000
loadScripts1133139912818340
setupStore691142010
uiStartup18092645205619694
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.93 KiB (0.04%)
  • ui: 326 Bytes (0.00%)
  • common: 1.54 KiB (0.02%)

@metamaskbot
Copy link
Collaborator

Builds ready [4554864]
Page Load Metrics (1940 ± 85 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint17452415194217283
domContentLoaded17012301190315876
load17462416194017785
domInteractive23231664220
backgroundConnect9114373015
firstReactRender512931115325
getState45314147
initialActions01000
loadScripts12571700141012158
setupStore670172010
uiStartup19572747217518991
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 1.93 KiB (0.04%)
  • ui: 326 Bytes (0.00%)
  • common: 1.54 KiB (0.02%)

@micaelae micaelae added this pull request to the merge queue Nov 12, 2024
Merged via the queue into develop with commit 0be3a41 Nov 12, 2024
76 checks passed
@micaelae micaelae deleted the mb891-fetch-bridge-quotes branch November 12, 2024 21:06
@github-actions github-actions bot locked and limited conversation to collaborators Nov 12, 2024
@metamaskbot metamaskbot added the release-12.8.0 Issue or pull request that will be included in release 12.8.0 label Nov 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.8.0 Issue or pull request that will be included in release 12.8.0 team-bridge team-swaps
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants