Skip to content

Commit

Permalink
Add bool TX pool flag to allow TX selection to skip finding all TXs f…
Browse files Browse the repository at this point in the history
…or the same sender

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
  • Loading branch information
matthew1001 committed Oct 17, 2023
1 parent 4276a40 commit c474dea
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Changelog

## Next Release
## 24.1.0

### Breaking Changes

### Additions and Improvements

- Add option to avoid grouping transactions from a single sender when selecting candidate transactions for a block [#6022](https://github.com/hyperledger/besu/pull/6022)

### Bug Fixes

### Download Links
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class TransactionPoolOptions implements CLIOptions<TransactionPoolConfigu
private static final String TX_POOL_ENABLE_SAVE_RESTORE = "--tx-pool-enable-save-restore";
private static final String TX_POOL_SAVE_FILE = "--tx-pool-save-file";
private static final String TX_POOL_PRICE_BUMP = "--tx-pool-price-bump";
private static final String TX_POOL_DISABLE_SENDER_GROUPING = "--tx-pool-disable-sender-grouping";
private static final String RPC_TX_FEECAP = "--rpc-tx-feecap";
private static final String STRICT_TX_REPLAY_PROTECTION_ENABLED_FLAG =
"--strict-tx-replay-protection-enabled";
Expand Down Expand Up @@ -88,6 +89,15 @@ public class TransactionPoolOptions implements CLIOptions<TransactionPoolConfigu
arity = "1")
private Percentage priceBump = TransactionPoolConfiguration.DEFAULT_PRICE_BUMP;

@CommandLine.Option(
names = {TX_POOL_DISABLE_SENDER_GROUPING},
paramLabel = "<Boolean>",
description =
"Disable sender grouping of transactions during selection. (default: ${DEFAULT-VALUE})",
arity = "0..1")
private Boolean disableSenderTXGrouping =
TransactionPoolConfiguration.DEFAULT_DISABLE_SENDER_TX_GROUPING;

@CommandLine.Option(
names = {RPC_TX_FEECAP},
description =
Expand Down Expand Up @@ -202,6 +212,7 @@ public static TransactionPoolOptions fromConfig(final TransactionPoolConfigurati
options.saveRestoreEnabled = config.getEnableSaveRestore();
options.disableLocalTxs = config.getDisableLocalTransactions();
options.priceBump = config.getPriceBump();
options.disableSenderTXGrouping = config.getDisableSenderTXGrouping();
options.txFeeCap = config.getTxFeeCap();
options.saveFile = config.getSaveFile();
options.strictTxReplayProtectionEnabled = config.getStrictTransactionReplayProtectionEnabled();
Expand Down Expand Up @@ -244,6 +255,7 @@ public TransactionPoolConfiguration toDomainObject() {
.enableSaveRestore(saveRestoreEnabled)
.disableLocalTransactions(disableLocalTxs)
.priceBump(priceBump)
.disableSenderTXGrouping(disableSenderTXGrouping)
.txFeeCap(txFeeCap)
.saveFile(saveFile)
.strictTransactionReplayProtectionEnabled(strictTxReplayProtectionEnabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ public void priceBump() {
priceBump.toString());
}

@Test
public void disableSenderTXGrouping() {
final Boolean senderTXGrouping = Boolean.FALSE;
internalTestSuccess(
config -> assertThat(config.getNoSenderTXGrouping()).isEqualTo(senderTXGrouping),
"--tx-pool-disable-sender-grouping",
senderTXGrouping.toString());
}

@Test
public void invalidPriceBumpShouldFail() {
internalTestFailure(
Expand Down
1 change: 1 addition & 0 deletions besu/src/test/resources/everything_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ strict-tx-replay-protection-enabled=true
tx-pool-disable-locals=false
tx-pool-enable-save-restore=true
tx-pool-save-file="txpool.dump"
tx-pool-disable-sender-grouping=false
## Layered
tx-pool-layer-max-capacity=12345678
tx-pool-max-prioritized=9876
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum Implementation {
Wei DEFAULT_RPC_TX_FEE_CAP = Wei.fromEth(1);
boolean DEFAULT_DISABLE_LOCAL_TXS = false;
boolean DEFAULT_ENABLE_SAVE_RESTORE = false;
boolean DEFAULT_DISABLE_SENDER_TX_GROUPING = false;

File DEFAULT_SAVE_FILE = new File(DEFAULT_SAVE_FILE_NAME);
long DEFAULT_PENDING_TRANSACTIONS_LAYER_MAX_CAPACITY_BYTES = 12_500_000L;
Expand Down Expand Up @@ -96,6 +97,11 @@ default Percentage getPriceBump() {
return DEFAULT_PRICE_BUMP;
}

@Value.Default
default Boolean getNoSenderTXGrouping() {
return DEFAULT_DISABLE_SENDER_TX_GROUPING;
}

@Value.Default
default Wei getTxFeeCap() {
return DEFAULT_RPC_TX_FEE_CAP;
Expand All @@ -121,6 +127,11 @@ default File getSaveFile() {
return DEFAULT_SAVE_FILE;
}

@Value.Default
default Boolean getDisableSenderTXGrouping() {
return DEFAULT_DISABLE_SENDER_TX_GROUPING;
}

@Value.Default
default Implementation getTxPoolImplementation() {
return DEFAULT_TX_POOL_IMPLEMENTATION;
Expand Down

0 comments on commit c474dea

Please sign in to comment.