Skip to content
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

Pack the Nodes message more tightly #74

Open
Nashatyrev opened this issue Sep 29, 2020 · 2 comments
Open

Pack the Nodes message more tightly #74

Nashatyrev opened this issue Sep 29, 2020 · 2 comments

Comments

@Nashatyrev
Copy link
Contributor

Description

Currently ENRs for Nodes message are packed considering the max ENR size, i.e. max 4 ENRs per packet to fit the max packet size in the worst case.
If ENRs are smaller then more records could be packed into a single message.

Also need to consider that the message can be sent withing both OrdinaryMessage and Handshake packets. However for Nodes message (as a response message) this situation is highly unlikely to occur with a honest remote node, so probably just controlling and dropping outgoing too large message would be enough. (see comment #72 (comment))

@Nashatyrev Nashatyrev mentioned this issue Sep 29, 2020
9 tasks
@atoulme
Copy link

atoulme commented Oct 7, 2020

Please note also that if all buckets are empty, the discovery lib sends several Nodes message. This is because of this line:
if (total % MAX_NODES_PER_MESSAGE == 0) {

On my end I see this:

01:34:23.394 [DefaultDispatcher-worker-5 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.409 [DefaultDispatcher-worker-5 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.411 [DefaultDispatcher-worker-5 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.412 [DefaultDispatcher-worker-5 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.412 [DefaultDispatcher-worker-5 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping
01:34:23.413 [DefaultDispatcher-worker-5 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.414 [DefaultDispatcher-worker-5 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.414 [DefaultDispatcher-worker-5 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping
01:34:23.416 [DefaultDispatcher-worker-6 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.417 [DefaultDispatcher-worker-6 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.417 [DefaultDispatcher-worker-6 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping
01:34:23.429 [DefaultDispatcher-worker-6 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.430 [DefaultDispatcher-worker-6 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.430 [DefaultDispatcher-worker-6 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping
01:34:23.453 [DefaultDispatcher-worker-6 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.454 [DefaultDispatcher-worker-6 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.455 [DefaultDispatcher-worker-6 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping
01:34:23.466 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.468 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.530 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.531 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.531 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping
01:34:23.663 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.664 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.664 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping
01:34:23.664 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.665 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.665 [DefaultDispatcher-worker-4 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping
01:34:23.676 [DefaultDispatcher-worker-7 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.677 [DefaultDispatcher-worker-7 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.677 [DefaultDispatcher-worker-7 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping
01:34:23.693 [DefaultDispatcher-worker-7 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message from /192.168.88.236:9000
01:34:23.693 [DefaultDispatcher-worker-7 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received message of type NODES
01:34:23.693 [DefaultDispatcher-worker-7 @coroutine#2] TRACE org.apache.tuweni.devp2p.v5.Session - Received NODES message but no matching FINDNODES present. Dropping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants