-
Notifications
You must be signed in to change notification settings - Fork 879
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
eth66 #2365
eth66 #2365
Conversation
33ca7f2
to
b87e7b0
Compare
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
private static final List<Integer> eth63Messages = | ||
Stream.concat( | ||
eth62Messages.stream(), | ||
Stream.of( | ||
EthPV63.GET_NODE_DATA, EthPV63.NODE_DATA, EthPV63.GET_RECEIPTS, EthPV63.RECEIPTS)) | ||
.collect(toUnmodifiableList()); | ||
|
||
static { | ||
eth63Messages.addAll( | ||
Arrays.asList( | ||
EthPV63.GET_NODE_DATA, EthPV63.NODE_DATA, EthPV63.GET_RECEIPTS, EthPV63.RECEIPTS)); | ||
} | ||
private static final List<Integer> eth65Messages = | ||
Stream.concat( | ||
eth62Messages.stream(), | ||
Stream.of( | ||
EthPV65.NEW_POOLED_TRANSACTION_HASHES, | ||
EthPV65.GET_POOLED_TRANSACTIONS, | ||
EthPV65.POOLED_TRANSACTIONS)) | ||
.collect(toUnmodifiableList()); |
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.
cosmetic
private final Set<Hash> knownBlocks = | ||
Collections.newSetFromMap( | ||
Collections.synchronizedMap( | ||
new LinkedHashMap<>(16, 0.75f, true) { | ||
@Override | ||
protected boolean removeEldestEntry(final Map.Entry<Hash, Boolean> eldest) { | ||
return size() > maxTrackedSeenBlocks; | ||
} | ||
})); |
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.
cosmetic, moved from constructor
@Test | ||
public void shouldRespondToNodeDataRequests() throws Exception { | ||
when(worldStateArchive.getNodeData(HASH1)).thenReturn(Optional.of(VALUE1)); | ||
when(worldStateArchive.getNodeData(HASH2)).thenReturn(Optional.of(VALUE2)); | ||
ethMessages.dispatch(new EthMessage(ethPeer, GetNodeDataMessage.create(asList(HASH1, HASH2)))); | ||
|
||
verify(ethPeer).send(NodeDataMessage.create(asList(VALUE1, VALUE2))); | ||
} | ||
|
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.
ethMessages
is no longer responsible for send
ing. Also, this behavior is already covered by EthProtocolManagerTest
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
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.
Looks good, I have a few questions to clarify my understanding and some minor nitpicky stuff
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/EthProtocol.java
Show resolved
Hide resolved
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/RequestId.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
static Map.Entry<BigInteger, MessageData> unwrapRequestId(final MessageData messageData) { | ||
final RLPInput messageDataRLP = RLP.input(messageData.getData()); |
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.
do we need to handle MalformedRLPInputException here or would it get appropriately handled further up the call stack?
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 catch, will fix
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.
did you determine we do not need to handle this 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.
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeer.java
Show resolved
Hide resolved
.ifPresentOrElse( | ||
responseStream -> responseStream.processMessage(requestIdAndEthMessage.getValue()), | ||
// disconnect on incorrect requestIds | ||
() -> peer.disconnect(DisconnectMessage.DisconnectReason.BREACH_OF_PROTOCOL)); |
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.
How does this happen in practice? We have a response, but no open stream to receive the response, so we disconnect the target peer? This seems likely to occur on our side rather than it being the fault of the remote ?
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 should have all the request ids for the outstanding requests we sent so if we receive a request id we're not tracking, that means the remote is breaching protocol somehow.
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.
isn't this our response to a request rather than a response to our request? Seems to me if we have formulated a response but can't find the request id, that is a problem on our end and we shouldn't disconnect from the peer. thoughts?
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 is handling their response to our request.
This is how we generate responses to remote requests:
https://github.com/RatanRSur/besu/blob/36d61b87c3a192d1b8bbd049230ba5a1ee00de08/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java#L278-L305
ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/RequestManagerTest.java
Show resolved
Hide resolved
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
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.
🚢 🥳
https://eips.ethereum.org/EIPS/eip-2481 Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
PR description
https://eips.ethereum.org/EIPS/eip-2481
Review suggestion: hide whitespace changes
Fixed Issue(s)
fixes #2210
Changelog