Skip to content

Commit

Permalink
Log the transaction hash in the module limit warning (#76)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Dudley <[email protected]>
  • Loading branch information
siladu authored Sep 18, 2024
1 parent d9f2a69 commit 9c79cc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Optional<String> 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()) {
Expand Down Expand Up @@ -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(
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

0 comments on commit 9c79cc0

Please sign in to comment.