Trait reef::traits::NullifierSet
source · pub trait NullifierSet: Clone + Debug + PartialEq + Serialize + DeserializeOwned + Send + Sync {
type Proof: Clone + Debug + Send + Sync;
// Required method
fn multi_insert(
&mut self,
nullifiers: &[(Nullifier, Self::Proof)]
) -> Result<(), Self::Proof>;
}Expand description
A set of nullifiers which have been spent.
In its simplest form this is just a set of nullifiers; however, notice that the only required
interface is for inserting new nullifiers. Querying nullifiers is done on a network-specific
basis, and we do not assume that the NullifierSet data structure will provide an interface for
querying every nullifier that has been published. This could, for example, be implemented as a
cryptographic commitment to a set of nullifiers, where multi_insert simply updates the
commitment.
Since NullifierSet may be a commitment to a set that is actually represented elsewhere, it
includes a notion of a Proof which can be used to authenticate that a
particular nullifier is or isn’t in the set. All interfaces involving NullifierSet are
written with the assumption that proofs are always necessary for inserting nullifiers, and must
always be returned as authentication when querying nullifiers. An implementation of this trait
which does not require authentication (for example, an implementation that maintains the
entire nullifiers set in memory) may use trivial proofs, like ().
Required Associated Types§
Required Methods§
sourcefn multi_insert(
&mut self,
nullifiers: &[(Nullifier, Self::Proof)]
) -> Result<(), Self::Proof>
fn multi_insert( &mut self, nullifiers: &[(Nullifier, Self::Proof)] ) -> Result<(), Self::Proof>
Update the set to include additional nullifiers.
Insert a collection of nullifiers into the set given proofs that the nullifiers are not already in the set. If this function fails, it returns one of the input proofs which was invalid.