Search in sources :

Example 1 with EstimateGasOperationTracer

use of org.hyperledger.besu.evm.tracing.EstimateGasOperationTracer in project besu by hyperledger.

the class EthEstimateGas method response.

@Override
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) {
    final JsonCallParameter callParams = validateAndGetCallParams(requestContext);
    final BlockHeader blockHeader = blockHeader();
    if (blockHeader == null) {
        return errorResponse(requestContext, JsonRpcError.INTERNAL_ERROR);
    }
    if (!blockchainQueries.getWorldStateArchive().isWorldStateAvailable(blockHeader.getStateRoot(), blockHeader.getHash())) {
        return errorResponse(requestContext, JsonRpcError.WORLD_STATE_UNAVAILABLE);
    }
    final CallParameter modifiedCallParams = overrideGasLimitAndPrice(callParams, blockHeader.getGasLimit());
    final EstimateGasOperationTracer operationTracer = new EstimateGasOperationTracer();
    return transactionSimulator.process(modifiedCallParams, ImmutableTransactionValidationParams.builder().from(TransactionValidationParams.transactionSimulator()).isAllowExceedingBalance(!callParams.isMaybeStrict().orElse(Boolean.FALSE)).build(), operationTracer, blockHeader.getNumber()).map(gasEstimateResponse(requestContext, operationTracer)).orElse(errorResponse(requestContext, JsonRpcError.INTERNAL_ERROR));
}
Also used : JsonCallParameter(org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonCallParameter) EstimateGasOperationTracer(org.hyperledger.besu.evm.tracing.EstimateGasOperationTracer) JsonCallParameter(org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonCallParameter) CallParameter(org.hyperledger.besu.ethereum.transaction.CallParameter) BlockHeader(org.hyperledger.besu.ethereum.core.BlockHeader)

Example 2 with EstimateGasOperationTracer

use of org.hyperledger.besu.evm.tracing.EstimateGasOperationTracer in project besu by hyperledger.

the class EstimateGasOperationTracerTest method setUp.

@Before
public void setUp() {
    operationTracer = new EstimateGasOperationTracer();
    messageFrameTestFixture = new MessageFrameTestFixture();
}
Also used : EstimateGasOperationTracer(org.hyperledger.besu.evm.tracing.EstimateGasOperationTracer) MessageFrameTestFixture(org.hyperledger.besu.ethereum.core.MessageFrameTestFixture) Before(org.junit.Before)

Aggregations

EstimateGasOperationTracer (org.hyperledger.besu.evm.tracing.EstimateGasOperationTracer)2 JsonCallParameter (org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.JsonCallParameter)1 BlockHeader (org.hyperledger.besu.ethereum.core.BlockHeader)1 MessageFrameTestFixture (org.hyperledger.besu.ethereum.core.MessageFrameTestFixture)1 CallParameter (org.hyperledger.besu.ethereum.transaction.CallParameter)1 Before (org.junit.Before)1