use of org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration in project besu by hyperledger.
the class TransactionPoolOptionsTest method eth65TrxAnnouncedBufferingPeriod.
@Test
public void eth65TrxAnnouncedBufferingPeriod() {
final long eth65TrxAnnouncedBufferingPeriod = 999;
final TestBesuCommand cmd = parseCommand("--Xeth65-tx-announced-buffering-period-milliseconds", String.valueOf(eth65TrxAnnouncedBufferingPeriod));
final TransactionPoolOptions options = getOptionsFromBesuCommand(cmd);
final TransactionPoolConfiguration config = options.toDomainObject().build();
assertThat(config.getEth65TrxAnnouncedBufferingPeriod()).hasMillis(eth65TrxAnnouncedBufferingPeriod);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
use of org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration in project besu by hyperledger.
the class TransactionPoolOptionsTest method strictTxReplayProtection_disabled.
@Test
public void strictTxReplayProtection_disabled() {
final TestBesuCommand cmd = parseCommand("--strict-tx-replay-protection-enabled=false");
final TransactionPoolOptions options = getOptionsFromBesuCommand(cmd);
final TransactionPoolConfiguration config = options.toDomainObject().build();
assertThat(config.getStrictTransactionReplayProtectionEnabled()).isFalse();
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
use of org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration in project besu by hyperledger.
the class TransactionPoolOptionsTest method strictTxReplayProtection_enabled.
@Test
public void strictTxReplayProtection_enabled() {
final TestBesuCommand cmd = parseCommand("--strict-tx-replay-protection-enabled");
final TransactionPoolOptions options = getOptionsFromBesuCommand(cmd);
final TransactionPoolConfiguration config = options.toDomainObject().build();
assertThat(config.getStrictTransactionReplayProtectionEnabled()).isTrue();
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
use of org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration in project besu by hyperledger.
the class TransactionPoolOptionsTest method strictTxReplayProtection_enabledWithBooleanArg.
@Test
public void strictTxReplayProtection_enabledWithBooleanArg() {
final TestBesuCommand cmd = parseCommand("--strict-tx-replay-protection-enabled=true");
final TransactionPoolOptions options = getOptionsFromBesuCommand(cmd);
final TransactionPoolConfiguration config = options.toDomainObject().build();
assertThat(config.getStrictTransactionReplayProtectionEnabled()).isTrue();
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
use of org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration in project besu by hyperledger.
the class RetestethContext method buildContext.
private boolean buildContext(final String genesisConfigString, final String sealEngine, final Optional<Long> clockTime) {
final ObjectNode genesisConfig = normalizeKeys(JsonUtil.objectNodeFromString(genesisConfigString));
retestethClock = new RetestethClock();
clockTime.ifPresent(retestethClock::resetTime);
final MetricsSystem metricsSystem = new NoOpMetricsSystem();
final JsonGenesisConfigOptions jsonGenesisConfigOptions = JsonGenesisConfigOptions.fromJsonObject(JsonUtil.getObjectNode(genesisConfig, "config").get());
protocolSchedule = MainnetProtocolSchedule.fromConfig(jsonGenesisConfigOptions, EvmConfiguration.DEFAULT);
if ("NoReward".equalsIgnoreCase(sealEngine)) {
protocolSchedule = new NoRewardProtocolScheduleWrapper(protocolSchedule);
}
blockHeaderFunctions = ScheduleBasedBlockHeaderFunctions.create(protocolSchedule);
final GenesisState genesisState = GenesisState.fromJson(genesisConfigString, protocolSchedule);
coinbase = genesisState.getBlock().getHeader().getCoinbase();
extraData = genesisState.getBlock().getHeader().getExtraData();
final WorldStateArchive worldStateArchive = new DefaultWorldStateArchive(new WorldStateKeyValueStorage(new InMemoryKeyValueStorage()), new WorldStatePreimageKeyValueStorage(new InMemoryKeyValueStorage()));
final MutableWorldState worldState = worldStateArchive.getMutable();
genesisState.writeStateTo(worldState);
blockchain = createInMemoryBlockchain(genesisState.getBlock());
protocolContext = new ProtocolContext(blockchain, worldStateArchive, null);
blockchainQueries = new BlockchainQueries(blockchain, worldStateArchive, ethScheduler);
final String sealengine = JsonUtil.getString(genesisConfig, "sealengine", "");
headerValidationMode = "NoProof".equals(sealengine) || "NoReward".equals(sealEngine) ? HeaderValidationMode.LIGHT : HeaderValidationMode.FULL;
final Iterable<Long> nonceGenerator = new IncrementingNonceGenerator(0);
poWSolver = ("NoProof".equals(sealengine) || "NoReward".equals(sealEngine)) ? new PoWSolver(nonceGenerator, NO_WORK_HASHER, false, Subscribers.none(), new EpochCalculator.DefaultEpochCalculator(), 1000, 8) : new PoWSolver(nonceGenerator, PoWHasher.ETHASH_LIGHT, false, Subscribers.none(), new EpochCalculator.DefaultEpochCalculator(), 1000, 8);
blockReplay = new BlockReplay(protocolSchedule, blockchainQueries.getBlockchain(), blockchainQueries.getWorldStateArchive());
// mining support
final EthPeers ethPeers = new EthPeers("reteseth", retestethClock, metricsSystem, 0);
final SyncState syncState = new SyncState(blockchain, ethPeers);
ethScheduler = new EthScheduler(1, 1, 1, 1, metricsSystem);
final EthContext ethContext = new EthContext(ethPeers, new EthMessages(), ethScheduler);
final TransactionPoolConfiguration transactionPoolConfiguration = ImmutableTransactionPoolConfiguration.builder().build();
transactionPool = TransactionPoolFactory.createTransactionPool(protocolSchedule, protocolContext, ethContext, retestethClock, metricsSystem, syncState, new MiningParameters.Builder().minTransactionGasPrice(Wei.ZERO).build(), transactionPoolConfiguration);
if (LOG.isTraceEnabled()) {
LOG.trace("Genesis Block {} ", genesisState.getBlock());
}
return true;
}
Aggregations