Skip to content

Commit

Permalink
Remove some dead code (#6861)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <[email protected]>
  • Loading branch information
fab-10 authored Apr 2, 2024
1 parent cf5e3da commit 0307996
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 82 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
*/
package org.hyperledger.besu.ethereum.core.feemarket;

import org.hyperledger.besu.datatypes.BlobGas;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.core.Transaction;

import java.math.BigInteger;
import java.util.Optional;

@FunctionalInterface
Expand All @@ -44,36 +42,4 @@ static TransactionPriceCalculator eip1559() {
return price;
};
}

// curiously named as in the spec
// https://eips.ethereum.org/EIPS/eip-4844#cryptographic-helpers
private static BigInteger fakeExponential(
final BigInteger factor, final BigInteger numerator, final BigInteger denominator) {
int i = 1;
BigInteger output = BigInteger.ZERO;
BigInteger numeratorAccumulator = factor.multiply(denominator);
while (numeratorAccumulator.signum() > 0) {
output = output.add(numeratorAccumulator);
numeratorAccumulator =
(numeratorAccumulator.multiply(numerator))
.divide(denominator.multiply(BigInteger.valueOf(i)));
++i;
}
return output.divide(denominator);
}

static TransactionPriceCalculator blobGas(
final int minBlobGasPrice,
final int blobGasPriceUpdateFraction,
final BlobGas excessBlobGas) {
return ((transaction, baseFee) -> {
final var blobGasPrice =
Wei.of(
fakeExponential(
BigInteger.valueOf(minBlobGasPrice),
excessBlobGas.toBigInteger(),
BigInteger.valueOf(blobGasPriceUpdateFraction)));
return blobGasPrice;
});
}
}

0 comments on commit 0307996

Please sign in to comment.