mesh

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

Package mesh defines the main store point for all the persisted mesh objects such as ATXs, ballots and blocks.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLayerNotInOrder = errors.New("layers not applied in order")
	ErrLayerApplied    = errors.New("layer already applied")
)

Functions

This section is empty.

Types

type Executor added in v1.0.0

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

func NewExecutor added in v1.0.0

func NewExecutor(db sql.Executor, atxsdata *atxsdata.Data, vm vmState, cs conservativeState, lg *zap.Logger) *Executor

func (*Executor) Execute added in v1.0.0

func (e *Executor) Execute(ctx context.Context, lid types.LayerID, block *types.Block) error

Execute transactions in the specified block and update the conservative cache.

func (*Executor) ExecuteOptimistic added in v1.0.0

func (e *Executor) ExecuteOptimistic(
	ctx context.Context,
	lid types.LayerID,
	tickHeight uint64,
	rewards []types.AnyReward,
	tids []types.TransactionID,
) (*types.Block, error)

ExecuteOptimistic executes the specified transactions and returns a block that contains only successfully executed transactions.

func (*Executor) Revert added in v1.0.0

func (e *Executor) Revert(ctx context.Context, revertTo types.LayerID) error

Revert reverts the VM state and conservative cache to the given layer.

type MalfeasanceHandler added in v1.6.0

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

func NewMalfeasanceHandler added in v1.6.0

func NewMalfeasanceHandler(
	db sql.Executor,
	edVerifier *signing.EdVerifier,
	opt ...MalfeasanceOpt,
) *MalfeasanceHandler

func (*MalfeasanceHandler) Info added in v1.7.2

func (mh *MalfeasanceHandler) Info(data wire.ProofData) (map[string]string, error)

func (*MalfeasanceHandler) ReportInvalidProof added in v1.6.0

func (mh *MalfeasanceHandler) ReportInvalidProof(numInvalidProofs *prometheus.CounterVec)

func (*MalfeasanceHandler) ReportProof added in v1.6.0

func (mh *MalfeasanceHandler) ReportProof(numProofs *prometheus.CounterVec)

func (*MalfeasanceHandler) Validate added in v1.6.0

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

type MalfeasanceOpt added in v1.6.0

type MalfeasanceOpt func(*MalfeasanceHandler)

func WithMalfeasanceLogger added in v1.6.0

func WithMalfeasanceLogger(logger *zap.Logger) MalfeasanceOpt

type Mesh

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

Mesh is the logic layer above our mesh.DB database.

func NewMesh

func NewMesh(
	db sql.StateDatabase,
	atxsdata *atxsdata.Data,
	trtl system.Tortoise,
	exec *Executor,
	state conservativeState,
	logger *zap.Logger,
) (*Mesh, error)

NewMesh creates a new instant of a mesh.

func (*Mesh) AddBallot added in v1.0.0

func (msh *Mesh) AddBallot(
	ctx context.Context,
	ballot *types.Ballot,
) (*wire.MalfeasanceProof, error)

AddBallot to the mesh.

func (*Mesh) AddBlockWithTXs added in v1.0.0

func (msh *Mesh) AddBlockWithTXs(ctx context.Context, block *types.Block) error

AddBlockWithTXs adds the block and its TXs in into the database.

func (*Mesh) AddTXsFromProposal added in v1.0.0

func (msh *Mesh) AddTXsFromProposal(
	ctx context.Context,
	layerID types.LayerID,
	proposalID types.ProposalID,
	txIDs []types.TransactionID,
) error

AddTXsFromProposal adds the TXs in a Proposal into the database.

func (*Mesh) GetLayer

func (msh *Mesh) GetLayer(lid types.LayerID) (*types.Layer, error)

GetLayer returns GetLayer i from the database.

func (*Mesh) GetLayerVerified added in v1.3.3

func (msh *Mesh) GetLayerVerified(lid types.LayerID) (*types.Block, error)

GetLayerVerified returns the verified, canonical block for a layer (or none for an empty layer).

func (*Mesh) GetRewardsByCoinbase added in v1.3.0

func (msh *Mesh) GetRewardsByCoinbase(coinbase types.Address) ([]*types.Reward, error)

GetRewardsByCoinbase retrieves account's rewards by the coinbase address.

func (*Mesh) GetRewardsBySmesherId added in v1.3.0

func (msh *Mesh) GetRewardsBySmesherId(smesherID types.NodeID) ([]*types.Reward, error)

GetRewardsBySmesherId retrieves account's rewards by the smesher ID.

func (*Mesh) LastVerified added in v1.0.0

func (msh *Mesh) LastVerified() types.LayerID

LastVerified returns the latest layer verified by tortoise.

func (*Mesh) LatestLayer

func (msh *Mesh) LatestLayer() types.LayerID

LatestLayer - returns the latest layer we saw from the network.

func (*Mesh) LatestLayerInState

func (msh *Mesh) LatestLayerInState() types.LayerID

LatestLayerInState returns the latest layer we applied to state.

func (*Mesh) MeshHash added in v1.0.0

func (msh *Mesh) MeshHash(lid types.LayerID) (types.Hash32, error)

MeshHash returns the aggregated mesh hash at the specified layer.

func (*Mesh) MissingBlocks added in v1.0.16

func (msh *Mesh) MissingBlocks() <-chan []types.BlockID

MissingBlocks returns single consumer channel. Consumer by contract is responsible for downloading missing blocks.

func (*Mesh) ProcessLayer added in v1.0.0

func (msh *Mesh) ProcessLayer(ctx context.Context, lid types.LayerID) error

ProcessLayer reads latest consensus results and ensures that vm state is consistent with results. It is safe to call after optimistically executing the block.

func (*Mesh) ProcessLayerPerHareOutput added in v1.0.0

func (msh *Mesh) ProcessLayerPerHareOutput(
	ctx context.Context,
	layerID types.LayerID,
	blockID types.BlockID,
	executed bool,
) error

ProcessLayerPerHareOutput receives hare output once it finishes running for a given layer.

func (*Mesh) ProcessedLayer

func (msh *Mesh) ProcessedLayer() types.LayerID

ProcessedLayer returns the last processed layer ID.

func (*Mesh) SetZeroBlockLayer added in v0.1.6

func (msh *Mesh) SetZeroBlockLayer(ctx context.Context, lid types.LayerID)

SetZeroBlockLayer advances the latest layer in the network with a layer that has no data.

func (*Mesh) Start added in v1.7.2

func (m *Mesh) Start(ctx context.Context)

type MissingBlocksError added in v1.4.3

type MissingBlocksError struct {
	Blocks []types.BlockID
}

func (*MissingBlocksError) Error added in v1.4.3

func (e *MissingBlocksError) Error() string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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