Nico Flaig ac704f28d2 fix: defer common block body production until next event loop (#8285)
**Motivation**

While going through block production logs I noticed in some rare cases
we sent header requests pretty delayed into the slot, but not if you
look at our logs, it shows that header was sent at ~100ms but mev-boost
received it at ~600ms which is a huge discrepancy. When further
analysing this I noticed that ~600ms is roughtly the time we finished
producing the common block body. This means we can't really trust the
logs here as they might be emitted but the actual HTTP request is not
sent.

Since this issue is pretty rare and most of the time we sent the
requests <100ms I think it's race condition and highly depends on I/O
timing and what other async/sync load is processed.

Another interesting side effect of this is that when these huge delays
happen (up to 500ms) I also noticed that builder HTTP requests run into
the 1 second timeout even though it looks from mev-boost perspective
that response was sent within time. My guess here is that the `fetch`
implementation sets the timer and starts it but since sending the actual
HTTP requests requires to go through poll phase it might not actually
bet sent.

Long story short, we need to wait until next evet loop iteration to
ensure I/O operations are processed before starting common block body
production as it is synchronous and blocking.

**Description**

Defer call produce common block body `produceCommonBlockBody` to next
event loop by running it in `setImmediate` callback.

Previous PR https://github.com/ChainSafe/lodestar/pull/7814
2025-09-01 11:46:22 +01:00
2022-01-31 11:49:02 -06:00
2020-03-30 20:24:46 -04:00
2024-11-17 12:13:51 +07:00
2021-03-07 12:50:58 +01:00
2024-02-08 16:59:25 +01:00
2025-03-11 12:43:21 -07:00

Lodestar Ethereum Consensus Implementation

GitHub release (latest by date) Docker Image Version (latest by date) Eth Consensus Spec v1.5.0 ES Version Node Version codecov gitpoap badge

Lodestar is a TypeScript implementation of the Ethereum Consensus specification developed by ChainSafe Systems.

Getting started

Prerequisites

Developer Quickstart:
yarn install
yarn build
./lodestar --help

Architecture Overview

  • 📦 This mono-repository contains a suite of Ethereum Consensus packages.
  • ⚖️ The mono-repository is released under Apache-2.0 license. Note, that the packages contain their own licenses.
Package Version License Docs Description
@chainsafe/lodestar npm License documentation 💻 Command-line tool for Lodestar
@lodestar/api npm License documentation 📋 REST Client for the Ethereum Beacon API
@lodestar/beacon-node npm License documentation 🚨 Beacon-chain client
@lodestar/config npm License documentation 🗒️ Eth Consensus types and params bundled together
@lodestar/db npm License documentation 💾 Read/write persistent Eth Consensus data
@lodestar/flare npm License documentation 💥 Command tool for triggering non-standard actions
@lodestar/fork-choice npm License documentation 🍴 Beacon-chain fork choice
@lodestar/light-client npm License documentation 🐦 Ethereum Light client
@lodestar/logger npm License documentation 📝 NodeJS logger for Lodestar binaries
@lodestar/params npm License documentation 🕸️ Eth Consensus network parameters
@lodestar/prover npm License documentation Ethereum Light client verifier for execution JSON-RPC calls
@lodestar/reqresp npm License documentation 📞 Eth Consensus Req/Resp protocol
@lodestar/spec-test-util npm License documentation 🧪 Test harness for Eth Consensus spec tests
@lodestar/state-transition npm License documentation 🔎 Eth Consensus beacon-state transition
@lodestar/types npm License documentation 🗒️ Eth Consensus TypeScript and SSZ types
@lodestar/utils npm License documentation 🧰 Miscellaneous utility functions used across Lodestar
@lodestar/validator npm License documentation 🏦 Validator client

Contributors

Read our contributors document, submit an issue or talk to us on our Discord!

Meetings

Weekly contributor meetings are posted under Discussions and topics are welcomed by any participant in the relevant meeting thread. Feel free to check out our meeting notes and documents on HackMD. Post-September 2021, meeting notes can be found on the Lodestar Wiki Page.

Donations

We are a local group of Toronto open-source developers. As such, all of our open-source work is funded by grants. We all take the time out of our hectic lives to contribute to the Ethereum ecosystem. If you want to donate, you can find the ETH address under "Sponsor this project" on this repository.

Description
No description provided
Readme 507 MiB
Languages
TypeScript 98.9%
JavaScript 0.6%
Shell 0.4%