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

Add plugin API to select Transactions #5396

Merged
merged 19 commits into from
May 23, 2023

Conversation

pinges
Copy link
Contributor

@pinges pinges commented Apr 27, 2023

PR description

This PR adds an API that can be used to select Transactions while they are added to a block

pinges added 3 commits April 20, 2023 18:47
Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Stefan <stefan.pingel@consensys.net>
@github-actions
Copy link

github-actions bot commented Apr 27, 2023

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.
  • I have considered running ./gradlew acceptanceTestNonMainnet locally if my PR affects non-mainnet modules.
  • I thought about the changelog and included a changelog update if required.
  • If my PR includes database changes (e.g. KeyValueSegmentIdentifier) I have thought about compatibility and performed forwards and backwards compatibility tests

Signed-off-by: Stefan <stefan.pingel@consensys.net>
public interface TransactionSelector {

default TransactionSelectionResult selectTransaction(
final Transaction transaction, final TransactionReceipt receipt) {

Check notice

Code scanning / CodeQL

Useless parameter

The parameter 'transaction' is never used.
public interface TransactionSelector {

default TransactionSelectionResult selectTransaction(
final Transaction transaction, final TransactionReceipt receipt) {

Check notice

Code scanning / CodeQL

Useless parameter

The parameter 'receipt' is never used.
Signed-off-by: Stefan <stefan.pingel@consensys.net>
@@ -360,6 +364,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
@CommandLine.ArgGroup(validate = false, heading = "@|bold P2P Discovery Options|@%n")
P2PDiscoveryOptionGroup p2PDiscoveryOptionGroup = new P2PDiscoveryOptionGroup();

private final TransactionSelectionServiceImpl transactionSelectionServiceImpl;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's a good idea to annotate it with @Unstable as we have for the other new services

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

import java.util.Optional;

/** The Storage service implementation. */
public class TransactionSelectionServiceImpl implements TransactionSelectionService {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's a good idea to annotate it with @Unstable as we have for the other new services

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Gabriel-Trintinalia Gabriel-Trintinalia added plugins TeamRevenant GH issues worked on by Revenant Team labels Apr 28, 2023
pinges added 2 commits May 17, 2023 16:38
Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Stefan <stefan.pingel@consensys.net>
@@ -331,28 +341,50 @@ private TransactionSelectionResult evaluateTransaction(
processableBlockHeader,
transaction,
miningBeneficiary,
// externalTransactionSelector.getTracer(),
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a related TODO here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

transactionReceiptFactory.create(
transaction.getType(), effectiveResult, worldState, cumulativeGasUsed);

TransactionSelectionResult transactionSelectionResult =
Copy link
Contributor

Choose a reason for hiding this comment

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

final

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

pinges and others added 10 commits May 18, 2023 13:11
Signed-off-by: Stefan <stefan.pingel@consensys.net>
…lectionServiceImpl.java

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
…lectionServiceImpl.java

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
…sactionSelectionResult.java

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
…TransactionSelectionService.java

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
…lectionServiceImpl.java

Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Stefan <stefan.pingel@consensys.net>
@pinges pinges marked this pull request as ready for review May 22, 2023 23:35
Copy link
Contributor

@macfarla macfarla left a comment

Choose a reason for hiding this comment

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

LGTM. do we want a changelog?

final BesuPluginContextImpl besuPluginContext) {
final Optional<TransactionSelectionService> txSelectionService =
besuPluginContext.getService(TransactionSelectionService.class);
return txSelectionService.isPresent() ? txSelectionService.get().get() : Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

I was going to suggest txSelectionService.orElse() but you have an extra get() in there

@pinges pinges enabled auto-merge (squash) May 23, 2023 03:09
@pinges pinges merged commit 65bcc55 into hyperledger:main May 23, 2023
@pinges pinges deleted the AddTransactionEvaluator branch May 23, 2023 03:37
siladu added a commit to siladu/besu that referenced this pull request May 25, 2023
This reverts commit 65bcc55.

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
siladu added a commit that referenced this pull request May 26, 2023
* Revert "Add plugin API to select Transactions (#5396)"

This reverts commit 65bcc55.

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
pinges added a commit to pinges/besu that referenced this pull request May 29, 2023
pinges added a commit to pinges/besu that referenced this pull request May 29, 2023
…)" (hyperledger#5499)"

This reverts commit a0c6052.

Signed-off-by: Stefan <stefan.pingel@consensys.net>
pinges added a commit that referenced this pull request Jun 2, 2023
* Revert "Revert "Add plugin API to select Transactions (#5396)" (#5499)"

This reverts commit a0c6052.

* fix receipt root bug

Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Usman Saleem <usman@usmans.info>
elenduuche pushed a commit to elenduuche/besu that referenced this pull request Aug 16, 2023
This API fulfils the basic requirements, but will probably be extended in the near future. 

Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
elenduuche pushed a commit to elenduuche/besu that referenced this pull request Aug 16, 2023
…perledger#5499)

* Revert "Add plugin API to select Transactions (hyperledger#5396)"

This reverts commit 65bcc55.

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
elenduuche pushed a commit to elenduuche/besu that referenced this pull request Aug 16, 2023
* Revert "Revert "Add plugin API to select Transactions (hyperledger#5396)" (hyperledger#5499)"

This reverts commit a0c6052.

* fix receipt root bug

Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Usman Saleem <usman@usmans.info>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
This API fulfils the basic requirements, but will probably be extended in the near future. 

Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
…perledger#5499)

* Revert "Add plugin API to select Transactions (hyperledger#5396)"

This reverts commit 65bcc55.

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
eum602 pushed a commit to lacchain/besu that referenced this pull request Nov 3, 2023
* Revert "Revert "Add plugin API to select Transactions (hyperledger#5396)" (hyperledger#5499)"

This reverts commit a0c6052.

* fix receipt root bug

Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Usman Saleem <usman@usmans.info>
Signed-off-by: Stefan Pingel <16143240+pinges@users.noreply.github.com>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Co-authored-by: Usman Saleem <usman@usmans.info>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugins TeamRevenant GH issues worked on by Revenant Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants