fraudserv

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 28 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GossibSubScore = pubsub.TopicScoreParams{
	SkipAtomicValidation: true,

	TopicWeight: 0.1,

	TimeInMeshWeight:  0.0002778,
	TimeInMeshQuantum: time.Second,
	TimeInMeshCap:     1,

	FirstMessageDeliveriesWeight: 50,
	FirstMessageDeliveriesDecay:  pubsub.ScoreParameterDecay(10 * time.Hour),

	FirstMessageDeliveriesCap: math.MaxFloat64,

	InvalidMessageDeliveriesWeight: 0,
}

GossibSubScore provides a set of recommended parameters for header GossipSub topic, a.k.a FraudSub. TODO(@Wondertan): We should disable mesh on publish for this topic to minimize chances of censoring FPs by eclipsing nodes producing them.

Functions

func PubsubTopicID

func PubsubTopicID(fraudType, networkID string) string

Types

type ProofService

type ProofService[H header.Header[H]] struct {
	// contains filtered or unexported fields
}

ProofService is responsible for validating and propagating Fraud Proofs. It implements the Service interface.

func NewProofService

func NewProofService[H header.Header[H]](
	p *pubsub.PubSub,
	host host.Host,
	headerGetter fraud.HeaderFetcher[H],
	headGetter fraud.HeadGetter[H],
	unmarshal fraud.ProofUnmarshaler[H],
	ds datastore.Datastore,
	syncerEnabled bool,
	networkID string,
) *ProofService[H]

func (*ProofService[H]) AddVerifier added in v0.1.1

func (f *ProofService[H]) AddVerifier(proofType fraud.ProofType, verifier fraud.Verifier[H]) error

func (*ProofService[H]) Broadcast

func (f *ProofService[H]) Broadcast(ctx context.Context, p fraud.Proof[H]) error

func (*ProofService[H]) Get

func (f *ProofService[H]) Get(ctx context.Context, proofType fraud.ProofType) ([]fraud.Proof[H], error)

func (*ProofService[H]) Start

func (f *ProofService[H]) Start(context.Context) error

Start joins fraud proofs topics, sets the stream handler for fraudProtocolID and starts syncing if syncer is enabled.

func (*ProofService[H]) Stop

func (f *ProofService[H]) Stop(context.Context) (err error)

Stop removes the stream handler and cancels the underlying ProofService

func (*ProofService[H]) Subscribe

func (f *ProofService[H]) Subscribe(proofType fraud.ProofType) (_ fraud.Subscription[H], err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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