Search in sources :

Example 1 with EvmConfiguration

use of org.hyperledger.besu.evm.internal.EvmConfiguration in project besu by hyperledger.

the class BaseBftProtocolSchedule method createProtocolSchedule.

public ProtocolSchedule createProtocolSchedule(final GenesisConfigOptions config, final ForksSchedule<? extends BftConfigOptions> forksSchedule, final PrivacyParameters privacyParameters, final boolean isRevertReasonEnabled, final BftExtraDataCodec bftExtraDataCodec, final EvmConfiguration evmConfiguration) {
    final Map<Long, Function<ProtocolSpecBuilder, ProtocolSpecBuilder>> specMap = new HashMap<>();
    forksSchedule.getForks().forEach(forkSpec -> specMap.put(forkSpec.getBlock(), builder -> applyBftChanges(builder, forkSpec.getValue(), config.isQuorum(), bftExtraDataCodec)));
    final ProtocolSpecAdapters specAdapters = new ProtocolSpecAdapters(specMap);
    return new ProtocolScheduleBuilder(config, DEFAULT_CHAIN_ID, specAdapters, privacyParameters, isRevertReasonEnabled, config.isQuorum(), evmConfiguration).createProtocolSchedule();
}
Also used : MainnetProtocolSpecs(org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSpecs) ProtocolSpecBuilder(org.hyperledger.besu.ethereum.mainnet.ProtocolSpecBuilder) ProtocolSpecAdapters(org.hyperledger.besu.ethereum.mainnet.ProtocolSpecAdapters) ProtocolScheduleBuilder(org.hyperledger.besu.ethereum.mainnet.ProtocolScheduleBuilder) FeeMarket(org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket) HashMap(java.util.HashMap) GenesisConfigOptions(org.hyperledger.besu.config.GenesisConfigOptions) EvmConfiguration(org.hyperledger.besu.evm.internal.EvmConfiguration) Function(java.util.function.Function) ProtocolSchedule(org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule) BftConfigOptions(org.hyperledger.besu.config.BftConfigOptions) MainnetBlockBodyValidator(org.hyperledger.besu.ethereum.mainnet.MainnetBlockBodyValidator) MainnetBlockImporter(org.hyperledger.besu.ethereum.mainnet.MainnetBlockImporter) ForksSchedule(org.hyperledger.besu.consensus.common.ForksSchedule) BlockHeaderValidator(org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator) Map(java.util.Map) Wei(org.hyperledger.besu.datatypes.Wei) BigInteger(java.math.BigInteger) PrivacyParameters(org.hyperledger.besu.ethereum.core.PrivacyParameters) Function(java.util.function.Function) HashMap(java.util.HashMap) ProtocolSpecAdapters(org.hyperledger.besu.ethereum.mainnet.ProtocolSpecAdapters) ProtocolScheduleBuilder(org.hyperledger.besu.ethereum.mainnet.ProtocolScheduleBuilder)

Example 2 with EvmConfiguration

use of org.hyperledger.besu.evm.internal.EvmConfiguration in project besu by hyperledger.

the class MainnetProtocolSpecs method londonDefinition.

