besu icon indicating copy to clipboard operation
besu copied to clipboard

Free gas networks using the London fee market break after a block which exceeds the gas target is created

Open gorbak25 opened this issue 3 years ago • 2 comments

When deploying a free gas network with the London fee market enabled, the baseGasPerBlock increases by 1 wei when a block which exceeds the gas target gets created. I'm using the following genesis.json file:

{
  "nonce": "0x0",
  "baseFeePerGas": "0x0",
  "gasLimit": "0x47b760",
  "gasUsed": "0x0",
  "number": "0x0",
  ...
  "config": {
    "londonBlock": 0,
    ...
  },
...
}

0 gas works fine until a block which exceeds the gas target appears. Here we're deploying a heavy contract which uses up more than half of the gaslimit: image The Base Fee per Gas is zero in that block. Every block after that one has Base Fee per Gas set to 1 wei, essentially disabling the free gas market :( image As a workaround, we increased the gas limit to the maximum allowable value, but we would prefer to keep the limit low. Here is the offending line in the source code of besu: https://github.com/hyperledger/besu/blob/80ab6489279fde7d61d896e2030bb578362d1fcf/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/feemarket/LondonFeeMarket.java#L112

Might be fixed by https://github.com/hyperledger/besu/issues/4061

gorbak25 avatar Aug 04 '22 12:08 gorbak25

Thanks for the report @gorbak25. You're right, I expect #4061 should fix this scenario.

London + free gas is still experimental right now. Another workaround would be to use "berlinBlock" (the fork before London).

May I ask what your use case is for using london on a private free gas network?

siladu avatar Aug 05 '22 11:08 siladu

@siladu we have contracts relying on EIP-3198(introduced in London) which we want to use on a free gas network. The opcode returns 0 on a free gas network, but we want to avoid modifying all of our contracts which use the BASEFEE opcode.

gorbak25 avatar Aug 12 '22 08:08 gorbak25

Hi @gorbak25, #4061 is merged but due to 'The Merge' won't be in a release until 22.7.3 which is planned for ~21st September.

If you wanted to try out the new zeroBaseFee: true config option before that in a dev/test environment, then you can use the (unstable) main branch of besu by building from source, downloading the snapshot build from https://hyperledger.jfrog.io/ui/native/besu-binaries/besu/22.7.2-SNAPSHOT/ or using one of the develop docker tags, e.g. docker pull hyperledger/besu:develop

siladu avatar Sep 02 '22 01:09 siladu

Hi @gorbak25, the new zeroBaseFee config was indeed released in https://github.com/hyperledger/besu/releases/tag/22.7.3

however I strongly recommend upgrading to https://github.com/hyperledger/besu/releases/tag/22.7.4 or higher since 22.7.3 had a memory leak bug.

Closing this but feel free to reopen if you have any issues using the zeroBaseFee config

siladu avatar Oct 13 '22 03:10 siladu