group_manager

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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 GroupManager interface {
	Start(ctx context.Context) error
	IdentityCredentials() (rln.IdentityCredential, error)
	MembershipIndex() rln.MembershipIndex
	Stop() error
	IsReady(ctx context.Context) (bool, error)
}

type MerkleRootTracker

type MerkleRootTracker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL