Ethereum consensus client in Rust
Go to file
Paul Hauner 11d80a6a38 Optimise per_epoch_processing low-hanging-fruit (#3254)
## Issue Addressed

NA

## Proposed Changes

- Uses a `Vec` in `SingleEpochParticipationCache` rather than `HashMap` to speed up processing times at the cost of memory usage.
- Cache the result of `integer_sqrt` rather than recomputing for each validator.
- Cache `state.previous_epoch` rather than recomputing it for each validator.

### Benchmarks

Benchmarks on a recent mainnet state using #3252 to get timing.

#### Without this PR

```
lcli skip-slots --state-path /tmp/state-0x3cdc.ssz --partial-state-advance --slots 32 --state-root 0x3cdc33cd02713d8d6cc33a6dbe2d3a5bf9af1d357de0d175a403496486ff845e --runs 10
[2022-06-09T08:21:02Z INFO  lcli::skip_slots] Using mainnet spec
[2022-06-09T08:21:02Z INFO  lcli::skip_slots] Advancing 32 slots
[2022-06-09T08:21:02Z INFO  lcli::skip_slots] Doing 10 runs
[2022-06-09T08:21:02Z INFO  lcli::skip_slots] State path: "/tmp/state-0x3cdc.ssz"
SSZ decoding /tmp/state-0x3cdc.ssz: 43ms
[2022-06-09T08:21:03Z INFO  lcli::skip_slots] Run 0: 245.718794ms
[2022-06-09T08:21:03Z INFO  lcli::skip_slots] Run 1: 245.364782ms
[2022-06-09T08:21:03Z INFO  lcli::skip_slots] Run 2: 255.866179ms
[2022-06-09T08:21:04Z INFO  lcli::skip_slots] Run 3: 243.838909ms
[2022-06-09T08:21:04Z INFO  lcli::skip_slots] Run 4: 250.431425ms
[2022-06-09T08:21:04Z INFO  lcli::skip_slots] Run 5: 248.68765ms
[2022-06-09T08:21:04Z INFO  lcli::skip_slots] Run 6: 262.051113ms
[2022-06-09T08:21:05Z INFO  lcli::skip_slots] Run 7: 264.293967ms
[2022-06-09T08:21:05Z INFO  lcli::skip_slots] Run 8: 293.202007ms
[2022-06-09T08:21:05Z INFO  lcli::skip_slots] Run 9: 264.552017ms
```

#### With this PR:

```
lcli skip-slots --state-path /tmp/state-0x3cdc.ssz --partial-state-advance --slots 32 --state-root 0x3cdc33cd02713d8d6cc33a6dbe2d3a5bf9af1d357de0d175a403496486ff845e --runs 10
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 0: 73.898678ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 1: 75.536978ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 2: 75.176104ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 3: 76.460828ms
[2022-06-09T08:57:59Z INFO  lcli::skip_slots] Run 4: 75.904195ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 5: 75.53077ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 6: 74.745572ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 7: 75.823489ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 8: 74.892055ms
[2022-06-09T08:58:00Z INFO  lcli::skip_slots] Run 9: 76.333569ms
```

## Additional Info

NA
2022-06-10 04:29:28 +00:00
.github Lint against panicky calls in async functions (#3250) 2022-06-10 04:29:27 +00:00
account_manager Improve slashing import log (#3122) 2022-03-28 07:14:16 +00:00
beacon_node Optimise per_epoch_processing low-hanging-fruit (#3254) 2022-06-10 04:29:28 +00:00
book Fix links in docs (#3219) 2022-05-31 06:09:07 +00:00
boot_node v2.3.0 (#3222) 2022-05-30 01:35:10 +00:00
common Update Ropsten TTD (#3240) 2022-06-04 21:24:39 +00:00
consensus Optimise per_epoch_processing low-hanging-fruit (#3254) 2022-06-10 04:29:28 +00:00
crypto Update and consolidate dependencies (#3136) 2022-04-04 00:26:16 +00:00
database_manager Conserve disk space by raising default SPRP (#3137) 2022-04-01 07:16:25 +00:00
lcli Use a stable tag for ubuntu in dockerfile (#3231) 2022-05-31 06:09:12 +00:00
lighthouse Improve eth1 block cache sync (for Ropsten) (#3234) 2022-06-03 06:05:03 +00:00
scripts Updates to tests and local testnet for Ganache 7 (#3056) 2022-03-20 22:48:14 +00:00
slasher Pin MDBX at last version with Win/Mac support (#3246) 2022-06-10 04:29:26 +00:00
testing Only use authenticated endpoints during EE integration testing (#3253) 2022-06-09 10:47:03 +00:00
validator_client Add new VC metrics for beacon node availability (#3193) 2022-05-26 02:05:16 +00:00
.dockerignore Exclude EE build dirs from Docker context (#3174) 2022-05-09 23:43:31 +00:00
.editorconfig Add editorconfig template 2019-03-11 15:09:57 +11:00
.gitignore Lint against panicky calls in async functions (#3250) 2022-06-10 04:29:27 +00:00
.gitmodules Replace EF tests submodule with a makefile 2019-09-08 04:19:54 +10:00
bors.toml Add minimum supported Rust version (#3082) 2022-03-17 03:33:29 +00:00
Cargo.lock minor libp2p upgrade (#3259) 2022-06-09 23:48:51 +00:00
Cargo.toml Update and consolidate dependencies (#3136) 2022-04-04 00:26:16 +00:00
CONTRIBUTING.md Update CONTRIBUTING.md (#751) 2020-01-03 10:45:53 +11:00
Cross.toml Optimise slasher DB layout and switch to MDBX (#2776) 2021-12-21 08:23:17 +00:00
Dockerfile Use a stable tag for ubuntu in dockerfile (#3231) 2022-05-31 06:09:12 +00:00
Dockerfile.cross Use a stable tag for ubuntu in dockerfile (#3231) 2022-05-31 06:09:12 +00:00
LICENSE Update License to Apache 2.0 2019-04-15 16:47:35 +10:00
Makefile Lint against panicky calls in async functions (#3250) 2022-06-10 04:29:27 +00:00
README.md Remove build status badge from README (#3195) 2022-05-20 05:02:14 +00:00
SECURITY.md Add how users should report security vulnerabilities for this repository (#2562) 2021-09-07 01:54:05 +00:00

Lighthouse: Ethereum consensus client

An open-source Ethereum consensus client, written in Rust and maintained by Sigma Prime.

Book Status Chat Badge

Documentation

Banner

Overview

Lighthouse is:

  • Ready for use on Ethereum consensus mainnet.
  • Fully open-source, licensed under Apache 2.0.
  • Security-focused. Fuzzing techniques have been continuously applied and several external security reviews have been performed.
  • Built in Rust, a modern language providing unique safety guarantees and excellent performance (comparable to C++).
  • Funded by various organisations, including Sigma Prime, the Ethereum Foundation, ConsenSys, the Decentralization Foundation and private individuals.
  • Actively involved in the specification and security analysis of the Ethereum proof-of-stake consensus specification.

Staking Deposit Contract

The Lighthouse team acknowledges 0x00000000219ab540356cBB839Cbe05303d7705Fa as the canonical staking deposit contract address.

Documentation

The Lighthouse Book contains information for users and developers.

The Lighthouse team maintains a blog at lighthouse-blog.sigmaprime.io which contains periodical progress updates, roadmap insights and interesting findings.

Branches

Lighthouse maintains two permanent branches:

  • stable: Always points to the latest stable release.
    • This is ideal for most users.
  • unstable: Used for development, contains the latest PRs.
    • Developers should base their PRs on this branch.

Contributing

Lighthouse welcomes contributors.

If you are looking to contribute, please head to the Contributing section of the Lighthouse book.

Contact

The best place for discussion is the Lighthouse Discord server.

Sign up to the Lighthouse Development Updates mailing list for email notifications about releases, network status and other important information.

Encrypt sensitive messages using our PGP key.

Donations

Lighthouse is an open-source project and a public good. Funding public goods is hard and we're grateful for the donations we receive from the community via:

  • Gitcoin Grants.
  • Ethereum address: 0x25c4a76E7d118705e7Ea2e9b7d8C59930d8aCD3b (donation.sigmaprime.eth).