TransactionSimulator can be a singleton (#7925)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Co-authored-by: daniellehrner <daniel.lehrner@consensys.net>
pull/7964/head
Fabio Di Fabio 5 days ago committed by GitHub
parent afd4da1974
commit c320724d29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java
  2. 30
      besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
  3. 20
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  4. 17
      besu/src/main/java/org/hyperledger/besu/controller/BesuController.java
  5. 27
      besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
  6. 3
      besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java
  7. 2
      besu/src/test/java/org/hyperledger/besu/FlexGroupPrivacyTest.java
  8. 2
      besu/src/test/java/org/hyperledger/besu/PrivacyReorgTest.java
  9. 2
      besu/src/test/java/org/hyperledger/besu/PrivacyTest.java
  10. 1
      besu/src/test/java/org/hyperledger/besu/RunnerTest.java
  11. 2
      besu/src/test/java/org/hyperledger/besu/chainexport/RlpBlockExporterTest.java
  12. 2
      besu/src/test/java/org/hyperledger/besu/chainimport/JsonBlockImporterTest.java
  13. 4
      besu/src/test/java/org/hyperledger/besu/chainimport/RlpBlockImporterTest.java
  14. 1
      besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java
  15. 4
      besu/src/test/java/org/hyperledger/besu/controller/AbstractBftBesuControllerBuilderTest.java
  16. 4
      besu/src/test/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilderTest.java
  17. 4
      besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java
  18. 12
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java
  19. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/GraphQLContextType.java
  20. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/internal/pojoadapter/BlockAdapterBase.java
  21. 4
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/graphql/internal/pojoadapter/PendingStateAdapter.java
  22. 16
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/DebugJsonRpcMethods.java
  23. 29
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/EthJsonRpcMethods.java
  24. 10
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java
  25. 30
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/TraceJsonRpcMethods.java
  26. 12
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java
  27. 11
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java
  28. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java
  29. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java
  30. 7
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java
  31. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java
  32. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java
  33. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java
  34. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java
  35. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java

@ -458,7 +458,8 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
final BesuControllerBuilder builder,
final MetricsSystem metricsSystem,
final KeyValueStorageProvider storageProvider,
final MiningConfiguration miningConfiguration) {
final MiningConfiguration miningConfiguration,
final ApiConfiguration apiConfiguration) {
builder
.synchronizerConfiguration(synchronizerConfiguration)
@ -473,6 +474,7 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
.maxRemotelyInitiatedPeers(15)
.miningParameters(miningConfiguration)
.randomPeerPriority(false)
.apiConfiguration(apiConfiguration)
.besuComponent(null);
return builder.build();
}

@ -672,12 +672,7 @@ public class RunnerBuilder {
final Synchronizer synchronizer = besuController.getSynchronizer();
final TransactionSimulator transactionSimulator =
new TransactionSimulator(
context.getBlockchain(),
context.getWorldStateArchive(),
protocolSchedule,
apiConfiguration.getGasCap());
final TransactionSimulator transactionSimulator = besuController.getTransactionSimulator();
final Bytes localNodeId = nodeKey.getPublicKey().getEncodedBytes();
final Optional<NodePermissioningController> nodePermissioningController =
@ -840,7 +835,8 @@ public class RunnerBuilder {
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl);
rpcEndpointServiceImpl,
transactionSimulator);
jsonRpcHttpService =
Optional.of(
@ -885,7 +881,8 @@ public class RunnerBuilder {
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl);
rpcEndpointServiceImpl,
transactionSimulator);
final Optional<AuthenticationService> authToUse =
engineJsonRpcConfiguration.get().isAuthenticationEnabled()
@ -932,7 +929,7 @@ public class RunnerBuilder {
graphQlContextMap.putIfAbsent(GraphQLContextType.SYNCHRONIZER, synchronizer);
graphQlContextMap.putIfAbsent(
GraphQLContextType.CHAIN_ID, protocolSchedule.getChainId().map(UInt256::valueOf));
graphQlContextMap.putIfAbsent(GraphQLContextType.GAS_CAP, apiConfiguration.getGasCap());
graphQlContextMap.putIfAbsent(GraphQLContextType.TRANSACTION_SIMULATOR, transactionSimulator);
final GraphQL graphQL;
try {
graphQL = GraphQLProvider.buildGraphQL(fetchers);
@ -980,7 +977,8 @@ public class RunnerBuilder {
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl);
rpcEndpointServiceImpl,
transactionSimulator);
createLogsSubscriptionService(
context.getBlockchain(), subscriptionManager, privacyParameters, blockchainQueries);
@ -1060,7 +1058,8 @@ public class RunnerBuilder {
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl);
rpcEndpointServiceImpl,
transactionSimulator);
jsonRpcIpcService =
Optional.of(
@ -1099,7 +1098,8 @@ public class RunnerBuilder {
natService,
besuPluginContext.getNamedPlugins(),
dataDir,
rpcEndpointServiceImpl);
rpcEndpointServiceImpl,
transactionSimulator);
} else {
inProcessRpcMethods = Map.of();
}
@ -1261,7 +1261,8 @@ public class RunnerBuilder {
final NatService natService,
final Map<String, BesuPlugin> namedPlugins,
final Path dataDir,
final RpcEndpointServiceImpl rpcEndpointServiceImpl) {
final RpcEndpointServiceImpl rpcEndpointServiceImpl,
final TransactionSimulator transactionSimulator) {
// sync vertx for engine consensus API, to process requests in FIFO order;
final Vertx consensusEngineServer = Vertx.vertx(new VertxOptions().setWorkerPoolSize(1));
@ -1298,7 +1299,8 @@ public class RunnerBuilder {
besuController.getProtocolManager().ethContext().getEthPeers(),
consensusEngineServer,
apiConfiguration,
enodeDnsConfiguration);
enodeDnsConfiguration,
transactionSimulator);
methods.putAll(besuController.getAdditionalJsonRpcMethods(jsonRpcApis));
final var pluginMethods =

