Skip to content

Handling infura blockage#10883

Merged
ryanml merged 6 commits intodevelopfrom
infura-blocking
Apr 15, 2021
Merged

Handling infura blockage#10883
ryanml merged 6 commits intodevelopfrom
infura-blocking

Conversation

@ryanml
Copy link
Contributor

@ryanml ryanml commented Apr 13, 2021

@metamaskbot
Copy link
Collaborator

Builds ready [dab8bdb]
Page Load Metrics (582 ± 35 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint46695684
domContentLoaded4086545817335
load4096555827335
domInteractive4076545807335

@metamaskbot
Copy link
Collaborator

Builds ready [e71bcb0]
Page Load Metrics (601 ± 33 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint45705684
domContentLoaded3647026006833
load3657036016833
domInteractive3637026006833

@ryanml ryanml changed the title Handling infura blockage [WIP] Handling infura blockage Apr 14, 2021
@ryanml ryanml self-assigned this Apr 14, 2021
@ryanml ryanml marked this pull request as ready for review April 14, 2021 19:12
@ryanml ryanml requested a review from a team as a code owner April 14, 2021 19:12
@metamaskbot
Copy link
Collaborator

Builds ready [9e5d8d1]
Page Load Metrics (569 ± 60 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint44695163
domContentLoaded31785056712560
load31885156912560
domInteractive31684956712560

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 good aside from the redundant state update part! Though I didn't test this locally.

@ryanml ryanml requested a review from Gudahtt April 14, 2021 20:56
@metamaskbot
Copy link
Collaborator

Builds ready [97be263]
Page Load Metrics (534 ± 47 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint44725894
domContentLoaded3656755339847
load3666765349747
domInteractive3656755339847

@ryanml ryanml requested a review from Gudahtt April 14, 2021 23:36

state = {
mounted: false,
canShowBlockageNotification: true,
Copy link
Member

Choose a reason for hiding this comment

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

This might be pretty annoying for users, as it'll be restored every time they navigate back to the home page. e.g. "Home => Settings => Home" will force them to dismiss it again.

But nonetheless, I like this solution for now. It's simple and pragmatic. We can improve the dismissal logic later if we feel the need. Given that there's not a lot users can do in this state, it might not be super important to improve this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My exact thoughts here as well, I think when we approach improving network connectivity UX as a whole, this should definitely be a point for refactoring

@metamaskbot
Copy link
Collaborator

Builds ready [538fea7]
Page Load Metrics (939 ± 79 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaintNaNNaNNaNNaNNaN
domContentLoaded591119293616680
load605119393916579
domInteractive591119293616680

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.

I've discovered a problem: the net_version request never goes to Infura. We intercept it and return the constant we have for the network version.

The two options I can see are checking the block tracker requests for fetch failures, or making a separate fetch request each time the network changes. The former is much nicer idea because it saves network traffic but unfortunately the fetch error details aren't returned by the block tracker at the moment - that would require an update to that library. Which we should absolutely do, but we don't have time for that now. So, direct fetch it is I suppose.

I'd suggest making it a non-blocking fetch as well, so that we don't slow down the network switch process.

I created a mock Infura server to test this with, which is available here: https://github.com/MetaMask/metamask-extension/compare/mock-infura . It also includes a patch to update eth-json-rpc-infura to send request to localhost instead of to Infura. That patch might not be necessary if you're calling fetch directly but it was important for testing anything that relies upon our provider.

@metamaskbot
Copy link
Collaborator

Builds ready [6bcde24]
Page Load Metrics (1019 ± 59 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6812693178
domContentLoaded7691330101612460
load7701331101912459
domInteractive7691330101512460

@ryanml ryanml requested a review from kumavis as a code owner April 15, 2021 16:51
@ryanml ryanml requested a review from Gudahtt April 15, 2021 16:52
@ryanml ryanml requested a review from Gudahtt April 15, 2021 17:00
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 [64d5613]
Page Load Metrics (606 ± 47 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint48785984
domContentLoaded3737336039847
load3757346069947
domInteractive3737336039847

@ryanml ryanml merged commit 2f89088 into develop Apr 15, 2021
@ryanml ryanml deleted the infura-blocking branch April 15, 2021 17:41
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 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.

3 participants