Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Report rejected transactions to an external service for SimulationValidator used by LineaTransactionPoolValidatorPlugin #85

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

usmansaleem
Copy link
Contributor

@usmansaleem usmansaleem commented Sep 24, 2024

feat: Report rejected transactions to an external service for SimulationValidator used by LineaTransactionPoolValidatorPlugin

Introduced/updated following cli options (LineaRejectedTxReportingCliOptions):
--plugin-linea-rejected-tx-endpoint - Endpoint URI for reporting rejected transactions. Specify a valid URI to enable reporting.
--plugin-linea-node-type - Linea Node type to use when reporting rejected transactions. (default: SEQUENCER. Valid values: SEQUENCER,P2P,RPC)

@usmansaleem usmansaleem changed the title Report rejected transactions from reporting pool validator feat: Report rejected transactions to an external service for SimulationValidator used by LineaTransactionPoolValidatorPlugin Sep 24, 2024
@usmansaleem usmansaleem marked this pull request as ready for review September 24, 2024 10:19
Copy link
Contributor

@fab-10 fab-10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, just some minor suggestions and questions.

Then want to be sure that it is intended, that during block creation all not selection reasons are reported, while on the txpool only the invalid simulation reason is reported.

paramLabel = "<NODE_TYPE>",
description =
"Linea Node type to use when reporting rejected transactions. (default: ${DEFAULT-VALUE}. Valid values: ${COMPLETION-CANDIDATES})")
private LineaNodeType lineaNodeType = LineaNodeType.SEQUENCER;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure is safe to set the default, I think it is better to default to something like UNSET or fail fast

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, UNSET seems ok to me as well.

Comment on lines +101 to +117
final String reason = handleModuleOverLimit(transaction, moduleLimitResult);

// Report rejected transactions to the JSON-RPC manager
rejectedTxJsonRpcManager.ifPresent(
jsonRpcManager -> {
final String jsonRpcCall =
JsonRpcRequestBuilder.generateSaveRejectedTxJsonRpc(
jsonRpcManager.getNodeType(),
transaction,
Instant.now(),
Optional.empty(), // block number is not available
reason,
List.of());
jsonRpcManager.submitNewJsonRpcCall(jsonRpcCall);
});

return Optional.of(reason);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like extracting this code as method is a good idea, since also the following calls are similar

Comment on lines +91 to +93
new JsonRpcManager(
besuConfiguration.getDataPath(), lineaRejectedTxReportingConfiguration)
.start());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if the JsonRpcManager is started or stopped twice, since both plugins could be enabled at the same time?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants