miner

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package miner is a generated GoMock package.

Package miner is responsible for creating valid blocks that contain valid activation transactions and transactions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveSetFromEpochFirstBlock added in v1.0.8

func ActiveSetFromEpochFirstBlock(db sql.Executor, epoch types.EpochID) ([]types.ATXID, error)

Types

type AtxGrade added in v1.0.7

type AtxGrade int

AtxGrade describes the grade of an ATX as described in https://community.spacemesh.io/t/grading-atxs-for-the-active-set/335

let s be the start of the epoch, and δ the network propagation time. grade 0: ATX was received at time t >= s-3δ, or an equivocation proof was received by time s-δ. grade 1: ATX was received at time t < s-3δ before the start of the epoch, and no equivocation proof was received by time s-δ. grade 2: ATX was received at time t < s-4δ, and no equivocation proof was received for that id until time s.

const (
	Evil AtxGrade = iota
	Acceptable
	Good
)

func GradeAtx added in v1.0.7

func GradeAtx(msh mesh, nodeID types.NodeID, atxReceived, epochStart time.Time, delta time.Duration) (AtxGrade, error)

type EpochEligibility added in v1.0.0

type EpochEligibility struct {
	Epoch     types.EpochID
	Atx       types.ATXID
	ActiveSet types.ATXIDList
	Proofs    map[types.LayerID][]types.VotingEligibility
	Slots     uint32
}

type MockconservativeState added in v1.0.0

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

MockconservativeState is a mock of conservativeState interface.

func NewMockconservativeState added in v1.0.0

func NewMockconservativeState(ctrl *gomock.Controller) *MockconservativeState

NewMockconservativeState creates a new mock instance.

func (*MockconservativeState) EXPECT added in v1.0.0

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

func (*MockconservativeState) SelectProposalTXs added in v1.0.0

func (m *MockconservativeState) SelectProposalTXs(arg0 types.LayerID, arg1 int) []types.TransactionID

SelectProposalTXs mocks base method.

type MockconservativeStateMockRecorder added in v1.0.0

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

MockconservativeStateMockRecorder is the mock recorder for MockconservativeState.

func (*MockconservativeStateMockRecorder) SelectProposalTXs added in v1.0.0

func (mr *MockconservativeStateMockRecorder) SelectProposalTXs(arg0, arg1 interface{}) *gomock.Call

SelectProposalTXs indicates an expected call of SelectProposalTXs.

type MocklayerClock added in v1.0.0

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

MocklayerClock is a mock of layerClock interface.

func NewMocklayerClock added in v1.0.0

func NewMocklayerClock(ctrl *gomock.Controller) *MocklayerClock

NewMocklayerClock creates a new mock instance.

func (*MocklayerClock) AwaitLayer added in v1.0.0

func (m *MocklayerClock) AwaitLayer(layerID types.LayerID) <-chan struct{}

AwaitLayer mocks base method.

func (*MocklayerClock) CurrentLayer added in v1.0.0

func (m *MocklayerClock) CurrentLayer() types.LayerID

CurrentLayer mocks base method.

func (*MocklayerClock) EXPECT added in v1.0.0

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

func (*MocklayerClock) LayerToTime added in v1.0.0

func (m *MocklayerClock) LayerToTime(arg0 types.LayerID) time.Time

LayerToTime mocks base method.

type MocklayerClockMockRecorder added in v1.0.0

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

MocklayerClockMockRecorder is the mock recorder for MocklayerClock.

func (*MocklayerClockMockRecorder) AwaitLayer added in v1.0.0

func (mr *MocklayerClockMockRecorder) AwaitLayer(layerID interface{}) *gomock.Call

AwaitLayer indicates an expected call of AwaitLayer.

func (*MocklayerClockMockRecorder) CurrentLayer added in v1.0.0

func (mr *MocklayerClockMockRecorder) CurrentLayer() *gomock.Call

CurrentLayer indicates an expected call of CurrentLayer.

func (*MocklayerClockMockRecorder) LayerToTime added in v1.0.0

func (mr *MocklayerClockMockRecorder) LayerToTime(arg0 interface{}) *gomock.Call

LayerToTime indicates an expected call of LayerToTime.

type Mockmesh added in v1.0.7

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

Mockmesh is a mock of mesh interface.

func NewMockmesh added in v1.0.7

func NewMockmesh(ctrl *gomock.Controller) *Mockmesh

NewMockmesh creates a new mock instance.

func (*Mockmesh) EXPECT added in v1.0.7

func (m *Mockmesh) EXPECT() *MockmeshMockRecorder

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

func (*Mockmesh) GetMalfeasanceProof added in v1.0.7

func (m *Mockmesh) GetMalfeasanceProof(nodeID types.NodeID) (*types.MalfeasanceProof, error)

GetMalfeasanceProof mocks base method.

type MockmeshMockRecorder added in v1.0.7

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

MockmeshMockRecorder is the mock recorder for Mockmesh.

func (*MockmeshMockRecorder) GetMalfeasanceProof added in v1.0.7

func (mr *MockmeshMockRecorder) GetMalfeasanceProof(nodeID interface{}) *gomock.Call

GetMalfeasanceProof indicates an expected call of GetMalfeasanceProof.

type MocknonceFetcher added in v1.0.0

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

MocknonceFetcher is a mock of nonceFetcher interface.

func NewMocknonceFetcher added in v1.0.0

func NewMocknonceFetcher(ctrl *gomock.Controller) *MocknonceFetcher

NewMocknonceFetcher creates a new mock instance.

func (*MocknonceFetcher) EXPECT added in v1.0.0

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

func (*MocknonceFetcher) VRFNonce added in v1.0.0

func (m *MocknonceFetcher) VRFNonce(arg0 types.NodeID, arg1 types.EpochID) (types.VRFPostIndex, error)

VRFNonce mocks base method.

type MocknonceFetcherMockRecorder added in v1.0.0

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

MocknonceFetcherMockRecorder is the mock recorder for MocknonceFetcher.

func (*MocknonceFetcherMockRecorder) VRFNonce added in v1.0.0

func (mr *MocknonceFetcherMockRecorder) VRFNonce(arg0, arg1 interface{}) *gomock.Call

VRFNonce indicates an expected call of VRFNonce.

type MockproposalOracle added in v1.0.0

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

MockproposalOracle is a mock of proposalOracle interface.

func NewMockproposalOracle added in v1.0.0

func NewMockproposalOracle(ctrl *gomock.Controller) *MockproposalOracle

NewMockproposalOracle creates a new mock instance.

func (*MockproposalOracle) EXPECT added in v1.0.0

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

func (*MockproposalOracle) ProposalEligibility added in v1.0.7

func (m *MockproposalOracle) ProposalEligibility(arg0 types.LayerID, arg1 types.Beacon, arg2 types.VRFPostIndex) (*EpochEligibility, error)

ProposalEligibility mocks base method.

type MockproposalOracleMockRecorder added in v1.0.0

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

MockproposalOracleMockRecorder is the mock recorder for MockproposalOracle.

func (*MockproposalOracleMockRecorder) ProposalEligibility added in v1.0.7

func (mr *MockproposalOracleMockRecorder) ProposalEligibility(arg0, arg1, arg2 interface{}) *gomock.Call

ProposalEligibility indicates an expected call of ProposalEligibility.

type MockvotesEncoder added in v1.0.0

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

MockvotesEncoder is a mock of votesEncoder interface.

func NewMockvotesEncoder added in v1.0.0

func NewMockvotesEncoder(ctrl *gomock.Controller) *MockvotesEncoder

NewMockvotesEncoder creates a new mock instance.

func (*MockvotesEncoder) EXPECT added in v1.0.0

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

func (*MockvotesEncoder) EncodeVotes added in v1.0.0

