@Override
  public OperationResult execute(final MessageFrame frame, final EVM evm) {
    final long dataLocation = clampedToLong(frame.popStackItem());
    final long numBytes = clampedToLong(frame.popStackItem());

    if (frame.isStatic()) {
      return new OperationResult(0, ExceptionalHaltReason.ILLEGAL_STATE_CHANGE);
    }

    final long cost = gasCalculator().logOperationGasCost(frame, dataLocation, numBytes, numTopics);
    if (frame.getRemainingGas() < cost) {
      return new OperationResult(cost, ExceptionalHaltReason.INSUFFICIENT_GAS);
    }

    final Address address = frame.getRecipientAddress();

    final Bytes data = frame.readMemory(dataLocation, numBytes);

    final ImmutableList.Builder<LogTopic> builder =
        ImmutableList.builderWithExpectedSize(numTopics);
    for (int i = 0; i < numTopics; i++) {
      builder.add(LogTopic.create(leftPad(frame.popStackItem())));
    }

    frame.addLog(new Log(address, data, builder.build()));
    return new OperationResult(cost, null);
  }
Instantiates a new Log operation.

@param numTopics the num topics
@param gasCalculator the gas calculator
evm/src/main/java/org/hyperledger/besu/evm/operation/LogOperation.java