Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Karim Taam <[email protected]>
  • Loading branch information
matkt committed Jul 10, 2024
1 parent 69f36b6 commit 6baafdc
Show file tree
Hide file tree
Showing 36 changed files with 105 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,14 @@ public BesuControllerBuilder randomPeerPriority(final Boolean randomPeerPriority
return this;
}

/**
* Sets whether parallel transaction processing is enabled. When parallel transaction processing
* is enabled, transactions within a block can be processed in parallel and potentially improving
* performance
*
* @param isParallelTxEnabled true to enable parallel transaction
* @return the besu controller
*/
public BesuControllerBuilder isParallelTxEnabled(final boolean isParallelTxEnabled) {
this.isParallelTxEnabled = isParallelTxEnabled;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,16 @@ private static MilestoneStreamingTransitionProtocolSchedule createSchedule(
new MilestoneStreamingProtocolSchedule(
(DefaultProtocolSchedule)
MainnetProtocolSchedule.fromConfig(
configOptions, MiningParameters.MINING_DISABLED, new BadBlockManager()));
configOptions, MiningParameters.MINING_DISABLED, new BadBlockManager(), false));
MilestoneStreamingProtocolSchedule postMergeProtocolSchedule =
new MilestoneStreamingProtocolSchedule(
(DefaultProtocolSchedule)
MergeProtocolSchedule.create(
configOptions, false, MiningParameters.MINING_DISABLED, new BadBlockManager()));
configOptions,
false,
MiningParameters.MINING_DISABLED,
new BadBlockManager(),
false));
final MilestoneStreamingTransitionProtocolSchedule schedule =
new MilestoneStreamingTransitionProtocolSchedule(
preMergeProtocolSchedule, postMergeProtocolSchedule);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void protocolSpecsAreCreatedAtBlockDefinedInJson() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);

final ProtocolSpec homesteadSpec = protocolSchedule.getByBlockHeader(blockHeader(1));
final ProtocolSpec tangerineWhistleSpec = protocolSchedule.getByBlockHeader(blockHeader(2));
Expand All @@ -92,7 +93,8 @@ public void parametersAlignWithMainnetWithAdjustments() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
new BadBlockManager(),
false)
.getByBlockHeader(blockHeader(0));

assertThat(homestead.getName()).isEqualTo("Frontier");
Expand All @@ -116,7 +118,8 @@ public void zeroEpochLengthThrowsException() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager()))
new BadBlockManager(),
false))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Epoch length in config must be greater than zero");
}
Expand All @@ -136,7 +139,8 @@ public void negativeEpochLengthThrowsException() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager()))
new BadBlockManager(),
false))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Epoch length in config must be greater than zero");
}
Expand All @@ -160,7 +164,8 @@ public void shouldValidateBaseFeeMarketTransition() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);

BlockHeader emptyFrontierParent =
headerBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ public void setup() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);

final Address otherAddress = Util.publicKeyToAddress(otherKeyPair.getPublicKey());
validatorList.add(otherAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public void setup() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);
cliqueEthContext = mock(EthContext.class, RETURNS_DEEP_STUBS);
blockHeaderBuilder = new BlockHeaderTestFixture();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ private BftProtocolSchedule createProtocolSchedule(
bftExtraDataCodec,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);
}

private boolean validateHeader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public BlockHeaderValidator.Builder createBlockHeaderRuleset(
bftExtraDataEncoder,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);
final ProtocolContext protContext =
new ProtocolContext(
blockchain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ public void setup() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);

ProtocolSchedule protocolSchedule =
new BftProtocolSchedule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void protocolSpecsAreCreatedAtBlockDefinedInJson() {
final GenesisConfigOptions config = GenesisConfigFile.fromConfig(jsonInput).getConfigOptions();
final ProtocolSchedule protocolSchedule =
MergeProtocolSchedule.create(
config, false, MiningParameters.MINING_DISABLED, new BadBlockManager());
config, false, MiningParameters.MINING_DISABLED, new BadBlockManager(), false);

final ProtocolSpec homesteadSpec = protocolSchedule.getByBlockHeader(blockHeader(1));
final ProtocolSpec londonSpec = protocolSchedule.getByBlockHeader(blockHeader(1559));
Expand All @@ -64,7 +64,7 @@ public void mergeSpecificModificationsAreUnappliedForShanghai() {
final GenesisConfigOptions config = GenesisConfigFile.mainnet().getConfigOptions();
final ProtocolSchedule protocolSchedule =
MergeProtocolSchedule.create(
config, false, MiningParameters.MINING_DISABLED, new BadBlockManager());
config, false, MiningParameters.MINING_DISABLED, new BadBlockManager(), false);

final long lastParisBlockNumber = 17034869L;
final ProtocolSpec parisSpec =
Expand Down Expand Up @@ -100,7 +100,7 @@ public void mergeSpecificModificationsAreUnappliedForCancun_whenShanghaiNotConfi
final GenesisConfigOptions config = GenesisConfigFile.fromConfig(jsonInput).getConfigOptions();
final ProtocolSchedule protocolSchedule =
MergeProtocolSchedule.create(
config, false, MiningParameters.MINING_DISABLED, new BadBlockManager());
config, false, MiningParameters.MINING_DISABLED, new BadBlockManager(), false);

final ProtocolSpec parisSpec =
protocolSchedule.getByBlockHeader(
Expand Down Expand Up @@ -128,7 +128,7 @@ public void mergeSpecificModificationsAreUnappliedForAllMainnetForksAfterParis()
final GenesisConfigOptions config = GenesisConfigFile.mainnet().getConfigOptions();
final ProtocolSchedule protocolSchedule =
MergeProtocolSchedule.create(
config, false, MiningParameters.MINING_DISABLED, new BadBlockManager());
config, false, MiningParameters.MINING_DISABLED, new BadBlockManager(), false);

