solidity-coverage: Overridden gas price does not work in London fork
Solidity-coverage overrides gasPrice
and sets it to 1 wei. This behaviour was acceptable before London hardfork but now coverage fails with
Transaction gasPrice (1) is too low for the next block, which has a baseFeePerGas of 73433802882
I understand the reasoning behind overriding gas
and blockGasLimit
, but I think gasPrice
should not be overridden anymore.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 20
- Comments: 17 (8 by maintainers)
Commits related to this issue
- Work around sc-forks/solidity-coverage#652 — committed to NomicFoundation/hardhat by feuGeneA 3 years ago
- Work around sc-forks/solidity-coverage#652 — committed to NomicFoundation/hardhat by feuGeneA 3 years ago
- Fix for https://github.com/sc-forks/solidity-coverage/issues/652 — committed to OwlInSpace/smart-contract-template by OwlInSpace 3 years ago
- added temp fix as per https://github.com/sc-forks/solidity-coverage/issues/652 — committed to cryptonative-ch/aqua-smartcontracts by denciu 3 years ago
- added temp fix as per https://github.com/sc-forks/solidity-coverage/issues/652 — committed to cryptonative-ch/aqua-smartcontracts by denciu 3 years ago
- Workaround solidity-coverage London fork issue https://github.com/sc-forks/solidity-coverage/issues/652 — committed to enjinstarter/enjinstarter-tge-contracts by timloh-enjinstarter 3 years ago
- contracts: Upgrade solidity-coverage to 0.7.17 For London hardfork. See this issue: https://github.com/sc-forks/solidity-coverage/issues/652 — committed to liquity/dev by bingen 3 years ago
- Update solidity-coverage to 0.7.17 which fixes https://github.com/sc-forks/solidity-coverage/issues/652 — committed to ethereum-optimism/optimism by elenadimitrova 3 years ago
- Update solidity-coverage to 0.7.17 which fixes https://github.com/sc-forks/solidity-coverage/issues/652 — committed to ethereum-optimism/optimism by elenadimitrova 3 years ago
One possible workaround would be to use set the initial base fee per gas to
0
.There’s a small chance of this not working, but I think it’d work in most of the cases.
Hey @cgewecke! Sorry to tag you, but this seems to be an urgent issue. Any chance you could remove the
this.gasPrice = 0x01
line and ship a fixed version ofsolidity-coverage
?We’d all be very grateful.
This is patched with @alcuadrado’s initialBaseFee fix (comment above) in
0.7.17
. (Thank you!!!)(Closing for the moment … might need to revisit this I guess)
I should have given more info here. This may not work because sendings txs that use more than 50% of the block gas limit would result in the next block having a larger base fee. Most the time, given the math of eip1559, this would still result in the next base fee being
0
or1
. But if this happens for a few blocks in a row, it may result in base fees greater than1
, and the og problem will happen.Actually, I’m going to leave this open for a bit so it’s easy to find because it’s so gnarly.
Another workaround is to set an environment variable as a flag and regress to the
berlin
hardfork in your Hardhat Network configuration when that flag is set. E.g. how I do it in my solidity-template:Of course, this is not great, because running test coverage on different EVMs might produce different results. But it’s good enough as a temporary solution.
@pedroyan Still need to investigate this a bit - have opened it as a separate issue and will track in #707. Thanks for the repro, perfect!
@pedroyan I see OpenZeppelin’s coverage passing in CI (they are on 2.9.1) and aren’t setting the base fee in their config: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/3fb25b604bda2af48bab75b8d9179b8ed3b7b87c/hardhat.config.js#L70
And our tests are passing on 2.9.3 in #706. If you have a way to repro this will reopen though.
@pedroyan To be clear you seeing an error that specifically mentions the gas price and the baseFeePerGas? Something like:
@pedroyan This is now being done automatically as well and the tool works with the London HF without additional config. Is it possible it’s being reset somewhere else in your code?