Skip to content
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

Support free gas networks when using London fee market #4003

Merged
merged 8 commits into from
Jun 30, 2022

Conversation

siladu
Copy link
Contributor

@siladu siladu commented Jun 23, 2022

In order to support free gas private networks in a London/EIP1559 context, I propose that we support setting a zero baseFee.

If baseFeePerGas is overridden as 0 wei, then bypass the need for a transaction to have a gas price of >= 7 wei.

The genesis would look something like this:

{
  "config": {
    ...
    "londonBlock": 0,
    ...
  },
  "baseFeePerGas": "0x0",
  "nonce": "0x0",
  ...
}

One potential downside is that once baseFeePerGas is set to 0, there's no going back for that chain. You can still use --min-gas-price to enforce some gas, but the London base fee calculation will be forever opted out of as a consequence of the zero baseFee in the genesis block. This also means no ether would get burned since base fee will always be zero.

This is currently blocking users with free gas networks from upgrading past the Berlin fork.

Fixed Issue(s)

Fixes #3374
Fixes #3763

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if
    updates are required.

Changelog

If baseFeePerGas is configured to "0x0" in the genesis file, bypass the need for a transaction to have a gas price of > 7 Wei

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@antonydenyer
Copy link
Member

It's a fiddly one! We talked about previously over at #3397

Should we tie the minimum to what is set in the genesis?

@siladu
Copy link
Contributor Author

siladu commented Jun 23, 2022

It's a fiddly one! We talked about previously over at #3397

It is indeed! I saw that PR, was planning on asking for your review for this ;)

Pre-London, configuring a free gas network only involved setting --min-gas-price=0 on the nodes but post-London, with this fix it would involve the user setting baseFeePerGas to zero in the genesis as well, which is a bit annoying but documentable.

The reason I've gone with that for now is because zero baseFee is also required to pass this validation:

if (baseFee.isPresent()) {
final Wei price = feeMarket.getTransactionPriceCalculator().price(transaction, baseFee);
if (!transactionValidationParams.isAllowMaxFeeGasBelowBaseFee()
&& price.compareTo(baseFee.orElseThrow()) < 0) {
return ValidationResult.invalid(
TransactionInvalidReason.INVALID_TRANSACTION_FORMAT,
"gasPrice is less than the current BaseFee");
}

Another option could be to default baseFee to zero and set it explicitly for public networks.

Was trying to get my head around how the fee gets burned and if there would be any implications for this configuration.

@siladu siladu requested a review from garyschulte June 23, 2022 12:25
@siladu siladu changed the title Support zero gas networks using London fee market Support free gas networks using London fee market Jun 23, 2022
Add more tests

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@siladu siladu added the doc-change-required Indicates an issue or PR that requires doc to be updated label Jun 24, 2022
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
@siladu siladu marked this pull request as ready for review June 24, 2022 08:13
@siladu siladu changed the title Support free gas networks using London fee market Support free gas networks when using London fee market Jun 24, 2022
@siladu
Copy link
Contributor Author

siladu commented Jun 29, 2022

Keeping open for @garyschulte to look at.

Copy link
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

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

0 or >=7 seems like a viable way to support both zero gas and "working" base fee networks 👍

eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
)

If baseFeePerGas is configured to "0x0" in the genesis file, bypass the need for a transaction to have a gas price of >= 7 Wei

Ensure baseFeeFloor is either 0 or >= 7 to avoid integer arithmetic issues.

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ibft2 ignores --min-gas-price=0 Getting the most up to date EVM version without EIP1559
6 participants