-
Notifications
You must be signed in to change notification settings - Fork 1k
Force tx replacement price bump to zero when zero base fee market is configured #6079
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
Changes from all commits
a12ad97
c7ca182
09e46dc
8b73053
4acffd7
caf560e
ca3c337
c481949
4404e8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,18 +12,19 @@ | |
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package org.hyperledger.besu.cli.options.stable; | ||
| package org.hyperledger.besu.cli.options; | ||
|
|
||
| import static org.hyperledger.besu.cli.DefaultCommandValues.MANDATORY_DOUBLE_FORMAT_HELP; | ||
| import static org.hyperledger.besu.cli.DefaultCommandValues.MANDATORY_INTEGER_FORMAT_HELP; | ||
| import static org.hyperledger.besu.cli.DefaultCommandValues.MANDATORY_LONG_FORMAT_HELP; | ||
| import static org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration.Implementation.LAYERED; | ||
| import static org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration.Implementation.LEGACY; | ||
|
|
||
| import org.hyperledger.besu.cli.converter.DurationMillisConverter; | ||
| import org.hyperledger.besu.cli.converter.FractionConverter; | ||
| import org.hyperledger.besu.cli.converter.PercentageConverter; | ||
| import org.hyperledger.besu.cli.options.CLIOptions; | ||
| import org.hyperledger.besu.cli.util.CommandLineUtils; | ||
| import org.hyperledger.besu.config.GenesisConfigOptions; | ||
| import org.hyperledger.besu.datatypes.Address; | ||
| import org.hyperledger.besu.datatypes.Wei; | ||
| import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration; | ||
|
|
@@ -32,6 +33,7 @@ | |
| import org.hyperledger.besu.util.number.Percentage; | ||
|
|
||
| import java.io.File; | ||
| import java.time.Duration; | ||
| import java.util.List; | ||
| import java.util.Set; | ||
|
|
||
|
|
@@ -195,6 +197,39 @@ static class Legacy { | |
| Integer txPoolMaxSize = TransactionPoolConfiguration.DEFAULT_MAX_PENDING_TRANSACTIONS; | ||
| } | ||
|
|
||
| @CommandLine.ArgGroup(validate = false) | ||
| private final TransactionPoolOptions.Unstable unstableOptions = | ||
| new TransactionPoolOptions.Unstable(); | ||
|
|
||
| static class Unstable { | ||
| private static final String TX_MESSAGE_KEEP_ALIVE_SEC_FLAG = | ||
| "--Xincoming-tx-messages-keep-alive-seconds"; | ||
|
|
||
| private static final String ETH65_TX_ANNOUNCED_BUFFERING_PERIOD_FLAG = | ||
| "--Xeth65-tx-announced-buffering-period-milliseconds"; | ||
|
Comment on lines
+205
to
+209
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again this seems to be unrelated to this PR?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I put this here since, I am in the process of refactoring how we manage the option, and so when I took some, I also take the opportunity to iterate on it, in this case it was the merging of (un)stable options in a single place. |
||
|
|
||
| @CommandLine.Option( | ||
| names = {TX_MESSAGE_KEEP_ALIVE_SEC_FLAG}, | ||
| paramLabel = "<INTEGER>", | ||
| hidden = true, | ||
| description = | ||
| "Keep alive of incoming transaction messages in seconds (default: ${DEFAULT-VALUE})", | ||
| arity = "1") | ||
| private Integer txMessageKeepAliveSeconds = | ||
| TransactionPoolConfiguration.Unstable.DEFAULT_TX_MSG_KEEP_ALIVE; | ||
|
|
||
| @CommandLine.Option( | ||
| names = {ETH65_TX_ANNOUNCED_BUFFERING_PERIOD_FLAG}, | ||
| paramLabel = "<LONG>", | ||
| converter = DurationMillisConverter.class, | ||
| hidden = true, | ||
| description = | ||
| "The period for which the announced transactions remain in the buffer before being requested from the peers in milliseconds (default: ${DEFAULT-VALUE})", | ||
| arity = "1") | ||
| private Duration eth65TrxAnnouncedBufferingPeriod = | ||
| TransactionPoolConfiguration.Unstable.ETH65_TRX_ANNOUNCED_BUFFERING_PERIOD; | ||
| } | ||
|
|
||
| private TransactionPoolOptions() {} | ||
|
|
||
| /** | ||
|
|
@@ -230,6 +265,10 @@ public static TransactionPoolOptions fromConfig(final TransactionPoolConfigurati | |
| config.getTxPoolLimitByAccountPercentage(); | ||
| options.legacyOptions.txPoolMaxSize = config.getTxPoolMaxSize(); | ||
| options.legacyOptions.pendingTxRetentionPeriod = config.getPendingTxRetentionPeriod(); | ||
| options.unstableOptions.txMessageKeepAliveSeconds = | ||
| config.getUnstable().getTxMessageKeepAliveSeconds(); | ||
| options.unstableOptions.eth65TrxAnnouncedBufferingPeriod = | ||
| config.getUnstable().getEth65TrxAnnouncedBufferingPeriod(); | ||
|
|
||
| return options; | ||
| } | ||
|
|
@@ -239,8 +278,10 @@ public static TransactionPoolOptions fromConfig(final TransactionPoolConfigurati | |
| * options are valid for the selected implementation. | ||
| * | ||
| * @param commandLine the full commandLine to check all the options specified by the user | ||
| * @param genesisConfigOptions the genesis config options | ||
| */ | ||
| public void validate(final CommandLine commandLine) { | ||
| public void validate( | ||
| final CommandLine commandLine, final GenesisConfigOptions genesisConfigOptions) { | ||
| CommandLineUtils.failIfOptionDoesntMeetRequirement( | ||
| commandLine, | ||
| "Could not use legacy transaction pool options with layered implementation", | ||
|
|
@@ -252,6 +293,12 @@ public void validate(final CommandLine commandLine) { | |
| "Could not use layered transaction pool options with legacy implementation", | ||
| !txPoolImplementation.equals(LEGACY), | ||
| CommandLineUtils.getCLIOptionNames(Layered.class)); | ||
|
|
||
| CommandLineUtils.failIfOptionDoesntMeetRequirement( | ||
| commandLine, | ||
| "Price bump option is not compatible with zero base fee market", | ||
| !genesisConfigOptions.isZeroBaseFee(), | ||
| List.of(TX_POOL_PRICE_BUMP)); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -271,11 +318,26 @@ public TransactionPoolConfiguration toDomainObject() { | |
| .txPoolLimitByAccountPercentage(legacyOptions.txPoolLimitByAccountPercentage) | ||
| .txPoolMaxSize(legacyOptions.txPoolMaxSize) | ||
| .pendingTxRetentionPeriod(legacyOptions.pendingTxRetentionPeriod) | ||
| .unstable( | ||
| ImmutableTransactionPoolConfiguration.Unstable.builder() | ||
| .txMessageKeepAliveSeconds(unstableOptions.txMessageKeepAliveSeconds) | ||
| .eth65TrxAnnouncedBufferingPeriod(unstableOptions.eth65TrxAnnouncedBufferingPeriod) | ||
| .build()) | ||
| .build(); | ||
| } | ||
|
|
||
| @Override | ||
| public List<String> getCLIOptions() { | ||
| return CommandLineUtils.getCLIOptions(this, new TransactionPoolOptions()); | ||
| } | ||
|
|
||
| /** | ||
| * Is price bump option set? | ||
| * | ||
| * @param commandLine the command line | ||
| * @return true is tx-pool-price-bump is set | ||
| */ | ||
| public boolean isPriceBumpSet(final CommandLine commandLine) { | ||
| return CommandLineUtils.isOptionSet(commandLine, TransactionPoolOptions.TX_POOL_PRICE_BUMP); | ||
| } | ||
| } | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that you need to be on the
londonfork in order to get the new behaviour? Could it be made to work in the same way for--min-gas-price=0for users pre-london?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that, but setting
--min-gas-price=0does not necessarily imply that it is a zero-gas-price network (actually also in zeroBaseFee network, the maxGasPrice could be > 0).So what if we introduce a specific option, that acts like a profile, that state clearly that we want a gas free network, for example
--gas-free? that has the effect of setting sound values for other options like themin-gas-priceand thetx-pool-price-bump, instead of trying to deduce the intent of the network from single options.what do you think of this approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle I agree @fab-10. However, I do have a couple of concerns about introducing it under this PR:
--min-gas-price=0and/orzeroBaseFee: trueto create what they think of as agas freenetwork. I agree it's not strictly gas free - but it probably means that defaulting--tx-pool-price-bumpto0if you're using one/both of those settings is what most people would expect. They can after all set--tx-pool-price-bump= (num > 0)if they don't want it--gas-freeoption people would have additional expectations if they set it - not just a default price bump of0. For example, would allocating initial funds to accounts be valid if--gas-freewas set? Would setting a transaction with agasPrice>0be allowed?So I agree that
--gas-freewould be a really useful option. But I think it's probably worth separate discussion & PR to introduce it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I see your point about
min-gas-priceand will implement your suggestion.And let's continue the discussion about a
gas-freeprofile, and all the feature that it should enable separately.