slashfilter

package
v1.15.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SlashConsensus added in v1.14.0

func SlashConsensus(ctx context.Context,
	cfg *config.FaultReporterConfig,
	walletAPI v1.IWallet,
	chainAPI v1.IChain,
	mpoolAPI v1.IMessagePool,
	syncAPI v1.ISyncer,
) error

Types

type ISlashFilter added in v0.9.5

type ISlashFilter interface {
	MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) (cid.Cid, bool, error)
}

ISlashFilter used to detect whether the miner mined a invalidated block , support local db and mysql storage

func NewLocalSlashFilter added in v0.9.5

func NewLocalSlashFilter(dstore ds.Batching) ISlashFilter

NewLocalSlashFilter create a slash filter base on badger db

func NewMysqlSlashFilter added in v0.9.5

func NewMysqlSlashFilter(cfg config.MySQLConfig) (ISlashFilter, error)

NewMysqlSlashFilter create a new slash filter base on mysql database

type LocalSlashFilter added in v0.9.5

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

LocalSlashFilter use badger db to save mined block for detect slash consensus block

func (*LocalSlashFilter) MinedBlock added in v0.9.5

func (f *LocalSlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) (cid.Cid, bool, error)

MinedBlock check whether the block mined is slash

type MinedBlock added in v0.9.5

type MinedBlock struct {
	ParentEpoch int64  `gorm:"column:parent_epoch;type:bigint(20);NOT NULL"`
	ParentKey   string `gorm:"column:parent_key;type:varchar(2048);NOT NULL"`

	Epoch int64  `gorm:"column:epoch;type:bigint(20);NOT NULL"`
	Miner string `gorm:"column:miner;type:varchar(256);NOT NULL"`
	Cid   string `gorm:"column:cid;type:varchar(256);NOT NULL"`
}

MinedBlock record mined block

type MysqlSlashFilter added in v0.9.5

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

func (*MysqlSlashFilter) MinedBlock added in v0.9.5

func (f *MysqlSlashFilter) MinedBlock(ctx context.Context, bh *types.BlockHeader, parentEpoch abi.ChainEpoch) (cid.Cid, bool, error)

MinedBlock check whether the block mined is slash

Jump to

Keyboard shortcuts

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