@ -134,7 +134,6 @@ import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProviderBuilder;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.ethereum.worldstate.DiffBasedSubStorageConfiguration;
import org.hyperledger.besu.ethereum.worldstate.ImmutableDataStorageConfiguration;
@ -339,6 +338,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
Suppliers.memoize(this::readGenesisConfigOptions);
private final Supplier<MiningConfiguration> miningParametersSupplier =
Suppliers.memoize(this::getMiningParameters);
private final Supplier<ApiConfiguration> apiConfigurationSupplier =
Suppliers.memoize(this::getApiConfiguration);
private RocksDBPlugin rocksDBPlugin;
@ -712,7 +713,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
private WebSocketConfiguration webSocketConfiguration;
private JsonRpcIpcConfiguration jsonRpcIpcConfiguration;
private InProcessRpcConfiguration inProcessRpcConfiguration;
private ApiConfiguration apiConfiguration;
private MetricsConfiguration metricsConfiguration;
private Optional<PermissioningConfiguration> permissioningConfiguration;
private DataStorageConfiguration dataStorageConfiguration;
@ -1237,7 +1237,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
webSocketConfiguration,
jsonRpcIpcConfiguration,
inProcessRpcConfiguration,
apiConfiguration,
apiConfigurationSupplier.get(),
metricsConfiguration,
permissioningConfiguration,
staticNodes,
@ -1249,11 +1249,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
besuController.getProtocolContext().getBlockchain(), besuController.getProtocolSchedule());
transactionSimulationServiceImpl.init(
besuController.getProtocolContext().getBlockchain(),
new TransactionSimulator(
besuController.getProtocolContext().getBlockchain(),
besuController.getProtocolContext().getWorldStateArchive(),
besuController.getProtocolSchedule(),
apiConfiguration.getGasCap()));
besuController.getTransactionSimulator());
rpcEndpointServiceImpl.init(runner.getInProcessRpcMethods());
besuPluginContext.addService(
@ -1447,7 +1443,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
validateTransactionPoolOptions();
validateDataStorageOptions();
validateGraphQlOptions();
validateApiOptions();
validateConsensusSyncCompatibilityOptions();
validatePluginOptions();
}
@ -1705,7 +1700,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
unstableIpcOptions.getIpcPath(),
unstableIpcOptions.getRpcIpcApis());
inProcessRpcConfiguration = inProcessRpcOptions.toDomainObject();
apiConfiguration = apiConfigurationOptions.apiConfiguration();
dataStorageConfiguration = getDataStorageConfiguration();
// hostsWhitelist is a hidden option. If it is specified, add the list to hostAllowlist
if (!hostsWhitelist.isEmpty()) {
@ -1823,6 +1817,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
.chainPruningConfiguration(unstableChainPruningOptions.toDomainObject())
.cacheLastBlocks(numberOfblocksToCache)
.genesisStateHashCacheEnabled(genesisStateHashCacheEnabled)
.apiConfiguration(apiConfigurationSupplier.get())
.besuComponent(besuComponent);
if (DataStorageFormat.BONSAI.equals(getDataStorageConfiguration().getDataStorageFormat())) {
final DiffBasedSubStorageConfiguration subStorageConfiguration =
@ -2148,6 +2143,11 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
return miningParameters;
}
private ApiConfiguration getApiConfiguration() {
validateApiOptions();
return apiConfigurationOptions.apiConfiguration();
}
/**
* Get the data storage configuration
*

@ -35,6 +35,7 @@ import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.config.SubProtocolConfiguration;
import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import java.io.Closeable;
@ -66,7 +67,6 @@ public class BesuController implements java.io.Closeable {
private final NodeKey nodeKey;
private final Synchronizer synchronizer;
private final JsonRpcMethods additionalJsonRpcMethodsFactory;
private final TransactionPool transactionPool;
private final MiningCoordinator miningCoordinator;
private final PrivacyParameters privacyParameters;
@ -77,6 +77,7 @@ public class BesuController implements java.io.Closeable {
private final EthPeers ethPeers;
private final StorageProvider storageProvider;
private final DataStorageConfiguration dataStorageConfiguration;
private final TransactionSimulator transactionSimulator;
/**
* Instantiates a new Besu controller.
@ -99,6 +100,7 @@ public class BesuController implements java.io.Closeable {
* @param ethPeers the eth peers
* @param storageProvider the storage provider
* @param dataStorageConfiguration the data storage configuration
* @param transactionSimulator the transaction simulator
*/
BesuController(
final ProtocolSchedule protocolSchedule,
@ -118,7 +120,8 @@ public class BesuController implements java.io.Closeable {
final PluginServiceFactory additionalPluginServices,
final EthPeers ethPeers,
final StorageProvider storageProvider,
final DataStorageConfiguration dataStorageConfiguration) {
final DataStorageConfiguration dataStorageConfiguration,
final TransactionSimulator transactionSimulator) {
this.protocolSchedule = protocolSchedule;
this.protocolContext = protocolContext;
this.ethProtocolManager = ethProtocolManager;
@ -137,6 +140,7 @@ public class BesuController implements java.io.Closeable {
this.ethPeers = ethPeers;
this.storageProvider = storageProvider;
this.dataStorageConfiguration = dataStorageConfiguration;
this.transactionSimulator = transactionSimulator;
}
/**
@ -307,6 +311,15 @@ public class BesuController implements java.io.Closeable {
return dataStorageConfiguration;
}
/**
* Gets the transaction simulator
*
* @return the transaction simulator
*/
public TransactionSimulator getTransactionSimulator() {
return transactionSimulator;
}
/** The type Builder. */
public static class Builder {
/** Instantiates a new Builder. */

@ -28,6 +28,7 @@ import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.ethereum.ConsensusContext;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.methods.JsonRpcMethods;
import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
@ -84,6 +85,7 @@ import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.SubProtocolConfiguration;
import org.hyperledger.besu.ethereum.storage.StorageProvider;
import org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueSegmentIdentifier;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.BonsaiWorldStateProvider;
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoader;
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.storage.BonsaiWorldStateKeyValueStorage;
@ -211,6 +213,12 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
/** whether parallel transaction processing is enabled or not */
protected boolean isParallelTxProcessingEnabled;
/** The API configuration */
protected ApiConfiguration apiConfiguration;
/** The transaction simulator */
protected TransactionSimulator transactionSimulator;
/** Instantiates a new Besu controller builder. */
protected BesuControllerBuilder() {}
@ -272,6 +280,17 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
return this;
}
/**
* API configuration besu controller builder.
*
* @param apiConfiguration the API config
* @return the besu controller builder
*/
public BesuControllerBuilder apiConfiguration(final ApiConfiguration apiConfiguration) {
this.apiConfiguration = apiConfiguration;
return this;
}
/**
* Eth protocol configuration besu controller builder.
*
@ -556,6 +575,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
checkNotNull(gasLimitCalculator, "Missing gas limit calculator");
checkNotNull(evmConfiguration, "Missing evm config");
checkNotNull(networkingConfiguration, "Missing network configuration");
checkNotNull(apiConfiguration, "Missing API configuration");
checkNotNull(dataStorageConfiguration, "Missing data storage configuration");
checkNotNull(besuComponent, "Must supply a BesuComponent");
prepForBuild();
@ -604,6 +624,10 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
genesisState.writeStateTo(worldStateArchive.getMutable());
}
transactionSimulator =
new TransactionSimulator(
blockchain, worldStateArchive, protocolSchedule, apiConfiguration.getGasCap());
final var consensusContext =
createConsensusContext(blockchain, worldStateArchive, protocolSchedule);
@ -795,7 +819,8 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides
additionalPluginServices,
ethPeers,
storageProvider,
dataStorageConfiguration);
dataStorageConfiguration,
transactionSimulator);
}
private GenesisState getGenesisState(

@ -79,7 +79,6 @@ import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.config.SubProtocolConfiguration;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.plugin.services.BesuEvents;
import org.hyperledger.besu.util.Subscribers;
@ -399,8 +398,6 @@ public class QbftBesuControllerBuilder extends BftBesuControllerBuilder {
BlockValidatorProvider.forkingValidatorProvider(
blockchain, epochManager, bftBlockInterface().get(), validatorOverrides);
final TransactionSimulator transactionSimulator =
new TransactionSimulator(blockchain, worldStateArchive, protocolSchedule, 0L);
transactionValidatorProvider =
new TransactionValidatorProvider(
blockchain, new ValidatorContractController(transactionSimulator), qbftForksSchedule);

@ -28,6 +28,7 @@ import org.hyperledger.besu.cryptoservices.NodeKeyUtils;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.enclave.EnclaveFactory;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider;
@ -162,6 +163,7 @@ class FlexGroupPrivacyTest {
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(context)
.apiConfiguration(ImmutableApiConfiguration.builder().build())
.build();
}
}

@ -41,6 +41,7 @@ import org.hyperledger.besu.enclave.EnclaveFactory;
import org.hyperledger.besu.enclave.types.ReceiveResponse;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.chain.DefaultBlockchain;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
@ -558,6 +559,7 @@ public class PrivacyReorgTest {
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(context)
.apiConfiguration(ImmutableApiConfiguration.builder().build())
.build();
return retval;
}

@ -28,6 +28,7 @@ import org.hyperledger.besu.controller.BesuController;
import org.hyperledger.besu.cryptoservices.NodeKeyUtils;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider;
@ -137,6 +138,7 @@ class PrivacyTest {
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(context)
.apiConfiguration(ImmutableApiConfiguration.builder().build())
.build();
}
}

@ -510,6 +510,7 @@ public final class RunnerTest {
.besuComponent(mock(BesuComponent.class))
.maxPeers(25)
.maxRemotelyInitiatedPeers(15)
.apiConfiguration(ImmutableApiConfiguration.builder().build())
.build();
}
}

@ -25,6 +25,7 @@ import org.hyperledger.besu.components.BesuComponent;
import org.hyperledger.besu.controller.BesuController;
import org.hyperledger.besu.cryptoservices.NodeKeyUtils;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockBody;
@ -105,6 +106,7 @@ public final class RlpBlockExporterTest {
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(mock(BesuComponent.class))
.apiConfiguration(ImmutableApiConfiguration.builder().build())
.build();
}

@ -28,6 +28,7 @@ import org.hyperledger.besu.cryptoservices.NodeKeyUtils;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockBody;
@ -475,6 +476,7 @@ public abstract class JsonBlockImporterTest {
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(DaggerJsonBlockImporterTest_JsonBlockImportComponent.builder().build())
.apiConfiguration(ImmutableApiConfiguration.builder().build())
.build();
}

@ -25,6 +25,7 @@ import org.hyperledger.besu.config.MergeConfiguration;
import org.hyperledger.besu.controller.BesuController;
import org.hyperledger.besu.cryptoservices.NodeKeyUtils;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider;
import org.hyperledger.besu.ethereum.core.MiningConfiguration;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
@ -80,6 +81,7 @@ public final class RlpBlockImporterTest {
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(mock(BesuComponent.class))
.apiConfiguration(ImmutableApiConfiguration.builder().build())
.build();
final RlpBlockImporter.ImportResult result =
rlpBlockImporter.importBlockchain(source, targetController, false);
@ -114,6 +116,7 @@ public final class RlpBlockImporterTest {
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(mock(BesuComponent.class))
.apiConfiguration(ImmutableApiConfiguration.builder().build())
.build();
assertThatThrownBy(
@ -145,6 +148,7 @@ public final class RlpBlockImporterTest {
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(mock(BesuComponent.class))
.apiConfiguration(ImmutableApiConfiguration.builder().build())
.build();
final RlpBlockImporter.ImportResult result =

@ -296,6 +296,7 @@ public abstract class CommandTestAbstract {
when(mockControllerBuilder.cacheLastBlocks(any())).thenReturn(mockControllerBuilder);
when(mockControllerBuilder.genesisStateHashCacheEnabled(any()))
.thenReturn(mockControllerBuilder);
when(mockControllerBuilder.apiConfiguration(any())).thenReturn(mockControllerBuilder);
when(mockControllerBuilder.build()).thenReturn(mockController);
lenient().when(mockController.getProtocolManager()).thenReturn(mockEthProtocolManager);

@ -29,6 +29,7 @@ import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
@ -158,7 +159,8 @@ public abstract class AbstractBftBesuControllerBuilderTest {
.gasLimitCalculator(gasLimitCalculator)
.evmConfiguration(EvmConfiguration.DEFAULT)
.besuComponent(mock(BesuComponent.class))
.networkConfiguration(NetworkingConfiguration.create());
.networkConfiguration(NetworkingConfiguration.create())
.apiConfiguration(ImmutableApiConfiguration.builder().build());
}
protected abstract void setupBftGenesisConfigFile() throws JsonProcessingException;

@ -33,6 +33,7 @@ import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
@ -191,7 +192,8 @@ public class CliqueBesuControllerBuilderTest {
.gasLimitCalculator(gasLimitCalculator)
.evmConfiguration(EvmConfiguration.DEFAULT)
.besuComponent(mock(BesuComponent.class))
.networkConfiguration(NetworkingConfiguration.create());
.networkConfiguration(NetworkingConfiguration.create())
.apiConfiguration(ImmutableApiConfiguration.builder().build());
}
@Test

@ -33,6 +33,7 @@ import org.hyperledger.besu.cryptoservices.NodeKeyUtils;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.GasLimitCalculator;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
@ -191,7 +192,8 @@ public class MergeBesuControllerBuilderTest {
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(mock(BesuComponent.class))
.networkId(networkId);
.networkId(networkId)
.apiConfiguration(ImmutableApiConfiguration.builder().build());
}
@Test

@ -45,6 +45,7 @@ import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.permissioning.AccountLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.hyperledger.besu.metrics.ObservableMetricsSystem;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
@ -77,6 +78,7 @@ public class JsonRpcTestMethodsFactory {
private final BlockchainQueries blockchainQueries;
private final Synchronizer synchronizer;
private final ProtocolSchedule protocolSchedule;
private final TransactionSimulator transactionSimulator;
public JsonRpcTestMethodsFactory(final BlockchainImporter importer) {
this.importer = importer;
@ -98,6 +100,9 @@ public class JsonRpcTestMethodsFactory {
this.blockchainQueries =
new BlockchainQueries(
protocolSchedule, blockchain, stateArchive, MiningConfiguration.newDefault());
this.transactionSimulator =
new TransactionSimulator(blockchain, stateArchive, protocolSchedule, 0L);
}
public JsonRpcTestMethodsFactory(
@ -117,6 +122,8 @@ public class JsonRpcTestMethodsFactory {
stateArchive,
MiningConfiguration.newDefault());
this.synchronizer = mock(Synchronizer.class);
this.transactionSimulator =
new TransactionSimulator(blockchain, stateArchive, protocolSchedule, 0L);
}
public JsonRpcTestMethodsFactory(
@ -137,6 +144,8 @@ public class JsonRpcTestMethodsFactory {
blockchain,
stateArchive,
MiningConfiguration.newDefault());
this.transactionSimulator =
new TransactionSimulator(blockchain, stateArchive, protocolSchedule, 0L);
}
public BlockchainQueries getBlockchainQueries() {
@ -219,6 +228,7 @@ public class JsonRpcTestMethodsFactory {
ethPeers,
Vertx.vertx(new VertxOptions().setWorkerPoolSize(1)),
ImmutableApiConfiguration.builder().build(),
Optional.empty());
Optional.empty(),
transactionSimulator);
}
}

@ -41,6 +41,6 @@ public enum GraphQLContextType {
/** Represents chain ID context. */
CHAIN_ID,
/** Represents gas cap context. */
GAS_CAP
/** Represents the transaction simulator. */
TRANSACTION_SIMULATOR
}

@ -332,10 +332,8 @@ public class BlockAdapterBase extends AdapterBase {
final ProtocolSchedule protocolSchedule =
environment.getGraphQlContext().get(GraphQLContextType.PROTOCOL_SCHEDULE);
final long bn = header.getNumber();
final long gasCap = environment.getGraphQlContext().get(GraphQLContextType.GAS_CAP);
final TransactionSimulator transactionSimulator =
new TransactionSimulator(
query.getBlockchain(), query.getWorldStateArchive(), protocolSchedule, gasCap);
environment.getGraphQlContext().get(GraphQLContextType.TRANSACTION_SIMULATOR);
long gasParam = -1;
Wei gasPriceParam = null;

@ -145,10 +145,8 @@ public class PendingStateAdapter extends AdapterBase {
final BlockchainQueries query = getBlockchainQueries(environment);
final ProtocolSchedule protocolSchedule =
environment.getGraphQlContext().get(GraphQLContextType.PROTOCOL_SCHEDULE);
final long gasCap = environment.getGraphQlContext().get(GraphQLContextType.GAS_CAP);
final TransactionSimulator transactionSimulator =
new TransactionSimulator(
query.getBlockchain(), query.getWorldStateArchive(), protocolSchedule, gasCap);
environment.getGraphQlContext().get(GraphQLContextType.TRANSACTION_SIMULATOR);
long gasParam = -1;
Wei gasPriceParam = null;

@ -15,7 +15,6 @@
package org.hyperledger.besu.ethereum.api.jsonrpc.methods;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.DebugReplayBlock;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.DebugAccountAt;
@ -64,7 +63,7 @@ public class DebugJsonRpcMethods extends ApiGroupJsonRpcMethods {
private final TransactionPool transactionPool;
private final Synchronizer synchronizer;
private final Path dataDir;
private final ApiConfiguration apiConfiguration;
private final TransactionSimulator transactionSimulator;
DebugJsonRpcMethods(
final BlockchainQueries blockchainQueries,
@ -74,7 +73,7 @@ public class DebugJsonRpcMethods extends ApiGroupJsonRpcMethods {
final TransactionPool transactionPool,
final Synchronizer synchronizer,
final Path dataDir,
final ApiConfiguration apiConfiguration) {
final TransactionSimulator transactionSimulator) {
this.blockchainQueries = blockchainQueries;
this.protocolContext = protocolContext;
this.protocolSchedule = protocolSchedule;
@ -82,7 +81,7 @@ public class DebugJsonRpcMethods extends ApiGroupJsonRpcMethods {
this.transactionPool = transactionPool;
this.synchronizer = synchronizer;
this.dataDir = dataDir;
this.apiConfiguration = apiConfiguration;
this.transactionSimulator = transactionSimulator;
}
@Override
@ -120,13 +119,6 @@ public class DebugJsonRpcMethods extends ApiGroupJsonRpcMethods {
new DebugGetRawBlock(blockchainQueries),
new DebugGetRawReceipts(blockchainQueries),
new DebugGetRawTransaction(blockchainQueries),
new DebugTraceCall(
blockchainQueries,
protocolSchedule,
new TransactionSimulator(
blockchainQueries.getBlockchain(),
blockchainQueries.getWorldStateArchive(),
protocolSchedule,
apiConfiguration.getGasCap())));
new DebugTraceCall(blockchainQueries, protocolSchedule, transactionSimulator));
}
}

@ -89,6 +89,7 @@ public class EthJsonRpcMethods extends ApiGroupJsonRpcMethods {
private final MiningCoordinator miningCoordinator;
private final Set<Capability> supportedCapabilities;
private final ApiConfiguration apiConfiguration;
private final TransactionSimulator transactionSimulator;
public EthJsonRpcMethods(
final BlockchainQueries blockchainQueries,
@ -98,7 +99,8 @@ public class EthJsonRpcMethods extends ApiGroupJsonRpcMethods {
final TransactionPool transactionPool,
final MiningCoordinator miningCoordinator,
final Set<Capability> supportedCapabilities,
final ApiConfiguration apiConfiguration) {
final ApiConfiguration apiConfiguration,
final TransactionSimulator transactionSimulator) {
this.blockchainQueries = blockchainQueries;
this.synchronizer = synchronizer;
this.protocolSchedule = protocolSchedule;
@ -107,6 +109,7 @@ public class EthJsonRpcMethods extends ApiGroupJsonRpcMethods {
this.miningCoordinator = miningCoordinator;
this.supportedCapabilities = supportedCapabilities;
this.apiConfiguration = apiConfiguration;
this.transactionSimulator = transactionSimulator;
}
@Override
@ -125,13 +128,7 @@ public class EthJsonRpcMethods extends ApiGroupJsonRpcMethods {
new EthGetBlockReceipts(blockchainQueries, protocolSchedule),
new EthGetBlockTransactionCountByNumber(blockchainQueries),
new EthGetBlockTransactionCountByHash(blockchainQueries),
new EthCall(
blockchainQueries,
new TransactionSimulator(
blockchainQueries.getBlockchain(),
blockchainQueries.getWorldStateArchive(),
protocolSchedule,
apiConfiguration.getGasCap())),
new EthCall(blockchainQueries, transactionSimulator),
new EthFeeHistory(protocolSchedule, blockchainQueries, miningCoordinator, apiConfiguration),
new EthGetCode(blockchainQueries),
new EthGetLogs(blockchainQueries, apiConfiguration.getMaxLogsRange()),
@ -155,20 +152,8 @@ public class EthJsonRpcMethods extends ApiGroupJsonRpcMethods {
new EthGetStorageAt(blockchainQueries),
new EthSendRawTransaction(transactionPool),
new EthSendTransaction(),
new EthEstimateGas(
blockchainQueries,
new TransactionSimulator(
blockchainQueries.getBlockchain(),
blockchainQueries.getWorldStateArchive(),
protocolSchedule,
apiConfiguration.getGasCap())),
new EthCreateAccessList(
blockchainQueries,
new TransactionSimulator(
blockchainQueries.getBlockchain(),
blockchainQueries.getWorldStateArchive(),
protocolSchedule,
apiConfiguration.getGasCap())),
new EthEstimateGas(blockchainQueries, transactionSimulator),
new EthCreateAccessList(blockchainQueries, transactionSimulator),
new EthMining(miningCoordinator),
new EthCoinbase(miningCoordinator),
new EthProtocolVersion(supportedCapabilities),

@ -36,6 +36,7 @@ import org.hyperledger.besu.ethereum.p2p.peers.EnodeDnsConfiguration;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.permissioning.AccountLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.metrics.ObservableMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -85,7 +86,8 @@ public class JsonRpcMethodsFactory {
final EthPeers ethPeers,
final Vertx consensusEngineServer,
final ApiConfiguration apiConfiguration,
final Optional<EnodeDnsConfiguration> enodeDnsConfiguration) {
final Optional<EnodeDnsConfiguration> enodeDnsConfiguration,
final TransactionSimulator transactionSimulator) {
final Map<String, JsonRpcMethod> enabled = new HashMap<>();
if (!rpcApis.isEmpty()) {
final JsonRpcMethod modules = new RpcModules(rpcApis);
@ -111,7 +113,7 @@ public class JsonRpcMethodsFactory {
transactionPool,
synchronizer,
dataDir,
apiConfiguration),
transactionSimulator),
new EeaJsonRpcMethods(
blockchainQueries, protocolSchedule, transactionPool, privacyParameters),
new ExecutionEngineJsonRpcMethods(
@ -131,7 +133,8 @@ public class JsonRpcMethodsFactory {
transactionPool,
miningCoordinator,
supportedCapabilities,
apiConfiguration),
apiConfiguration,
transactionSimulator),
new NetJsonRpcMethods(
p2pNetwork,
networkId,
@ -155,6 +158,7 @@ public class JsonRpcMethodsFactory {
protocolSchedule,
protocolContext,
apiConfiguration,
transactionSimulator,
metricsSystem),
new TxPoolJsonRpcMethods(transactionPool),
new PluginsJsonRpcMethods(namedPlugins));

@ -41,6 +41,7 @@ public class TraceJsonRpcMethods extends ApiGroupJsonRpcMethods {
private final ProtocolSchedule protocolSchedule;
private final ApiConfiguration apiConfiguration;
private final ProtocolContext protocolContext;
private final TransactionSimulator transactionSimulator;
private final MetricsSystem metricsSystem;
TraceJsonRpcMethods(
@ -48,11 +49,13 @@ public class TraceJsonRpcMethods extends ApiGroupJsonRpcMethods {
final ProtocolSchedule protocolSchedule,
final ProtocolContext protocolContext,
final ApiConfiguration apiConfiguration,
final TransactionSimulator transactionSimulator,
final MetricsSystem metricsSystem) {
this.blockchainQueries = blockchainQueries;
this.protocolSchedule = protocolSchedule;
this.protocolContext = protocolContext;
this.apiConfiguration = apiConfiguration;
this.transactionSimulator = transactionSimulator;
this.metricsSystem = metricsSystem;
}
@ -76,29 +79,8 @@ public class TraceJsonRpcMethods extends ApiGroupJsonRpcMethods {
new TraceTransaction(
() -> new BlockTracer(blockReplay), protocolSchedule, blockchainQueries),
new TraceBlock(protocolSchedule, blockchainQueries, metricsSystem),
new TraceCall(
blockchainQueries,
protocolSchedule,
new TransactionSimulator(
blockchainQueries.getBlockchain(),
blockchainQueries.getWorldStateArchive(),
protocolSchedule,
apiConfiguration.getGasCap())),
new TraceCallMany(
blockchainQueries,
protocolSchedule,
new TransactionSimulator(
blockchainQueries.getBlockchain(),
blockchainQueries.getWorldStateArchive(),
protocolSchedule,
apiConfiguration.getGasCap())),
new TraceRawTransaction(
protocolSchedule,
blockchainQueries,
new TransactionSimulator(
blockchainQueries.getBlockchain(),
blockchainQueries.getWorldStateArchive(),
protocolSchedule,
apiConfiguration.getGasCap())));
new TraceCall(blockchainQueries, protocolSchedule, transactionSimulator),
new TraceCallMany(blockchainQueries, protocolSchedule, transactionSimulator),
new TraceRawTransaction(protocolSchedule, blockchainQueries, transactionSimulator));
}
}

@ -38,6 +38,7 @@ import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.plugin.data.SyncStatus;
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat;
@ -135,6 +136,13 @@ public abstract class AbstractEthGraphQLHttpServiceTest {
final GraphQLDataFetchers dataFetchers = new GraphQLDataFetchers(supportedCapabilities);
final GraphQL graphQL = GraphQLProvider.buildGraphQL(dataFetchers);
final var transactionSimulator =
new TransactionSimulator(
blockchain,
blockchainSetupUtil.getWorldArchive(),
blockchainSetupUtil.getProtocolSchedule(),
0L);
service =
new GraphQLHttpService(
vertx,
@ -152,8 +160,8 @@ public abstract class AbstractEthGraphQLHttpServiceTest {
miningCoordinatorMock,
GraphQLContextType.SYNCHRONIZER,
synchronizerMock,
GraphQLContextType.GAS_CAP,
0L),
GraphQLContextType.TRANSACTION_SIMULATOR,
transactionSimulator),
mock(EthScheduler.class));
service.start().join();

@ -46,6 +46,7 @@ import org.hyperledger.besu.ethereum.mainnet.ValidationResult;
import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -169,6 +170,13 @@ public abstract class AbstractJsonRpcHttpServiceTest {
final NatService natService = new NatService(Optional.empty());
final var transactionSimulator =
new TransactionSimulator(
blockchainSetupUtil.getBlockchain(),
blockchainSetupUtil.getWorldArchive(),
blockchainSetupUtil.getProtocolSchedule(),
0L);
return new JsonRpcMethodsFactory()
.methods(
CLIENT_NODE_NAME,
@ -201,7 +209,8 @@ public abstract class AbstractJsonRpcHttpServiceTest {
mock(EthPeers.class),
syncVertx,
mock(ApiConfiguration.class),
Optional.empty());
Optional.empty(),
transactionSimulator);
}
protected void startService() throws Exception {

@ -41,6 +41,7 @@ import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.permissioning.AccountLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -138,7 +139,8 @@ public class JsonRpcHttpServiceHostAllowlistTest {
mock(EthPeers.class),
vertx,
mock(ApiConfiguration.class),
Optional.empty());
Optional.empty(),
mock(TransactionSimulator.class));
service = createJsonRpcHttpService();
service.start().join();

@ -46,6 +46,7 @@ import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -169,7 +170,8 @@ public class JsonRpcHttpServiceLoginTest {
mock(EthPeers.class),
vertx,
mock(ApiConfiguration.class),
Optional.empty());
Optional.empty(),
mock(TransactionSimulator.class));
service = createJsonRpcHttpService();
jwtAuth = service.authenticationService.get().getJwtAuthProvider();
service.start().join();

@ -51,6 +51,7 @@ import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.permissioning.AccountLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -235,7 +236,8 @@ public class JsonRpcHttpServiceRpcApisTest {
mock(EthPeers.class),
vertx,
mock(ApiConfiguration.class),
Optional.empty());
Optional.empty(),
mock(TransactionSimulator.class));
final JsonRpcHttpService jsonRpcHttpService =
new JsonRpcHttpService(
vertx,
@ -346,7 +348,8 @@ public class JsonRpcHttpServiceRpcApisTest {
mock(EthPeers.class),
vertx,
mock(ApiConfiguration.class),
Optional.empty());
Optional.empty(),
mock(TransactionSimulator.class));
final JsonRpcHttpService jsonRpcHttpService =
new JsonRpcHttpService(
vertx,

@ -41,6 +41,7 @@ import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.permissioning.AccountLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
@ -147,7 +148,8 @@ public class JsonRpcHttpServiceTestBase {
ethPeersMock,
vertx,
mock(ApiConfiguration.class),
Optional.empty());
Optional.empty(),
mock(TransactionSimulator.class));
disabledRpcMethods = new HashMap<>();
addedRpcMethods = new HashSet<>();

@ -48,6 +48,7 @@ import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.permissioning.AccountLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -152,7 +153,8 @@ public class JsonRpcHttpServiceTlsClientAuthTest {
mock(EthPeers.class),
vertx,
mock(ApiConfiguration.class),
Optional.empty());
Optional.empty(),
mock(TransactionSimulator.class));
System.setProperty("javax.net.ssl.trustStore", CLIENT_AS_CA_CERT.getKeyStoreFile().toString());
System.setProperty(

@ -47,6 +47,7 @@ import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.permissioning.AccountLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -140,7 +141,8 @@ class JsonRpcHttpServiceTlsMisconfigurationTest {
mock(EthPeers.class),
vertx,
mock(ApiConfiguration.class),
Optional.empty());
Optional.empty(),
mock(TransactionSimulator.class));
}
@AfterEach

@ -47,6 +47,7 @@ import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.permissioning.AccountLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.permissioning.NodeLocalConfigPermissioningController;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -141,7 +142,8 @@ public class JsonRpcHttpServiceTlsTest {
mock(EthPeers.class),
vertx,
mock(ApiConfiguration.class),
Optional.empty());
Optional.empty(),
mock(TransactionSimulator.class));
service = createJsonRpcHttpService(createJsonRpcConfig());
service.start().join();
baseUrl = service.url();

@ -54,6 +54,7 @@ import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.p2p.network.P2PNetwork;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.hyperledger.besu.ethereum.transaction.TransactionSimulator;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.nat.NatService;
@ -205,7 +206,8 @@ public class WebSocketServiceLoginTest {
mock(EthPeers.class),
vertx,
mock(ApiConfiguration.class),
Optional.empty()));
Optional.empty(),
mock(TransactionSimulator.class)));
websocketMethods.putAll(rpcMethods);
webSocketMessageHandlerSpy =

Loading…
Cancel
Save