-
Notifications
You must be signed in to change notification settings - Fork 130
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.
Sorry for the trouble! :(
...tance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.java
Outdated
Show resolved
Hide resolved
...c/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/factory/PantheonNodeFactory.java
Show resolved
Hide resolved
...ests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java
Outdated
Show resolved
Hide resolved
...test/java/tech/pegasys/pantheon/tests/acceptance/jsonrpc/perm/PermAddNodeAcceptanceTest.java
Outdated
Show resolved
Hide resolved
...c/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/eea/PermAddNode.java
Outdated
Show resolved
Hide resolved
...c/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/eea/PermAddNode.java
Outdated
Show resolved
Hide resolved
...rc/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/eea/PermRemoveNode.java
Outdated
Show resolved
Hide resolved
...c/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/eea/PermAddNode.java
Outdated
Show resolved
Hide resolved
...rc/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/eea/PermRemoveNode.java
Outdated
Show resolved
Hide resolved
...c/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/eea/PermAddNodeTest.java
Outdated
Show resolved
Hide resolved
...est/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/eea/PermRemoveNodeTest.java
Outdated
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.
The API is missing the perm_getNodesWhitelist method.
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.
Looking good. The only thing that worries me is the exception handling on the Add and Remove nodes from the whitelist methods.
return new JsonRpcSuccessResponse(req.getId(), true); | ||
} catch (IllegalArgumentException e) { | ||
return new JsonRpcErrorResponse(req.getId(), JsonRpcError.NODE_WHITELIST_INVALID_ENTRY); | ||
} catch (Exception e) { |
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 capturing a generic exception and assuming it was caused by a missing entry can be misleading. If it is a server failure or something else throwing the exception we will never know the true cause.
It would be good to either create specific exceptions (what we don't do much in Pantheon) or create an object that represents the status of the removeNodes operation. And based on the status you choose the correct error response. This is the approach I took for the Accounts whitelist.
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.
Good idea. I'll implement a return object to make this a bit clearer and enable the generic handler to catch unexpected exceptions. 👍
return new JsonRpcSuccessResponse(req.getId(), true); | ||
} catch (IllegalArgumentException e) { | ||
return new JsonRpcErrorResponse(req.getId(), JsonRpcError.NODE_WHITELIST_INVALID_ENTRY); | ||
} catch (Exception e) { |
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.
Same comment about the generic exception catch 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.
After reviewing the acceptance tests with more details, I've noticed that we can change some things. I've added a comment on the specific place.
...va/tech/pegasys/pantheon/tests/acceptance/dsl/condition/perm/GetNodesWhitelistPopulated.java
Outdated
Show resolved
Hide resolved
…r -> enode conversion.
} | ||
} | ||
|
||
private String buildEnodeURI(final Peer s) { |
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.
would this be better moved into Peer? e.g. peer.getEnodeURI()
Concerns addressed in subsequent commit.
PR description
Added JSON-RPC methods to interact with the permissioning whitelist.
Fixed Issue(s)
#NC-1938