slash

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2020 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBanned added in v1.3.7

func IsBanned(wrapper *staking.ValidatorWrapper) bool

IsBanned ..

func Rate added in v1.3.3

func Rate(votingPower *votepower.Roster, records Records) numeric.Dec

Rate is the slashing % rate

func Verify added in v1.3.1

func Verify(
	chain CommitteeReader,
	state *state.DB,
	candidate *Record,
) error

Verify checks that the slash is valid

Types

type Application added in v1.3.3

type Application struct {
	TotalSlashed      *big.Int `json:"total-slashed"`
	TotalSnitchReward *big.Int `json:"total-snitch-reward"`
}

Application tracks the slash application to state

func Apply added in v1.3.1

func Apply(
	chain staking.ValidatorSnapshotReader, state *state.DB,
	slashes Records, rate numeric.Dec,
) (*Application, error)

Apply ..

func (*Application) String added in v1.3.3

func (a *Application) String() string

type CommitteeReader added in v1.3.3

type CommitteeReader interface {
	Config() *params.ChainConfig
	ReadShardState(epoch *big.Int) (*shard.State, error)
	CurrentBlock() *types.Block
}

CommitteeReader ..

type ConflictingBallots added in v1.3.3

type ConflictingBallots struct {
	AlreadyCastBallot  votepower.Ballot `json:"already-cast-vote"`
	DoubleSignedBallot votepower.Ballot `json:"double-signed-vote"`
}

ConflictingBallots ..

type Evidence added in v1.3.3

type Evidence struct {
	Moment
	ConflictingBallots
}

Evidence ..

func (Evidence) MarshalJSON added in v1.3.3

func (e Evidence) MarshalJSON() ([]byte, error)

MarshalJSON ..

func (Evidence) String added in v1.3.3

func (e Evidence) String() string

type Moment added in v1.3.3

type Moment struct {
	Epoch        *big.Int `json:"epoch"`
	TimeUnixNano *big.Int `json:"time-unix-nano"`
	ShardID      uint32   `json:"shard-id"`
}

Moment ..

type Record

type Record struct {
	// the reporter who will get rewarded
	Evidence Evidence       `json:"evidence"`
	Reporter common.Address `json:"reporter"`
	Offender common.Address `json:"offender"`
}

Record is an proof of a slashing made by a witness of a double-signing event

func (Record) Hash added in v1.3.4

func (r Record) Hash() common.Hash

Hash is a New256 hash of an RLP encoded Record

func (Record) MarshalJSON added in v1.3.3

func (r Record) MarshalJSON() ([]byte, error)

MarshalJSON ..

func (Record) String added in v1.3.3

func (r Record) String() string

type Records added in v1.3.3

type Records []Record

Records ..

func (Records) SetDifference added in v1.3.4

func (r Records) SetDifference(ys Records) Records

SetDifference returns all the records that are in ys but not in r

func (Records) String added in v1.3.3

func (r Records) String() string

Jump to

Keyboard shortcuts

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