Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix the log of the profitability selector in the pre process phase #129

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,13 @@ private void updateMetric(
final Transaction tx,
final Wei profitablePriorityFeePerGas) {

final var effectivePriorityFee = evaluationContext.getTransactionGasPrice().subtract(baseFee);
final var ratio =
effectivePriorityFee.getValue().doubleValue()
/ profitablePriorityFeePerGas.getValue().doubleValue();

maybeProfitabilityMetrics.ifPresent(
histogramMetrics -> {
final var effectivePriorityFee =
evaluationContext.getTransactionGasPrice().subtract(baseFee);
final var ratio =
effectivePriorityFee.getValue().doubleValue()
/ profitablePriorityFeePerGas.getValue().doubleValue();

histogramMetrics.track(ratio, label.value());

if (ratio < lastBlockMinRatios.get(label)) {
Expand All @@ -296,19 +295,20 @@ private void updateMetric(
if (ratio > lastBlockMaxRatios.get(label)) {
lastBlockMaxRatios.put(label, ratio);
}

log.atTrace()
.setMessage(
"POST_PROCESSING: block[{}] tx {} , baseFee {}, effectiveGasPrice {}, ratio (effectivePayingPriorityFee {} / calculatedProfitablePriorityFee {}) {}")
.addArgument(evaluationContext.getPendingBlockHeader().getNumber())
.addArgument(tx.getHash())
.addArgument(baseFee::toHumanReadableString)
.addArgument(evaluationContext.getTransactionGasPrice()::toHumanReadableString)
.addArgument(effectivePriorityFee::toHumanReadableString)
.addArgument(profitablePriorityFeePerGas::toHumanReadableString)
.addArgument(ratio)
.log();
});

log.atTrace()
.setMessage(
"{}: block[{}] tx {} , baseFee {}, effectiveGasPrice {}, ratio (effectivePayingPriorityFee {} / calculatedProfitablePriorityFee {}) {}")
.addArgument(label.name())
.addArgument(evaluationContext.getPendingBlockHeader().getNumber())
.addArgument(tx.getHash())
.addArgument(baseFee::toHumanReadableString)
.addArgument(evaluationContext.getTransactionGasPrice()::toHumanReadableString)
.addArgument(effectivePriorityFee::toHumanReadableString)
.addArgument(profitablePriorityFeePerGas::toHumanReadableString)
.addArgument(ratio)
.log();
}

private static void resetMinMaxRatios() {
Expand Down
Loading