Skip to content

Commit

Permalink
Merge pull request #9 from Firstset/readme-updates
Browse files Browse the repository at this point in the history
Readme updates, tidy up config
  • Loading branch information
bernatfp authored Oct 22, 2024
2 parents f65aeb4 + 10f7f65 commit ac8aac6
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ __pycache__/
.pytest_cache

venv
.venv
validator_keys
config.toml

75 changes: 49 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,57 @@
# Lido CSM validator manager

A CLI tool to deploy, monitor and manage validator keys for the Lido CSM.

## Features

- Deploy validators: Create and deploy new validator keys to the validator client and CSM
- Manage validator keys:
- Find inconsistencies between generated keys, loaded keystores and successfully registered validators
- Rollback inconsistent states
- Exit validators:
- Manually, with its public key
- Automatically, by monitoring the Lido Validator Exit Bus Oracle and actioning exit requests
- Support for remote signer setups (e.g. web3signer)

## Pre-requisites

- The [deposit key generation tool](https://github.com/ethereum/staking-deposit-cli)

- A previously generated seed phrase

- An execution layer RPC address
- A synchronized, running Ethereum node (EL + CL)
- An Ethereum account managed by the node, able to sign transactions.
- Access to a synchronized, running Ethereum RPC node (EL & CL)
- Reachable through HTTP & WS (CL & EL respectively)
- A running validator client with support for mutiple key management (e.g. Lighthouse)
- With active Keymanager API listening in localhost
- Reachable through ssh
- With active Keymanager API listening in localhost
- Reachable through SSH

## Setup

Copy `config.toml.example` to `config.toml` and fill with your configuration values
Copy `config.toml.holesky.example` or `config.toml.mainnet.example` to `config.toml` and fill with your configuration values

```
cp config.toml.example config.toml
cp config.toml.holesky.example config.toml
```

The config file should contain:
The Holesky config file may contain:

```toml
# eth_base is the ETH address that will send the transaction
# to register the Lido CSM validators. The bond will be send
# from eth_base's ETH balance
eth_base="<eth_base_address>"
eth_base=<eth_base_address>
chain="holesky"

[deposit]
# Lido CSM testnet withdrawal address.
withdrawal_address="0xF0179dEC45a37423EAD4FaD5fCb136197872EAd9"
path="/path/to/deposit/tool/deposit" # staking-cli-deposit executable
withdrawal_address=<withdrawal_address>
path="/path/to/deposit/tool/deposit/"

[csm]
# Lido CSM Node Operator id. Remove line if no ID has bee
# assigned yet.
node_operator_id=999999

[csm.contracts]
# Lido CSM tstnet contracts.
module_address="0x4562c3e63c2e586cD1651B958C22F88135aCAd4f"
accounting_address="0xc093e53e8F4b55A223c18A2Da6fA00e60DD5EFE1"
VEBO_address="0xffDDF7025410412deaa05E3E1cE68FE53208afcb"

[rpc]
address="http://my-rpc-address:port"
execution_address="ws://my-exec-rpc-address:port"
consensus_address="http://my-beacon-rpc-address:port"

[validator_api]
auth_token="api-token-0x123456789"
Expand All @@ -56,12 +61,14 @@ port=5062
[remote_signer]
ssh_address="user@signer"
port=9000
url="http://my-signer.xyz:port"
url="http://my-remote-signer.xyz:port"

[state_check]
node_operator_ids=[420, 666]
[monitoring]
node_operator_ids = [420, 666]
```

Some of these parameters are optional and can be omitted depending on the functionality you want to use.


Install python dependencies

Expand All @@ -70,15 +77,15 @@ pip install -r requirements.txt
```


## Exceute
## Execute

### Deploy validators

`python -m swarm deploy --n_keys <N> --index <I> [--remote_sign]`

`N` is the number of keys to be generated and submitted, and `I` is the starting index for key generation, defaults to 0.

The `--remote_sign` flag indicates that the keystores will be uploaded to a remote signer, while also registered as remote keys in the configured validator.
The `--remote_sign` flag indicates that the keystores will be uploaded to a remote signer, while also registered as remote keys in the configured validator. Otherwise, the keystores will be stored in the validator client.

### State check

Expand All @@ -87,3 +94,19 @@ The state check subcommand will retrieve all keys registered in CSM, validator c
`python -m swarm state-check [--delete]`

`--delete` will attempt to remove dangling validator keys, i.e. validator keys that are present either in the validaor client or remote signer, but not in CSM. Keys registered in CSM will never be deleted.

### Manual exit

This subcommand will submit an exit request for a validator with a given public key.

`python -m swarm exit --pubkey <pubkey>`

`pubkey` is the public key of the validator to be exited.

### Monitoring and automated exits

This subcommand will monitor the Lido Validator Exit Bus Oracle and log exit requests for the configured node operator ids.

`python -m swarm auto_exit [--delete]`

The `--delete` flag indicates that the validator will be automatically exited when an exit request has been detected.
4 changes: 2 additions & 2 deletions config.toml.example → config.toml.holesky.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ eth_base=<eth_base_address>
chain="holesky"

[deposit]
withdrawal_address=<withdrawal_address>
withdrawal_address=0xF0179dEC45a37423EAD4FaD5fCb136197872EAd9
path="/path/to/deposit/tool/deposit/"

[csm]
Expand All @@ -28,4 +28,4 @@ port=9000
url="http://my-remote-signer.xyz:port"

[monitoring]
node_operator_ids = ['420','666']
node_operator_ids = [420, 666]
31 changes: 31 additions & 0 deletions config.toml.mainnet.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
eth_base=<eth_base_address>
chain="mainnet"

[deposit]
withdrawal_address=0xb9d7934878b5fb9610b3fe8a5e441e8fad7e293f
path="/path/to/deposit/tool/deposit/"

[csm]
node_operator_id=999999

[csm.contracts]
module_address="0xdA7dE2ECdDfccC6c3AF10108Db212ACBBf9EA83F"
accounting_address="0x4d72BFF1BeaC69925F8Bd12526a39BAAb069e5Da"
VEBO_address="0x0De4Ea0184c2ad0BacA7183356Aea5B8d5Bf5c6e"

[rpc]
execution_address="ws://my-exec-rpc-address:port"
consensus_address="http://my-beacon-rpc-address:port"

[validator_api]
auth_token="api-token-0x123456789"
ssh_address="user@server"
port=5062

[remote_signer]
ssh_address="user@signer"
port=9000
url="http://my-remote-signer.xyz:port"

[monitoring]
node_operator_ids = [999999]
2 changes: 1 addition & 1 deletion swarm/validator/exit_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class ExitHandler():
def __init__(self, config: dict) -> None:
self.beacon_rpc = config['rpc']['beacon_address']
self.beacon_rpc = config['rpc']['consensus_address']
if not is_well_formed_url(self.beacon_rpc, 'http'):
raise ConsensusLayerRPCException('Consensus layer RPC is not well formed. It must be a valid http adress, and specify a port.')
self.keymanager_ssh = config['validator_api']['ssh_address']
Expand Down
2 changes: 1 addition & 1 deletion tests/test_exit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TestDeposit(unittest.TestCase):
def setUp(self):
self.config = {
'rpc': {
'beacon_address': 'http://beacon-rpc.xyz:9090'
'consensus_address': 'http://beacon-rpc.xyz:9090'
},
'validator_api': {
'ssh_address': 'user@validator',
Expand Down

0 comments on commit ac8aac6

Please sign in to comment.