slash

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 21 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 ConflictingVotes added in v1.3.11

type ConflictingVotes struct {
	FirstVote  Vote `json:"first-vote"`
	SecondVote Vote `json:"second-vote"`
}

ConflictingVotes ..

type Evidence added in v1.3.3

type Evidence struct {
	Moment
	ConflictingVotes
	Offender common.Address `json:"offender"`
}

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"`
	ShardID uint32   `json:"shard-id"`
	Height  uint64   `json:"height"`
	ViewID  uint64   `json:"view-id"`
}

Moment ..

type Record

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

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

type Vote added in v1.3.11

type Vote struct {
	SignerPubKeys   []bls.SerializedPublicKey `json:"bls-public-keys"`
	BlockHeaderHash common.Hash               `json:"block-header-hash"`
	Signature       []byte                    `json:"bls-signature"`
}

Vote is the vote of the double signer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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