Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

web3.eth.getGasPrice sometimes returns 0 for xDai chain #9795

Closed
varasev opened this issue Oct 22, 2018 · 5 comments
Closed

web3.eth.getGasPrice sometimes returns 0 for xDai chain #9795

varasev opened this issue Oct 22, 2018 · 5 comments
Labels
A3-stale 🍃 Pull request did not receive any updates in a long time. No review needed at this stage. Close it. F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. F8-enhancement 🎊 An additional feature request. M6-rpcapi 📣 RPC API. P9-somedaymaybe 🌞 Issue might be worth doing eventually.
Milestone

Comments

@varasev
Copy link
Contributor

varasev commented Oct 22, 2018

  • Parity Ethereum version: 1.11.8-stable, 2.0.8-stable
  • Operating system: MacOS
  • Installation: homebrew
  • Fully synchronized: yes
  • Network: xdai
  • Restarted: yes

web3.eth.getGasPrice (web3 1.0 is used) sometimes returns 0 for xDai chain but sometimes it returns a correct value of 1 gwei.

However, for POA Sokol and POA Core it works fine: status-im/status-mobile#6388 (comment)

Seems something's wrong with eth_gasPrice JSON RPC for xDai chain which uses transactions with zero gas price for its bridge part.

I tried to launch Parity in the following manner:

parity --no-warp --jsonrpc-port 8545 --jsonrpc-apis all --chain ./spec.json --reserved-peers ./bootnodes.txt

spec.json and bootnodes.txt should be taken from here: https://github.com/poanetwork/poa-chain-spec/tree/dai

The code to reproduce:

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));

async function main() {
  setInterval(async function() {
    const res = await web3.eth.getGasPrice();
    console.log(res); // prints `1000000000` or `0`
  }, 5000);
}

main();
@jam10o-new
Copy link
Contributor

@varasev just to make sure no recent fixes address this issue, can you try to replicate with a recent version of parity? (stable or beta?)

@varasev
Copy link
Contributor Author

varasev commented Oct 25, 2018

@joshua-mir The same is observed with 2.0.8-stable.

@jam10o-new jam10o-new added the F2-bug 🐞 The client fails to follow expected behavior. label Oct 25, 2018
@jam10o-new jam10o-new added F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. and removed F2-bug 🐞 The client fails to follow expected behavior. labels Oct 25, 2018
@varasev
Copy link
Contributor Author

varasev commented Oct 25, 2018

I've updated the description ☝️ to reproduce the bug on a local node.

@jam10o-new
Copy link
Contributor

jam10o-new commented Oct 25, 2018

Thanks!

I have a hunch this has something to do with how we calculate the gas price to use based on previous blocks. I just checked out the block explorer for xDai and it looks like most blocks are empty, which might be the issue here.

@tomusdrw are you the right person to ask about this?

@tomusdrw
Copy link
Collaborator

@joshua-mir correct, gas price estimate is based on transactions from last blocks. If there is none we fallback to some default value, but if there are some transactions we will use their gas price.

Perhpas we should add a minimal bound to eth_gasPrice in case min-gas-price in CLI is set, cause afair the issue keeps returning.

@5chdn 5chdn added this to the 2.3 milestone Oct 29, 2018
@5chdn 5chdn modified the milestones: 2.3, 2.4 Jan 10, 2019
@jam10o-new jam10o-new added F8-enhancement 🎊 An additional feature request. P9-somedaymaybe 🌞 Issue might be worth doing eventually. labels Feb 1, 2019
@5chdn 5chdn modified the milestones: 2.4, 2.5 Feb 21, 2019
@soc1c soc1c modified the milestones: 2.5, 2.6 Apr 2, 2019
@ordian ordian modified the milestones: 2.6, 2.7 Jul 12, 2019
@adria0 adria0 added the A3-stale 🍃 Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Jul 27, 2020
@adria0 adria0 closed this as completed Jul 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A3-stale 🍃 Pull request did not receive any updates in a long time. No review needed at this stage. Close it. F3-annoyance 💩 The client behaves within expectations, however this “expected behaviour” itself is at issue. F8-enhancement 🎊 An additional feature request. M6-rpcapi 📣 RPC API. P9-somedaymaybe 🌞 Issue might be worth doing eventually.
Projects
None yet
Development

No branches or pull requests

7 participants