-
Notifications
You must be signed in to change notification settings - Fork 880
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
Conversation
Signed-off-by: Stefan <stefan.pingel@consensys.net>
|
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
public interface TransactionSelector { | ||
|
||
default TransactionSelectionResult selectTransaction( | ||
final Transaction transaction, final TransactionReceipt receipt) { |
Check notice
Code scanning / CodeQL
Useless parameter
@@ -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; |
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.
I think it's a good idea to annotate it with @Unstable
as we have for the other new services
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.
Done
import java.util.Optional; | ||
|
||
/** The Storage service implementation. */ | ||
public class TransactionSelectionServiceImpl implements TransactionSelectionService { |
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.
I think it's a good idea to annotate it with @Unstable
as we have for the other new services
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.
Done
plugin-api/src/main/java/org/hyperledger/besu/plugin/services/TransactionSelectionService.java
Outdated
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/services/TransactionSelectionServiceImpl.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Stefan <stefan.pingel@consensys.net>
Signed-off-by: Stefan <stefan.pingel@consensys.net>
besu/src/main/java/org/hyperledger/besu/services/TransactionSelectionServiceImpl.java
Outdated
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/services/TransactionSelectionServiceImpl.java
Outdated
Show resolved
Hide resolved
@@ -331,28 +341,50 @@ private TransactionSelectionResult evaluateTransaction( | |||
processableBlockHeader, | |||
transaction, | |||
miningBeneficiary, | |||
// externalTransactionSelector.getTracer(), |
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.
is there a related TODO here?
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.
removed
transactionReceiptFactory.create( | ||
transaction.getType(), effectiveResult, worldState, cumulativeGasUsed); | ||
|
||
TransactionSelectionResult transactionSelectionResult = |
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.
final
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.
Done
plugin-api/src/main/java/org/hyperledger/besu/plugin/data/TransactionSelectionResult.java
Outdated
Show resolved
Hide resolved
plugin-api/src/main/java/org/hyperledger/besu/plugin/services/TransactionSelectionService.java
Outdated
Show resolved
Hide resolved
besu/src/main/java/org/hyperledger/besu/services/TransactionSelectionServiceImpl.java
Outdated
Show resolved
Hide resolved
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>
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.
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(); |
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.
I was going to suggest txSelectionService.orElse() but you have an extra get() in there
This reverts commit 65bcc55. Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
…)" (hyperledger#5499)" This reverts commit a0c6052.
…)" (hyperledger#5499)" This reverts commit a0c6052. Signed-off-by: Stefan <stefan.pingel@consensys.net>
* 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>
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>
…perledger#5499) * Revert "Add plugin API to select Transactions (hyperledger#5396)" This reverts commit 65bcc55. Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
* 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>
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>
…perledger#5499) * Revert "Add plugin API to select Transactions (hyperledger#5396)" This reverts commit 65bcc55. Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
* 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>
PR description
This PR adds an API that can be used to select Transactions while they are added to a block