Skip to content

Commit

Permalink
Revert "Add block added listener and handler into LineaTransactionPoo…
Browse files Browse the repository at this point in the history
…lValidatorPlugin"

This reverts commit 88d9174.

# Conflicts:
#	sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/LineaTransactionPoolValidatorPlugin.java
#	sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/metrics/TransactionPoolProfitabilityMetrics.java
  • Loading branch information
fab-10 committed Oct 28, 2024
1 parent aa396b3 commit d5efae6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@
import net.consensys.linea.AbstractLineaRequiredPlugin;
import net.consensys.linea.config.LineaRejectedTxReportingConfiguration;
import net.consensys.linea.jsonrpc.JsonRpcManager;
import net.consensys.linea.sequencer.txpoolvalidation.metrics.TransactionPoolProfitabilityMetrics;
import net.consensys.linea.sequencer.txpoolvalidation.metrics.ValidatorProfitabilityMetrics;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.plugin.BesuContext;
import org.hyperledger.besu.plugin.BesuPlugin;
import org.hyperledger.besu.plugin.services.BesuConfiguration;
import org.hyperledger.besu.plugin.services.BesuEvents;
import org.hyperledger.besu.plugin.services.TransactionPoolValidatorService;
import org.hyperledger.besu.plugin.services.TransactionSimulationService;

Expand All @@ -49,15 +46,13 @@
@Slf4j
@AutoService(BesuPlugin.class)
public class LineaTransactionPoolValidatorPlugin extends AbstractLineaRequiredPlugin {
private BesuContext besuContext;
private BesuConfiguration besuConfiguration;
private TransactionPoolValidatorService transactionPoolValidatorService;
private TransactionSimulationService transactionSimulationService;
private Optional<JsonRpcManager> rejectedTxJsonRpcManager = Optional.empty();

@Override
public void doRegister(final BesuContext context) {
besuContext = context;
besuConfiguration =
context
.getService(BesuConfiguration.class)
Expand Down Expand Up @@ -87,14 +82,6 @@ public void doRegister(final BesuContext context) {
public void start() {
super.start();

final var validatorProfitabilityMetrics =
new ValidatorProfitabilityMetrics(
besuConfiguration, metricsSystem, profitabilityConfiguration());

final var transactionPoolProfitabilityMetrics =
new TransactionPoolProfitabilityMetrics(
besuConfiguration, metricsSystem, profitabilityConfiguration());

try (Stream<String> lines =
Files.lines(
Path.of(new File(transactionPoolValidatorConfiguration().denyListPath()).toURI()))) {
Expand Down Expand Up @@ -126,37 +113,6 @@ public void start() {
l1L2BridgeSharedConfiguration(),
rejectedTxJsonRpcManager));

final var besuEventsService =
besuContext
.getService(BesuEvents.class)
.orElseThrow(
() -> new RuntimeException("Failed to obtain BesuEvents from the BesuContext."));

besuEventsService.addBlockAddedListener(
addedBlockContext -> {
try {
validatorProfitabilityMetrics.handleBlockAdded(addedBlockContext);
} catch (final Exception e) {
log.warn(
"Error calculating transaction profitability for block {}({})",
addedBlockContext.getBlockHeader().getNumber(),
addedBlockContext.getBlockHeader().getBlockHash(),
e);
}
});

besuEventsService.addTransactionAddedListener(
transaction -> {
try {
transactionPoolProfitabilityMetrics.handleTransactionAdded(transaction);
} catch (Exception e) {
log.warn(
"Error recording transaction profitability metrics for {}: {}",
transaction.getHash(),
e.getMessage());
}
});

} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit d5efae6

Please sign in to comment.