-
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
Open
usmansaleem
wants to merge
17
commits into
Consensys:main
Choose a base branch
from
usmansaleem:rej_tx_reporting_pool_validator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4a9f636
Extract reporting endpoint URI cli option
usmansaleem 5f8cfac
Merge remote-tracking branch 'upstream/main' into rej_tx_reporting_po…
usmansaleem 7fb1d48
Linea Transaction Pool Validator to report rejected tx
usmansaleem ac075c3
Linea node type and refactored request builder
usmansaleem 5eed03a
Update unit tests to use refactored generateSaveRejectedTxJsonRpc
usmansaleem c8950f1
Add license header
usmansaleem c37f7e1
javadoc
usmansaleem 0393705
Add json rpc call in SimulationValidator
usmansaleem 38b4502
SimulationValidator unit test for rejected tx reporting
usmansaleem fe8b328
fix link in changelog
usmansaleem 15a6b3f
removing temp debug statement
usmansaleem 1d5166e
Merge remote-tracking branch 'upstream/main' into rej_tx_reporting_po…
usmansaleem d3aec19
Merge remote-tracking branch 'upstream/main' into rej_tx_reporting_po…
usmansaleem 142e2a9
Add empty overflows list
usmansaleem a6aaeac
Use transactionSelectionResult.toString in LineaTransactionSelector
usmansaleem 5327a0a
Update test
usmansaleem 835a169
minor fix
usmansaleem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
sequencer/src/main/java/net/consensys/linea/config/LineaNodeType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Consensys Software Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package net.consensys.linea.config; | ||
|
||
/** Linea node type that is used when reporting rejected transactions. */ | ||
public enum LineaNodeType { | ||
SEQUENCER, | ||
RPC, | ||
P2P | ||
} |
92 changes: 92 additions & 0 deletions
92
sequencer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingCliOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Copyright Consensys Software Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package net.consensys.linea.config; | ||
|
||
import java.net.URI; | ||
|
||
import com.google.common.base.MoreObjects; | ||
import net.consensys.linea.plugins.LineaCliOptions; | ||
import picocli.CommandLine; | ||
|
||
/** The Linea Rejected Transaction Reporting CLI options. */ | ||
public class LineaRejectedTxReportingCliOptions implements LineaCliOptions { | ||
/** | ||
* The configuration key used in AbstractLineaPrivateOptionsPlugin to identify the cli options. | ||
*/ | ||
public static final String CONFIG_KEY = "rejected-tx-reporting-config"; | ||
|
||
/** The rejected transaction endpoint. */ | ||
public static final String REJECTED_TX_ENDPOINT = "--plugin-linea-rejected-tx-endpoint"; | ||
|
||
/** The Linea node type. */ | ||
public static final String LINEA_NODE_TYPE = "--plugin-linea-node-type"; | ||
|
||
@CommandLine.Option( | ||
names = {REJECTED_TX_ENDPOINT}, | ||
hidden = true, | ||
paramLabel = "<URI>", | ||
description = | ||
"Endpoint URI for reporting rejected transactions. Specify a valid URI to enable reporting.") | ||
private URI rejectedTxEndpoint = null; | ||
|
||
@CommandLine.Option( | ||
names = {LINEA_NODE_TYPE}, | ||
hidden = true, | ||
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; | ||
|
||
/** Default constructor. */ | ||
private LineaRejectedTxReportingCliOptions() {} | ||
|
||
/** | ||
* Create Linea Rejected Transaction Reporting CLI options. | ||
* | ||
* @return the Linea Rejected Transaction Reporting CLI options | ||
*/ | ||
public static LineaRejectedTxReportingCliOptions create() { | ||
return new LineaRejectedTxReportingCliOptions(); | ||
} | ||
|
||
/** | ||
* Instantiates a new Linea rejected tx reporting cli options from Configuration object | ||
* | ||
* @param config An instance of LineaRejectedTxReportingConfiguration | ||
*/ | ||
public static LineaRejectedTxReportingCliOptions fromConfig( | ||
final LineaRejectedTxReportingConfiguration config) { | ||
final LineaRejectedTxReportingCliOptions options = create(); | ||
options.rejectedTxEndpoint = config.rejectedTxEndpoint(); | ||
options.lineaNodeType = config.lineaNodeType(); | ||
return options; | ||
} | ||
|
||
@Override | ||
public LineaRejectedTxReportingConfiguration toDomainObject() { | ||
return LineaRejectedTxReportingConfiguration.builder() | ||
.rejectedTxEndpoint(rejectedTxEndpoint) | ||
.lineaNodeType(lineaNodeType) | ||
.build(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return MoreObjects.toStringHelper(this) | ||
.add(REJECTED_TX_ENDPOINT, rejectedTxEndpoint) | ||
.add(LINEA_NODE_TYPE, lineaNodeType) | ||
.toString(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...encer/src/main/java/net/consensys/linea/config/LineaRejectedTxReportingConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright Consensys Software Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package net.consensys.linea.config; | ||
|
||
import java.net.URI; | ||
|
||
import lombok.Builder; | ||
import net.consensys.linea.plugins.LineaOptionsConfiguration; | ||
|
||
/** The Linea RPC configuration. */ | ||
@Builder(toBuilder = true) | ||
public record LineaRejectedTxReportingConfiguration( | ||
URI rejectedTxEndpoint, LineaNodeType lineaNodeType) implements LineaOptionsConfiguration {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 fastThere 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.