-
Notifications
You must be signed in to change notification settings - Fork 235
Conversation
10a5051
to
fd0804d
Compare
Presents! |
@@ -194,6 +194,15 @@ class NodeIPEndpoint | |||
operator bool() const { return !address.is_unspecified() && udpPort > 0 && tcpPort > 0; } | |||
|
|||
bool isAllowed() const { return NodeIPEndpoint::test_allowLocal ? !address.is_unspecified() : isPublicAddress(address); } | |||
|
|||
bool operator==(const NodeIPEndpoint rhs) const |
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.
NodeIPEndpoint const& _cmp. Whitespace can be removed in header (single line function).
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.
Please keep the line breaks for better readability if the line would be longer than 100 characters.
try { | ||
RLP rlp(rlpBytes); | ||
switch (packetType) | ||
auto packet = DiscoveryDatagram::interpretUDP(_from, _packet); |
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.
Please remove DRY from this PR and submit in a future PR, or, leave DRY in and submit functional changes in a separate PR.
In the C++ codebase, especially in the networking code, we do not review PRs which mix semantic and functional changes into a PR as it's too difficult to effectively review changes. Moreover, this class does not throw exceptions and logs have been removed. Please revert these as requested. Otherwise, please create github issues, assign them to me, and notify me – I will happily make the changes requested. In particular, I've really been meaning to refactor the nearestNodeEntries function (it was thrown together in a few days to make the PoC release). |
31c14a5
to
8d34e97
Compare
@@ -98,20 +98,25 @@ bytes ReputationManager::data(Session const& _s, std::string const& _sub) const | |||
return bytes(); | |||
} | |||
|
|||
Host::Host(std::string const& _clientVersion, NetworkPreferences const& _n, bytesConstRef _restoreNetwork): | |||
Host::Host(std::string const& _clientVersion, KeyPair _alias, NetworkPreferences const& _n): |
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.
KeyPair const&
?
As already discussed, please change the exceptions while interpreting the packet to direct logging (potentially using a helper function) plus returning an empty unique ptr. |
@fjl ah, ok, now I get why you want to use |
@@ -77,6 +77,9 @@ using AddressHash = std::unordered_set<h160>; | |||
/// A vector of secrets. | |||
using Secrets = std::vector<Secret>; | |||
|
|||
/// Amount of bytes added when encrypting with encryptECIES. | |||
static const unsigned c_eciesOverhead = 113; |
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.
This file seems a bit too generic for this protocol detail. Can we move it somewhere else?
PTAL |
|
||
// These two are set for inbound packets only. | ||
NodeID sourceid; | ||
h256 echo; |
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.
What does echo
mean?
Only minor things left apart from the randomness issue: |
For the padding we decided to go with rand(3), which is known to be unsafe for concurrent use, instead of using boost. It will be fixed later. |
Tested on linux, works fine. |
This commit implements relaxed packet decoding as required by EIP-8. It also removes support for discovery v3 ping packets.
Squashed. |
implements ethereum/EIPs#49
Fixes: ethereum/webthree-umbrella#159