-
Notifications
You must be signed in to change notification settings - Fork 24
feat: ssz infrastructure #580
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
Conversation
Co-authored-by: Copilot <[email protected]>
} | ||
} | ||
|
||
impl TreeHash for PartialSignatureKind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't it be derived?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I think I suggested adding support for cases like this a while ago, need to check
// Pad signature to RSA_SIGNATURE_SIZE if needed | ||
let padded_signature = if signature.len() < RSA_SIGNATURE_SIZE { | ||
let mut padded = vec![0; RSA_SIGNATURE_SIZE]; | ||
let padded_signature: [u8; RSA_SIGNATURE_SIZE] = if signature.len() < RSA_SIGNATURE_SIZE { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about pub type RsaSignature = [u8; RSA_SIGNATURE_SIZE];
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was for creating a type alias for [u8; RSA_SIGNATURE_SIZE]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes but this was the only place we explicitly defining the type and the compiler can infer it so its not needed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use it in other places too. But we also do vec![[0u8; RSA_SIGNATURE_SIZE]]
which is actually defining elements instead of a type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my side, I'm good with it. Sorry for the lengthy review. As I'm not that familiar with the code, it's better if @dknopik can give it a final review.
Will review once tomorrow's post-release backmerge has been merged here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you so much!
Issue Addressed
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
andto_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 useFrom
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