-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
[WIP] Extend GasFeeController to poll for network status #609
Commits on Oct 25, 2021
-
Refactor and backfill GasFeeController tests
The tests for GasFeeController are currently lacking in a few ways: * `nock` is being used to test that requests are being used to obtain data; however, GasFeeController takes functions as arguments which can be used to stub out those requests, thereby removing the need for `nock`. * The logic within `getGasFeeEstimatesAndStartPolling` is not being fully exercised, specifically the polling code. * There are no tests for `disconnectPoller`. * There are no explicit tests for `stopPolling`. * The logic within `_fetchGasFeeEstimateData` is not being fully exercised, specifically with regard to how the result of `getChainId` changes the URL that ends up being hit for both EIP-1559 and non-EIP-1559 flows. * There are tests categorized under a `getChainId` describe block which are actually for `_fetchGasFeeEstimateData`. This commit attempts to address these issues so that future changes to GasFeeController do not break existing behavior.
Configuration menu - View commit details
-
Copy full SHA for f174f93 - Browse repository at this point
Copy the full SHA f174f93View commit details
Commits on Oct 28, 2021
-
Extract determineGasFeeSuggestions
We would like to introduce another fallback to how we estimate gas fees in a future commit — namely, we want to use `eth_feeHistory` for EIP-1559 networks if the usual API is down. To do this, the existing code around gas fee estimates needs to be refactored. This is the first in a two-part refactor, extracting the majority of the code in `GasFeeController._fetchGasFeeEstimateData` to `gas-util`. In addition to making room for more changes, this also allows us to test this code in isolation from the polling code that already exists in GasFeeController. Note that I am using the term "suggestions" to encompass the data that `_fetchGasFeeEstimateData` returns. This is because `gasFeeEstimates` is an intermediate value that can also be packaged with `estimatedGasFeeTimeBounds`, so "estimates" could be confusing. Also, I replaced "fetch" with "determine" as in the future we may be performing calculations that APIs have done for us in the past ("fetch" seems like a more low-level action).
Configuration menu - View commit details
-
Copy full SHA for ecac47e - Browse repository at this point
Copy the full SHA ecac47eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4fa9bc4 - Browse repository at this point
Copy the full SHA 4fa9bc4View commit details
Commits on Oct 29, 2021
-
Configuration menu - View commit details
-
Copy full SHA for ae5b0dd - Browse repository at this point
Copy the full SHA ae5b0ddView commit details
Commits on Nov 1, 2021
-
Refactor and backfill GasFeeController tests
The tests for GasFeeController are currently lacking in a few ways: * `nock` is being used to test that requests are being used to obtain data; however, GasFeeController takes functions as arguments which can be used to stub out those requests, thereby removing the need for `nock`. * The logic within `getGasFeeEstimatesAndStartPolling` is not being fully exercised, specifically the polling code. * There are no tests for `disconnectPoller`. * There are no explicit tests for `stopPolling`. * The logic within `_fetchGasFeeEstimateData` is not being fully exercised, specifically with regard to how the result of `getChainId` changes the URL that ends up being hit for both EIP-1559 and non-EIP-1559 flows. * There are tests categorized under a `getChainId` describe block which are actually for `_fetchGasFeeEstimateData`. This commit attempts to address these issues so that future changes to GasFeeController do not break existing behavior.
Configuration menu - View commit details
-
Copy full SHA for d87b8c4 - Browse repository at this point
Copy the full SHA d87b8c4View commit details -
Merge branch 'refactor-gas-fee-controller-tests' into extract-gas-fee…
…-recommendations
Configuration menu - View commit details
-
Copy full SHA for f103867 - Browse repository at this point
Copy the full SHA f103867View commit details -
Refactor and backfill GasFeeController tests
The tests for GasFeeController are currently lacking in a few ways: * `nock` is being used to test that requests are being used to obtain data; however, GasFeeController takes functions as arguments which can be used to stub out those requests, thereby removing the need for `nock`. * The logic within `getGasFeeEstimatesAndStartPolling` is not being fully exercised, specifically the polling code. * There are no tests for `disconnectPoller`. * There are no explicit tests for `stopPolling`. * The logic within `_fetchGasFeeEstimateData` is not being fully exercised, specifically with regard to how the result of `getChainId` changes the URL that ends up being hit for both EIP-1559 and non-EIP-1559 flows. * There are tests categorized under a `getChainId` describe block which are actually for `_fetchGasFeeEstimateData`. This commit attempts to address these issues so that future changes to GasFeeController do not break existing behavior.
Configuration menu - View commit details
-
Copy full SHA for 7e20e7b - Browse repository at this point
Copy the full SHA 7e20e7bView commit details -
Merge branch 'refactor-gas-fee-controller-tests' into extract-gas-fee…
…-recommendations
Configuration menu - View commit details
-
Copy full SHA for b16cb47 - Browse repository at this point
Copy the full SHA b16cb47View commit details -
Use eth_feeHistory as a fallback for gas estimates
If we are on an EIP-1559-supported network and the Metaswap API fails for some reason, fall back to using `eth_feeHistory` to calculate gas estimates (which the API uses anyway). This code is more or less taken from the code for the API ([1]). [1]: https://gitlab.com/ConsenSys/codefi/products/metaswap/gas-api/-/blob/eae6927b1a0c445e02cb3cba9e9e6b0f35857a12/src/eip1559/feeHistory.ts
Configuration menu - View commit details
-
Copy full SHA for b4f23df - Browse repository at this point
Copy the full SHA b4f23dfView commit details -
Extend GasFeeController to poll for network status
When a user is about to send a transaction or is looking at a swap quote, we would like to inform them if the network is busy so that we can push them to use a lower fee setting. GasFeeController already provides a way to poll for fee estimates, which we employ on transaction preview screens. This commit updates the polling code so that we also gauge network status as we pull estimates. This is done by hitting another endpoint in the MetaSwap API which specifically gives us a base fee threshold we can use to determine whether the network is busy (falling back to using `eth_feeHistory` if the API is not available).
Configuration menu - View commit details
-
Copy full SHA for 888b63d - Browse repository at this point
Copy the full SHA 888b63dView commit details