Skip to content

Commit d24987f

Browse files
authored
feat(signer): add support for more CL keystore formats (#189)
* Add support for Teku keystore format * WIP: Add prysm keystore support * Refactor Prysm loader * Fix clippy and format * Add Lodestar support * Improve error handling * Update docs * Move dependencies to root Cargo.toml * Update example config with new format field * Use lowercase for ValidatorKeyFormat Serialization * Remove unnecessary dependency * Update docs * Remove unnecessary docker env var * Add tests for loaders * Replace serde rename with alias * Fix format
1 parent 0be1454 commit d24987f

23 files changed

+610
-31
lines changed

Cargo.lock

+65-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+7
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ toml = "0.8.13"
5555
serde = { version = "1.0.202", features = ["derive"] }
5656
serde_json = "1.0.117"
5757
serde_yaml = "0.9.33"
58+
base64 = "0.22.1"
59+
unicode-normalization = "0.1.24"
5860

5961
# telemetry
6062
tracing = "0.1.40"
@@ -68,6 +70,11 @@ tree_hash = "0.8"
6870
tree_hash_derive = "0.8"
6971
eth2_keystore = { git = "https://github.com/sigp/lighthouse", rev = "9e12c21f268c80a3f002ae0ca27477f9f512eb6f" }
7072
k256 = "0.13"
73+
aes = "0.8"
74+
ctr = "0.9.2"
75+
cipher = "0.4"
76+
pbkdf2 = "0.12.2"
77+
sha2 = "0.10.8"
7178

7279
# docker
7380
docker-compose-types = "0.12.0"

config.example.toml

+13-3
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,23 @@ headers = { X-MyCustomHeader = "ADifferentCustomValue" }
131131
docker_image = "ghcr.io/commit-boost/signer:latest"
132132
# Configuration for how the Signer module should load validator keys. Currently two types of loaders are supported:
133133
# - File: load keys from a plain text file (unsafe, use only for testing purposes)
134-
# - ValidatorsDir: load keys from a `keys` and `secrets` folder (ERC-2335 style keystores as used in Lighthouse)
134+
# - ValidatorsDir: load keys from a `keys` and `secrets` file/folder (ERC-2335 style keystores). More details can be found in the docs (https://commit-boost.github.io/commit-boost-client/get_started/configuration/)
135135
[signer.loader]
136136
# File: path to the keys file
137137
key_path = "./keys.example.json"
138-
# ValidatorsDir: path to the keys directory
138+
# ValidatorsDir: format of the keystore (lighthouse, prysm, teku or lodestar)
139+
# format = "lighthouse"
140+
# ValidatorsDir: full path to the keys directory
141+
# For lighthouse, it's de path to the directory where the `<pubkey>/voting-keystore.json` directories are located.
142+
# For prysm, it's the path to the `all-accounts.keystore.json` file.
143+
# For teku, it's the path to the directory where all `<pubkey>.json` files are located.
144+
# For lodestar, it's the path to the directory where all `<pubkey>.json` files are located.
139145
# keys_path = ""
140-
# ValidatorsDir: path to the secrets directory
146+
# ValidatorsDir: full path to the secrets file/directory
147+
# For lighthouse, it's de path to the directory where the `<pubkey>.json` files are located.
148+
# For prysm, it's the path to the file containing the wallet decryption password.
149+
# For teku, it's the path to the directory where all `<pubkey>.txt` files are located.
150+
# For lodestar, it's the path to the file containing the decryption password.
141151
# secrets_path = ""
142152
# Configuration for how the Signer module should store proxy delegations. Currently one type of store is supported:
143153
# - File: store keys and delegations from a plain text file (unsafe, use only for testing purposes)

crates/cli/src/docker_init.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ pub fn handle_docker_init(config_path: String, output_dir: String) -> Result<()>
329329
let (k, v) = get_env_val(SIGNER_KEYS_ENV, SIGNER_DEFAULT);
330330
signer_envs.insert(k, v);
331331
}
332-
SignerLoader::ValidatorsDir { keys_path, secrets_path } => {
332+
SignerLoader::ValidatorsDir { keys_path, secrets_path, format: _ } => {
333333
volumes.push(Volumes::Simple(format!(
334334
"{}:{}:ro",
335335
keys_path.display(),

crates/common/Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ tree_hash.workspace = true
3535
tree_hash_derive.workspace = true
3636
eth2_keystore.workspace = true
3737
k256.workspace = true
38+
aes.workspace = true
39+
ctr.workspace = true
40+
cipher.workspace = true
41+
pbkdf2.workspace = true
42+
sha2.workspace = true
3843

3944
# misc
4045
thiserror.workspace = true
@@ -43,3 +48,6 @@ url.workspace = true
4348
rand.workspace = true
4449
bimap.workspace = true
4550
derive_more.workspace = true
51+
52+
unicode-normalization.workspace = true
53+
base64.workspace = true

0 commit comments

Comments
 (0)