mock

package
v2.0.5-testnet Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0, MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockBeacon

func NewMockBeacon(t *testing.T, sch *crypto.Scheme, clk clock.Clock) (*drand.ChainInfoPacket, *drand.PublicRandResponse)

NewMockBeacon provides a random beacon and the chain it validates against

func NewMockGRPCPublicServer

func NewMockGRPCPublicServer(t *testing.T, l log.Logger, bind string, badSecondRound bool, sch *crypto.Scheme, clk clock.Clock) (net.Listener, net.Service)

NewMockGRPCPublicServer creates a listener that provides valid single-node randomness.

func NewMockServer

func NewMockServer(t *testing.T, badSecondRound bool, sch *crypto.Scheme, clk clock.Clock) net.Service

NewMockServer creates a server interface not bound to a network port

Types

type Data

type Data struct {
	Public            []byte
	Signature         string
	Round             int
	PreviousSignature string
	PreviousRound     int
	Genesis           int64
	Period            time.Duration
	BadSecondRound    bool
	Scheme            *crypto.Scheme
	// contains filtered or unexported fields
}

Data of signing

type GrpcClient

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

func NewGrpcClient

func NewGrpcClient(s *Server) *GrpcClient

func (*GrpcClient) Close

func (c *GrpcClient) Close() error

func (*GrpcClient) Get

func (c *GrpcClient) Get(ctx context.Context, round uint64) (client.Result, error)

func (*GrpcClient) Info

func (c *GrpcClient) Info(ctx context.Context) (*chain.Info, error)

func (*GrpcClient) RoundAt

func (c *GrpcClient) RoundAt(_ time.Time) uint64

func (*GrpcClient) Watch

func (c *GrpcClient) Watch(ctx context.Context) <-chan client.Result

type Server

type Server struct {
	*testnet.EmptyServer
	// contains filtered or unexported fields
}

Server fake

func (*Server) ChainInfo

ChainInfo implements net.Service

func (*Server) Command

func (*Server) DKGStatus

func (*Server) EmitRand

func (s *Server) EmitRand(closeStream bool)

EmitRand will cause the next round to be emitted by a previous call to `PublicRandomStream`

func (*Server) Metrics

func (*Server) Packet

func (*Server) PublicRand

PublicRand implements net.Service

func (*Server) PublicRandStream

func (s *Server) PublicRandStream(_ *drand.PublicRandRequest, stream drand.Public_PublicRandStreamServer) error

PublicRandStream is part of the public drand service.

type Service

type Service interface {
	EmitRand(bool)
}

Service provides a way for clients getting the service to be able to call the EmitRand method on the mock server

Jump to

Keyboard shortcuts

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