public static OperationResult staticOperation(
      final MessageFrame frame, final GasCalculator gasCalculator) {
    final Bytes number = frame.popStackItem();
    final Bytes power = frame.popStackItem();

    final int numBytes = (power.bitLength() + 7) / 8;

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

    byte[] numberBytes = number.toArrayUnsafe();
    BigInteger numBI = numberBytes.length > 0 ? new BigInteger(1, numberBytes) : BigInteger.ZERO;
    byte[] powBytes = power.toArrayUnsafe();
    BigInteger powBI = powBytes.length > 0 ? new BigInteger(1, powBytes) : BigInteger.ZERO;

    final BigInteger result = numBI.modPow(powBI, MOD_BASE);

    byte[] resultArray = result.toByteArray();
    int length = resultArray.length;
    if (length > 32) {
      frame.pushStackItem(Bytes.wrap(resultArray, length - 32, 32));
    } else {
      frame.pushStackItem(Bytes.wrap(resultArray));
    }
    return new OperationResult(cost, null);
  }
Performs exp operation.

@param frame the frame
@param gasCalculator the gas calculator
@return the operation result
evm/src/main/java/org/hyperledger/besu/evm/operation/ExpOperation.java