Documentation ¶
Index ¶
- Constants
- Variables
- func StaticSetup(rlnRelayMemIndex r.MembershipIndex) ([]r.IDCommitment, r.MembershipKeyPair, r.MembershipIndex, error)
- func ToRateLimitProof(msg *pb.WakuMessage) *r.RateLimitProof
- type MessageValidationResult
- type RegistrationEventHandler
- type RegistrationHandler
- type SpamHandler
- type WakuRLNRelay
- func (rln *WakuRLNRelay) AppendRLNProof(msg *pb.WakuMessage, senderEpochTime time.Time) error
- func (rln *WakuRLNRelay) HandleGroupUpdates(handler RegistrationEventHandler, errChan chan<- error)
- func (rln *WakuRLNRelay) HasDuplicate(msg *pb.WakuMessage) (bool, error)
- func (r *WakuRLNRelay) MembershipContractAddress() common.Address
- func (r *WakuRLNRelay) MembershipIndex() r.MembershipIndex
- func (r *WakuRLNRelay) MembershipKeyPair() *r.MembershipKeyPair
- func (rln *WakuRLNRelay) Register(ctx context.Context) (*r.MembershipIndex, error)
- func (rln *WakuRLNRelay) Stop()
- func (rln *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime *time.Time) (MessageValidationResult, error)
Constants ¶
const AcceptableRootWindowSize = 5
const MAX_CLOCK_GAP_SECONDS = 20
the maximum clock difference between peers in seconds
const MAX_EPOCH_GAP = int64(MAX_CLOCK_GAP_SECONDS / r.EPOCH_UNIT_SECONDS)
maximum allowed gap between the epochs of messages' RateLimitProofs
Variables ¶
var MEMBERSHIP_FEE = big.NewInt(1000000000000000) // wei - 0.001 eth
Functions ¶
func StaticSetup ¶
func StaticSetup(rlnRelayMemIndex r.MembershipIndex) ([]r.IDCommitment, r.MembershipKeyPair, r.MembershipIndex, error)
func ToRateLimitProof ¶
func ToRateLimitProof(msg *pb.WakuMessage) *r.RateLimitProof
Types ¶
type MessageValidationResult ¶
type MessageValidationResult int
const ( MessageValidationResult_Unknown MessageValidationResult = iota MessageValidationResult_Valid MessageValidationResult_Invalid MessageValidationResult_Spam )
type RegistrationEventHandler ¶
type RegistrationEventHandler = func(pubkey r.IDCommitment, index r.MembershipIndex) error
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)
type SpamHandler ¶
type SpamHandler = func(message *pb.WakuMessage) error
type WakuRLNRelay ¶
func RlnRelayDynamic ¶
func RlnRelayDynamic( ctx context.Context, relay *relay.WakuRelay, ethClientAddr string, ethAccountPrivateKey *ecdsa.PrivateKey, memContractAddr common.Address, memKeyPair *r.MembershipKeyPair, memIndex r.MembershipIndex, pubsubTopic string, contentTopic string, spamHandler SpamHandler, registrationHandler RegistrationHandler, log *zap.Logger, ) (*WakuRLNRelay, error)
func RlnRelayStatic ¶
func RlnRelayStatic( ctx context.Context, relay *relay.WakuRelay, group []r.IDCommitment, memKeyPair r.MembershipKeyPair, memIndex r.MembershipIndex, pubsubTopic string, contentTopic string, spamHandler SpamHandler, log *zap.Logger, ) (*WakuRLNRelay, error)
func (*WakuRLNRelay) AppendRLNProof ¶
func (rln *WakuRLNRelay) AppendRLNProof(msg *pb.WakuMessage, senderEpochTime time.Time) error
func (*WakuRLNRelay) HandleGroupUpdates ¶
func (rln *WakuRLNRelay) HandleGroupUpdates(handler RegistrationEventHandler, errChan chan<- 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 (*WakuRLNRelay) HasDuplicate ¶
func (rln *WakuRLNRelay) HasDuplicate(msg *pb.WakuMessage) (bool, error)
func (*WakuRLNRelay) MembershipContractAddress ¶
func (r *WakuRLNRelay) MembershipContractAddress() common.Address
func (*WakuRLNRelay) MembershipIndex ¶
func (r *WakuRLNRelay) MembershipIndex() r.MembershipIndex
func (*WakuRLNRelay) MembershipKeyPair ¶
func (r *WakuRLNRelay) MembershipKeyPair() *r.MembershipKeyPair
func (*WakuRLNRelay) Register ¶
func (rln *WakuRLNRelay) Register(ctx context.Context) (*r.MembershipIndex, error)
Register registers the public key of the rlnPeer which is rlnPeer.membershipKeyPair.publicKey into the membership contract whose address is in rlnPeer.membershipContractAddress
func (*WakuRLNRelay) Stop ¶
func (rln *WakuRLNRelay) Stop()
func (*WakuRLNRelay) ValidateMessage ¶
func (rln *WakuRLNRelay) ValidateMessage(msg *pb.WakuMessage, optionalTime *time.Time) (MessageValidationResult, error)