Skip to content

Commit b4660eb

Browse files
authored
feat: ssz infrastructure (#580)
This pulls out the ssz infrastructure in #493 into its own PR. Functionally, this should change nothing but it enables hashing for the checks required in the spec tests This uses new functions `to_variable_list` and `to_variable_list_with_error` which both take the length as a generic to check the upper bound of the data being validated. Allows us to use `From` while also ensuring that we reject invalid length data. This is the base PR for all of the spec test as we must hash the messages for output comparison against go-ssv Co-Authored-By: Zacholme7 <zacholme@gmail.com> Co-Authored-By: Zac Holme <79027434+Zacholme7@users.noreply.github.com>
1 parent 21ae966 commit b4660eb

File tree

27 files changed

+974
-376
lines changed

27 files changed

+974
-376
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ serde = { version = "1.0.208", features = ["derive"] }
133133
serde_json = "1.0.140"
134134
serde_yaml = "0.9"
135135
sha2 = "0.10.8"
136+
ssz_types = "0.11.0"
136137
strum = { version = "0.27.0", features = ["derive"] }
137138
thiserror = "2.0.11"
138139
tokio = { version = "1.39.2", features = [
@@ -149,6 +150,7 @@ tracing-appender = "0.2"
149150
tracing-subscriber = { version = "0.3.18", features = ["fmt", "env-filter"] }
150151
tree_hash = "0.10"
151152
tree_hash_derive = "0.10"
153+
typenum = "1.18"
152154
vsss-rs = "5.1.0"
153155
zeroize = "1.8.1"
154156

anchor/common/qbft/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ indexmap = { workspace = true }
1717
sha2 = { workspace = true }
1818
ssv_types = { workspace = true }
1919
tracing = { workspace = true }
20+
typenum = { workspace = true }
2021
types = { workspace = true }
2122

2223
[dev-dependencies]

anchor/common/qbft/src/error.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use ssv_types::message::SignedSSVMessageError;
2+
13
/// Error associated with Config building.
24
#[derive(Debug, Clone)]
35
pub enum ConfigBuilderError {
@@ -86,15 +88,24 @@ pub enum QbftError {
8688
RoundChangeJustificationNotInCommittee,
8789
RoundChangeJustificationNoPrepareQuorum,
8890
RoundChangeJustificationMultiSigner,
91+
RoundChangeJustificationTooBig { provided: usize, max: usize },
92+
RoundChangeJustificationListTooBig { provided: usize, max: usize },
8993
PrepareJustificationWrongRound,
9094
PrepareJustificationMultiSigner,
9195
PrepareJustificationWrongHeight,
9296
PrepareJustificationNoQuorum,
9397
PrepareJustificationDecodeFailed,
9498
PrepareJustificationNotPrepare,
9599
PrepareJustificationRootMismatch,
100+
PrepareJustificationTooBig { provided: usize, max: usize },
101+
PrepareJustificationListTooBig { provided: usize, max: usize },
96102

97103
// Misc
98-
FailedToAggregate,
104+
MissingLastPreparedValue,
105+
FailedToAggregate(SignedSSVMessageError),
106+
SignedSSVMessageError(SignedSSVMessageError),
99107
InvalidState,
108+
MissingData,
109+
CommitQuorumMismatch,
110+
MissingCommit,
100111
}

0 commit comments

Comments
 (0)