Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/prysm-geth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run : |
sudo apt update
sudo apt install -y git gcc g++ make cmake pkg-config llvm-dev libclang-dev clang
- name: Install Lighthouse
- name: Install Lighthouse lcli
run: |
git clone https://github.com/sigp/lighthouse.git
cd lighthouse
Expand All @@ -55,6 +55,8 @@ jobs:
run: |
curl -L https://github.com/prysmaticlabs/prysm/releases/download/v5.3.0/beacon-chain-v5.3.0-linux-amd64 -o prysm
chmod +x prysm
curl -L https://github.com/prysmaticlabs/prysm/releases/download/v5.3.0/validator-v5.3.0-linux-amd64 -o prysm_vc
chmod +x prysm_vc
- name: Install Geth
run: |
git clone https://github.com/ethereum/go-ethereum.git
Expand All @@ -79,7 +81,7 @@ jobs:
block_published_lines=$(cat ./data/shadow/hosts/node*/prysm.*.stderr | grep "Finished building block" | wc -l)
echo "block_published_lines=$block_published_lines"
test $block_published_lines -eq 24
attestation_published_lines=$(cat ./data/shadow/hosts/node*/lighthouse.*.stderr | grep "Successfully published attestations" | wc -l)
attestation_published_lines=$(cat ./data/shadow/hosts/node*/prysm_vc.*.stderr | grep -a "Submitted new attestations" | wc -l)
echo "attestation_published_lines=$attestation_published_lines"
test $attestation_published_lines -gt 22
chain_segment_imported_lines=$(cat ./data/shadow/hosts/node*/geth.*.stderr | grep "Imported new potential chain segment" | wc -l)
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cd lighthouse
git checkout v5.3.0 # The latest tested version
make
make install-lcli
cd ..

# Geth
git clone https://github.com/ethereum/go-ethereum.git
Expand All @@ -38,6 +39,7 @@ git checkout v1.14.11 # The latest tested version
make all
sudo cp build/bin/geth /usr/local/bin/geth # Make it globally accessible
sudo cp build/bin/bootnode /usr/local/bin/bootnode # Make it globally accessible
cd ..
```

Install Shadow
Expand All @@ -48,13 +50,15 @@ cd shadow
./setup build --clean
./setup install
echo 'export PATH="${PATH}:/home/${USER}/.local/bin"' >> ~/.bashrc && source ~/.bashrc
cd ..
```

Install Ethshadow.
```sh
git clone https://github.com/ethereum/ethshadow.git
cd ethshadow
cargo install --path .
cd ..
```

Save the following file to a config file `myfirstsim.yaml`.
Expand Down Expand Up @@ -117,7 +121,7 @@ features might not work.
| [Lighthouse](docs/clients/lighthouse.md) | ✅ | ✅ | ✅ | v5.3.0 |
| Lodestar | ❔ | ❔ | ❔ | |
| Nimbus | ❔ | ❔ | ❔ | |
| Prysm | ✅ | ❔ | | v5.3.0 |
| [Prysm](docs/clients/prysm.md) | ✅ | ❔ | | v5.3.0 |
| Teku | ❌ | ❔ | ❔ | |

<!--- ANCHOR_END: supported-clients (for mdbook) -->
Expand Down
5 changes: 4 additions & 1 deletion ci/prysm-geth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ ethereum:
clients:
el: geth
cl: prysm
vc: lighthouse_vc
vc: prysm_vc
count:
per_combination: 10
clients:
prysm:
type: prysm
executable: ./prysm
prysm_vc:
type: prysm_vc
executable: ./prysm_vc
23 changes: 23 additions & 0 deletions docs/clients/prysm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Prysm

## Installation

Download Prysm beacon chain and validator binaries from the Github release page.

```sh
curl -L https://github.com/prysmaticlabs/prysm/releases/download/v5.3.0/beacon-chain-v5.3.0-linux-amd64 -o prysm
chmod +x prysm
curl -L https://github.com/prysmaticlabs/prysm/releases/download/v5.3.0/validator-v5.3.0-linux-amd64 -o prysm_vc
chmod +x prysm_vc
```

## Configuration

### Prysm beacon chain

- `executable`: Specify path of the prysm beacon chain binary to use. This field is required and there is no default value for it.

### Prysm validator

- `executable`: Specify path of the prysm validator binary to use. This field is required and there is no default value for it.
PATH.
4 changes: 2 additions & 2 deletions lib/src/clients/blobssss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::clients::Client;
use crate::clients::CommonParams;
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::validators::Validator;
use crate::validators::ValidatorSet;
use crate::Error;
use itertools::Itertools;
use serde::Deserialize;
Expand All @@ -24,7 +24,7 @@ impl Client for Blobssss {
&self,
_node: &NodeInfo,
ctx: &mut SimulationContext,
_validators: &[Validator],
_vs: &ValidatorSet,
) -> Result<Process, Error> {
Ok(Process {
path: self.common.executable_or("blobssss"),
Expand Down
4 changes: 2 additions & 2 deletions lib/src/clients/geth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::clients::{Client, JSON_RPC_PORT};
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::utils::log_and_wait;
use crate::validators::Validator;
use crate::validators::ValidatorSet;
use crate::Error;
use log::debug;
use serde::Deserialize;
Expand All @@ -26,7 +26,7 @@ impl Client for Geth {
&self,
node: &NodeInfo,
ctx: &mut SimulationContext,
_validators: &[Validator],
_vs: &ValidatorSet,
) -> Result<Process, Error> {
let genesis_file = ctx.metadata_path().join("genesis.json");
let genesis_file = genesis_file.to_str().ok_or(Error::NonUTF8Path)?;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/clients/geth_bootnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::io::Write;
use libsecp256k1::{PublicKey, SecretKey};
use serde::Deserialize;

use crate::clients::{Client, Validator};
use crate::clients::{Client, ValidatorSet};
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::Error;
Expand All @@ -26,7 +26,7 @@ impl Client for GethBootnode {
&self,
node: &NodeInfo,
ctx: &mut SimulationContext,
_validators: &[Validator],
_vs: &ValidatorSet,
) -> Result<Process, Error> {
let dir = node.dir().join("geth_bootnode");
create_dir(&dir)?;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/clients/lighthouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::clients::CommonParams;
use crate::clients::{BEACON_API_PORT, CL_PROMETHEUS_PORT, ENGINE_API_PORT};
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::validators::Validator;
use crate::validators::ValidatorSet;
use crate::Error;
use serde::Deserialize;
use std::collections::HashMap;
Expand Down Expand Up @@ -33,7 +33,7 @@ impl Client for Lighthouse {
&self,
node: &NodeInfo<'a>,
ctx: &mut SimulationContext<'a>,
_validators: &[Validator],
_vs: &ValidatorSet,
) -> Result<Process, Error> {
let dir = node.dir().join("lighthouse");
let dir = dir.to_str().ok_or(Error::NonUTF8Path)?;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/clients/lighthouse_bootnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::HashMap;
use std::fs::read_to_string;
use std::process::Command;

use crate::clients::{Client, Validator};
use crate::clients::{Client, ValidatorSet};
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::utils::log_and_wait;
Expand Down Expand Up @@ -37,7 +37,7 @@ impl Client for LighthouseBootnode {
&self,
node: &NodeInfo,
ctx: &mut SimulationContext,
_validators: &[Validator],
_vs: &ValidatorSet,
) -> Result<Process, Error> {
let dir = node.dir().join("lighthouse_bootnode");
debug!("Calling lcli generate-bootnode-enr");
Expand Down
27 changes: 4 additions & 23 deletions lib/src/clients/lighthouse_vc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::clients::BEACON_API_PORT;
use crate::clients::{Client, ValidatorDemand};
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::validators::Validator;
use crate::validators::ValidatorSet;
use crate::Error;
use serde::Deserialize;
use std::collections::HashMap;
Expand All @@ -24,34 +24,15 @@ impl Client for LighthouseValidatorClient {
&self,
node: &NodeInfo,
ctx: &mut SimulationContext,
validators: &[Validator],
vs: &ValidatorSet,
) -> Result<Process, Error> {
let dir = node.dir().join("lighthouse");
let dir_str = dir.to_str().ok_or(Error::NonUTF8Path)?;
if !dir.exists() {
create_dir(&dir)?;
}

let secrets_dest = dir.join("secrets");
if !secrets_dest.exists() {
create_dir(&secrets_dest)?;
}
let validators_dest = dir.join("validators");
if !validators_dest.exists() {
create_dir(&validators_dest)?;
}

for validator in validators {
let key = validator.key();
fs::rename(
validator.base_path().join("secrets").join(key),
secrets_dest.join(key),
)?;
fs::rename(
validator.base_path().join("keys").join(key),
validators_dest.join(key),
)?;
}
fs::rename(vs.base_path().join("secrets"), dir.join("secrets"))?;
fs::rename(vs.base_path().join("keys"), dir.join("validators"))?;

Ok(Process {
path: self.common.executable_or("lighthouse"),
Expand Down
5 changes: 3 additions & 2 deletions lib/src/clients/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::validators::Validator;
use crate::validators::ValidatorSet;
use crate::CowStr;
use crate::Error;
use serde::Deserialize;
Expand All @@ -19,6 +19,7 @@ pub mod lighthouse_bootnode;
pub mod lighthouse_vc;
pub mod prometheus;
pub mod prysm;
pub mod prysm_vc;
pub mod reth;

pub enum ValidatorDemand {
Expand All @@ -38,7 +39,7 @@ pub trait Client: Debug {
&self,
node: &NodeInfo<'a>,
ctx: &mut SimulationContext<'a>,
validators: &[Validator],
validators: &ValidatorSet,
) -> Result<Process, Error>;

fn validator_demand(&self) -> ValidatorDemand {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/clients/prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::clients::Client;
use crate::clients::CommonParams;
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::validators::Validator;
use crate::validators::ValidatorSet;
use crate::Error;
use serde::{Deserialize, Serialize};
use serde_yaml::to_writer;
Expand Down Expand Up @@ -40,7 +40,7 @@ impl Client for Prometheus {
&self,
node: &NodeInfo,
ctx: &mut SimulationContext,
_validators: &[Validator],
_vs: &ValidatorSet,
) -> Result<Process, Error> {
let dir = node.dir().join("prometheus");
let config_file = node.dir().join("prometheus.yaml");
Expand Down
4 changes: 2 additions & 2 deletions lib/src/clients/prysm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::clients::CommonParams;
use crate::clients::{BEACON_API_PORT, ENGINE_API_PORT};
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::validators::Validator;
use crate::validators::ValidatorSet;
use crate::Error;
use serde::Deserialize;
use std::collections::HashMap;
Expand Down Expand Up @@ -33,7 +33,7 @@ impl Client for Prysm {
&self,
node: &NodeInfo<'a>,
ctx: &mut SimulationContext<'a>,
_validators: &[Validator],
_vs: &ValidatorSet,
) -> Result<Process, Error> {
if self.common.executable.is_empty() {
return Err(Error::MissingExecutable(String::from("prysm")));
Expand Down
73 changes: 73 additions & 0 deletions lib/src/clients/prysm_vc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
use crate::clients::CommonParams;
use crate::clients::{Client, ValidatorDemand};
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::validators::ValidatorSet;
use crate::Error;
use serde::Deserialize;
use std::collections::HashMap;
use std::fs;
use std::fs::create_dir;

#[derive(Deserialize, Debug, Clone, Default)]
#[serde(default)]
pub struct PrysmValidatorClient {
#[serde(flatten)]
pub common: CommonParams,
pub validators: Option<usize>,
}

#[typetag::deserialize(name = "prysm_vc")]
impl Client for PrysmValidatorClient {
fn add_to_node(
&self,
node: &NodeInfo,
ctx: &mut SimulationContext,
vs: &ValidatorSet,
) -> Result<Process, Error> {
if self.common.executable.is_empty() {
return Err(Error::MissingExecutable(String::from("prysm_vc")));
}
let dir = node.dir().join("prysm");
let dir_str = dir.to_str().ok_or(Error::NonUTF8Path)?;
if !dir.exists() {
create_dir(&dir)?;
}
let wallet_dir = dir.join("wallet");
let wallet_dir_str = wallet_dir.to_str().ok_or(Error::NonUTF8Path)?;

let password_file = dir.join("passphrase");
let password_file_str = password_file.to_str().ok_or(Error::NonUTF8Path)?;

fs::rename(vs.base_path().join("prysm"), &wallet_dir)?;
fs::write(&password_file, "12345678")?;

let meta_dir = ctx.metadata_path().to_str().ok_or(Error::NonUTF8Path)?;

let args = format!(
"--chain-config-file \"{meta_dir}/config.yaml\" \
--accept-terms-of-use \
--datadir \"{dir_str}\" \
--wallet-dir \"{wallet_dir_str}\" \
--wallet-password-file \"{password_file_str}\" \
{}",
self.common
.arguments("--suggested-fee-recipient 0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134"),
);

Ok(Process {
path: self.common.executable.clone().into(),
args,
environment: HashMap::new(),
expected_final_state: "running".into(),
start_time: "5s".into(),
})
}

fn validator_demand(&self) -> ValidatorDemand {
match self.validators {
None => ValidatorDemand::Any,
Some(num) => ValidatorDemand::Count(num),
}
}
}
4 changes: 2 additions & 2 deletions lib/src/clients/reth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::clients::ENGINE_API_PORT;
use crate::clients::{Client, JSON_RPC_PORT};
use crate::config::shadow::Process;
use crate::node::{NodeInfo, SimulationContext};
use crate::validators::Validator;
use crate::validators::ValidatorSet;
use crate::Error;
use serde::Deserialize;
use std::collections::HashMap;
Expand All @@ -23,7 +23,7 @@ impl Client for Reth {
&self,
node: &NodeInfo,
ctx: &mut SimulationContext,
_validators: &[Validator],
_vs: &ValidatorSet,
) -> Result<Process, Error> {
let genesis_file = ctx.metadata_path().join("genesis.json");
let genesis_file = genesis_file.to_str().ok_or(Error::NonUTF8Path)?;
Expand Down
Loading