Documentation ¶
Index ¶
- type Tree
- func (t Tree) AddSignature(idx int, sig blst.P1Affine)
- func (t Tree) ClearSignatures()
- func (t Tree) Clone() Tree
- func (t Tree) Derive() Tree
- func (t Tree) FinalizedSig() blst.P1Affine
- func (t Tree) Get(idx int) (key blst.P2Affine, sig blst.P1Affine, ok bool)
- func (t Tree) Index(k blst.P2Affine) int
- func (t Tree) NUnaggregatedKeys() int
- func (t Tree) SparseIndices(dst []int) []int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree struct { // The bitset indicating what signatures are present. // This is exported so that the SignatureProof can read it. SigBits *bitset.BitSet // contains filtered or unexported fields }
Tree presents a set of keys and signatures in a tree, using an array layout.
func New ¶
New returns a new Tree. The keys are an iterator because the caller collects [gcrypto.PubKey] but this tree wants the lower-level blst values; since we are collecting the values into a new slice, it doesn't make sense to have the caller allocate a new slice either.
func (Tree) AddSignature ¶
AddSignature associates the signature with the key at the given index. It is the caller's responsibility to ensure the signature was verified first, using Get if necessary to retrieve the key.
If this signature's neighbor is also populated, the parent signature will be aggregated automatically, cascading up as many layers as required.
func (Tree) ClearSignatures ¶
func (t Tree) ClearSignatures()
ClearSignatures zeros every signature in the tree. This is useful for reusing a tree if no keys have changed.
func (Tree) Derive ¶
Derive returns a new Tree with the same keys but with a new, empty set of signatures.
func (Tree) FinalizedSig ¶
Return the finalized signature represented in the tree, by doing a final aggregation across all non-zero signatures without regard to tree structure.
func (Tree) Get ¶
Get returns the key and signature at the given index. The ok value indicates whether the index was in bounds. The key is guaranteed to be set if ok is true, and the signature may be a zero value if it was not explicitly set or inferred by its children being set.
func (Tree) Index ¶
Index searches through the tree and returns the numeric index for the key equal to the input k.
If no matching key is found, -1 is returned.
func (Tree) NUnaggregatedKeys ¶
NUnaggregatedKeys returns the number of unaggregated keys in the tree.
func (Tree) SparseIndices ¶
SparseIndices appends to dst the index of each minimally-aggregated non-zero signature.