Make transaction pool limits for sender based on pool size (#4417)

* make transaction pool limits for sender based on pool size.  default by sender is 5
move config into TransactionPoolOptions class

Signed-off-by: garyschulte <garyschulte@gmail.com>
pull/4430/head
garyschulte 2 years ago committed by GitHub
parent 8718fa61e0
commit 42086bf4a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 18
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  3. 40
      besu/src/main/java/org/hyperledger/besu/cli/options/unstable/TransactionPoolOptions.java
  4. 2
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  5. 45
      besu/src/test/java/org/hyperledger/besu/cli/options/TransactionPoolOptionsTest.java
  6. 2
      besu/src/test/resources/everything_config.toml
  7. 5
      ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/BlockTransactionSelectorTest.java
  8. 9
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolConfiguration.java
  9. 32
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/BaseFeePendingTransactionsTest.java
  10. 23
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/GasPricePendingTransactionsTest.java
  11. 4
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/PendingMultiTypesTransactionsTest.java
  12. 5
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolTest.java

@ -10,6 +10,7 @@
- Upgrade besu-native to 0.6.1 and include linux arm64 build of bls12-381 [#4416](https://github.com/hyperledger/besu/pull/4416)
- Create a new flag on RocksDB (_--Xplugin-rocksdb-high-spec-enabled_) for high spec hardware to boost performance
- Transaction pool improvements to avoid filling the pool with not executable transactions, that could result in empty or semi-empty block proposals [#4425](https://github.com/hyperledger/besu/pull/4425)
- Limit Transaction pool consumption by sender to a configurable percentage of the pool size [#4417](https://github.com/hyperledger/besu/pull/4417)
### Bug Fixes
- Retry block creation if there is a transient error and we still have time, to mitigate empty block issue [#4407](https://github.com/hyperledger/besu/pull/4407)

@ -1218,16 +1218,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
"Price bump percentage to replace an already existing transaction (default: ${DEFAULT-VALUE})",
arity = "1")
private final Integer priceBump = TransactionPoolConfiguration.DEFAULT_PRICE_BUMP.getValue();
@Option(
names = {"--tx-pool-future-max-by-account"},
paramLabel = MANDATORY_INTEGER_FORMAT_HELP,
converter = PercentageConverter.class,
description =
"Maximum per account of currently unexecutable future transactions that can occupy the txpool (default: ${DEFAULT-VALUE})",
arity = "1")
private final Integer maxFutureTransactionsByAccount =
TransactionPoolConfiguration.MAX_FUTURE_TRANSACTION_BY_ACCOUNT;
}
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) // PicoCLI requires non-final Strings.
@ -1969,6 +1959,13 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
if (txPoolOptionGroup.pooledTransactionHashesSize != null) {
logger.warn(DEPRECATED_AND_USELESS_WARNING_MSG, "--tx-pool-hashes-max-size");
}
if (txPoolOptionGroup.pooledTransactionHashesSize != null) {
logger.warn(
DEPRECATION_WARNING_MSG,
"--tx-pool-future-max-by-account",
"--tx-pool-limit-by-account-percentage");
}
}
private void configure() throws Exception {
@ -2820,7 +2817,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
.txPoolMaxSize(txPoolOptionGroup.txPoolMaxSize)
.pendingTxRetentionPeriod(txPoolOptionGroup.pendingTxRetentionPeriod)
.priceBump(Percentage.fromInt(txPoolOptionGroup.priceBump))
.txPoolMaxFutureTransactionByAccount(txPoolOptionGroup.maxFutureTransactionsByAccount)
.txFeeCap(txFeeCap)
.build();
}

@ -14,6 +14,10 @@
*/
package org.hyperledger.besu.cli.options.unstable;
import static org.hyperledger.besu.cli.util.CommandLineUtils.DEPRECATION_WARNING_MSG;
import org.hyperledger.besu.Besu;
import org.hyperledger.besu.cli.converter.FractionConverter;
import org.hyperledger.besu.cli.options.CLIOptions;
import org.hyperledger.besu.cli.options.OptionParser;
import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration;
@ -23,10 +27,14 @@ import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine;
public class TransactionPoolOptions
implements CLIOptions<ImmutableTransactionPoolConfiguration.Builder> {
private static final Logger LOG = LoggerFactory.getLogger(Besu.class);
private static final String TX_MESSAGE_KEEP_ALIVE_SEC_FLAG =
"--Xincoming-tx-messages-keep-alive-seconds";
@ -36,6 +44,9 @@ public class TransactionPoolOptions
private static final String STRICT_TX_REPLAY_PROTECTION_ENABLED_FLAG =
"--strict-tx-replay-protection-enabled";
private static final String TX_POOL_LIMIT_BY_ACCOUNT_PERCENTAGE =
"--tx-pool-limit-by-account-percentage";
@CommandLine.Option(
names = {STRICT_TX_REPLAY_PROTECTION_ENABLED_FLAG},
paramLabel = "<Boolean>",
@ -65,6 +76,23 @@ public class TransactionPoolOptions
private long eth65TrxAnnouncedBufferingPeriod =
TransactionPoolConfiguration.ETH65_TRX_ANNOUNCED_BUFFERING_PERIOD.toMillis();
@CommandLine.Option(
names = {TX_POOL_LIMIT_BY_ACCOUNT_PERCENTAGE},
paramLabel = "<DOUBLE>",
converter = FractionConverter.class,
description =
"Maximum portion of the transaction pool which a single account may occupy with future transactions (default: ${DEFAULT-VALUE})",
arity = "1")
private Float txPoolLimitByAccountPercentage =
TransactionPoolConfiguration.LIMIT_TXPOOL_BY_ACCOUNT_PERCENTAGE;
@CommandLine.Option(
hidden = true,
names = {"--tx-pool-future-max-by-account"},
description = "Deprecated parameter, see instead: --tx-pool-limit-by-account-percentage")
@SuppressWarnings({"FieldCanBeFinal", "UnusedVariable"})
private Integer maxFutureTransactionsByAccount = -1;
private TransactionPoolOptions() {}
public static TransactionPoolOptions create() {
@ -77,21 +105,31 @@ public class TransactionPoolOptions
options.eth65TrxAnnouncedBufferingPeriod =
config.getEth65TrxAnnouncedBufferingPeriod().toMillis();
options.strictTxReplayProtectionEnabled = config.getStrictTransactionReplayProtectionEnabled();
options.txPoolLimitByAccountPercentage = config.getTxPoolLimitByAccountPercentage();
return options;
}
@Override
public ImmutableTransactionPoolConfiguration.Builder toDomainObject() {
if (maxFutureTransactionsByAccount != null) {
LOG.warn(
DEPRECATION_WARNING_MSG,
"--tx-pool-future-max-by-account",
"--tx-pool-limit-by-account-percentage");
}
return ImmutableTransactionPoolConfiguration.builder()
.strictTransactionReplayProtectionEnabled(strictTxReplayProtectionEnabled)
.txMessageKeepAliveSeconds(txMessageKeepAliveSeconds)
.eth65TrxAnnouncedBufferingPeriod(Duration.ofMillis(eth65TrxAnnouncedBufferingPeriod));
.eth65TrxAnnouncedBufferingPeriod(Duration.ofMillis(eth65TrxAnnouncedBufferingPeriod))
.txPoolLimitByAccountPercentage(txPoolLimitByAccountPercentage);
}
@Override
public List<String> getCLIOptions() {
return Arrays.asList(
STRICT_TX_REPLAY_PROTECTION_ENABLED_FLAG + "=" + strictTxReplayProtectionEnabled,
TX_POOL_LIMIT_BY_ACCOUNT_PERCENTAGE,
OptionParser.format(txPoolLimitByAccountPercentage),
TX_MESSAGE_KEEP_ALIVE_SEC_FLAG,
OptionParser.format(txMessageKeepAliveSeconds),
ETH65_TX_ANNOUNCED_BUFFERING_PERIOD_FLAG,

@ -824,6 +824,8 @@ public class BesuCommandTest extends CommandTestAbstract {
tomlResult.getArray(tomlKey);
} else if (optionSpec.type().equals(Double.class)) {
tomlResult.getDouble(tomlKey);
} else if (optionSpec.type().equals(Float.class)) {
tomlResult.getDouble(tomlKey);
} else if (Number.class.isAssignableFrom(optionSpec.type())) {
tomlResult.getLong(tomlKey);
} else if (Wei.class.isAssignableFrom(optionSpec.type())) {

@ -16,6 +16,7 @@ package org.hyperledger.besu.cli.options;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration.LIMIT_TXPOOL_BY_ACCOUNT_PERCENTAGE;
import org.hyperledger.besu.cli.options.unstable.TransactionPoolOptions;
import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration;
@ -68,6 +69,44 @@ public class TransactionPoolOptionsTest
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void senderLimitedTxPool_derived() {
final TestBesuCommand cmd = parseCommand("--tx-pool-limit-by-account-percentage=0.002");
final TransactionPoolOptions options = getOptionsFromBesuCommand(cmd);
final TransactionPoolConfiguration config = options.toDomainObject().build();
assertThat(config.getTxPoolMaxFutureTransactionByAccount()).isEqualTo(9);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void senderLimitedTxPoolFloor_derived() {
final TestBesuCommand cmd = parseCommand("--tx-pool-limit-by-account-percentage=0.0001");
final TransactionPoolOptions options = getOptionsFromBesuCommand(cmd);
final TransactionPoolConfiguration config = options.toDomainObject().build();
assertThat(config.getTxPoolMaxFutureTransactionByAccount()).isEqualTo(1);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void senderLimitedTxPoolCeiling_violated() {
final TestBesuCommand cmd = parseCommand("--tx-pool-limit-by-account-percentage=1.00002341");
final TransactionPoolOptions options = getOptionsFromBesuCommand(cmd);
final TransactionPoolConfiguration config = options.toDomainObject().build();
assertThat(config.getTxPoolLimitByAccountPercentage())
.isEqualTo(LIMIT_TXPOOL_BY_ACCOUNT_PERCENTAGE);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8))
.contains("Invalid value for option '--tx-pool-limit-by-account-percentage'");
}
@Test
public void strictTxReplayProtection_default() {
final TestBesuCommand cmd = parseCommand();
@ -120,7 +159,8 @@ public class TransactionPoolOptionsTest
return ImmutableTransactionPoolConfiguration.builder()
.strictTransactionReplayProtectionEnabled(false)
.txMessageKeepAliveSeconds(defaultValue.getTxMessageKeepAliveSeconds())
.eth65TrxAnnouncedBufferingPeriod(defaultValue.getEth65TrxAnnouncedBufferingPeriod());
.eth65TrxAnnouncedBufferingPeriod(defaultValue.getEth65TrxAnnouncedBufferingPeriod())
.txPoolLimitByAccountPercentage(defaultValue.getTxPoolLimitByAccountPercentage());
}
@Override
@ -130,7 +170,8 @@ public class TransactionPoolOptionsTest
.txMessageKeepAliveSeconds(TransactionPoolConfiguration.DEFAULT_TX_MSG_KEEP_ALIVE + 1)
.eth65TrxAnnouncedBufferingPeriod(
TransactionPoolConfiguration.ETH65_TRX_ANNOUNCED_BUFFERING_PERIOD.plus(
Duration.ofMillis(100)));
Duration.ofMillis(100)))
.txPoolLimitByAccountPercentage(0.5f);
}
@Override

@ -167,7 +167,7 @@ tx-pool-retention-hours=999
tx-pool-price-bump=13
tx-pool-max-size=1234
tx-pool-hashes-max-size=10000
tx-pool-future-max-by-account=50
tx-pool-limit-by-account-percentage=0.017
Xincoming-tx-messages-keep-alive-seconds=60
rpc-tx-feecap=2000000000000000000
strict-tx-replay-protection-enabled=true

@ -91,7 +91,10 @@ public class BlockTransactionSelectorTest {
worldState = InMemoryKeyValueStorageProvider.createInMemoryWorldState();
pendingTransactions =
new GasPricePendingTransactionsSorter(
ImmutableTransactionPoolConfiguration.builder().txPoolMaxSize(5).build(),
ImmutableTransactionPoolConfiguration.builder()
.txPoolMaxSize(5)
.txPoolLimitByAccountPercentage(1)
.build(),
TestClock.system(ZoneId.systemDefault()),
metricsSystem,
BlockTransactionSelectorTest::mockBlockHeader);

@ -26,7 +26,7 @@ import org.immutables.value.Value;
public interface TransactionPoolConfiguration {
int DEFAULT_TX_MSG_KEEP_ALIVE = 60;
int MAX_PENDING_TRANSACTIONS = 4096;
int MAX_FUTURE_TRANSACTION_BY_ACCOUNT = 64;
float LIMIT_TXPOOL_BY_ACCOUNT_PERCENTAGE = 0.001f; // 0.1%
int DEFAULT_TX_RETENTION_HOURS = 13;
boolean DEFAULT_STRICT_TX_REPLAY_PROTECTION_ENABLED = false;
Percentage DEFAULT_PRICE_BUMP = Percentage.fromInt(10);
@ -41,8 +41,13 @@ public interface TransactionPoolConfiguration {
}
@Value.Default
default float getTxPoolLimitByAccountPercentage() {
return LIMIT_TXPOOL_BY_ACCOUNT_PERCENTAGE;
}
@Value.Derived
default int getTxPoolMaxFutureTransactionByAccount() {
return MAX_FUTURE_TRANSACTION_BY_ACCOUNT;
return (int) Math.ceil(getTxPoolLimitByAccountPercentage() * getTxPoolMaxSize());
}
@Value.Default

@ -59,7 +59,7 @@ import org.junit.Test;
public class BaseFeePendingTransactionsTest {
private static final int MAX_TRANSACTIONS = 5;
private static final int MAX_TRANSACTIONS_BY_SENDER = 4;
private static final float MAX_TRANSACTIONS_BY_SENDER_PERCENTAGE = 0.8f;
private static final Supplier<SignatureAlgorithm> SIGNATURE_ALGORITHM =
Suppliers.memoize(SignatureAlgorithmFactory::getInstance);
private static final KeyPair KEYS1 = SIGNATURE_ALGORITHM.get().generateKeyPair();
@ -74,16 +74,21 @@ public class BaseFeePendingTransactionsTest {
private final StubMetricsSystem metricsSystem = new StubMetricsSystem();
private final BaseFeePendingTransactionsSorter transactions =
new BaseFeePendingTransactionsSorter(
ImmutableTransactionPoolConfiguration.builder().txPoolMaxSize(MAX_TRANSACTIONS).build(),
ImmutableTransactionPoolConfiguration.builder()
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(1)
.build(),
TestClock.system(ZoneId.systemDefault()),
metricsSystem,
BaseFeePendingTransactionsTest::mockBlockHeader);
private final TransactionPoolConfiguration senderLimitedConfig =
ImmutableTransactionPoolConfiguration.builder()
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(MAX_TRANSACTIONS_BY_SENDER_PERCENTAGE)
.build();
private final BaseFeePendingTransactionsSorter senderLimitedTransactions =
new BaseFeePendingTransactionsSorter(
ImmutableTransactionPoolConfiguration.builder()
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolMaxFutureTransactionByAccount(MAX_TRANSACTIONS_BY_SENDER)
.build(),
senderLimitedConfig,
TestClock.system(ZoneId.systemDefault()),
metricsSystem,
BaseFeePendingTransactionsTest::mockBlockHeader);
@ -168,7 +173,9 @@ public class BaseFeePendingTransactionsTest {
furthestFutureTransaction = transactionWithNonceSenderAndGasPrice(i, KEYS1, 10L);
senderLimitedTransactions.addRemoteTransaction(furthestFutureTransaction, Optional.empty());
}
assertThat(senderLimitedTransactions.size()).isEqualTo(MAX_TRANSACTIONS_BY_SENDER);
assertThat(senderLimitedTransactions.size())
.isEqualTo(senderLimitedConfig.getTxPoolMaxFutureTransactionByAccount());
assertThat(senderLimitedConfig.getTxPoolMaxFutureTransactionByAccount()).isEqualTo(4);
assertThat(senderLimitedTransactions.getTransactionByHash(furthestFutureTransaction.getHash()))
.isEmpty();
}
@ -226,7 +233,7 @@ public class BaseFeePendingTransactionsTest {
// This should kick the tx with the highest nonce for the sender of the oldest tx, that is
// the penultimate tx
final Transaction highGasPriceTransaction =
transactionWithNonceSenderAndGasPrice(MAX_TRANSACTIONS + 1, KEYS1, 100);
transactionWithNonceSenderAndGasPrice(1, KEYS1, 100);
transactions.addRemoteTransaction(highGasPriceTransaction, Optional.empty());
assertThat(transactions.size()).isEqualTo(MAX_TRANSACTIONS);
assertTransactionNotPending(penultimateTx);
@ -540,8 +547,8 @@ public class BaseFeePendingTransactionsTest {
transactions.addRemoteTransaction(transactionWithNonceAndSender(2, KEYS1), Optional.empty());
assertMaximumNonceForSender(SENDER1, 3);
transactions.addRemoteTransaction(transactionWithNonceAndSender(20, KEYS2), Optional.empty());
assertMaximumNonceForSender(SENDER2, 21);
transactions.addRemoteTransaction(transactionWithNonceAndSender(4, KEYS2), Optional.empty());
assertMaximumNonceForSender(SENDER2, 5);
assertMaximumNonceForSender(SENDER1, 3);
}
@ -588,7 +595,7 @@ public class BaseFeePendingTransactionsTest {
final Transaction transaction1 = transactionWithNonceAndSender(0, KEYS1);
final Transaction transaction2 = transactionWithNonceAndSender(1, KEYS1);
final Transaction transaction3 = transactionWithNonceAndSender(2, KEYS1);
final Transaction transaction4 = transactionWithNonceAndSender(5, KEYS2);
final Transaction transaction4 = transactionWithNonceAndSender(4, KEYS2);
transactions.addLocalTransaction(transaction1, Optional.empty());
transactions.addLocalTransaction(transaction4, Optional.empty());
@ -646,6 +653,7 @@ public class BaseFeePendingTransactionsTest {
ImmutableTransactionPoolConfiguration.builder()
.pendingTxRetentionPeriod(maxTransactionRetentionHours)
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(1)
.build(),
clock,
metricsSystem,
@ -670,6 +678,7 @@ public class BaseFeePendingTransactionsTest {
ImmutableTransactionPoolConfiguration.builder()
.pendingTxRetentionPeriod(maxTransactionRetentionHours)
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(1)
.build(),
clock,
metricsSystem,
@ -690,6 +699,7 @@ public class BaseFeePendingTransactionsTest {
ImmutableTransactionPoolConfiguration.builder()
.pendingTxRetentionPeriod(maxTransactionRetentionHours)
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(1)
.build(),
clock,
metricsSystem,

@ -57,7 +57,7 @@ import org.junit.Test;
public class GasPricePendingTransactionsTest {
private static final int MAX_TRANSACTIONS = 5;
private static final int MAX_TRANSACTIONS_BY_SENDER = 4;
private static final float MAX_TRANSACTIONS_BY_SENDER_PERCENT = 0.8f; // should evaluate to 4
private static final Supplier<SignatureAlgorithm> SIGNATURE_ALGORITHM =
Suppliers.memoize(SignatureAlgorithmFactory::getInstance);
private static final KeyPair KEYS1 = SIGNATURE_ALGORITHM.get().generateKeyPair();
@ -72,7 +72,10 @@ public class GasPricePendingTransactionsTest {
private final StubMetricsSystem metricsSystem = new StubMetricsSystem();
private final GasPricePendingTransactionsSorter transactions =
new GasPricePendingTransactionsSorter(
ImmutableTransactionPoolConfiguration.builder().txPoolMaxSize(MAX_TRANSACTIONS).build(),
ImmutableTransactionPoolConfiguration.builder()
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(1)
.build(),
TestClock.system(ZoneId.systemDefault()),
metricsSystem,
GasPricePendingTransactionsTest::mockBlockHeader);
@ -156,12 +159,14 @@ public class GasPricePendingTransactionsTest {
@Test
public void shouldDropFutureTransactionWhenSenderLimitExceeded() {
final var senderLimitedConfig =
ImmutableTransactionPoolConfiguration.builder()
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(MAX_TRANSACTIONS_BY_SENDER_PERCENT)
.build();
final GasPricePendingTransactionsSorter senderLimitedtransactions =
new GasPricePendingTransactionsSorter(
ImmutableTransactionPoolConfiguration.builder()
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolMaxFutureTransactionByAccount(MAX_TRANSACTIONS_BY_SENDER)
.build(),
senderLimitedConfig,
TestClock.system(ZoneId.systemDefault()),
metricsSystem,
GasPricePendingTransactionsTest::mockBlockHeader);
@ -171,7 +176,9 @@ public class GasPricePendingTransactionsTest {
furthestFutureTransaction = transactionWithNonceSenderAndGasPrice(i, KEYS1, 10L);
senderLimitedtransactions.addRemoteTransaction(furthestFutureTransaction, Optional.empty());
}
assertThat(senderLimitedtransactions.size()).isEqualTo(MAX_TRANSACTIONS_BY_SENDER);
assertThat(senderLimitedtransactions.size())
.isEqualTo(senderLimitedConfig.getTxPoolMaxFutureTransactionByAccount());
assertThat(senderLimitedConfig.getTxPoolMaxFutureTransactionByAccount()).isEqualTo(4);
assertThat(metricsSystem.getCounterValue(REMOVED_COUNTER, REMOTE, DROPPED)).isEqualTo(1L);
assertThat(senderLimitedtransactions.getTransactionByHash(furthestFutureTransaction.getHash()))
@ -642,6 +649,7 @@ public class GasPricePendingTransactionsTest {
ImmutableTransactionPoolConfiguration.builder()
.pendingTxRetentionPeriod(1)
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(1)
.build(),
clock,
metricsSystem,
@ -684,6 +692,7 @@ public class GasPricePendingTransactionsTest {
ImmutableTransactionPoolConfiguration.builder()
.pendingTxRetentionPeriod(2)
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(1)
.build(),
clock,
metricsSystem,

@ -44,7 +44,7 @@ import org.junit.Test;
public class PendingMultiTypesTransactionsTest {
private static final int MAX_TRANSACTIONS = 5;
private static final int MAX_TRANSACTIONS_BY_SENDER = 4;
private static final float MAX_TRANSACTIONS_BY_SENDER_PERCENTAGE = 0.8f; // evaluates to 4
private static final Supplier<SignatureAlgorithm> SIGNATURE_ALGORITHM =
Suppliers.memoize(SignatureAlgorithmFactory::getInstance)::get;
private static final KeyPair KEYS1 = SIGNATURE_ALGORITHM.get().generateKeyPair();
@ -64,7 +64,7 @@ public class PendingMultiTypesTransactionsTest {
new BaseFeePendingTransactionsSorter(
ImmutableTransactionPoolConfiguration.builder()
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolMaxFutureTransactionByAccount(MAX_TRANSACTIONS_BY_SENDER)
.txPoolLimitByAccountPercentage(MAX_TRANSACTIONS_BY_SENDER_PERCENTAGE)
.build(),
TestClock.system(ZoneId.systemDefault()),
metricsSystem,

@ -134,7 +134,10 @@ public class TransactionPoolTest {
blockchain = executionContext.getBlockchain();
transactions =
new GasPricePendingTransactionsSorter(
ImmutableTransactionPoolConfiguration.builder().txPoolMaxSize(MAX_TRANSACTIONS).build(),
ImmutableTransactionPoolConfiguration.builder()
.txPoolMaxSize(MAX_TRANSACTIONS)
.txPoolLimitByAccountPercentage(1)
.build(),
TestClock.system(ZoneId.systemDefault()),
metricsSystem,
blockchain::getChainHeadHeader);

Loading…
Cancel
Save