Skip to content

CBST2-02: Make proposer commitment signatures unique to modules #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 63 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
c68125d
bump version
ltitanb Apr 2, 2025
d9979a2
Successful cross-compilation, but runtime has memory allocation issues
jclapis May 5, 2025
97ef653
Working with OpenSSL static-linked
jclapis May 6, 2025
91eefe2
Got dynamic linking working, added a feature flag to toggle dynamic v…
jclapis May 6, 2025
de09415
Fixed the vendored build arg
jclapis May 6, 2025
3aee63d
Reintroduced the cargo chef setup
jclapis May 6, 2025
c07c717
Ported the cross-compilation stuff into PBS
jclapis May 6, 2025
699b7ec
Split the dockerfiles into separate builder / image definitions
jclapis May 7, 2025
7165f12
Added a build guide
jclapis May 7, 2025
9438dae
Refactored the Github release action to use the Docker builder
jclapis May 13, 2025
12c020a
Fixed the Docker image binary filenames
jclapis May 13, 2025
53cafc0
Cleaned up the Darwin artifact step
jclapis May 13, 2025
58c6117
Made the CI workflow and justfile use the same toolchain as the source
jclapis May 14, 2025
45e581b
Revert "Made the CI workflow and justfile use the same toolchain as t…
jclapis May 14, 2025
24a10c5
Testing removal of OpenSSL vendored option
jclapis May 14, 2025
e36da54
Updating just in the CI workflow
jclapis May 14, 2025
843b110
Merge branch 'main' into cross-compile
jclapis May 28, 2025
e7c6d19
Refactored the signer to support host and port config settings
jclapis May 21, 2025
6117219
Updated docs
jclapis May 21, 2025
c0f591d
Fixing Clippy in CI workflow
jclapis May 21, 2025
adbd34a
Removed obviated CI setup
jclapis May 28, 2025
e3488b3
Minor dedup of RwLock guard acquisition
jclapis May 20, 2025
c3d7ec4
Added rate limiting for signer clients with repeated JWT auth failures
jclapis May 22, 2025
9ddad64
Added Signer config validation
jclapis May 22, 2025
c62185e
Started unit test setup for the Signer
jclapis May 22, 2025
dc73c62
Finished a basic signer module unit test
jclapis May 28, 2025
6c3d967
Added a JWT failure unit test
jclapis May 28, 2025
6464638
Added a rate limit test and cleaned up a bit
jclapis May 28, 2025
0313f18
Added unique ports to unit tests for parallel execution
jclapis May 28, 2025
346eea4
Cleaned up the build Dockerfile and removed an extra dependency layer
jclapis May 28, 2025
7b20d2f
Ported the build script over to the justfile
jclapis May 29, 2025
cf3f0b1
Merge branch 'main' into cross-compile
jclapis May 29, 2025
ca9f4a1
Added a justfile recipe for installing protoc
jclapis May 29, 2025
3eed526
Merge branch 'cross-compile' into add-ip-bind-to-signer
jclapis May 29, 2025
aa6ad96
Merge branch 'add-ip-bind-to-signer' into rate-limit-jwt
jclapis May 29, 2025
fc872ac
Merge branch 'main' into add-ip-bind-to-signer
jclapis Jun 3, 2025
ca0c6e8
Merge branch 'add-ip-bind-to-signer' into rate-limit-jwt
jclapis Jun 3, 2025
40d34aa
Merge branch 'main' into add-ip-bind-to-signer
jclapis Jun 9, 2025
d537288
Update crates/cli/src/docker_init.rs
jclapis Jun 9, 2025
7afb763
Added example signer config params
jclapis Jun 9, 2025
09ac821
Cleaned up signer config loading from feedback
jclapis Jun 9, 2025
cf39d86
Merge remote-tracking branch 'origin/add-ip-bind-to-signer' into add-…
jclapis Jun 9, 2025
2431937
Merge branch 'add-ip-bind-to-signer' into rate-limit-jwt
jclapis Jun 9, 2025
2e1198b
Merge branch 'main' into rate-limit-jwt
jclapis Jun 9, 2025
ccaf97d
Added JWT auth fields to the example config
jclapis Jun 10, 2025
145ebe8
Started building the JWT config file
jclapis Jun 12, 2025
bb0e023
Added tests
jclapis Jun 12, 2025
71a7605
Started migration from JWTS_ENV to the config file
jclapis Jun 12, 2025
615774e
Signing requests now uses the module's signing ID
jclapis Jun 16, 2025
af6076d
Finished added signing ID support and a quick test
jclapis Jun 17, 2025
cc13a6f
Fixed some example config parameters
jclapis Jun 18, 2025
488547a
Added a test to ensure modules can't create the same sigs
jclapis Jun 18, 2025
ef3d8f2
Merge branch 'rate-limit-jwt' into prevent-cross-module-sigs
jclapis Jun 18, 2025
6fd4327
Made the jwt_config_file optional
jclapis Jun 18, 2025
d9ef82f
Started working on docs
jclapis Jun 24, 2025
83db727
Redid implementation with the original JWTS env var
jclapis Jun 26, 2025
8d08c11
Started the signer doc
jclapis Jun 26, 2025
64b49f2
Overhauled the signing_id setup to be directly in the signed struct
jclapis Jul 1, 2025
8b65b1e
Made proposer commitments nested Merkle trees to allow Dirk support
jclapis Jul 1, 2025
9967033
Added the signer request guide
jclapis Jul 1, 2025
adb1cb8
Added quotes to some HTML
jclapis Jul 1, 2025
1c3a07d
Added some simple JWT secret info
jclapis Jul 2, 2025
daf3147
Adding a closing tag
jclapis Jul 2, 2025
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
17 changes: 15 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ color-eyre = "0.6.3"
ctr = "0.9.2"
derive_more = { version = "2.0.1", features = ["deref", "display", "from", "into"] }
docker-compose-types = "0.16.0"
docker-image = "0.2.1"
eth2_keystore = { git = "https://github.com/sigp/lighthouse", rev = "8d058e4040b765a96aa4968f4167af7571292be2" }
ethereum_serde_utils = "0.7.0"
ethereum_ssz = "0.8"
Expand All @@ -57,6 +58,7 @@ serde_json = "1.0.117"
serde_yaml = "0.9.33"
sha2 = "0.10.8"
ssz_types = "0.10"
tempfile = "3.20.0"
thiserror = "2.0.12"
tokio = { version = "1.37.0", features = ["full"] }
toml = "0.8.13"
Expand Down
12 changes: 10 additions & 2 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,22 @@ url = "http://0xa119589bb33ef52acbb8116832bec2b58fca590fe5c85eac5d3230b44d5bc09f
# - Dirk: a remote Dirk instance
# - Local: a local Signer module
# More details on the docs (https://commit-boost.github.io/commit-boost-client/get_started/configuration/#signer-module)
# [signer]
[signer]
# Docker image to use for the Signer module.
# OPTIONAL, DEFAULT: ghcr.io/commit-boost/signer:latest
# docker_image = "ghcr.io/commit-boost/signer:latest"
docker_image = "ghcr.io/commit-boost/signer:latest"
# Host to bind the Signer API server to
# OPTIONAL, DEFAULT: 127.0.0.1
host = "127.0.0.1"
# Port to listen for Signer API calls on
# OPTIONAL, DEFAULT: 20000
port = 20000
# Number of JWT authentication attempts a client can fail before blocking that client temporarily from Signer access
# OPTIONAL, DEFAULT: 3
jwt_auth_fail_limit = 3
# How long to block a client from Signer access, in seconds, if it failed JWT authentication too many times
# OPTIONAL, DEFAULT: 300
jwt_auth_fail_timeout_seconds = 300

# For Remote signer:
# [signer.remote]
Expand Down Expand Up @@ -233,6 +239,8 @@ proxy_dir = "./proxies"
[[modules]]
# Unique ID of the module
id = "DA_COMMIT"
# Unique hash that the Signer service will combine with the incoming data in signing requests to generate a signature specific to this module
signing_id = "0x6a33a23ef26a4836979edff86c493a69b26ccf0b4a16491a815a13787657431b"
# Type of the module. Supported values: commit, events
type = "commit"
# Docker image of the module
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/src/docker_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use cb_common::{
PROXY_DIR_KEYS_ENV, PROXY_DIR_SECRETS_DEFAULT, PROXY_DIR_SECRETS_ENV, SIGNER_DEFAULT,
SIGNER_DIR_KEYS_DEFAULT, SIGNER_DIR_KEYS_ENV, SIGNER_DIR_SECRETS_DEFAULT,
SIGNER_DIR_SECRETS_ENV, SIGNER_ENDPOINT_ENV, SIGNER_KEYS_ENV, SIGNER_MODULE_NAME,
SIGNER_URL_ENV,
SIGNER_PORT_DEFAULT, SIGNER_URL_ENV,
},
pbs::{BUILDER_API_PATH, GET_STATUS_PATH},
signer::{ProxyStore, SignerLoader, DEFAULT_SIGNER_PORT},
signer::{ProxyStore, SignerLoader},
types::ModuleId,
utils::random_jwt_secret,
};
Expand Down Expand Up @@ -73,7 +73,7 @@ pub async fn handle_docker_init(config_path: PathBuf, output_dir: PathBuf) -> Re
let mut targets = Vec::new();

// address for signer API communication
let signer_port = cb_config.signer.as_ref().map(|s| s.port).unwrap_or(DEFAULT_SIGNER_PORT);
let signer_port = cb_config.signer.as_ref().map(|s| s.port).unwrap_or(SIGNER_PORT_DEFAULT);
let signer_server =
if let Some(SignerConfig { inner: SignerType::Remote { url }, .. }) = &cb_config.signer {
url.to_string()
Expand Down
1 change: 1 addition & 0 deletions crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ blst.workspace = true
cipher.workspace = true
ctr.workspace = true
derive_more.workspace = true
docker-image.workspace = true
eth2_keystore.workspace = true
ethereum_serde_utils.workspace = true
ethereum_ssz.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/common/src/commit/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl<T: ProxyId> SignedProxyDelegation<T> {
&self.message.delegator,
&self.message,
&self.signature,
None,
COMMIT_BOOST_DOMAIN,
)
}
Expand Down
10 changes: 10 additions & 0 deletions crates/common/src/config/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ pub const SIGNER_MODULE_NAME: &str = "signer";

/// Where the signer module should open the server
pub const SIGNER_ENDPOINT_ENV: &str = "CB_SIGNER_ENDPOINT";
pub const SIGNER_PORT_DEFAULT: u16 = 20000;

/// Number of auth failures before rate limiting the client
pub const SIGNER_JWT_AUTH_FAIL_LIMIT_ENV: &str = "CB_SIGNER_JWT_AUTH_FAIL_LIMIT";
pub const SIGNER_JWT_AUTH_FAIL_LIMIT_DEFAULT: u32 = 3;

/// How long to rate limit the client after auth failures
pub const SIGNER_JWT_AUTH_FAIL_TIMEOUT_SECONDS_ENV: &str =
"CB_SIGNER_JWT_AUTH_FAIL_TIMEOUT_SECONDS";
pub const SIGNER_JWT_AUTH_FAIL_TIMEOUT_SECONDS_DEFAULT: u32 = 5 * 60;

/// Comma separated list module_id=jwt_secret
pub const JWTS_ENV: &str = "CB_JWTS";
Expand Down
3 changes: 3 additions & 0 deletions crates/common/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ impl CommitBoostConfig {
/// Validate config
pub async fn validate(&self) -> Result<()> {
self.pbs.pbs_config.validate(self.chain).await?;
if let Some(signer) = &self.signer {
signer.validate().await?;
}
Ok(())
}

Expand Down
3 changes: 3 additions & 0 deletions crates/common/src/config/module.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::collections::HashMap;

use alloy::primitives::B256;
use eyre::{ContextCompat, Result};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use toml::Table;
Expand Down Expand Up @@ -37,6 +38,8 @@ pub struct StaticModuleConfig {
/// Type of the module
#[serde(rename = "type")]
pub kind: ModuleKind,
/// Signing ID for the module to use when requesting signatures
pub signing_id: Option<B256>,
}

/// Runtime config to start a module
Expand Down
Loading
Loading