From 3dd949c92d6f7c2ac0c348aebb6b711d142a91f0 Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Tue, 14 Jan 2025 17:01:59 +0100 Subject: [PATCH] Fix the log of the profitability selector in the pre process phase Signed-off-by: Fabio Di Fabio --- .../ProfitableTransactionSelector.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java b/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java index 2cd6768f5..75c9518d5 100644 --- a/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java +++ b/sequencer/src/main/java/net/consensys/linea/sequencer/txselection/selectors/ProfitableTransactionSelector.java @@ -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)) { @@ -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() {