Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Gas prices from EthGasStation #87

Merged
merged 31 commits into from
Mar 22, 2019
Merged

Gas prices from EthGasStation #87

merged 31 commits into from
Mar 22, 2019

Conversation

ethanbennett
Copy link
Contributor

No description provided.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
@codecov-io
Copy link

codecov-io commented Mar 16, 2019

Codecov Report

Merging #87 into dev will decrease coverage by 0.07%.
The diff coverage is 94.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev      #87      +/-   ##
==========================================
- Coverage   93.02%   92.94%   -0.08%     
==========================================
  Files          64       64              
  Lines        1777     1814      +37     
==========================================
+ Hits         1653     1686      +33     
- Misses        124      128       +4
Impacted Files Coverage Δ
src/config/ConfigFactory.js 86.66% <ø> (ø) ⬆️
src/config/DefaultServiceProvider.js 100% <ø> (ø) ⬆️
src/exchanges/oasis/OasisExchangeService.js 100% <ø> (ø) ⬆️
lib/dai-plugin-mcd/src/CdpManager.js 100% <100%> (ø) ⬆️
src/eth/TransactionManager.js 95.28% <100%> (-0.84%) ⬇️
src/eth/EthereumTokenService.js 97.61% <100%> (ø) ⬆️
src/eth/Web3Service.js 87.7% <100%> (ø) ⬆️
src/eth/tokens/EtherToken.js 100% <100%> (ø) ⬆️
src/eth/TransactionObject.js 85.29% <80%> (-1.07%) ⬇️
src/eth/GasService.js 94.91% <94.91%> (ø)
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae93cd1...4b90434. Read the comment docs.

@ethanbennett
Copy link
Contributor Author

@levity @shkfnly These are all good points. The motivation here initially was just to move the eth gas station fetch from the config in the governance dashboard (or any other app) into the newly expanded gas estimator service. If transactions send a static gas price, that creates a possible situation where someone would have a stuck transaction and retry with the same gas price (i.e. the new transactions would continue to get stuck). Since we've been talking about implementing this tx-retry functionality for a while, it seemed like a good time to take a shot at it.

But we could actually address the initial concern by throwing an error, like you suggested, but also resetting the default gas price to fastest before throwing (and maybe re-querying eth gas station?). I could then extract this tx-retry functionality into a plugin that can be used to watch and resend transactions, which would have a few advantages:

  • Handling this from outside the transaction object would allow us to use the transaction manager as expected on the second attempt, which would clean up some of the contract weirdness here
  • It would also allow for the process to be more modular (so users could handle the original transaction promises, trigger notifications before retrying, make the wait time configurable, etc.)
  • I could wrap up this subtask shortly and just hack on the plugin when I have extra time

@ethanbennett ethanbennett changed the title [WIP] Gas prices from EthGasStation Gas prices from EthGasStation Mar 21, 2019
src/eth/GasEstimatorService.js Outdated Show resolved Hide resolved
src/eth/GasEstimatorService.js Outdated Show resolved Hide resolved
tx = await this._web3Service.getTransaction(this.hash);
if ((tx || {}).blockHash) break;
log('not mined yet');
await promiseWait(5000);
}

if (tx && !tx.blockHash) {
this._gasEstimator.transactionSpeed = 'fastest';
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm on the fence about this -- on the one hand, this is probably the right thing to do in most cases, and on the other hand, this will change the behavior for all other transactions sent from the same maker instance without telling the user. (unless they have disabled gas price in which case it does nothing)

probably better just to drop it, but to make it clear in the documentation how the user would change gas estimator settings for a live instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@levity what do you think about disabling the gasPrice instead? Granted, that's still a change for all other transactions. But I think with MetaMask, this would cause all other transactions to prompt the user to select a gas price, which is probably the ideal behavior here. But if they're not using MetaMask, it could still be weird...so I could see arguments for either side.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still in favor of doing nothing and documenting options for the user. Leaning on the principle of least surprise here.

Copy link
Contributor

@levity levity left a comment

Choose a reason for hiding this comment

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

Looks pretty good now -- I would still drop that one change

@ethanbennett ethanbennett merged commit 987d790 into dev Mar 22, 2019
@ethanbennett ethanbennett deleted the gas-price branch April 9, 2019 03:05
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.

None yet

4 participants