From 9c79cc051f1d6062959d8e4b21d16f255a00588e Mon Sep 17 00:00:00 2001 From: Simon Dudley Date: Wed, 18 Sep 2024 17:47:12 +1000 Subject: [PATCH] Log the transaction hash in the module limit warning (#76) Signed-off-by: Simon Dudley --- .../linea/EthSendRawTransactionSimulationCheckTest.java | 3 ++- .../txpoolvalidation/validators/SimulationValidator.java | 8 +++++--- .../validators/SimulationValidatorTest.java | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java index 02120594..5047247e 100644 --- a/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java +++ b/acceptance-tests/src/test/java/linea/plugin/acc/test/rpc/linea/EthSendRawTransactionSimulationCheckTest.java @@ -78,7 +78,8 @@ public void transactionOverModuleLineCountNotAccepted() throws Exception { assertThat(signedTxContractInteractionResp.hasError()).isTrue(); assertThat(signedTxContractInteractionResp.getError().getMessage()) - .isEqualTo("Transaction line count for module ADD=2017 is above the limit 70"); + .isEqualTo( + "Transaction 0xe813560d9a3aedff46be12fc32706d8fe9b6565dd7e2db47457a9c416f2d45d7 line count for module ADD=2017 is above the limit 70"); assertThat(getTxPoolContent()).isEmpty(); diff --git a/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java b/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java index b82bdc2c..e769bfd7 100644 --- a/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java +++ b/sequencer/src/main/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidator.java @@ -91,7 +91,7 @@ public Optional validateTransaction( transaction, isLocal, hasPriority, maybeSimulationResults, moduleLimitResult); if (moduleLimitResult.getResult() != ModuleLineCountValidator.ModuleLineCountResult.VALID) { - return Optional.of(handleModuleOverLimit(moduleLimitResult)); + return Optional.of(handleModuleOverLimit(transaction, moduleLimitResult)); } if (maybeSimulationResults.isPresent()) { @@ -150,7 +150,8 @@ private ZkTracer createZkTracer(final BlockHeader chainHeadHeader) { return zkTracer; } - private String handleModuleOverLimit(ModuleLimitsValidationResult moduleLimitResult) { + private String handleModuleOverLimit( + Transaction transaction, ModuleLimitsValidationResult moduleLimitResult) { if (moduleLimitResult.getResult() == MODULE_NOT_DEFINED) { String moduleNotDefinedMsg = String.format( @@ -161,7 +162,8 @@ private String handleModuleOverLimit(ModuleLimitsValidationResult moduleLimitRes if (moduleLimitResult.getResult() == TX_MODULE_LINE_COUNT_OVERFLOW) { String txOverflowMsg = String.format( - "Transaction line count for module %s=%s is above the limit %s", + "Transaction %s line count for module %s=%s is above the limit %s", + transaction.getHash(), moduleLimitResult.getModuleName(), moduleLimitResult.getModuleLineCount(), moduleLimitResult.getModuleLineLimit()); diff --git a/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidatorTest.java b/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidatorTest.java index bd88f9a0..8bb71b86 100644 --- a/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidatorTest.java +++ b/sequencer/src/test/java/net/consensys/linea/sequencer/txpoolvalidation/validators/SimulationValidatorTest.java @@ -161,6 +161,7 @@ public void moduleLineCountOverflowTransactionIsInvalid() { .signature(FAKE_SIGNATURE) .build(); assertThat(simulationValidator.validateTransaction(transaction, true, false)) - .contains("Transaction line count for module EXT=7 is above the limit 5"); + .contains( + "Transaction 0xbf668c5dc926c008d5b34f347e1842b94911b46f4a36b668812f821e20303322 line count for module EXT=7 is above the limit 5"); } }