func (m *MockvotesEncoder) EncodeVotes(arg0 context.Context, arg1 ...tortoise.EncodeVotesOpts) (*types.Opinion, error)

EncodeVotes mocks base method.

func (*MockvotesEncoder) LatestComplete added in v1.0.0

func (m *MockvotesEncoder) LatestComplete() types.LayerID

LatestComplete mocks base method.

func (*MockvotesEncoder) TallyVotes added in v1.0.0

func (m *MockvotesEncoder) TallyVotes(arg0 context.Context, arg1 types.LayerID)

TallyVotes mocks base method.

type MockvotesEncoderMockRecorder added in v1.0.0

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

MockvotesEncoderMockRecorder is the mock recorder for MockvotesEncoder.

func (*MockvotesEncoderMockRecorder) EncodeVotes added in v1.0.0

func (mr *MockvotesEncoderMockRecorder) EncodeVotes(arg0 interface{}, arg1 ...interface{}) *gomock.Call

EncodeVotes indicates an expected call of EncodeVotes.

func (*MockvotesEncoderMockRecorder) LatestComplete added in v1.0.0

func (mr *MockvotesEncoderMockRecorder) LatestComplete() *gomock.Call

LatestComplete indicates an expected call of LatestComplete.

func (*MockvotesEncoderMockRecorder) TallyVotes added in v1.0.0

func (mr *MockvotesEncoderMockRecorder) TallyVotes(arg0, arg1 interface{}) *gomock.Call

TallyVotes indicates an expected call of TallyVotes.

type Opt added in v1.0.0

type Opt func(h *ProposalBuilder)

Opt for configuring ProposalBuilder.

func WithHdist added in v1.0.0

func WithHdist(dist uint32) Opt

func WithLayerPerEpoch added in v1.0.0

func WithLayerPerEpoch(layers uint32) Opt

WithLayerPerEpoch defines the number of layers per epoch.

func WithLayerSize added in v1.0.0

func WithLayerSize(size uint32) Opt

WithLayerSize defines the average number of proposal per layer.

func WithLogger added in v1.0.0

func WithLogger(logger log.Log) Opt

WithLogger defines the logger.

func WithMinimalActiveSetWeight added in v1.0.0

func WithMinimalActiveSetWeight(weight uint64) Opt

func WithNetworkDelay added in v1.0.7

func WithNetworkDelay(delay time.Duration) Opt

func WithNodeID added in v1.0.0

func WithNodeID(id types.NodeID) Opt

WithNodeID defines the miner's NodeID.

type Oracle added in v0.1.15

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

Oracle provides proposal eligibility proofs for the miner.

func (*Oracle) ProposalEligibility added in v1.0.7

func (o *Oracle) ProposalEligibility(lid types.LayerID, beacon types.Beacon, nonce types.VRFPostIndex) (*EpochEligibility, error)

ProposalEligibility returns the miner's ATXID and the active set for the layer's epoch, along with the list of eligibility proofs for that layer.

type ProposalBuilder added in v1.0.0

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

ProposalBuilder builds Proposals for a miner.

func NewProposalBuilder added in v1.0.0

func NewProposalBuilder(
	ctx context.Context,
	clock layerClock,
	signer *signing.EdSigner,
	vrfSigner *signing.VRFSigner,
	cdb *datastore.CachedDB,
	publisher pubsub.Publisher,
	trtl votesEncoder,
	beaconProvider system.BeaconGetter,
	syncer system.SyncStateProvider,
	conState conservativeState,
	opts ...Opt,
) *ProposalBuilder

NewProposalBuilder creates a struct of block builder type.

func (*ProposalBuilder) Close added in v1.0.0

func (pb *ProposalBuilder) Close()

Close stops the loop that listens to layers and build proposals.

func (*ProposalBuilder) Start added in v1.0.0

func (pb *ProposalBuilder) Start(ctx context.Context) error

Start starts the loop that listens to layers and build proposals.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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