Search in sources :

Example 1 with CfgFork

use of org.aion.zero.impl.config.CfgFork in project aion by aionnetwork.

the class BulkExecutor method executeNextBatchOfPrecompiledTransactions.

/**
 * Returns the execution summaries of the next batch of precompiled contract call transactions
 * to be run. This batch of transactions begins with the transaction at index {@code
 * currentIndex} in the provided list of transactions and includes all subsequent transactions
 * that are precompiled-bound.
 */
private static List<AionTxExecSummary> executeNextBatchOfPrecompiledTransactions(RepositoryCache repository, List<AionTransaction> transactions, int currentIndex, long blockNumber, AionAddress blockCoinbase, PostExecutionWork postExecutionWork, Logger logger, boolean checkBlockEnergyLimit, boolean incrementSenderNonce, boolean isLocalCall, long blockRemainingEnergy) {
    // Grab the next batch of precompiled contract call transactions to execute.
    List<AionTransaction> precompiledTransactionsToExecute = fetchNextBatchOfPrecompiledContractCallTransactions(transactions, currentIndex);
    AionTransaction[] precompiledTransactions = new AionTransaction[precompiledTransactionsToExecute.size()];
    precompiledTransactionsToExecute.toArray(precompiledTransactions);
    CfgFork cfg = new CfgFork();
    String forkProperty = cfg.getProperties().getProperty("fork0.3.2");
    boolean fork032Enabled = (forkProperty != null) && (blockNumber >= Long.valueOf(forkProperty));
    // Execute the precompiled contract call transactions.
    return PrecompiledTransactionExecutor.executeTransactions(repository, blockNumber, blockCoinbase, precompiledTransactions, postExecutionWork, logger, checkBlockEnergyLimit, incrementSenderNonce, isLocalCall, fork032Enabled, blockRemainingEnergy);
}
Also used : AionTransaction(org.aion.base.AionTransaction) CfgFork(org.aion.zero.impl.config.CfgFork)

Example 2 with CfgFork

use of org.aion.zero.impl.config.CfgFork in project aion by aionnetwork.

the class ExternalStateForFvm method runInternalPrecompiledContractCall.

/**
 * Executes an internal precompiled contract call and returns the result.
 *
 * @param context The context of the internal transaction.
 * @return the execution result.
 */
@Override
public FastVmTransactionResult runInternalPrecompiledContractCall(ExecutionContext context) {
    PrecompiledTransactionContext precompiledContext = toPrecompiledTransactionContext(context);
    CfgFork cfg = new CfgFork();
    String forkProperty = cfg.getProperties().getProperty("fork0.3.2");
    boolean fork032Enabled = (forkProperty != null) && (blockNumber >= Long.valueOf(forkProperty));
    IExternalStateForPrecompiled precompiledWorldState = new ExternalStateForPrecompiled(this.repository, this.blockNumber, this.isLocalCall, fork032Enabled, this.allowNonceIncrement);
    PrecompiledTransactionResult result = ContractExecutor.executeInternalCall(new ExternalCapabilitiesForPrecompiled(), precompiledWorldState, precompiledContext, context.getTransactionData(), context.getTransactionEnergy());
    return precompiledToFvmResult(result);
}
Also used : PrecompiledTransactionResult(org.aion.precompiled.PrecompiledTransactionResult) IExternalStateForPrecompiled(org.aion.precompiled.type.IExternalStateForPrecompiled) PrecompiledTransactionContext(org.aion.precompiled.type.PrecompiledTransactionContext) ExternalCapabilitiesForPrecompiled(org.aion.zero.impl.vm.precompiled.ExternalCapabilitiesForPrecompiled) CfgFork(org.aion.zero.impl.config.CfgFork) IExternalStateForPrecompiled(org.aion.precompiled.type.IExternalStateForPrecompiled) ExternalStateForPrecompiled(org.aion.zero.impl.vm.precompiled.ExternalStateForPrecompiled)

Aggregations

CfgFork (org.aion.zero.impl.config.CfgFork)2 AionTransaction (org.aion.base.AionTransaction)1 PrecompiledTransactionResult (org.aion.precompiled.PrecompiledTransactionResult)1 IExternalStateForPrecompiled (org.aion.precompiled.type.IExternalStateForPrecompiled)1 PrecompiledTransactionContext (org.aion.precompiled.type.PrecompiledTransactionContext)1 ExternalCapabilitiesForPrecompiled (org.aion.zero.impl.vm.precompiled.ExternalCapabilitiesForPrecompiled)1 ExternalStateForPrecompiled (org.aion.zero.impl.vm.precompiled.ExternalStateForPrecompiled)1