paradigmxyz / reth

Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust
https://reth.rs/
Apache License 2.0
3.53k stars 915 forks source link

Buffer incoming engine messages if pruner is active #8203

Open mattsse opened 1 month ago

mattsse commented 1 month ago

Describe the feature

currently, pruning data and engine message handling are mutually exclusive because we can't handle them concurrently due to exclusive db lock.

rn we're dropping messages in edge cases, which is not ideal. we expect the pruner to be active for at most a few 100ms, so we should be able to delay engine message processing by buffering them in a Vecdeque and popping them in poll loop:

https://github.com/paradigmxyz/reth/blob/a8bbab2470c08140f10d327989a1ac3122ca2211/crates/consensus/beacon/src/engine/mod.rs#L1870-L1870

we can change this to, draining the incoming messages and storing them in a vecque temporarily, and proceed to pop from the vecdque once we're ready to handle them

Additional context

No response

emhane commented 1 month ago

related https://github.com/paradigmxyz/reth/pull/8251#issuecomment-2131273121 @rkrasiuk