final long lastParisBlockNumber = 17034869L;
final ProtocolSpec parisSpec =
Expand Down Expand Up @@ -160,7 +160,8 @@ public void parametersAlignWithMainnetWithAdjustments() {
GenesisConfigFile.DEFAULT.getConfigOptions(),
false,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
new BadBlockManager(),
false)
.getByBlockHeader(blockHeader(0));

assertThat(london.getName()).isEqualTo("Paris");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ default ProtocolSchedule getMergeProtocolSchedule() {
getPosGenesisConfigFile().getConfigOptions(),
false,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ private BftProtocolSchedule createProtocolSchedule(
bftExtraDataCodec,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);
}

private boolean validateHeader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ QbftContext.class, validators, new QbftExtraDataCodec()),
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
new BadBlockManager(),
false);

ProtocolSchedule protocolSchedule =
new BftProtocolSchedule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public final JsonRpcResponse response(final JsonRpcRequestContext request) {
.addArgument(this.getName())
.addArgument(t.getMessage())
.log();
t.printStackTrace(System.out);
}
return new JsonRpcErrorResponse(
request.getRequest().getId(), RpcErrorType.INVALID_REQUEST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public void initServerAndClient() throws Exception {
MainnetProtocolSchedule.fromConfig(
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
MiningParameters.MINING_DISABLED,
new BadBlockManager()),
new BadBlockManager(),
false),
mock(ProtocolContext.class),
mock(FilterManager.class),
mock(TransactionPool.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ public static void initServerAndClient() throws Exception {
blockchainQueries,
synchronizer,
MainnetProtocolSchedule.fromConfig(
genesisConfigOptions, MiningParameters.MINING_DISABLED, new BadBlockManager()),
genesisConfigOptions,
MiningParameters.MINING_DISABLED,
new BadBlockManager(),
false),
mock(ProtocolContext.class),
mock(FilterManager.class),
mock(TransactionPool.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public static void initServerAndClient() throws Exception {
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager()),
new BadBlockManager(),
false),
mock(ProtocolContext.class),
mock(FilterManager.class),
mock(TransactionPool.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public void initServer() throws Exception {
MainnetProtocolSchedule.fromConfig(
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
MiningParameters.MINING_DISABLED,
new BadBlockManager()),
new BadBlockManager(),
false),
mock(ProtocolContext.class),
mock(FilterManager.class),
mock(TransactionPool.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ public void beforeEach() {
MainnetProtocolSchedule.fromConfig(
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
MiningParameters.MINING_DISABLED,
new BadBlockManager()),
new BadBlockManager(),
false),
mock(ProtocolContext.class),
mock(FilterManager.class),
mock(TransactionPool.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public void initServer() throws Exception {
MainnetProtocolSchedule.fromConfig(
new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID),
MiningParameters.MINING_DISABLED,
new BadBlockManager()),
new BadBlockManager(),
false),
mock(ProtocolContext.class),
mock(FilterManager.class),
mock(TransactionPool.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public class EthGetTransactionReceiptTest {
BlockHeader::getCoinbase,
null,
false,
false,
null,
GasLimitCalculator.constant(),
FeeMarket.legacy(),
Expand Down Expand Up @@ -172,6 +173,7 @@ public class EthGetTransactionReceiptTest {
BlockHeader::getCoinbase,
null,
false,
false,
null,
GasLimitCalculator.constant(),
FeeMarket.legacy(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ public void before() throws URISyntaxException {
MainnetProtocolSchedule.fromConfig(
genesisConfigOptions,
MiningParameters.MINING_DISABLED,
new BadBlockManager()),
new BadBlockManager(),
false),
mock(ProtocolContext.class),
mock(FilterManager.class),
mock(TransactionPool.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ private AbstractBlockCreator createBlockCreator(final ProtocolSpecAdapters proto
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
new BadBlockManager(),
false)
.createProtocolSchedule())
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ protected ProtocolSchedule createProtocolSchedule() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
new BadBlockManager(),
false)
.createProtocolSchedule();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ protected ProtocolSchedule createProtocolSchedule() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
new BadBlockManager(),
false)
.createProtocolSchedule();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ void createMainnetBlock1() throws IOException {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
new BadBlockManager(),
false)
.createProtocolSchedule())
.build();

Expand Down Expand Up @@ -150,7 +151,8 @@ void createMainnetBlock1_fixedDifficulty1() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
new BadBlockManager(),
false)
.createProtocolSchedule())
.build();

Expand Down Expand Up @@ -196,7 +198,8 @@ void rewardBeneficiary_zeroReward_skipZeroRewardsFalse() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
new BadBlockManager(),
false)
.createProtocolSchedule();
final ExecutionContextTestFixture executionContextTestFixture =
ExecutionContextTestFixture.builder().protocolSchedule(protocolSchedule).build();
Expand Down Expand Up @@ -265,7 +268,8 @@ void rewardBeneficiary_zeroReward_skipZeroRewardsTrue() {
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
new BadBlockManager(),
false)
.createProtocolSchedule();
final ExecutionContextTestFixture executionContextTestFixture =
ExecutionContextTestFixture.builder().protocolSchedule(protocolSchedule).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ public BlockProcessingResult processBlock(

if (isParallelTxEnabled && parallelizedConcurrentTransactionProcessor.isPresent()) {
// applyParallelizedTransactionResult, if activated, fetch the results of transactions
// processed by
// background threads.
// processed by background threads.
transactionProcessingResult =
parallelizedConcurrentTransactionProcessor
.get()
Expand Down
Loading

0 comments on commit 6baafdc

Please sign in to comment.