Skip to content

client: add support for multiple same-type messages over devp2p - #2940

Merged
jochem-brouwer merged 2 commits into
masterfrom
multiple-devp2p-msgs
Aug 5, 2023
Merged

client: add support for multiple same-type messages over devp2p#2940
jochem-brouwer merged 2 commits into
masterfrom
multiple-devp2p-msgs

Conversation

@jochem-brouwer

Copy link
Copy Markdown
Member

This PR fixes a hive test (on top of #2935 which fixes another related timeout problem) where this happens:

There are two clients. These both gets fed messages and it is necessary that upon creating new blocks the peers have exchanged all messages. The block builder client (1) has a race condition without this PR. Here is what happens:

Client (1) gets multiple NewPooledTransactionHashes (5 in total, over 5 messages). Therefore, client (1) requests 5 GetPooledTransactions. However, at some point client (1) is already requesting a pooled tx without getting a response, and then queries a new GetPooledTransactions. Prior to this PR this is not possible because there is only ONE request possible per devp2p message type. This PR has a temporary fix: we now create a Lock for every message which now ensures that if the message is already used, we wait until it is freed and then query this message.

This is not ideal: since devp2p now supports Request IDs it is much easier to match up replies to whatever message was sent first. Just check the message type, check the request ID, find in a map the Promise which awaits this request (if available) and then resolve it. However, this temporarily fixes this.

This also fixes (on top of #2935) this hive test: ./hive --sim ethereum/engine --client ethereumjs --sim.limit "engine-blobs/Blob Transaction Ordering, Multiple Clients"

@codecov

codecov Bot commented Aug 5, 2023

Copy link
Copy Markdown

Codecov Report

Merging #2940 (95a3eb7) into master (d13804d) will decrease coverage by 4.97%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.66% <ø> (?)
blockchain 92.58% <ø> (?)
client 87.68% <100.00%> (?)
common 98.64% <ø> (ø)
evm 69.95% <ø> (?)
statemanager 85.16% <ø> (ø)
trie 89.95% <ø> (-0.04%) ⬇️
tx 95.96% <ø> (?)
util 86.77% <ø> (ø)
vm 79.20% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@jochem-brouwer

Copy link
Copy Markdown
Member Author

Will block this one since I just realized we have (untested) deadlock situations. In ANY case that the request somehow gets handled (timeout, error, whatever) the lock should be destroyed otherwise we have forever hanging requests.

@jochem-brouwer
jochem-brouwer marked this pull request as ready for review August 5, 2023 18:15
@acolytec3
acolytec3 changed the base branch from pooled-txs-fixes to master August 5, 2023 18:18
@jochem-brouwer
jochem-brouwer changed the base branch from master to pooled-txs-fixes August 5, 2023 18:20
@jochem-brouwer
jochem-brouwer changed the base branch from pooled-txs-fixes to master August 5, 2023 18:20

@acolytec3 acolytec3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! a good half step forward

@jochem-brouwer
jochem-brouwer merged commit 845a26b into master Aug 5, 2023
@holgerd77
holgerd77 deleted the multiple-devp2p-msgs branch August 7, 2023 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants