Skip to content

Commit b59c245

Browse files
authored
chore: bump eth deps (Commit-Boost#133)
1 parent ec33164 commit b59c245

19 files changed

+152
-208
lines changed

Cargo.toml

+10-8
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,14 @@ cb-pbs = { path = "crates/pbs" }
2727
cb-signer = { path = "crates/signer" }
2828

2929
# ethereum
30-
alloy = { version = "0.2.0", features = ["rpc-types-beacon"] }
31-
ethereum_ssz = "0.5"
32-
ethereum_ssz_derive = "0.5.3"
33-
ssz_types = "0.5"
34-
ethereum_serde_utils = "0.5.2"
35-
ethereum-types = "0.14.1"
30+
alloy = { version = "0.3.6", features = [
31+
"rpc-types-beacon",
32+
"serde",
33+
"ssz",
34+
"getrandom",
35+
] }
36+
ssz_types = "0.8"
37+
ethereum_serde_utils = "0.7.0"
3638

3739
# networking
3840
axum = { version = "0.7.5", features = ["macros"] }
@@ -60,8 +62,8 @@ prometheus = "0.13.4"
6062

6163
# crypto
6264
blst = "0.3.11"
63-
tree_hash = "0.5"
64-
tree_hash_derive = "0.5"
65+
tree_hash = "0.8"
66+
tree_hash_derive = "0.8"
6567
eth2_keystore = { git = "https://github.com/sigp/lighthouse", rev = "9e12c21f268c80a3f002ae0ca27477f9f512eb6f" }
6668
k256 = "0.13"
6769

crates/common/Cargo.toml

+1-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ publish = false
77

88
[dependencies]
99
# ethereum
10-
alloy = { workspace = true, features = ["ssz"] }
11-
ethereum_ssz.workspace = true
10+
alloy = { workspace = true }
1211
ssz_types.workspace = true
13-
ethereum_ssz_derive.workspace = true
1412
ethereum_serde_utils.workspace = true
15-
ethereum-types.workspace = true
1613

1714
# networking
1815
axum.workspace = true

crates/common/src/commit/request.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ use std::fmt::{self, Debug, Display, LowerHex};
33
use alloy::rpc::types::beacon::BlsSignature;
44
use derive_more::derive::From;
55
use serde::{Deserialize, Serialize};
6-
use ssz::{Decode, Encode};
7-
use ssz_derive::{Decode, Encode};
86
use tree_hash::TreeHash;
97
use tree_hash_derive::TreeHash;
108

@@ -16,17 +14,14 @@ use crate::{
1614
types::Chain,
1715
};
1816

19-
pub trait PublicKey:
20-
AsRef<[u8]> + Debug + Clone + Copy + Encode + Decode + TreeHash + Display + LowerHex
21-
{
22-
}
17+
pub trait PublicKey: AsRef<[u8]> + Debug + Clone + Copy + TreeHash + Display + LowerHex {}
2318

2419
impl PublicKey for EcdsaPublicKey {}
2520

2621
impl PublicKey for BlsPublicKey {}
2722

2823
// GENERIC PROXY DELEGATION
29-
#[derive(Debug, Clone, Copy, Serialize, Deserialize, Encode, Decode, TreeHash)]
24+
#[derive(Debug, Clone, Copy, Serialize, Deserialize, TreeHash)]
3025
pub struct ProxyDelegation<T: PublicKey> {
3126
pub delegator: BlsPublicKey,
3227
pub proxy: T,

crates/common/src/pbs/types/beacon_block.rs

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
use alloy::{primitives::B256, rpc::types::beacon::BlsSignature};
22
use serde::{Deserialize, Serialize};
3-
use ssz_derive::{Decode, Encode};
43

54
use super::{
65
blinded_block_body::BlindedBeaconBlockBody, blobs_bundle::BlobsBundle,
76
execution_payload::ExecutionPayload, spec::DenebSpec, utils::VersionedResponse,
87
};
98

10-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
9+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
1110
/// Sent to relays in submit_block
1211
pub struct SignedBlindedBeaconBlock {
1312
pub message: BlindedBeaconBlock,
@@ -20,7 +19,7 @@ impl SignedBlindedBeaconBlock {
2019
}
2120
}
2221

23-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
22+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
2423
pub struct BlindedBeaconBlock {
2524
#[serde(with = "serde_utils::quoted_u64")]
2625
pub slot: u64,
@@ -34,7 +33,7 @@ pub struct BlindedBeaconBlock {
3433
/// Returned by relay in submit_block
3534
pub type SubmitBlindedBlockResponse = VersionedResponse<PayloadAndBlobs>;
3635

37-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
36+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
3837
pub struct PayloadAndBlobs {
3938
pub execution_payload: ExecutionPayload<DenebSpec>,
4039
pub blobs_bundle: Option<BlobsBundle<DenebSpec>>,
@@ -48,7 +47,10 @@ impl SubmitBlindedBlockResponse {
4847

4948
#[cfg(test)]
5049
mod tests {
50+
use serde_json::json;
51+
5152
use super::{SignedBlindedBeaconBlock, SubmitBlindedBlockResponse};
53+
use crate::utils::test_encode_decode;
5254

5355
#[test]
5456
// this is from the builder api spec, but with sync_committee_bits fixed to
@@ -248,7 +250,7 @@ mod tests {
248250
"signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
249251
}"#;
250252

251-
assert!(serde_json::from_str::<SignedBlindedBeaconBlock>(&data).is_ok());
253+
test_encode_decode::<SignedBlindedBeaconBlock>(&data);
252254
}
253255

254256
#[test]
@@ -535,7 +537,7 @@ mod tests {
535537
},
536538
"execution_payload_header": {
537539
"parent_hash": "0xa330251430b91a6fb5342f30a1f527dc76499c03a411464235951dbd51b94d9f",
538-
"fee_recipient": "0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134",
540+
"fee_recipient": "0xf97e180c050e5ab072211ad2c213eb5aee4df134",
539541
"state_root": "0x079f2cc22a29388fd4fc20f451cbaa3ff39845d68b2c368ff7be314617418e38",
540542
"receipts_root": "0xed980a4cf6df8ba330c14ed9fe0597ec20515f44e5a9adfd2f7b72aa14890996",
541543
"logs_bloom": "0x0000000400000008000008000040000000000000000000001000104880000200000004000000400000000204000020002000000000000000000000000022000800000004000000000002000c000000000000000000000100000000000000000000000000000000000000000000000040000000000040000001000014000000010002104000000000000000000000000000000000000000000000000000000080020000000000000000002400000000000001000000000002000200102000000040100002000000000000000000000000000000000000000800000000000000000010000000000000000000000000000000000400002000000000000000200000",
@@ -562,19 +564,19 @@ mod tests {
562564
"signature": "0x8c3095fd9d3a18e43ceeb7648281e16bb03044839dffea796432c4e5a1372bef22c11a98a31e0c1c5389b98cc6d45917170a0f1634bcf152d896f360dc599fabba2ec4de77898b5dff080fa1628482bdbad5b37d2e64fea3d8721095186cfe50"
563565
}"#;
564566

565-
assert!(serde_json::from_str::<SignedBlindedBeaconBlock>(&data).is_ok());
567+
test_encode_decode::<SignedBlindedBeaconBlock>(&data);
566568
}
567569

568570
#[test]
569571
// this is from the builder api spec, but with blobs fixed to deserialize
570572
// correctly
571573
fn test_submit_blinded_block_response() {
572-
let blob = alloy::primitives::hex::encode([1; 131072]);
573-
let data = format!(
574-
r#"{{
574+
let blob = alloy::primitives::hex::encode_prefixed([1; 131072]);
575+
576+
let data = json!({
575577
"version": "deneb",
576-
"data": {{
577-
"execution_payload": {{
578+
"data": {
579+
"execution_payload": {
578580
"parent_hash":
579581
"0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
580582
"fee_recipient": "0xabcf8e0d4e9587369b2301d0790347320302cc09",
@@ -598,30 +600,28 @@ mod tests {
598600
"0x02f878831469668303f51d843b9ac9f9843b9aca0082520894c93269b73096998db66be0441e836d873535cb9c8894a19041886f000080c001a031cc29234036afbf9a1fb9476b463367cb1f957ac0b919b69bbc798436e604aaa018c4e9c3914eb27aadd0b91e10b18655739fcf8c1fc398763a9f1beecb8ddc86"
599601
],
600602
"withdrawals": [
601-
{{
603+
{
602604
"index": "1",
603605
"validator_index": "1",
604606
"address": "0xabcf8e0d4e9587369b2301d0790347320302cc09",
605607
"amount": "32000000000"
606-
}}
608+
}
607609
]
608-
}},
609-
"blobs_bundle": {{
610+
},
611+
"blobs_bundle": {
610612
"commitments": [
611613
"0x8dab030c51e16e84be9caab84ee3d0b8bbec1db4a0e4de76439da8424d9b957370a10a78851f97e4b54d2ce1ab0d686f"
612614
],
613615
"proofs": [
614616
"0xb4021b0de10f743893d4f71e1bf830c019e832958efd6795baf2f83b8699a9eccc5dc99015d8d4d8ec370d0cc333c06a"
615617
],
616618
"blobs": [
617-
"0x{}"
619+
blob
618620
]
619-
}}
620-
}}
621-
}}"#,
622-
blob
623-
);
621+
}
622+
}
623+
}).to_string();
624624

625-
assert!(serde_json::from_str::<SubmitBlindedBlockResponse>(&data).is_ok());
625+
test_encode_decode::<SubmitBlindedBlockResponse>(&data);
626626
}
627627
}

crates/common/src/pbs/types/blinded_block_body.rs

+17-18
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ use alloy::{
33
rpc::types::beacon::{BlsPublicKey, BlsSignature},
44
};
55
use serde::{Deserialize, Serialize};
6-
use ssz_derive::{Decode, Encode};
76
use ssz_types::{typenum, BitList, BitVector, FixedVector, VariableList};
87

98
use super::{
109
execution_payload::ExecutionPayloadHeader, kzg::KzgCommitments, spec::EthSpec, utils::*,
1110
};
1211
use crate::utils::as_str;
1312

14-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
13+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
1514
pub struct BlindedBeaconBlockBody<T: EthSpec> {
1615
pub randao_reveal: BlsSignature,
1716
pub eth1_data: Eth1Data,
@@ -28,15 +27,15 @@ pub struct BlindedBeaconBlockBody<T: EthSpec> {
2827
pub blob_kzg_commitments: KzgCommitments<T>,
2928
}
3029

31-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
30+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
3231
pub struct Eth1Data {
3332
pub deposit_root: B256,
3433
#[serde(with = "serde_utils::quoted_u64")]
3534
pub deposit_count: u64,
3635
pub block_hash: B256,
3736
}
3837

39-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
38+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
4039
pub struct BeaconBlockHeader {
4140
#[serde(with = "serde_utils::quoted_u64")]
4241
pub slot: u64,
@@ -47,39 +46,39 @@ pub struct BeaconBlockHeader {
4746
pub body_root: B256,
4847
}
4948

50-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
49+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
5150
pub struct SignedBeaconBlockHeader {
5251
pub message: BeaconBlockHeader,
5352
pub signature: BlsSignature,
5453
}
5554

56-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
55+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
5756
pub struct BlsToExecutionChange {
5857
#[serde(with = "as_str")]
5958
pub validator_index: u64,
6059
pub from_bls_pubkey: BlsPublicKey,
6160
pub to_execution_address: Address,
6261
}
6362

64-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
63+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
6564
pub struct SignedBlsToExecutionChange {
6665
pub message: BlsToExecutionChange,
6766
pub signature: BlsSignature,
6867
}
6968

70-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
69+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
7170
pub struct ProposerSlashing {
7271
pub signed_header_1: SignedBeaconBlockHeader,
7372
pub signed_header_2: SignedBeaconBlockHeader,
7473
}
7574

76-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
75+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
7776
pub struct AttesterSlashing<T: EthSpec> {
7877
pub attestation_1: IndexedAttestation<T>,
7978
pub attestation_2: IndexedAttestation<T>,
8079
}
8180

82-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
81+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
8382
#[serde(bound = "T: EthSpec")]
8483
pub struct IndexedAttestation<T: EthSpec> {
8584
/// Lists validator registry indices, not committee indices.
@@ -89,7 +88,7 @@ pub struct IndexedAttestation<T: EthSpec> {
8988
pub signature: BlsSignature,
9089
}
9190

92-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
91+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
9392
pub struct AttestationData {
9493
#[serde(with = "serde_utils::quoted_u64")]
9594
pub slot: u64,
@@ -102,28 +101,28 @@ pub struct AttestationData {
102101
pub target: Checkpoint,
103102
}
104103

105-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
104+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
106105
pub struct Checkpoint {
107106
#[serde(with = "serde_utils::quoted_u64")]
108107
pub epoch: u64,
109108
pub root: B256,
110109
}
111110

112-
#[derive(Debug, Clone, Serialize, Deserialize, Encode, Decode)]
111+
#[derive(Debug, Clone, Serialize, Deserialize)]
113112
#[serde(bound = "T: EthSpec")]
114113
pub struct Attestation<T: EthSpec> {
115114
pub aggregation_bits: BitList<T::MaxValidatorsPerCommittee>,
116115
pub data: AttestationData,
117116
pub signature: BlsSignature,
118117
}
119118

120-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
119+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
121120
pub struct Deposit {
122121
pub proof: FixedVector<B256, typenum::U33>, // put this in EthSpec?
123122
pub data: DepositData,
124123
}
125124

126-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
125+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
127126
pub struct DepositData {
128127
pub pubkey: BlsPublicKey,
129128
pub withdrawal_credentials: B256,
@@ -132,13 +131,13 @@ pub struct DepositData {
132131
pub signature: BlsSignature,
133132
}
134133

135-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
134+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
136135
pub struct SignedVoluntaryExit {
137136
pub message: VoluntaryExit,
138137
pub signature: BlsSignature,
139138
}
140139

141-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
140+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
142141
pub struct VoluntaryExit {
143142
/// Earliest epoch when voluntary exit can be processed.
144143
#[serde(with = "serde_utils::quoted_u64")]
@@ -147,7 +146,7 @@ pub struct VoluntaryExit {
147146
pub validator_index: u64,
148147
}
149148

150-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
149+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
151150
#[serde(bound = "T: EthSpec")]
152151
pub struct SyncAggregate<T: EthSpec> {
153152
pub sync_committee_bits: BitVector<T::SyncCommitteeSize>,

crates/common/src/pbs/types/blobs_bundle.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
use serde::{Deserialize, Serialize};
2-
use ssz_derive::{Decode, Encode};
32
use ssz_types::{FixedVector, VariableList};
43

54
use super::{
65
kzg::{KzgCommitments, KzgProofs},
76
spec::EthSpec,
87
};
98

10-
#[derive(Debug, Default, Clone, Serialize, Deserialize, Encode, Decode)]
9+
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
1110
#[serde(bound = "T: EthSpec")]
1211
pub struct BlobsBundle<T: EthSpec> {
1312
pub commitments: KzgCommitments<T>,

0 commit comments

Comments
 (0)