Skip to content

Commit

Permalink
Updated lighthouse book & fixed slasher cli tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ethDreamer committed May 18, 2021
1 parent 18603c9 commit d23e695
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 17 deletions.
48 changes: 31 additions & 17 deletions book/src/installation-source.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Installation: Build from Source

Lighthouse builds on Linux, macOS, and Windows (via [WSL][] only).
Lighthouse builds on Linux, macOS, and Windows (native Windows support in
BETA, we also support Windows via [WSL][]).

Compilation should be easy. In fact, if you already have Rust installed all you
need is:
Compilation should be easy. In fact, if you already have Rust and the build
dependencies installed, all you need is:

- `git clone https://github.com/sigp/lighthouse.git`
- `cd lighthouse`
Expand All @@ -26,35 +27,45 @@ directory will be the location you cloned Lighthouse to during the installation
- `git checkout ${VERSION}`
- `make`


## Detailed Instructions

1. Install Rust and Cargo with [rustup](https://rustup.rs/).
- Use the `stable` toolchain (it's the default).
- Check the [Troubleshooting](#troubleshooting) section for additional
dependencies (e.g., `cmake`).
1. Install the build dependencies for your platform
- Check the [Dependencies](#dependencies) section for additional
information.
1. Clone the Lighthouse repository.
- Run `$ git clone https://github.com/sigp/lighthouse.git`
- Change into the newly created directory with `$ cd lighthouse`
1. Build Lighthouse with `$ make`.
1. Installation was successful if `$ lighthouse --help` displays the
command-line documentation.
1. The build was successful if the `lighthouse` binary exists in the `target/release` directory and `$ ./target/release/lighthouse --help` displays the command-line documentation.

> First time compilation may take several minutes. If you experience any
> failures, please reach out on [discord](https://discord.gg/cyAszAh) or
> [create an issue](https://github.com/sigp/lighthouse/issues/new).
## Windows Support

Compiling or running Lighthouse natively on Windows is not currently supported. However,
Lighthouse can run successfully under the [Windows Subsystem for Linux (WSL)][WSL]. If using
Ubuntu under WSL, you can should install the Ubuntu dependencies listed in the [Dependencies
(Ubuntu)](#dependencies-ubuntu) section.
## Dependencies

[WSL]: https://docs.microsoft.com/en-us/windows/wsl/about
#### Installing Rust

## Troubleshooting
The best way to install Rust (regardless of platform) is usually with [rustup](https://rustup.rs/)
- Use the `stable` toolchain (it's the default).

#### Windows Support

These instructions are for compiling or running Lighthouse natively on Windows, which is currently in
BETA testing. Lighthouse can also run successfully under the [Windows Subsystem for Linux (WSL)][WSL].
If using Ubuntu under WSL, you should follow the instructions for Ubuntu listed in the
[Dependencies (Ubuntu)](#ubuntu) section.

### Dependencies
[WSL]: https://docs.microsoft.com/en-us/windows/wsl/about

1. Install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
1. Install [Chocolatey](https://chocolatey.org/install) Package Manager for Windows
- Install `make` via `choco install make`
- Install `cmake` via `choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'`
1. Note that in Windows, the lighthouse binary will exist at `.\target\release\lighthouse.exe` when
built successfully.

#### Ubuntu

Expand All @@ -71,6 +82,9 @@ You will need `cmake`. You can install via homebrew:

brew install cmake


## Troubleshooting

### Command is not found

Lighthouse will be installed to `CARGO_HOME` or `$HOME/.cargo`. This directory
Expand Down
1 change: 1 addition & 0 deletions book/src/slasher.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ of the immaturity of the slasher UX and the extra resources required.
* Quad-core CPU
* 16 GB RAM
* 256 GB solid state storage (in addition to space for the beacon node DB)
- ⚠️ **If you are running natively on Windows**: LMDB will pre-allocate the entire 256 GB for the slasher database

## How to Run

Expand Down
7 changes: 7 additions & 0 deletions lighthouse/tests/beacon_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,7 @@ fn compact_db_flag() {
fn slasher_flag() {
CommandLineTest::new()
.flag("slasher", None)
.flag("slasher-max-db-size", Some("16"))
.run()
.with_config_and_dir(|config, dir| {
if let Some(slasher_config) = &config.slasher {
Expand All @@ -699,6 +700,7 @@ fn slasher_dir_flag() {
CommandLineTest::new()
.flag("slasher", None)
.flag("slasher-dir", dir.path().as_os_str().to_str())
.flag("slasher-max-db-size", Some("16"))
.run()
.with_config(|config| {
if let Some(slasher_config) = &config.slasher {
Expand All @@ -712,6 +714,7 @@ fn slasher_dir_flag() {
fn slasher_update_period_flag() {
CommandLineTest::new()
.flag("slasher", None)
.flag("slasher-max-db-size", Some("16"))
.flag("slasher-update-period", Some("100"))
.run()
.with_config(|config| {
Expand All @@ -726,6 +729,7 @@ fn slasher_update_period_flag() {
fn slasher_history_length_flag() {
CommandLineTest::new()
.flag("slasher", None)
.flag("slasher-max-db-size", Some("16"))
.flag("slasher-history-length", Some("2048"))
.run()
.with_config(|config| {
Expand Down Expand Up @@ -755,6 +759,7 @@ fn slasher_chunk_size_flag() {
CommandLineTest::new()
.flag("slasher", None)
.flag("slasher-chunk-size", Some("32"))
.flag("slasher-max-db-size", Some("16"))
.run()
.with_config(|config| {
let slasher_config = config
Expand All @@ -768,6 +773,7 @@ fn slasher_chunk_size_flag() {
fn slasher_validator_chunk_size_flag() {
CommandLineTest::new()
.flag("slasher", None)
.flag("slasher-max-db-size", Some("16"))
.flag("slasher-validator-chunk-size", Some("512"))
.run()
.with_config(|config| {
Expand All @@ -783,6 +789,7 @@ fn slasher_broadcast_flag() {
CommandLineTest::new()
.flag("slasher", None)
.flag("slasher-broadcast", None)
.flag("slasher-max-db-size", Some("16"))
.run()
.with_config(|config| {
let slasher_config = config
Expand Down

0 comments on commit d23e695

Please sign in to comment.