Documentation ¶
Index ¶
- type Details
- type GroupManager
- type MerkleRootTracker
- func (m *MerkleRootTracker) Backfill(fromBlockNumber uint64)
- func (m *MerkleRootTracker) Buffer() []rln.MerkleNode
- func (m *MerkleRootTracker) ContainsRoot(root [32]byte) bool
- func (m *MerkleRootTracker) IndexOf(root [32]byte) int
- func (m *MerkleRootTracker) Roots() []rln.MerkleNode
- func (m *MerkleRootTracker) SetValidRootsPerBlock(roots []RootsPerBlock)
- func (m *MerkleRootTracker) UpdateLatestRoot(blockNumber uint64) rln.MerkleNode
- func (m *MerkleRootTracker) ValidRootsPerBlock() []RootsPerBlock
- type RootsPerBlock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Details ¶ added in v0.8.0
type Details struct { GroupManager GroupManager RootTracker *MerkleRootTracker RLN *rln.RLN }
type GroupManager ¶ added in v0.8.0
type MerkleRootTracker ¶
MerkleRootTracker keeps track of the latest N merkle roots considered valid for RLN proofs.
func NewMerkleRootTracker ¶
func NewMerkleRootTracker(acceptableRootWindowSize int, rlnInstance *rln.RLN) *MerkleRootTracker
NewMerkleRootTracker creates an instance of MerkleRootTracker
func (*MerkleRootTracker) Backfill ¶
func (m *MerkleRootTracker) Backfill(fromBlockNumber uint64)
Backfill is used to pop merkle roots when there is a chain fork
func (*MerkleRootTracker) Buffer ¶
func (m *MerkleRootTracker) Buffer() []rln.MerkleNode
Buffer is used as a repository of older merkle roots that although they were valid once, they have left the acceptable window of merkle roots. We keep track of them in case a chain fork occurs and we need to restore the valid merkle roots to a previous point of time
func (*MerkleRootTracker) ContainsRoot ¶ added in v0.8.0
func (m *MerkleRootTracker) ContainsRoot(root [32]byte) bool
ContainsRoot is used to check whether a merkle tree root is contained in the list of valid merkle roots or not
func (*MerkleRootTracker) IndexOf ¶ added in v0.8.0
func (m *MerkleRootTracker) IndexOf(root [32]byte) int
IndexOf returns the index of a root if present in the list of valid merkle roots
func (*MerkleRootTracker) Roots ¶
func (m *MerkleRootTracker) Roots() []rln.MerkleNode
Roots return the list of valid merkle roots
func (*MerkleRootTracker) SetValidRootsPerBlock ¶ added in v0.8.0
func (m *MerkleRootTracker) SetValidRootsPerBlock(roots []RootsPerBlock)
SetValidRootsPerBlock is used to overwrite the valid merkle roots
func (*MerkleRootTracker) UpdateLatestRoot ¶
func (m *MerkleRootTracker) UpdateLatestRoot(blockNumber uint64) rln.MerkleNode
UpdateLatestRoot should be called when a block containing a new IDCommitment is received so we can keep track of the merkle root change
func (*MerkleRootTracker) ValidRootsPerBlock ¶ added in v0.8.0
func (m *MerkleRootTracker) ValidRootsPerBlock() []RootsPerBlock
ValidRootsPerBlock returns the current valid merkle roots and block numbers
type RootsPerBlock ¶
type RootsPerBlock struct { Root rln.MerkleNode BlockNumber uint64 }
RootsPerBlock stores the merkle root generated at N block number