Skip to content

Commit 6f32b95

Browse files
authored
modernize BLST and Dependencies (#383)
1 parent 7e1bdfd commit 6f32b95

File tree

9 files changed

+799
-457
lines changed

9 files changed

+799
-457
lines changed

Cargo.lock

Lines changed: 765 additions & 428 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version = "0.8.1-rc.2"
99

1010
[workspace.dependencies]
1111
aes = "0.8"
12-
alloy = { version = "0.12", features = [
12+
alloy = { version = "^1.0.35", features = [
1313
"full",
1414
"getrandom",
1515
"providers",
@@ -18,12 +18,14 @@ alloy = { version = "0.12", features = [
1818
"signer-local",
1919
"ssz",
2020
] }
21+
alloy-primitives = "^1.3.1"
2122
async-trait = "0.1.80"
2223
axum = { version = "0.8.1", features = ["macros"] }
2324
axum-extra = { version = "0.10.0", features = ["typed-header"] }
2425
base64 = "0.22.1"
2526
bimap = { version = "0.6.3", features = ["serde"] }
26-
blsful = "2.5"
27+
blst = "^0.3.15"
28+
blsful = "^2.5"
2729
bytes = "1.10.1"
2830
cb-cli = { path = "crates/cli" }
2931
cb-common = { path = "crates/common" }
@@ -38,16 +40,16 @@ derive_more = { version = "2.0.1", features = ["deref", "display", "from", "into
3840
docker-compose-types = "0.16.0"
3941
docker-image = "0.2.1"
4042
ethereum_serde_utils = "0.7.0"
41-
ethereum_ssz = "0.8"
42-
ethereum_ssz_derive = "0.8"
43+
ethereum_ssz = "0.9"
44+
ethereum_ssz_derive = "0.9"
4345
eyre = "0.6.12"
4446
futures = "0.3.30"
4547
headers = "0.4.0"
4648
indexmap = "2.2.6"
4749
jsonwebtoken = { version = "9.3.1", default-features = false }
4850
lazy_static = "1.5.0"
49-
lh_eth2_keystore = { package = "eth2_keystore", git = "https://github.com/sigp/lighthouse", tag = "v7.1.0" }
50-
lh_types = { package = "types", git = "https://github.com/sigp/lighthouse", tag = "v7.1.0" }
51+
lh_eth2_keystore = { package = "eth2_keystore", git = "https://github.com/sigp/lighthouse", tag = "v8.0.0-rc.0" }
52+
lh_types = { package = "types", git = "https://github.com/sigp/lighthouse", tag = "v8.0.0-rc.0" }
5153
parking_lot = "0.12.3"
5254
pbkdf2 = "0.12.2"
5355
prometheus = "0.14.0"
@@ -59,7 +61,8 @@ serde = { version = "1.0.202", features = ["derive"] }
5961
serde_json = "1.0.117"
6062
serde_yaml = "0.9.33"
6163
sha2 = "0.10.8"
62-
ssz_types = "0.10"
64+
ssz_types = "0.11"
65+
subtle = "2.5"
6366
tempfile = "3.20.0"
6467
thiserror = "2.0.12"
6568
tokio = { version = "1.37.0", features = ["full"] }
@@ -70,9 +73,13 @@ tower-http = { version = "0.6", features = ["trace"] }
7073
tracing = "0.1.40"
7174
tracing-appender = "0.2.3"
7275
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
73-
tree_hash = "0.9"
76+
tracing-test = { version = "0.2.5", features = ["no-env-filter"] }
77+
tree_hash = "^0.10"
7478
tree_hash_derive = "0.9"
7579
typenum = "1.17.0"
7680
unicode-normalization = "0.1.24"
7781
url = { version = "2.5.0", features = ["serde"] }
7882
uuid = { version = "1.8.0", features = ["fast-rng", "serde", "v4"] }
83+
84+
[patch.crates-io]
85+
blstrs_plus = { git = "https://github.com/Commit-Boost/blstrs" }

crates/common/src/config/mux.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,12 @@ async fn fetch_lido_registry_keys(
281281
let http = Http::with_client(client, rpc_url);
282282
let is_local = http.guess_local();
283283
let rpc_client = RpcClient::new(http, is_local);
284-
let provider = ProviderBuilder::new().on_client(rpc_client);
284+
let provider = ProviderBuilder::new().connect_client(rpc_client);
285285

286286
let registry_address = lido_registry_address(chain)?;
287287
let registry = LidoRegistry::new(registry_address, provider);
288288

289-
let total_keys =
290-
registry.getTotalSigningKeyCount(node_operator_id).call().await?._0.try_into()?;
289+
let total_keys = registry.getTotalSigningKeyCount(node_operator_id).call().await?.try_into()?;
291290

292291
if total_keys == 0 {
293292
return Ok(Vec::new());
@@ -449,7 +448,7 @@ mod tests {
449448
#[tokio::test]
450449
async fn test_lido_registry_address() -> eyre::Result<()> {
451450
let url = Url::parse("https://ethereum-rpc.publicnode.com")?;
452-
let provider = ProviderBuilder::new().on_http(url);
451+
let provider = ProviderBuilder::new().connect_http(url);
453452

454453
let registry =
455454
LidoRegistry::new(address!("55032650b14df07b85bF18A3a3eC8E0Af2e028d5"), provider);
@@ -458,7 +457,7 @@ mod tests {
458457
let node_operator_id = U256::from(1);
459458

460459
let total_keys: u64 =
461-
registry.getTotalSigningKeyCount(node_operator_id).call().await?._0.try_into()?;
460+
registry.getTotalSigningKeyCount(node_operator_id).call().await?.try_into()?;
462461

463462
assert!(total_keys > LIMIT as u64);
464463

crates/common/src/config/pbs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl PbsConfig {
171171
if let Some(rpc_url) = &self.rpc_url {
172172
// TODO: remove this once we support chain ids for custom chains
173173
if !matches!(chain, Chain::Custom { .. }) {
174-
let provider = ProviderBuilder::new().on_http(rpc_url.clone());
174+
let provider = ProviderBuilder::new().connect_http(rpc_url.clone());
175175
let chain_id = provider.get_chain_id().await?;
176176
ensure!(
177177
chain_id == chain.id(),

crates/common/src/signer/schemes/ecdsa.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{ops::Deref, str::FromStr};
22

33
use alloy::{
4-
primitives::{Address, B256, PrimitiveSignature},
4+
primitives::{Address, B256, Signature},
55
signers::{SignerSync, local::PrivateKeySigner},
66
};
77
use eyre::ensure;
@@ -14,7 +14,7 @@ use crate::{
1414
};
1515

1616
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
17-
pub struct EcdsaSignature(PrimitiveSignature);
17+
pub struct EcdsaSignature(Signature);
1818

1919
impl std::fmt::Display for EcdsaSignature {
2020
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -37,18 +37,18 @@ impl<'de> serde::Deserialize<'de> for EcdsaSignature {
3737
D: serde::Deserializer<'de>,
3838
{
3939
let s = String::deserialize(deserializer)?;
40-
Ok(Self(PrimitiveSignature::from_str(&s).map_err(serde::de::Error::custom)?))
40+
Ok(Self(Signature::from_str(&s).map_err(serde::de::Error::custom)?))
4141
}
4242
}
4343

44-
impl From<PrimitiveSignature> for EcdsaSignature {
45-
fn from(signature: PrimitiveSignature) -> Self {
44+
impl From<Signature> for EcdsaSignature {
45+
fn from(signature: Signature) -> Self {
4646
Self(signature)
4747
}
4848
}
4949

5050
impl Deref for EcdsaSignature {
51-
type Target = PrimitiveSignature;
51+
type Target = Signature;
5252

5353
fn deref(&self) -> &Self::Target {
5454
&self.0

crates/common/src/signer/store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ mod test {
709709
.join(consensus_signer.pubkey().to_string())
710710
.join("TEST_MODULE")
711711
.join("bls")
712-
.join(format!("{}.sig", proxy_signer.pubkey().to_string()))
712+
.join(format!("{}.sig", proxy_signer.pubkey()))
713713
)
714714
.unwrap()
715715
)

crates/common/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ pub trait TestRandomSeed: TestRandom {
434434
where
435435
Self: Sized,
436436
{
437-
let mut rng = XorShiftRng::from_entropy();
437+
let mut rng = XorShiftRng::from_os_rng();
438438
Self::random_for_test(&mut rng)
439439
}
440440
}

crates/pbs/src/mev_boost/get_header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async fn fetch_parent_block(
152152
parent_hash: B256,
153153
parent_block: Arc<RwLock<Option<Block>>>,
154154
) {
155-
let provider = alloy::providers::ProviderBuilder::new().on_http(rpc_url).to_owned();
155+
let provider = alloy::providers::ProviderBuilder::new().connect_http(rpc_url).to_owned();
156156

157157
debug!(%parent_hash, "fetching parent block");
158158

tests/tests/payloads.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ fn test_missing_registration_field(field_name: &str) -> String {
3030
let mut values: Value = serde_json::from_str(data).unwrap();
3131

3232
// Remove specified field from the first validator's message
33-
if let Value::Array(arr) = &mut values {
34-
if let Some(first_validator) = arr.get_mut(0) {
35-
if let Some(Value::Object(msg_obj)) = first_validator.get_mut("message") {
36-
msg_obj.remove(field_name);
37-
}
38-
}
33+
if let Value::Array(arr) = &mut values &&
34+
let Some(first_validator) = arr.get_mut(0) &&
35+
let Some(Value::Object(msg_obj)) = first_validator.get_mut("message")
36+
{
37+
msg_obj.remove(field_name);
3938
}
4039

4140
// This should fail since the field is required

0 commit comments

Comments
 (0)