static ProtocolSpecBuilder londonDefinition(final Optional<BigInteger> chainId, final OptionalInt configContractSizeLimit, final OptionalInt configStackSizeLimit, final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final boolean quorumCompatibilityMode, final EvmConfiguration evmConfiguration) {
    final int contractSizeLimit = configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
    final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);
    final long londonForkBlockNumber = genesisConfigOptions.getLondonBlockNumber().orElse(Long.MAX_VALUE);
    final BaseFeeMarket londonFeeMarket = FeeMarket.london(londonForkBlockNumber, genesisConfigOptions.getBaseFeePerGas());
    return berlinDefinition(chainId, configContractSizeLimit, configStackSizeLimit, enableRevertReason, quorumCompatibilityMode, evmConfiguration).gasCalculator(LondonGasCalculator::new).gasLimitCalculator(new LondonTargetingGasLimitCalculator(londonForkBlockNumber, londonFeeMarket)).transactionValidatorBuilder(gasCalculator -> new MainnetTransactionValidator(gasCalculator, londonFeeMarket, true, chainId, Set.of(TransactionType.FRONTIER, TransactionType.ACCESS_LIST, TransactionType.EIP1559), quorumCompatibilityMode)).transactionProcessorBuilder((gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor) -> new MainnetTransactionProcessor(gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor, true, stackSizeLimit, londonFeeMarket, CoinbaseFeePriceCalculator.eip1559())).contractCreationProcessorBuilder((gasCalculator, evm) -> new ContractCreationProcessor(gasCalculator, evm, true, List.of(MaxCodeSizeRule.of(contractSizeLimit), PrefixCodeRule.of()), 1, SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES)).evmBuilder((gasCalculator, jdCacheConfig) -> MainnetEVMs.london(gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration)).feeMarket(londonFeeMarket).difficultyCalculator(MainnetDifficultyCalculators.LONDON).blockHeaderValidatorBuilder(feeMarket -> MainnetBlockHeaderValidator.createBaseFeeMarketValidator(londonFeeMarket)).ommerHeaderValidatorBuilder(feeMarket -> MainnetBlockHeaderValidator.createBaseFeeMarketOmmerValidator(londonFeeMarket)).blockBodyValidatorBuilder(BaseFeeBlockBodyValidator::new).name(LONDON_FORK_NAME);
}
Also used : BaseFeeMarket(org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket) WorldUpdater(org.hyperledger.besu.evm.worldstate.WorldUpdater) GoQuorumBlockProcessor(org.hyperledger.besu.ethereum.goquorum.GoQuorumBlockProcessor) PowAlgorithm(org.hyperledger.besu.config.PowAlgorithm) FeeMarket(org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket) GenesisConfigOptions(org.hyperledger.besu.config.GenesisConfigOptions) ByzantiumGasCalculator(org.hyperledger.besu.evm.gascalculator.ByzantiumGasCalculator) BlockValidatorBuilder(org.hyperledger.besu.ethereum.mainnet.ProtocolSpecBuilder.BlockValidatorBuilder) BlockProcessorBuilder(org.hyperledger.besu.ethereum.mainnet.ProtocolSpecBuilder.BlockProcessorBuilder) TransactionReceipt(org.hyperledger.besu.ethereum.core.TransactionReceipt) MainnetEVMs(org.hyperledger.besu.evm.MainnetEVMs) TangerineWhistleGasCalculator(org.hyperledger.besu.evm.gascalculator.TangerineWhistleGasCalculator) BigInteger(java.math.BigInteger) HomesteadGasCalculator(org.hyperledger.besu.evm.gascalculator.HomesteadGasCalculator) ImmutableSet(com.google.common.collect.ImmutableSet) Blockchain(org.hyperledger.besu.ethereum.chain.Blockchain) CoinbaseFeePriceCalculator(org.hyperledger.besu.ethereum.core.feemarket.CoinbaseFeePriceCalculator) Set(java.util.Set) EvmConfiguration(org.hyperledger.besu.evm.internal.EvmConfiguration) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) TransactionProcessingResult(org.hyperledger.besu.ethereum.processing.TransactionProcessingResult) List(java.util.List) IstanbulGasCalculator(org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator) MutableAccount(org.hyperledger.besu.evm.account.MutableAccount) Optional(java.util.Optional) ContractCreationProcessor(org.hyperledger.besu.evm.processor.ContractCreationProcessor) TransactionType(org.hyperledger.besu.plugin.data.TransactionType) PrefixCodeRule(org.hyperledger.besu.evm.contractvalidation.PrefixCodeRule) IntStream(java.util.stream.IntStream) MessageCallProcessor(org.hyperledger.besu.evm.processor.MessageCallProcessor) PrivateTransactionValidator(org.hyperledger.besu.ethereum.privacy.PrivateTransactionValidator) Address(org.hyperledger.besu.datatypes.Address) OptionalInt(java.util.OptionalInt) MaxCodeSizeRule(org.hyperledger.besu.evm.contractvalidation.MaxCodeSizeRule) FrontierGasCalculator(org.hyperledger.besu.evm.gascalculator.FrontierGasCalculator) BaseFeeMarket(org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket) Wei(org.hyperledger.besu.datatypes.Wei) LondonGasCalculator(org.hyperledger.besu.evm.gascalculator.LondonGasCalculator) PetersburgGasCalculator(org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator) PrivateMetadataUpdater(org.hyperledger.besu.ethereum.privacy.storage.PrivateMetadataUpdater) WorldState(org.hyperledger.besu.evm.worldstate.WorldState) GoQuorumBlockValidator(org.hyperledger.besu.ethereum.goquorum.GoQuorumBlockValidator) Resources(com.google.common.io.Resources) BlockHeader(org.hyperledger.besu.ethereum.core.BlockHeader) MutableWorldState(org.hyperledger.besu.ethereum.core.MutableWorldState) IOException(java.io.IOException) PrivateTransactionProcessor(org.hyperledger.besu.ethereum.privacy.PrivateTransactionProcessor) JsonArray(io.vertx.core.json.JsonArray) MainnetBlockValidator(org.hyperledger.besu.ethereum.MainnetBlockValidator) SpuriousDragonGasCalculator(org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator) BerlinGasCalculator(org.hyperledger.besu.evm.gascalculator.BerlinGasCalculator) ConstantinopleGasCalculator(org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator) MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) Transaction(org.hyperledger.besu.ethereum.core.Transaction) Collections(java.util.Collections) ContractCreationProcessor(org.hyperledger.besu.evm.processor.ContractCreationProcessor)

Example 3 with EvmConfiguration

use of org.hyperledger.besu.evm.internal.EvmConfiguration in project besu by hyperledger.

the class ThreadBesuNodeRunner method startNode.

@Override
public void startNode(final BesuNode node) {
    if (MDC.get("node") != null) {
        LOG.error("ThreadContext node is already set to {}", MDC.get("node"));
    }
    MDC.put("node", node.getName());
    if (!node.getRunCommand().isEmpty()) {
        throw new UnsupportedOperationException("commands are not supported with thread runner");
    }
    final StorageServiceImpl storageService = new StorageServiceImpl();
    final SecurityModuleServiceImpl securityModuleService = new SecurityModuleServiceImpl();
    final Path dataDir = node.homeDirectory();
    final BesuConfiguration commonPluginConfiguration = new BesuConfigurationImpl(dataDir, dataDir.resolve(DATABASE_PATH));
    final BesuPluginContextImpl besuPluginContext = besuPluginContextMap.computeIfAbsent(node, n -> buildPluginContext(node, storageService, securityModuleService, commonPluginConfiguration));
    final ObservableMetricsSystem metricsSystem = MetricsSystemFactory.create(node.getMetricsConfiguration());
    final List<EnodeURL> bootnodes = node.getConfiguration().getBootnodes().stream().map(EnodeURLImpl::fromURI).collect(Collectors.toList());
    final NetworkName network = node.getNetwork() == null ? NetworkName.DEV : node.getNetwork();
    final EthNetworkConfig.Builder networkConfigBuilder = new EthNetworkConfig.Builder(EthNetworkConfig.getNetworkConfig(network)).setBootNodes(bootnodes);
    node.getConfiguration().getGenesisConfig().ifPresent(networkConfigBuilder::setGenesisConfig);
    final EthNetworkConfig ethNetworkConfig = networkConfigBuilder.build();
    final BesuControllerBuilder builder = new BesuController.Builder().fromEthNetworkConfig(ethNetworkConfig);
    final KeyValueStorageProvider storageProvider = new KeyValueStorageProviderBuilder().withStorageFactory(storageService.getByName("rocksdb").get()).withCommonConfiguration(commonPluginConfiguration).withMetricsSystem(metricsSystem).build();
    final TransactionPoolConfiguration txPoolConfig = ImmutableTransactionPoolConfiguration.builder().strictTransactionReplayProtectionEnabled(node.isStrictTxReplayProtectionEnabled()).build();
    final int maxPeers = 25;
    builder.synchronizerConfiguration(new SynchronizerConfiguration.Builder().build()).dataDirectory(node.homeDirectory()).miningParameters(node.getMiningParameters()).privacyParameters(node.getPrivacyParameters()).nodeKey(new NodeKey(new KeyPairSecurityModule(KeyPairUtil.loadKeyPair(dataDir)))).metricsSystem(metricsSystem).transactionPoolConfiguration(txPoolConfig).ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()).clock(Clock.systemUTC()).isRevertReasonEnabled(node.isRevertReasonEnabled()).storageProvider(storageProvider).gasLimitCalculator(GasLimitCalculator.constant()).pkiBlockCreationConfiguration(node.getPkiKeyStoreConfiguration().map(pkiConfig -> new PkiBlockCreationConfigurationProvider().load(pkiConfig))).evmConfiguration(EvmConfiguration.DEFAULT).maxPeers(maxPeers);
    node.getGenesisConfig().map(GenesisConfigFile::fromConfig).ifPresent(builder::genesisConfigFile);
    final BesuController besuController = builder.build();
    final RunnerBuilder runnerBuilder = new RunnerBuilder();
    runnerBuilder.permissioningConfiguration(node.getPermissioningConfiguration());
    final Runner runner = runnerBuilder.vertx(Vertx.vertx()).besuController(besuController).ethNetworkConfig(ethNetworkConfig).discovery(node.isDiscoveryEnabled()).p2pAdvertisedHost(node.getHostName()).p2pListenPort(0).maxPeers(maxPeers).networkingConfiguration(node.getNetworkingConfiguration()).jsonRpcConfiguration(node.jsonRpcConfiguration()).webSocketConfiguration(node.webSocketConfiguration()).jsonRpcIpcConfiguration(node.jsonRpcIpcConfiguration()).dataDir(node.homeDirectory()).metricsSystem(metricsSystem).permissioningService(new PermissioningServiceImpl()).metricsConfiguration(node.getMetricsConfiguration()).p2pEnabled(node.isP2pEnabled()).p2pTLSConfiguration(node.getTLSConfiguration()).graphQLConfiguration(GraphQLConfiguration.createDefault()).staticNodes(node.getStaticNodes().stream().map(EnodeURLImpl::fromString).collect(Collectors.toList())).besuPluginContext(new BesuPluginContextImpl()).autoLogBloomCaching(false).storageProvider(storageProvider).forkIdSupplier(() -> besuController.getProtocolManager().getForkIdAsBytesList()).rpcEndpointService(new RpcEndpointServiceImpl()).build();
    besuPluginContext.beforeExternalServices();
    runner.startExternalServices();
    besuPluginContext.addService(BesuEvents.class, new BesuEventsImpl(besuController.getProtocolContext().getBlockchain(), besuController.getProtocolManager().getBlockBroadcaster(), besuController.getTransactionPool(), besuController.getSyncState()));
    besuPluginContext.startPlugins();
    runner.startEthereumMainLoop();
    besuRunners.put(node.getName(), runner);
    MDC.remove("node");
}
Also used : BesuPluginContextImpl(org.hyperledger.besu.services.BesuPluginContextImpl) KeyPairUtil(org.hyperledger.besu.crypto.KeyPairUtil) EnodeURLImpl(org.hyperledger.besu.ethereum.p2p.peers.EnodeURLImpl) LoggerFactory(org.slf4j.LoggerFactory) RocksDBPlugin(org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin) Runner(org.hyperledger.besu.Runner) NetworkName(org.hyperledger.besu.cli.config.NetworkName) GenesisConfigFile(org.hyperledger.besu.config.GenesisConfigFile) Map(java.util.Map) BesuPluginContextImpl(org.hyperledger.besu.services.BesuPluginContextImpl) Path(java.nio.file.Path) CommandLine(picocli.CommandLine) SecurityModuleService(org.hyperledger.besu.plugin.services.SecurityModuleService) EthProtocolConfiguration(org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration) PkiBlockCreationConfigurationProvider(org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfigurationProvider) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) PicoCLIOptions(org.hyperledger.besu.plugin.services.PicoCLIOptions) DATABASE_PATH(org.hyperledger.besu.controller.BesuController.DATABASE_PATH) EvmConfiguration(org.hyperledger.besu.evm.internal.EvmConfiguration) Collectors(java.util.stream.Collectors) BesuConfigurationImpl(org.hyperledger.besu.services.BesuConfigurationImpl) List(java.util.List) TransactionPoolConfiguration(org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration) KeyValueStorageProvider(org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProvider) BesuConfiguration(org.hyperledger.besu.plugin.services.BesuConfiguration) BesuEventsImpl(org.hyperledger.besu.services.BesuEventsImpl) GasLimitCalculator(org.hyperledger.besu.ethereum.GasLimitCalculator) NodeKey(org.hyperledger.besu.crypto.NodeKey) BesuEvents(org.hyperledger.besu.plugin.services.BesuEvents) KeyPairSecurityModule(org.hyperledger.besu.crypto.KeyPairSecurityModule) ImmutableTransactionPoolConfiguration(org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration) EthNetworkConfig(org.hyperledger.besu.cli.config.EthNetworkConfig) BesuControllerBuilder(org.hyperledger.besu.controller.BesuControllerBuilder) HashMap(java.util.HashMap) SynchronizerConfiguration(org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration) RunnerBuilder(org.hyperledger.besu.RunnerBuilder) BesuController(org.hyperledger.besu.controller.BesuController) StorageService(org.hyperledger.besu.plugin.services.StorageService) HashSet(java.util.HashSet) PermissioningServiceImpl(org.hyperledger.besu.services.PermissioningServiceImpl) RpcEndpointServiceImpl(org.hyperledger.besu.services.RpcEndpointServiceImpl) Logger(org.slf4j.Logger) MetricsSystemFactory(org.hyperledger.besu.metrics.MetricsSystemFactory) SecurityModuleServiceImpl(org.hyperledger.besu.services.SecurityModuleServiceImpl) StorageServiceImpl(org.hyperledger.besu.services.StorageServiceImpl) KeyValueStorageProviderBuilder(org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProviderBuilder) Vertx(io.vertx.core.Vertx) GraphQLConfiguration(org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration) File(java.io.File) EnodeURL(org.hyperledger.besu.plugin.data.EnodeURL) PicoCLIOptionsImpl(org.hyperledger.besu.services.PicoCLIOptionsImpl) ObservableMetricsSystem(org.hyperledger.besu.metrics.ObservableMetricsSystem) MDC(org.slf4j.MDC) Clock(java.time.Clock) CommandSpec(picocli.CommandLine.Model.CommandSpec) Runner(org.hyperledger.besu.Runner) NetworkName(org.hyperledger.besu.cli.config.NetworkName) BesuController(org.hyperledger.besu.controller.BesuController) KeyValueStorageProvider(org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProvider) TransactionPoolConfiguration(org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration) ImmutableTransactionPoolConfiguration(org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration) BesuControllerBuilder(org.hyperledger.besu.controller.BesuControllerBuilder) RunnerBuilder(org.hyperledger.besu.RunnerBuilder) KeyValueStorageProviderBuilder(org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProviderBuilder) BesuEventsImpl(org.hyperledger.besu.services.BesuEventsImpl) BesuControllerBuilder(org.hyperledger.besu.controller.BesuControllerBuilder) KeyValueStorageProviderBuilder(org.hyperledger.besu.ethereum.storage.keyvalue.KeyValueStorageProviderBuilder) EnodeURL(org.hyperledger.besu.plugin.data.EnodeURL) RunnerBuilder(org.hyperledger.besu.RunnerBuilder) SecurityModuleServiceImpl(org.hyperledger.besu.services.SecurityModuleServiceImpl) NodeKey(org.hyperledger.besu.crypto.NodeKey) StorageServiceImpl(org.hyperledger.besu.services.StorageServiceImpl) Path(java.nio.file.Path) PkiBlockCreationConfigurationProvider(org.hyperledger.besu.consensus.qbft.pki.PkiBlockCreationConfigurationProvider) RpcEndpointServiceImpl(org.hyperledger.besu.services.RpcEndpointServiceImpl) BesuConfiguration(org.hyperledger.besu.plugin.services.BesuConfiguration) EnodeURLImpl(org.hyperledger.besu.ethereum.p2p.peers.EnodeURLImpl) PermissioningServiceImpl(org.hyperledger.besu.services.PermissioningServiceImpl) ObservableMetricsSystem(org.hyperledger.besu.metrics.ObservableMetricsSystem) KeyPairSecurityModule(org.hyperledger.besu.crypto.KeyPairSecurityModule) EthNetworkConfig(org.hyperledger.besu.cli.config.EthNetworkConfig) BesuConfigurationImpl(org.hyperledger.besu.services.BesuConfigurationImpl)

