malfeasance

package
v1.7.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package malfeasance is a generated GoMock package.

Index

Constants

View Source
const (
	// V1 types.
	MultipleATXs     MalfeasanceType = MalfeasanceType(wire.MultipleATXs)
	MultipleBallots                  = MalfeasanceType(wire.MultipleBallots)
	HareEquivocation                 = MalfeasanceType(wire.HareEquivocation)
	InvalidPostIndex                 = MalfeasanceType(wire.InvalidPostIndex)
	InvalidPrevATX                   = MalfeasanceType(wire.InvalidPrevATX)

	// V2 types
	// TODO(mafa): for future use.
	InvalidActivation MalfeasanceType = iota + 10
	InvalidBallot
	InvalidHareMsg
)

Variables

View Source
var (
	ErrKnownProof = errors.New("known proof")
)

Functions

This section is empty.

Types

type Handler

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

Handler processes MalfeasanceProof from gossip and, if deems it valid, propagates it to peers.

func NewHandler

func NewHandler(
	cdb *datastore.CachedDB,
	lg *zap.Logger,
	self p2p.Peer,
	nodeID []types.NodeID,
	tortoise tortoise,
) *Handler

func (*Handler) HandleMalfeasanceProof

func (h *Handler) HandleMalfeasanceProof(ctx context.Context, peer p2p.Peer, data []byte) error

HandleMalfeasanceProof is the gossip receiver for MalfeasanceGossip.

func (*Handler) HandleSyncedMalfeasanceProof

func (h *Handler) HandleSyncedMalfeasanceProof(
	ctx context.Context,
	expHash types.Hash32,
	_ p2p.Peer,
	data []byte,
) error

HandleSyncedMalfeasanceProof is the sync validator for MalfeasanceProof.

func (*Handler) RegisterHandlerV1 added in v1.6.0

func (h *Handler) RegisterHandlerV1(malfeasanceType MalfeasanceType, handler HandlerV1)

func (*Handler) RegisterHandlerV2 added in v1.6.0

func (h *Handler) RegisterHandlerV2(malfeasanceType MalfeasanceType, handler HandlerV2)

func (*Handler) Validate added in v1.6.0

func (h *Handler) Validate(ctx context.Context, p *wire.MalfeasanceGossip) (types.NodeID, error)

type HandlerV1 added in v1.6.0

type HandlerV1 interface {
	Validate(ctx context.Context, data wire.ProofData) (types.NodeID, error)
	ReportProof(vec *prometheus.CounterVec)
	ReportInvalidProof(vec *prometheus.CounterVec)
}

type HandlerV2 added in v1.6.0

type HandlerV2 interface {
	Validate(ctx context.Context, data []byte) (types.NodeID, error)
}

type MalfeasanceType added in v1.6.0

type MalfeasanceType byte

type MockHandlerV1 added in v1.6.0

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

MockHandlerV1 is a mock of HandlerV1 interface.

func NewMockHandlerV1 added in v1.6.0

func NewMockHandlerV1(ctrl *gomock.Controller) *MockHandlerV1

NewMockHandlerV1 creates a new mock instance.

func (*MockHandlerV1) EXPECT added in v1.6.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHandlerV1) ReportInvalidProof added in v1.6.0

func (m *MockHandlerV1) ReportInvalidProof(vec *prometheus.CounterVec)

ReportInvalidProof mocks base method.

func (*MockHandlerV1) ReportProof added in v1.6.0

func (m *MockHandlerV1) ReportProof(vec *prometheus.CounterVec)

ReportProof mocks base method.

func (*MockHandlerV1) Validate added in v1.6.0

func (m *MockHandlerV1) Validate(ctx context.Context, data wire.ProofData) (types.NodeID, error)

Validate mocks base method.

type MockHandlerV1MockRecorder added in v1.6.0

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

MockHandlerV1MockRecorder is the mock recorder for MockHandlerV1.

func (*MockHandlerV1MockRecorder) ReportInvalidProof added in v1.6.0

ReportInvalidProof indicates an expected call of ReportInvalidProof.

func (*MockHandlerV1MockRecorder) ReportProof added in v1.6.0

ReportProof indicates an expected call of ReportProof.

func (*MockHandlerV1MockRecorder) Validate added in v1.6.0

func (mr *MockHandlerV1MockRecorder) Validate(ctx, data any) *MockHandlerV1ValidateCall

