private static long computeGas(
      final TraceFrame traceFrame, final Optional<TraceFrame> nextTraceFrame) {
    if (traceFrame.getGasCost().isPresent()) {
      final long gasNeeded = traceFrame.getGasCost().getAsLong();
      final long currentGas = traceFrame.getGasRemaining();
      if (currentGas >= gasNeeded) {
        final long gasRemaining = currentGas - gasNeeded;
        return gasRemaining - Math.floorDiv(gasRemaining, EIP_150_DIVISOR);
      }
    }
    return nextTraceFrame.map(TraceFrame::getGasRemaining).orElse(0L);
  }
Generates a stream of {@link Trace} from the passed {@link TransactionTrace} and {@link Block}
data with additional Transaction Information added to FlatTrace

@param protocolSchedule the current {@link ProtocolSchedule} to use
@param transactionTrace the {@link TransactionTrace} to use
@param block the {@link Block} to use
@return a stream of generated traces {@link Trace}
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/FlatTraceGenerator.java