-
Notifications
You must be signed in to change notification settings - Fork 14
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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); |
There was a problem hiding this comment.
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
new JsonRpcManager( | ||
besuConfiguration.getDataPath(), lineaRejectedTxReportingConfiguration) | ||
.start()); |
There was a problem hiding this comment.
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?
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)