Validate indicates an expected call of Validate.

type MockHandlerV1ReportInvalidProofCall added in v1.6.0

type MockHandlerV1ReportInvalidProofCall struct {
	*gomock.Call
}

MockHandlerV1ReportInvalidProofCall wrap *gomock.Call

func (*MockHandlerV1ReportInvalidProofCall) Do added in v1.6.0

Do rewrite *gomock.Call.Do

func (*MockHandlerV1ReportInvalidProofCall) DoAndReturn added in v1.6.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHandlerV1ReportInvalidProofCall) Return added in v1.6.0

Return rewrite *gomock.Call.Return

type MockHandlerV1ReportProofCall added in v1.6.0

type MockHandlerV1ReportProofCall struct {
	*gomock.Call
}

MockHandlerV1ReportProofCall wrap *gomock.Call

func (*MockHandlerV1ReportProofCall) Do added in v1.6.0

Do rewrite *gomock.Call.Do

func (*MockHandlerV1ReportProofCall) DoAndReturn added in v1.6.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHandlerV1ReportProofCall) Return added in v1.6.0

Return rewrite *gomock.Call.Return

type MockHandlerV1ValidateCall added in v1.6.0

type MockHandlerV1ValidateCall struct {
	*gomock.Call
}

MockHandlerV1ValidateCall wrap *gomock.Call

func (*MockHandlerV1ValidateCall) Do added in v1.6.0

Do rewrite *gomock.Call.Do

func (*MockHandlerV1ValidateCall) DoAndReturn added in v1.6.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHandlerV1ValidateCall) Return added in v1.6.0

Return rewrite *gomock.Call.Return

type MockHandlerV2 added in v1.6.0

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

MockHandlerV2 is a mock of HandlerV2 interface.

func NewMockHandlerV2 added in v1.6.0

func NewMockHandlerV2(ctrl *gomock.Controller) *MockHandlerV2

NewMockHandlerV2 creates a new mock instance.

func (*MockHandlerV2) EXPECT added in v1.6.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHandlerV2) Validate added in v1.6.0

func (m *MockHandlerV2) Validate(ctx context.Context, data []byte) (types.NodeID, error)

Validate mocks base method.

type MockHandlerV2MockRecorder added in v1.6.0

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

MockHandlerV2MockRecorder is the mock recorder for MockHandlerV2.

func (*MockHandlerV2MockRecorder) Validate added in v1.6.0

func (mr *MockHandlerV2MockRecorder) Validate(ctx, data any) *MockHandlerV2ValidateCall

Validate indicates an expected call of Validate.

type MockHandlerV2ValidateCall added in v1.6.0

type MockHandlerV2ValidateCall struct {
	*gomock.Call
}

MockHandlerV2ValidateCall wrap *gomock.Call

func (*MockHandlerV2ValidateCall) Do added in v1.6.0

Do rewrite *gomock.Call.Do

func (*MockHandlerV2ValidateCall) DoAndReturn added in v1.6.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockHandlerV2ValidateCall) Return added in v1.6.0

Return rewrite *gomock.Call.Return

type Mocktortoise

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

Mocktortoise is a mock of tortoise interface.

func NewMocktortoise

func NewMocktortoise(ctrl *gomock.Controller) *Mocktortoise

NewMocktortoise creates a new mock instance.

func (*Mocktortoise) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*Mocktortoise) OnMalfeasance

func (m *Mocktortoise) OnMalfeasance(arg0 types.NodeID)

OnMalfeasance mocks base method.

type MocktortoiseMockRecorder

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

MocktortoiseMockRecorder is the mock recorder for Mocktortoise.

func (*MocktortoiseMockRecorder) OnMalfeasance

OnMalfeasance indicates an expected call of OnMalfeasance.

type MocktortoiseOnMalfeasanceCall added in v1.4.0

type MocktortoiseOnMalfeasanceCall struct {
	*gomock.Call
}

MocktortoiseOnMalfeasanceCall wrap *gomock.Call

func (*MocktortoiseOnMalfeasanceCall) Do added in v1.4.0

Do rewrite *gomock.Call.Do

func (*MocktortoiseOnMalfeasanceCall) DoAndReturn added in v1.4.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MocktortoiseOnMalfeasanceCall) Return added in v1.4.0

Return rewrite *gomock.Call.Return

Directories

Path Synopsis
nolint
nolint

Jump to

Keyboard shortcuts

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