Example 4 with EvmConfiguration

use of org.hyperledger.besu.evm.internal.EvmConfiguration in project besu by hyperledger.

the class MainnetProtocolSpecs method frontierDefinition.

public static ProtocolSpecBuilder frontierDefinition(final OptionalInt configContractSizeLimit, final OptionalInt configStackSizeLimit, final boolean goQuorumMode, final EvmConfiguration evmConfiguration) {
    final int contractSizeLimit = configContractSizeLimit.orElse(FRONTIER_CONTRACT_SIZE_LIMIT);
    final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);
    return new ProtocolSpecBuilder().gasCalculator(FrontierGasCalculator::new).gasLimitCalculator(new FrontierTargetingGasLimitCalculator()).evmBuilder(MainnetEVMs::frontier).precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::frontier).messageCallProcessorBuilder(MessageCallProcessor::new).contractCreationProcessorBuilder((gasCalculator, evm) -> new ContractCreationProcessor(gasCalculator, evm, false, Collections.singletonList(MaxCodeSizeRule.of(contractSizeLimit)), 0)).transactionValidatorBuilder(gasCalculator -> new MainnetTransactionValidator(gasCalculator, false, Optional.empty(), goQuorumMode)).transactionProcessorBuilder((gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor) -> new MainnetTransactionProcessor(gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor, false, stackSizeLimit, FeeMarket.legacy(), CoinbaseFeePriceCalculator.frontier())).privateTransactionProcessorBuilder((gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor, privateTransactionValidator) -> new PrivateTransactionProcessor(gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor, false, stackSizeLimit, new PrivateTransactionValidator(Optional.empty()))).difficultyCalculator(MainnetDifficultyCalculators.FRONTIER).blockHeaderValidatorBuilder(feeMarket -> MainnetBlockHeaderValidator.create()).ommerHeaderValidatorBuilder(feeMarket -> MainnetBlockHeaderValidator.createLegacyFeeMarketOmmerValidator()).blockBodyValidatorBuilder(MainnetBlockBodyValidator::new).transactionReceiptFactory(MainnetProtocolSpecs::frontierTransactionReceiptFactory).blockReward(FRONTIER_BLOCK_REWARD).skipZeroBlockRewards(false).blockProcessorBuilder(MainnetProtocolSpecs.blockProcessorBuilder(goQuorumMode)).blockValidatorBuilder(MainnetProtocolSpecs.blockValidatorBuilder(goQuorumMode)).blockImporterBuilder(MainnetBlockImporter::new).blockHeaderFunctions(new MainnetBlockHeaderFunctions()).miningBeneficiaryCalculator(BlockHeader::getCoinbase).evmConfiguration(evmConfiguration).name("Frontier");
}
Also used : MessageCallProcessor(org.hyperledger.besu.evm.processor.MessageCallProcessor) WorldUpdater(org.hyperledger.besu.evm.worldstate.WorldUpdater) GoQuorumBlockProcessor(org.hyperledger.besu.ethereum.goquorum.GoQuorumBlockProcessor) PowAlgorithm(org.hyperledger.besu.config.PowAlgorithm) FeeMarket(org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket) GenesisConfigOptions(org.hyperledger.besu.config.GenesisConfigOptions) ByzantiumGasCalculator(org.hyperledger.besu.evm.gascalculator.ByzantiumGasCalculator) BlockValidatorBuilder(org.hyperledger.besu.ethereum.mainnet.ProtocolSpecBuilder.BlockValidatorBuilder) BlockProcessorBuilder(org.hyperledger.besu.ethereum.mainnet.ProtocolSpecBuilder.BlockProcessorBuilder) TransactionReceipt(org.hyperledger.besu.ethereum.core.TransactionReceipt) MainnetEVMs(org.hyperledger.besu.evm.MainnetEVMs) TangerineWhistleGasCalculator(org.hyperledger.besu.evm.gascalculator.TangerineWhistleGasCalculator) BigInteger(java.math.BigInteger) HomesteadGasCalculator(org.hyperledger.besu.evm.gascalculator.HomesteadGasCalculator) ImmutableSet(com.google.common.collect.ImmutableSet) Blockchain(org.hyperledger.besu.ethereum.chain.Blockchain) CoinbaseFeePriceCalculator(org.hyperledger.besu.ethereum.core.feemarket.CoinbaseFeePriceCalculator) Set(java.util.Set) EvmConfiguration(org.hyperledger.besu.evm.internal.EvmConfiguration) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) TransactionProcessingResult(org.hyperledger.besu.ethereum.processing.TransactionProcessingResult) List(java.util.List) IstanbulGasCalculator(org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator) MutableAccount(org.hyperledger.besu.evm.account.MutableAccount) Optional(java.util.Optional) ContractCreationProcessor(org.hyperledger.besu.evm.processor.ContractCreationProcessor) TransactionType(org.hyperledger.besu.plugin.data.TransactionType) PrefixCodeRule(org.hyperledger.besu.evm.contractvalidation.PrefixCodeRule) IntStream(java.util.stream.IntStream) MessageCallProcessor(org.hyperledger.besu.evm.processor.MessageCallProcessor) PrivateTransactionValidator(org.hyperledger.besu.ethereum.privacy.PrivateTransactionValidator) Address(org.hyperledger.besu.datatypes.Address) OptionalInt(java.util.OptionalInt) MaxCodeSizeRule(org.hyperledger.besu.evm.contractvalidation.MaxCodeSizeRule) FrontierGasCalculator(org.hyperledger.besu.evm.gascalculator.FrontierGasCalculator) BaseFeeMarket(org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket) Wei(org.hyperledger.besu.datatypes.Wei) LondonGasCalculator(org.hyperledger.besu.evm.gascalculator.LondonGasCalculator) PetersburgGasCalculator(org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator) PrivateMetadataUpdater(org.hyperledger.besu.ethereum.privacy.storage.PrivateMetadataUpdater) WorldState(org.hyperledger.besu.evm.worldstate.WorldState) GoQuorumBlockValidator(org.hyperledger.besu.ethereum.goquorum.GoQuorumBlockValidator) Resources(com.google.common.io.Resources) BlockHeader(org.hyperledger.besu.ethereum.core.BlockHeader) MutableWorldState(org.hyperledger.besu.ethereum.core.MutableWorldState) IOException(java.io.IOException) PrivateTransactionProcessor(org.hyperledger.besu.ethereum.privacy.PrivateTransactionProcessor) JsonArray(io.vertx.core.json.JsonArray) MainnetBlockValidator(org.hyperledger.besu.ethereum.MainnetBlockValidator) SpuriousDragonGasCalculator(org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator) BerlinGasCalculator(org.hyperledger.besu.evm.gascalculator.BerlinGasCalculator) ConstantinopleGasCalculator(org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator) MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) Transaction(org.hyperledger.besu.ethereum.core.Transaction) Collections(java.util.Collections) MainnetEVMs(org.hyperledger.besu.evm.MainnetEVMs) FrontierGasCalculator(org.hyperledger.besu.evm.gascalculator.FrontierGasCalculator) PrivateTransactionProcessor(org.hyperledger.besu.ethereum.privacy.PrivateTransactionProcessor) ContractCreationProcessor(org.hyperledger.besu.evm.processor.ContractCreationProcessor) PrivateTransactionValidator(org.hyperledger.besu.ethereum.privacy.PrivateTransactionValidator) BlockHeader(org.hyperledger.besu.ethereum.core.BlockHeader)

Example 5 with EvmConfiguration

use of org.hyperledger.besu.evm.internal.EvmConfiguration in project besu by hyperledger.

the class MainnetProtocolSpecs method spuriousDragonDefinition.

public static ProtocolSpecBuilder spuriousDragonDefinition(final Optional<BigInteger> chainId, final OptionalInt configContractSizeLimit, final OptionalInt configStackSizeLimit, final boolean quorumCompatibilityMode, final EvmConfiguration evmConfiguration) {
    final int contractSizeLimit = configContractSizeLimit.orElse(SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
    final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);
    return tangerineWhistleDefinition(OptionalInt.empty(), configStackSizeLimit, quorumCompatibilityMode, evmConfiguration).gasCalculator(SpuriousDragonGasCalculator::new).skipZeroBlockRewards(true).messageCallProcessorBuilder((evm, precompileContractRegistry) -> new MessageCallProcessor(evm, precompileContractRegistry, SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES)).contractCreationProcessorBuilder((gasCalculator, evm) -> new ContractCreationProcessor(gasCalculator, evm, true, Collections.singletonList(MaxCodeSizeRule.of(contractSizeLimit)), 1, SPURIOUS_DRAGON_FORCE_DELETE_WHEN_EMPTY_ADDRESSES)).transactionValidatorBuilder(gasCalculator -> new MainnetTransactionValidator(gasCalculator, true, chainId, quorumCompatibilityMode)).transactionProcessorBuilder((gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor) -> new MainnetTransactionProcessor(gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor, true, stackSizeLimit, FeeMarket.legacy(), CoinbaseFeePriceCalculator.frontier())).name("SpuriousDragon");
}
Also used : MessageCallProcessor(org.hyperledger.besu.evm.processor.MessageCallProcessor) WorldUpdater(org.hyperledger.besu.evm.worldstate.WorldUpdater) GoQuorumBlockProcessor(org.hyperledger.besu.ethereum.goquorum.GoQuorumBlockProcessor) PowAlgorithm(org.hyperledger.besu.config.PowAlgorithm) FeeMarket(org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket) GenesisConfigOptions(org.hyperledger.besu.config.GenesisConfigOptions) ByzantiumGasCalculator(org.hyperledger.besu.evm.gascalculator.ByzantiumGasCalculator) BlockValidatorBuilder(org.hyperledger.besu.ethereum.mainnet.ProtocolSpecBuilder.BlockValidatorBuilder) BlockProcessorBuilder(org.hyperledger.besu.ethereum.mainnet.ProtocolSpecBuilder.BlockProcessorBuilder) TransactionReceipt(org.hyperledger.besu.ethereum.core.TransactionReceipt) MainnetEVMs(org.hyperledger.besu.evm.MainnetEVMs) TangerineWhistleGasCalculator(org.hyperledger.besu.evm.gascalculator.TangerineWhistleGasCalculator) BigInteger(java.math.BigInteger) HomesteadGasCalculator(org.hyperledger.besu.evm.gascalculator.HomesteadGasCalculator) ImmutableSet(com.google.common.collect.ImmutableSet) Blockchain(org.hyperledger.besu.ethereum.chain.Blockchain) CoinbaseFeePriceCalculator(org.hyperledger.besu.ethereum.core.feemarket.CoinbaseFeePriceCalculator) Set(java.util.Set) EvmConfiguration(org.hyperledger.besu.evm.internal.EvmConfiguration) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) TransactionProcessingResult(org.hyperledger.besu.ethereum.processing.TransactionProcessingResult) List(java.util.List) IstanbulGasCalculator(org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator) MutableAccount(org.hyperledger.besu.evm.account.MutableAccount) Optional(java.util.Optional) ContractCreationProcessor(org.hyperledger.besu.evm.processor.ContractCreationProcessor) TransactionType(org.hyperledger.besu.plugin.data.TransactionType) PrefixCodeRule(org.hyperledger.besu.evm.contractvalidation.PrefixCodeRule) IntStream(java.util.stream.IntStream) MessageCallProcessor(org.hyperledger.besu.evm.processor.MessageCallProcessor) PrivateTransactionValidator(org.hyperledger.besu.ethereum.privacy.PrivateTransactionValidator) Address(org.hyperledger.besu.datatypes.Address) OptionalInt(java.util.OptionalInt) MaxCodeSizeRule(org.hyperledger.besu.evm.contractvalidation.MaxCodeSizeRule) FrontierGasCalculator(org.hyperledger.besu.evm.gascalculator.FrontierGasCalculator) BaseFeeMarket(org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket) Wei(org.hyperledger.besu.datatypes.Wei) LondonGasCalculator(org.hyperledger.besu.evm.gascalculator.LondonGasCalculator) PetersburgGasCalculator(org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator) PrivateMetadataUpdater(org.hyperledger.besu.ethereum.privacy.storage.PrivateMetadataUpdater) WorldState(org.hyperledger.besu.evm.worldstate.WorldState) GoQuorumBlockValidator(org.hyperledger.besu.ethereum.goquorum.GoQuorumBlockValidator) Resources(com.google.common.io.Resources) BlockHeader(org.hyperledger.besu.ethereum.core.BlockHeader) MutableWorldState(org.hyperledger.besu.ethereum.core.MutableWorldState) IOException(java.io.IOException) PrivateTransactionProcessor(org.hyperledger.besu.ethereum.privacy.PrivateTransactionProcessor) JsonArray(io.vertx.core.json.JsonArray) MainnetBlockValidator(org.hyperledger.besu.ethereum.MainnetBlockValidator) SpuriousDragonGasCalculator(org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator) BerlinGasCalculator(org.hyperledger.besu.evm.gascalculator.BerlinGasCalculator) ConstantinopleGasCalculator(org.hyperledger.besu.evm.gascalculator.ConstantinopleGasCalculator) MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) Transaction(org.hyperledger.besu.ethereum.core.Transaction) Collections(java.util.Collections) ContractCreationProcessor(org.hyperledger.besu.evm.processor.ContractCreationProcessor) SpuriousDragonGasCalculator(org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator)

Aggregations

EvmConfiguration (org.hyperledger.besu.evm.internal.EvmConfiguration)6 BigInteger (java.math.BigInteger)5 List (java.util.List)5 Wei (org.hyperledger.besu.datatypes.Wei)5 FeeMarket (org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket)5 Collections (java.util.Collections)4 Optional (java.util.Optional)4 OptionalInt (java.util.OptionalInt)4 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 GenesisConfigOptions (org.hyperledger.besu.config.GenesisConfigOptions)4 PowAlgorithm (org.hyperledger.besu.config.PowAlgorithm)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 Resources (com.google.common.io.Resources)3 JsonArray (io.vertx.core.json.JsonArray)3 IOException (java.io.IOException)3 StandardCharsets (java.nio.charset.StandardCharsets)3 IntStream (java.util.stream.IntStream)3 TransactionReceipt (org.hyperledger.besu.ethereum.core.TransactionReceipt)3 CoinbaseFeePriceCalculator (org.hyperledger.besu.ethereum.core.feemarket.CoinbaseFeePriceCalculator)3