Search in sources :

Example 1 with MessageCallProcessor

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

use of org.hyperledger.besu.evm.processor.MessageCallProcessor 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 3 with MessageCallProcessor

use of org.hyperledger.besu.evm.processor.MessageCallProcessor 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)

Example 4 with MessageCallProcessor

use of org.hyperledger.besu.evm.processor.MessageCallProcessor 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)

Example 5 with MessageCallProcessor

use of org.hyperledger.besu.evm.processor.MessageCallProcessor in project besu by hyperledger.

the class TestCodeExecutor method executeCode.

public MessageFrame executeCode(final String codeHexString, final long gasLimit, final Consumer<MutableAccount> accountSetup) {
    final ProtocolSpec protocolSpec = fixture.getProtocolSchedule().getByBlockNumber(0);
    final WorldUpdater worldUpdater = createInitialWorldState(accountSetup, fixture.getStateArchive());
    final Deque<MessageFrame> messageFrameStack = new ArrayDeque<>();
    final EVM evm = protocolSpec.getEvm();
    final MessageCallProcessor messageCallProcessor = new MessageCallProcessor(evm, new PrecompileContractRegistry());
    final Bytes codeBytes = Bytes.fromHexString(codeHexString);
    final Code code = evm.getCode(Hash.hash(codeBytes), codeBytes);
    final Transaction transaction = Transaction.builder().type(TransactionType.FRONTIER).value(Wei.ZERO).sender(SENDER_ADDRESS).signature(SignatureAlgorithmFactory.getInstance().createSignature(BigInteger.ONE, BigInteger.TEN, (byte) 1)).gasLimit(gasLimit).to(SENDER_ADDRESS).payload(Bytes.EMPTY).gasPrice(Wei.ZERO).nonce(0).build();
    final MessageFrame initialFrame = new MessageFrameTestFixture().messageFrameStack(messageFrameStack).blockchain(fixture.getBlockchain()).worldUpdater(worldUpdater).initialGas(gasLimit).address(SENDER_ADDRESS).originator(SENDER_ADDRESS).contract(SENDER_ADDRESS).gasPrice(transaction.getGasPrice().get()).inputData(transaction.getPayload()).sender(SENDER_ADDRESS).value(transaction.getValue()).code(code).blockHeader(blockHeader).depth(0).build();
    messageFrameStack.addFirst(initialFrame);
    while (!messageFrameStack.isEmpty()) {
        messageCallProcessor.process(messageFrameStack.peekFirst(), OperationTracer.NO_TRACING);
    }
    return initialFrame;
}
Also used : MessageCallProcessor(org.hyperledger.besu.evm.processor.MessageCallProcessor) Bytes(org.apache.tuweni.bytes.Bytes) ProtocolSpec(org.hyperledger.besu.ethereum.mainnet.ProtocolSpec) WorldUpdater(org.hyperledger.besu.evm.worldstate.WorldUpdater) MessageFrame(org.hyperledger.besu.evm.frame.MessageFrame) EVM(org.hyperledger.besu.evm.EVM) PrecompileContractRegistry(org.hyperledger.besu.evm.precompile.PrecompileContractRegistry) Code(org.hyperledger.besu.evm.Code) ArrayDeque(java.util.ArrayDeque)

Aggregations

MessageFrame (org.hyperledger.besu.evm.frame.MessageFrame)8 MessageCallProcessor (org.hyperledger.besu.evm.processor.MessageCallProcessor)7 List (java.util.List)6 Wei (org.hyperledger.besu.datatypes.Wei)6 Optional (java.util.Optional)5 Set (java.util.Set)5 Address (org.hyperledger.besu.datatypes.Address)5 MainnetEVMs (org.hyperledger.besu.evm.MainnetEVMs)5 MaxCodeSizeRule (org.hyperledger.besu.evm.contractvalidation.MaxCodeSizeRule)5 PrefixCodeRule (org.hyperledger.besu.evm.contractvalidation.PrefixCodeRule)5 ContractCreationProcessor (org.hyperledger.besu.evm.processor.ContractCreationProcessor)5 WorldUpdater (org.hyperledger.besu.evm.worldstate.WorldUpdater)5 IOException (java.io.IOException)4 BigInteger (java.math.BigInteger)4 StandardCharsets (java.nio.charset.StandardCharsets)4 ArrayDeque (java.util.ArrayDeque)4 Collections (java.util.Collections)4 OptionalInt (java.util.OptionalInt)4 PowAlgorithm (org.hyperledger.besu.config.PowAlgorithm)4 BlockHeader (org.hyperledger.besu.ethereum.core.BlockHeader)4