Tidy validation signatures

This commit is contained in:
Paul Hauner 2018-09-24 18:09:01 +10:00
parent 26537c1184
commit c55b94053b
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -18,11 +18,12 @@ pub enum SignatureVerificationError {
DBError(String), DBError(String),
} }
fn verify_aggregate_signature_for_indices<T>(message: &[u8], pub fn verify_aggregate_signature_for_indices<T>(
agg_sig: &AggregateSignature, message: &[u8],
attestation_indices: &[usize], agg_sig: &AggregateSignature,
bitfield: &Bitfield, attestation_indices: &[usize],
validator_store: &ValidatorStore<T>) bitfield: &Bitfield,
validator_store: &ValidatorStore<T>)
-> Result<(bool, Option<HashSet<usize>>), SignatureVerificationError> -> Result<(bool, Option<HashSet<usize>>), SignatureVerificationError>
where T: ClientDB + Sized where T: ClientDB + Sized
{ {
@ -68,6 +69,15 @@ mod tests {
use super::super::db::MemoryDB; use super::super::db::MemoryDB;
use std::sync::Arc; use std::sync::Arc;
/*
* Cases that still need testing:
*
* - No signatures.
* - Database failure.
* - Unknown validator index.
* - Extra validator on signature.
*/
#[test] #[test]
fn test_signature_verification() { fn test_signature_verification() {
let message = "cats".as_bytes(); let message = "cats".as_bytes();