dynamic

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: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RLNAppInfo = keystore.AppInfo{
	Application:   "waku-rln-relay",
	AppIdentifier: "01234567890abcdef",
	Version:       "0.2",
}

Functions

func Topic added in v0.8.0

func Topic(topic string) common.Hash

Types

type DynamicGroupManager

type DynamicGroupManager struct {
	MembershipFetcher
	// contains filtered or unexported fields
}

func NewDynamicGroupManager

func NewDynamicGroupManager(
	ethClientAddr string,
	memContractAddr common.Address,
	membershipIndexToLoad *uint,
	appKeystore *keystore.AppKeystore,
	keystorePassword string,
	reg prometheus.Registerer,
	rlnInstance *rln.RLN,
	rootTracker *group_manager.MerkleRootTracker,
	log *zap.Logger,
) (*DynamicGroupManager, error)

func (*DynamicGroupManager) IdentityCredentials

func (gm *DynamicGroupManager) IdentityCredentials() (rln.IdentityCredential, error)

func (*DynamicGroupManager) InsertMembers

func (gm *DynamicGroupManager) InsertMembers(toInsert *om.OrderedMap) error

func (*DynamicGroupManager) IsReady added in v0.8.0

func (gm *DynamicGroupManager) IsReady(ctx context.Context) (bool, error)

func (*DynamicGroupManager) MembershipIndex

func (gm *DynamicGroupManager) MembershipIndex() rln.MembershipIndex

func (*DynamicGroupManager) RemoveMembers

func (gm *DynamicGroupManager) RemoveMembers(toRemove *om.OrderedMap) error

func (*DynamicGroupManager) SetMetadata added in v0.8.0

func (gm *DynamicGroupManager) SetMetadata(meta RLNMetadata) error

SetMetadata stores some metadata into the zerokit's RLN database

func (*DynamicGroupManager) Start

func (gm *DynamicGroupManager) Start(ctx context.Context) error

func (*DynamicGroupManager) Stop

func (gm *DynamicGroupManager) Stop() error

Stop stops all go-routines, eth client and closes the rln database

type ErrCount added in v0.8.0

type ErrCount struct {
	// contains filtered or unexported fields
}

type MembershipFetcher added in v0.8.0

type MembershipFetcher struct {
	// contains filtered or unexported fields
}

MembershipFetcher is used for getting membershipRegsitered Events from the eth rpc

func NewMembershipFetcher added in v0.8.0

func NewMembershipFetcher(web3Config *web3.Config, rln *rln.RLN, rootTracker *group_manager.MerkleRootTracker, log *zap.Logger) MembershipFetcher

func (*MembershipFetcher) GetMetadata added in v0.8.0

func (mf *MembershipFetcher) GetMetadata() (RLNMetadata, error)

GetMetadata retrieves metadata from the zerokit's RLN database

func (*MembershipFetcher) HandleGroupUpdates added in v0.8.0

func (mf *MembershipFetcher) HandleGroupUpdates(ctx context.Context, handler RegistrationEventHandler) error

HandleGroupUpdates mounts the supplied handler for the registration events emitting from the membership contract It connects to the eth client, subscribes to the `MemberRegistered` event emitted from the `MembershipContract` and collects all the events, for every received event, it calls the `handler`

func (*MembershipFetcher) Stop added in v0.8.0

func (mf *MembershipFetcher) Stop()

type Metrics added in v0.8.0

type Metrics interface {
	RecordRegisteredMembership(num uint)
	RecordMembershipInsertionDuration(duration time.Duration)
	RecordMembershipCredentialsImportDuration(duration time.Duration)
}

Metrics exposes the functions required to update prometheus metrics for lightpush protocol

type MockBlock added in v0.8.0

type MockBlock []MockEvent

type MockBlockChain added in v0.8.0

type MockBlockChain struct {
	Blocks map[int64]*MockBlock `json:"blocks"`
}

MockBlockChain is currently a chain of events for different block numbers it is used internal by mock client for returning events for a given block number or range in FilterLog rpc call.

type MockClient added in v0.8.0

type MockClient struct {
	ethclient.Client
	// contains filtered or unexported fields
}

func NewMockClient added in v0.8.0

func NewMockClient(t *testing.T, blockFile string) *MockClient

func (*MockClient) BlockByNumber added in v0.8.0

func (c *MockClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

func (*MockClient) Close added in v0.8.0

func (c *MockClient) Close()

func (*MockClient) FilterLogs added in v0.8.0

func (c *MockClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery) (allTxLogs []types.Log, err error)

func (*MockClient) SetErrorOnBlock added in v0.8.0

func (c *MockClient) SetErrorOnBlock(blockNum int64, err error, count int)

func (*MockClient) SetLatestBlockNumber added in v0.8.0

func (c *MockClient) SetLatestBlockNumber(num int64)

func (*MockClient) SubscribeNewHead added in v0.8.0

func (c *MockClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

type MockEvent added in v0.8.0

type MockEvent struct {
	Address common.Address `json:"address"`
	Topics  []string       `json:"topics"`
	Txhash  common.Hash    `json:"txhash"`
	Data    []string       `json:"data"`
}

func (MockEvent) GetLog added in v0.8.0

func (e MockEvent) GetLog() types.Log

type RLNMetadata added in v0.8.0

type RLNMetadata struct {
	LastProcessedBlock uint64
	ChainID            *big.Int
	ContractAddress    common.Address
	ValidRootsPerBlock []group_manager.RootsPerBlock
}

RLNMetadata persists attributes in the RLN database

func DeserializeMetadata added in v0.8.0

func DeserializeMetadata(b []byte) (RLNMetadata, error)

DeserializeMetadata converts a byte slice into a RLNMetadata instance

func (RLNMetadata) Serialize added in v0.8.0

func (r RLNMetadata) Serialize() []byte

Serialize converts a RLNMetadata into a binary format expected by zerokit's RLN

type RegistrationEventHandler

type RegistrationEventHandler = func([]*contracts.RLNMemberRegistered) error

RegistrationEventHandler represents the types of inputs to this handler matches the MemberRegistered event/proc defined in the MembershipContract interface

type RegistrationHandler

type RegistrationHandler = func(tx *types.Transaction)

Jump to

Keyboard shortcuts

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