Search in sources :

Example 1 with MainnetEVMs

use of org.hyperledger.besu.evm.MainnetEVMs 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 2 with MainnetEVMs

use of org.hyperledger.besu.evm.MainnetEVMs in project besu by hyperledger.

the class ClassicProtocolSpecs method atlantisDefinition.

public static ProtocolSpecBuilder atlantisDefinition(final Optional<BigInteger> chainId, final OptionalInt configContractSizeLimit, final OptionalInt configStackSizeLimit, final boolean enableRevertReason, final OptionalLong ecip1017EraRounds, final boolean quorumCompatibilityMode, final EvmConfiguration evmConfiguration) {
    final int contractSizeLimit = configContractSizeLimit.orElse(MainnetProtocolSpecs.SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
    final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);
    return gothamDefinition(chainId, configContractSizeLimit, configStackSizeLimit, ecip1017EraRounds, quorumCompatibilityMode, evmConfiguration).evmBuilder(MainnetEVMs::byzantium).evmConfiguration(evmConfiguration).gasCalculator(SpuriousDragonGasCalculator::new).skipZeroBlockRewards(true).messageCallProcessorBuilder(MessageCallProcessor::new).precompileContractRegistryBuilder(MainnetPrecompiledContractRegistries::byzantium).difficultyCalculator(ClassicDifficultyCalculators.EIP100).transactionReceiptFactory(enableRevertReason ? ClassicProtocolSpecs::byzantiumTransactionReceiptFactoryWithReasonEnabled : ClassicProtocolSpecs::byzantiumTransactionReceiptFactory).contractCreationProcessorBuilder((gasCalculator, evm) -> new ContractCreationProcessor(gasCalculator, evm, true, Collections.singletonList(MaxCodeSizeRule.of(contractSizeLimit)), 1)).transactionProcessorBuilder((gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor) -> new MainnetTransactionProcessor(gasCalculator, transactionValidator, contractCreationProcessor, messageCallProcessor, true, stackSizeLimit, FeeMarket.legacy(), CoinbaseFeePriceCalculator.frontier())).name("Atlantis");
}
Also used : MessageCallProcessor(org.hyperledger.besu.evm.processor.MessageCallProcessor) MainnetProtocolSpecs.powHasher(org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSpecs.powHasher) PrefixCodeRule(org.hyperledger.besu.evm.contractvalidation.PrefixCodeRule) MessageCallProcessor(org.hyperledger.besu.evm.processor.MessageCallProcessor) PowAlgorithm(org.hyperledger.besu.config.PowAlgorithm) FeeMarket(org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket) OptionalInt(java.util.OptionalInt) MaxCodeSizeRule(org.hyperledger.besu.evm.contractvalidation.MaxCodeSizeRule) OptionalLong(java.util.OptionalLong) TransactionReceipt(org.hyperledger.besu.ethereum.core.TransactionReceipt) MainnetEVMs(org.hyperledger.besu.evm.MainnetEVMs) Wei(org.hyperledger.besu.datatypes.Wei) TangerineWhistleGasCalculator(org.hyperledger.besu.evm.gascalculator.TangerineWhistleGasCalculator) BigInteger(java.math.BigInteger) LondonGasCalculator(org.hyperledger.besu.evm.gascalculator.LondonGasCalculator) PetersburgGasCalculator(org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator) WorldState(org.hyperledger.besu.evm.worldstate.WorldState) CoinbaseFeePriceCalculator(org.hyperledger.besu.ethereum.core.feemarket.CoinbaseFeePriceCalculator) Set(java.util.Set) DieHardGasCalculator(org.hyperledger.besu.evm.gascalculator.DieHardGasCalculator) EvmConfiguration(org.hyperledger.besu.evm.internal.EvmConfiguration) TransactionProcessingResult(org.hyperledger.besu.ethereum.processing.TransactionProcessingResult) List(java.util.List) SpuriousDragonGasCalculator(org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator) IstanbulGasCalculator(org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator) BerlinGasCalculator(org.hyperledger.besu.evm.gascalculator.BerlinGasCalculator) Optional(java.util.Optional) MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) ContractCreationProcessor(org.hyperledger.besu.evm.processor.ContractCreationProcessor) TransactionType(org.hyperledger.besu.plugin.data.TransactionType) Collections(java.util.Collections) MainnetEVMs(org.hyperledger.besu.evm.MainnetEVMs) ContractCreationProcessor(org.hyperledger.besu.evm.processor.ContractCreationProcessor) SpuriousDragonGasCalculator(org.hyperledger.besu.evm.gascalculator.SpuriousDragonGasCalculator)

Aggregations

BigInteger (java.math.BigInteger)2 Collections (java.util.Collections)2 List (java.util.List)2 Optional (java.util.Optional)2 OptionalInt (java.util.OptionalInt)2 Set (java.util.Set)2 PowAlgorithm (org.hyperledger.besu.config.PowAlgorithm)2 Wei (org.hyperledger.besu.datatypes.Wei)2 TransactionReceipt (org.hyperledger.besu.ethereum.core.TransactionReceipt)2 CoinbaseFeePriceCalculator (org.hyperledger.besu.ethereum.core.feemarket.CoinbaseFeePriceCalculator)2 FeeMarket (org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket)2 TransactionProcessingResult (org.hyperledger.besu.ethereum.processing.TransactionProcessingResult)2 MainnetEVMs (org.hyperledger.besu.evm.MainnetEVMs)2 MaxCodeSizeRule (org.hyperledger.besu.evm.contractvalidation.MaxCodeSizeRule)2 PrefixCodeRule (org.hyperledger.besu.evm.contractvalidation.PrefixCodeRule)2 MessageFrame (org.hyperledger.besu.evm.frame.MessageFrame)2 BerlinGasCalculator (org.hyperledger.besu.evm.gascalculator.BerlinGasCalculator)2 IstanbulGasCalculator (org.hyperledger.besu.evm.gascalculator.IstanbulGasCalculator)2 LondonGasCalculator (org.hyperledger.besu.evm.gascalculator.LondonGasCalculator)2 PetersburgGasCalculator (org.hyperledger.besu.evm.gascalculator.PetersburgGasCalculator)2