[][src]Trait bls_like::pop::ProofsOfPossession

pub trait ProofsOfPossession<E: EngineBLS> {
    type Signers: Borrow<[u8]> + BorrowMut<[u8]> + Clone + Sized;
    fn agreement(&self, other: &Self) -> bool;
fn new_signers(&self) -> Self::Signers;
fn lookup(&self, index: usize) -> Option<PublicKey<E>>;
fn find(&self, publickey: &PublicKey<E>) -> Option<usize>; }

Proof-of-possession table.

We provide a signers bitfield for efficent

Associated Types

type Signers: Borrow<[u8]> + BorrowMut<[u8]> + Clone + Sized

Bitfield type used to represent a signers set

Must not permit altering length, so Box<[u8]> or [u8; 128] not Vec<u8>.

Loading content...

Required methods

fn agreement(&self, other: &Self) -> bool

Returns true if two ProofsOfPossession databases match exactly.

We could employ a PartialEq + Eq bound for this, except those are frequently slow even for small for databases.

fn new_signers(&self) -> Self::Signers

Create a new signers set bitfield

fn lookup(&self, index: usize) -> Option<PublicKey<E>>

Lookup the public key with a particular bit index.

Must succeed if index < signers.borrow().len(), but should panic if index > signers.borrow().len(). It may return None if the position is empty.

Must satisfy self.lookup(i).and_then(|i| self.find(i)) == Some(i) when i is occupied.

fn find(&self, publickey: &PublicKey<E>) -> Option<usize>

Find the bit index for a particular public key.

Must succeed if the public key is present, and fail otherwise.

Must satisfy self.find(pk).and_then(|i| self.lookup(i)) == Some(pk) when pk is present.

Loading content...

Implementors

impl<E, V> ProofsOfPossession<E> for V where
    E: EngineBLS,
    V: Deref<Target = [PublicKey<E>]>, 
[src]

Avoiding duplicate keys inside a slice gets costly. We suggest improving performance by using a customized data type.

TODO: Evaluate using Deref vs Borrow in this context TODO: Use specialization here

type Signers = Box<[u8]>

Loading content...