-
Notifications
You must be signed in to change notification settings - Fork 889
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 support for private log subscriptions (Pub-Sub API) #858
Conversation
...src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/methods/PrivSubscribe.java
Show resolved
Hide resolved
...perledger/besu/ethereum/api/jsonrpc/websocket/subscription/logs/LogsSubscriptionService.java
Show resolved
Hide resolved
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 have to look at the tests on Monday ...
final SubscriptionManager subscriptionManager, | ||
final PrivacyParameters privacyParameters) { | ||
|
||
Optional<PrivacyQueries> privacyQueries = 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.
could do an if/else or even
privacyQueries = privacyParameters.isEnabled() ? x : y;
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 the way that it is implemented makes it more readable. PrivacyQueries start empty and, if privacy is enabled, we set it to the proper object.
I think in this case the ternary operator will make it less readable.
.../src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/response/JsonRpcError.java
Outdated
Show resolved
Hide resolved
public Collection<JsonRpcMethod> methods() { | ||
final SubscriptionRequestMapper subscriptionRequestMapper = new SubscriptionRequestMapper(); | ||
final EnclavePublicKeyProvider enclavePublicKeyProvider = | ||
EnclavePublicKeyProvider.build(privacyParameters); |
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.
We do this in the PrivacyApiGroupJsonRpcMethods as well, but in the PrivJsonRpcMethods we do pass the privacy controller and the enclavePublicKeyProvider into the create() method.
This means that we have several instances of the controller and enclavePKP where we would only need one.
Can we fix that in a nice way?
...dger/besu/ethereum/api/jsonrpc/websocket/subscription/request/SubscriptionRequestMapper.java
Outdated
Show resolved
Hide resolved
...er/besu/ethereum/api/jsonrpc/websocket/subscription/response/SubscriptionResponseResult.java
Show resolved
Hide resolved
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
...test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/methods/PrivSubscribeTest.java
Show resolved
Hide resolved
...test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/methods/PrivSubscribeTest.java
Show resolved
Hide resolved
...test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/methods/PrivSubscribeTest.java
Show resolved
Hide resolved
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
Signed-off-by: Lucas Saldanha <lucas.saldanha@consensys.net>
PR description
• Created the two private subscription-related methods (priv_subscribe/priv_unsubscribe)
• Created a new type of subscription
PrivateLogsSubscription
• Updated
LogsSubscriptionService
to observe new blocks and check for private logs (similar to what is done in theFilterManager
).• Updated
WebSocketRequestHandler
to deal withInvalidJsonRpcParameters
exception• Some plumbing work to get everything working together!
Fixed Issue(s)
fixes #762