Skip to content

Commit ac59210

Browse files
AgeManningmacladsonpaulhaunermichaelsproul
authored
Update to Libp2p to 39.1 (#2448)
* Adjust beacon node timeouts for validator client HTTP requests (#2352) ## Issue Addressed Resolves #2313 ## Proposed Changes Provide `BeaconNodeHttpClient` with a dedicated `Timeouts` struct. This will allow granular adjustment of the timeout duration for different calls made from the VC to the BN. These can either be a constant value, or as a ratio of the slot duration. Improve timeout performance by using these adjusted timeout duration's only whenever a fallback endpoint is available. Add a CLI flag called `use-long-timeouts` to revert to the old behavior. ## Additional Info Additionally set the default `BeaconNodeHttpClient` timeouts to the be the slot duration of the network, rather than a constant 12 seconds. This will allow it to adjust to different network specifications. Co-authored-by: Paul Hauner <[email protected]> * Use read_recursive locks in database (#2417) ## Issue Addressed Closes #2245 ## Proposed Changes Replace all calls to `RwLock::read` in the `store` crate with `RwLock::read_recursive`. ## Additional Info * Unfortunately we can't run the deadlock detector on CI because it's pinned to an old Rust 1.51.0 nightly which cannot compile Lighthouse (one of our deps uses `ptr::addr_of!` which is too new). A fun side-project at some point might be to update the deadlock detector. * The reason I think we haven't seen this deadlock (at all?) in practice is that _writes_ to the database's split point are quite infrequent, and a concurrent write is required to trigger the deadlock. The split point is only written when finalization advances, which is once per epoch (every ~6 minutes), and state reads are also quite sporadic. Perhaps we've just been incredibly lucky, or there's something about the timing of state reads vs database migration that protects us. * I wrote a few small programs to demo the deadlock, and the effectiveness of the `read_recursive` fix: https://github.com/michaelsproul/relock_deadlock_mvp * [The docs for `read_recursive`](https://docs.rs/lock_api/0.4.2/lock_api/struct.RwLock.html#method.read_recursive) warn of starvation for writers. I think in order for starvation to occur the database would have to be spammed with so many state reads that it's unable to ever clear them all and find time for a write, in which case migration of states to the freezer would cease. If an attack could be performed to trigger this starvation then it would likely trigger a deadlock in the current code, and I think ceasing migration is preferable to deadlocking in this extreme situation. In practice neither should occur due to protection from spammy peers at the network layer. Nevertheless, it would be prudent to run this change on the testnet nodes to check that it doesn't cause accidental starvation. * Return more detail when invalid data is found in the DB during startup (#2445) ## Issue Addressed - Resolves #2444 ## Proposed Changes Adds some more detail to the error message returned when the `BeaconChainBuilder` is unable to access or decode block/state objects during startup. ## Additional Info NA * Use hardware acceleration for SHA256 (#2426) ## Proposed Changes Modify the SHA256 implementation in `eth2_hashing` so that it switches between `ring` and `sha2` to take advantage of [x86_64 SHA extensions](https://en.wikipedia.org/wiki/Intel_SHA_extensions). The extensions are available on modern Intel and AMD CPUs, and seem to provide a considerable speed-up: on my Ryzen 5950X it dropped state tree hashing times by about 30% from 35ms to 25ms (on Prater). ## Additional Info The extensions became available in the `sha2` crate [last year](https://www.reddit.com/r/rust/comments/hf2vcx/ann_rustcryptos_sha1_and_sha2_now_support/), and are not available in Ring, which uses a [pure Rust implementation of sha2](https://github.com/briansmith/ring/blob/main/src/digest/sha2.rs). Ring is faster on CPUs that lack the extensions so I've implemented a runtime switch to use `sha2` only when the extensions are available. The runtime switching seems to impose a miniscule penalty (see the benchmarks linked below). * Start a release checklist (#2270) ## Issue Addressed NA ## Proposed Changes Add a checklist to the release draft created by CI. I know @michaelsproul was also working on this and I suspect @realbigsean also might have useful input. ## Additional Info NA * Serious banning * fmt Co-authored-by: Mac L <[email protected]> Co-authored-by: Paul Hauner <[email protected]> Co-authored-by: Michael Sproul <[email protected]>
1 parent b867d33 commit ac59210

File tree

30 files changed

+616
-176
lines changed

30 files changed

+616
-176
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,23 @@ jobs:
237237
body=$(cat <<- "ENDBODY"
238238
<Rick and Morty character>
239239
240+
## Testing Checklist (DELETE ME)
241+
242+
- [ ] Run on synced Pyrmont Sigma Prime nodes.
243+
- [ ] Run on synced Prater Sigma Prime nodes.
244+
- [ ] Run on synced Canary (mainnet) Sigma Prime nodes.
245+
- [ ] Resync a Pyrmont node.
246+
- [ ] Resync a Prater node.
247+
- [ ] Resync a mainnet node.
248+
249+
## Release Checklist (DELETE ME)
250+
251+
- [ ] Merge `unstable` -> `stable`.
252+
- [ ] Ensure docker images are published (check `latest` and the version tag).
253+
- [ ] Prepare Discord post.
254+
- [ ] Prepare Twitter post.
255+
- [ ] Prepare mailing list email.
256+
240257
## Summary
241258
242259
Add a summary.

Cargo.lock

Lines changed: 114 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)