In the current consensus code, we drop deserialized partial signatures and re-deserialize them when generating a notarization, nullification, or finalization:
|
// Verify signature |
|
let Some(signature) = Eval::deserialize(&nullify.view_signature) else { |
|
debug!( |
|
public_key_index, |
|
"partial signature is not formatted correctly" |
|
); |
|
return; |
|
}; |
|
if signature.index != public_key_index { |
|
debug!( |
|
public_key_index, |
|
partial_signature = signature.index, |
|
"invalid signature index for nullify" |
|
); |
|
return; |
|
} |
|
let nullify_message = nullify_message(nullify.view); |
|
if ops::partial_verify_message( |
|
identity, |
|
Some(&self.nullify_namespace), |
|
&nullify_message, |
|
&signature, |
|
) |
|
.is_err() |
|
{ |
|
return; |
|
} |
|
|
|
// Verify seed |
|
let Some(seed) = Eval::deserialize(&nullify.seed_signature) else { |
|
return; |
|
}; |
|
if seed.index != public_key_index { |
|
return; |
|
} |
|
let seed_message = seed_message(nullify.view); |
|
if ops::partial_verify_message(identity, Some(&self.seed_namespace), &seed_message, &seed) |
|
.is_err() |
|
{ |
|
return; |
|
} |
|
|
|
// Handle nullify |
|
self.handle_nullify(public_key_index, nullify).await; |
|
for notarize in notarizes.values() { |
|
let eval = Eval::deserialize(¬arize.message.proposal_signature).unwrap(); |
|
notarization.push(eval); |
|
let eval = Eval::deserialize(¬arize.message.seed_signature).unwrap(); |
|
seed.push(eval); |
We should find a way to store arbitrary fixed-size arrays with a parsed protobuf object or find a way to parse the types directly with prost (#454).
We currently have Parsed but that is typically only used with Digests (and support one associated item):
|
/// Parsed is a wrapper around a message that has a parsable digest. |
|
#[derive(Clone)] |
|
struct Parsed<Message, D: Digest> { |
|
pub message: Message, |
|
pub digest: D, |
|
} |
In the current consensus code, we drop deserialized partial signatures and re-deserialize them when generating a
notarization,nullification, orfinalization:monorepo/consensus/src/threshold_simplex/actors/voter/actor.rs
Lines 1037 to 1080 in eaedda6
monorepo/consensus/src/threshold_simplex/actors/voter/actor.rs
Lines 450 to 454 in eaedda6
We should find a way to store arbitrary fixed-size arrays with a parsed protobuf object or find a way to parse the types directly with prost (#454).
We currently have
Parsedbut that is typically only used with Digests (and support one associated item):monorepo/consensus/src/lib.rs
Lines 31 to 36 in eaedda6