slash

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DefaultWebHookPath ..
	DefaultWebHookPath = "staking/slash/webhook.example.yaml"
)

Variables

This section is empty.

Functions

func Rate added in v1.3.3

func Rate(doubleSignerCount, committeeSize int) numeric.Dec

Rate is the slashing % rate

func Verify added in v1.3.1

func Verify(chain CommitteeReader, candidate *Record) error

Verify checks that the signature is valid

Types

type Application added in v1.3.3

type Application struct {
	TotalSlashed, TotalSnitchReward *big.Int
}

Application ..

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 {
	ReadShardState(epoch *big.Int) (*shard.State, error)
}

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 DoubleSignWebHooks added in v1.3.1

type DoubleSignWebHooks struct {
	WebHooks *struct {
		OnNoticeDoubleSign     string `yaml:"notice-double-sign"`
		OnThisNodeDoubleSigned string `yaml:"this-node-double-signed"`
	} `yaml:"web-hooks"`
	Malicious *struct {
		Trigger *struct {
			PublicKeys        []string `yaml:"list"`
			DoubleSignNodeURL string   `yaml:"double-sign"`
		} `yaml:"trigger"`
	} `yaml:"malicious"`
}

DoubleSignWebHooks ..

func NewDoubleSignWebHooksFromPath added in v1.3.1

func NewDoubleSignWebHooksFromPath(yamlPath string) (*DoubleSignWebHooks, error)

NewDoubleSignWebHooksFromPath ..

func (*DoubleSignWebHooks) Contains added in v1.3.3

func (h *DoubleSignWebHooks) Contains(key *bls.PublicKey) bool

Contains ..

type Evidence added in v1.3.3

type Evidence struct {
	Moment
	ConflictingBallots
	ProposalHeader *block.Header `json:"header"`
}

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"`
	Height       *big.Int `json:"block-height"`
	TimeUnixNano *big.Int `json:"time-unix-nano"`
	ViewID       uint64   `json:"view-id"`
	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) 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) SanityCheck added in v1.3.3

func (r Records) SanityCheck() error

SanityCheck fails if any of the slashes fail

func (Records) String added in v1.3.3

func (r Records) String() string

type ReportResult added in v1.3.3

type ReportResult struct {
	Result  string `json:"result"`
	Payload string `json:"payload"`
}

ReportResult ..

func DoPost added in v1.3.3

func DoPost(url string, record *Record) (*ReportResult, error)

DoPost is a fire and forget helper

func NewFailure added in v1.3.3

func NewFailure(payload string) *ReportResult

NewFailure ..

func NewSuccess added in v1.3.3

func NewSuccess(payload string) *ReportResult

NewSuccess ..

Jump to

Keyboard shortcuts

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