slashing

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// GetSigningInfoMethod defines the ABI method name for the slashing SigningInfo query
	GetSigningInfoMethod = "getSigningInfo"
	// GetSigningInfosMethod defines the ABI method name for the slashing SigningInfos query
	GetSigningInfosMethod = "getSigningInfos"
	// GetParamsMethod defines the ABI method name for the slashing Params query
	GetParamsMethod = "getParams"
)
View Source
const (
	// EventTypeValidatorUnjailed defines the event type for validator unjailing
	EventTypeValidatorUnjailed = "ValidatorUnjailed"
)
View Source
const (
	// UnjailMethod defines the ABI method name for the slashing Unjail
	// transaction.
	UnjailMethod = "unjail"
)

Variables

This section is empty.

Functions

func LoadABI

func LoadABI() (abi.ABI, error)

LoadABI loads the slashing ABI from the embedded abi.json file for the slashing precompile.

func ParseSigningInfoArgs

func ParseSigningInfoArgs(args []interface{}) (*slashingtypes.QuerySigningInfoRequest, error)

ParseSigningInfoArgs parses the arguments for the signing info query

func ParseSigningInfosArgs

func ParseSigningInfosArgs(method *abi.Method, args []interface{}) (*slashingtypes.QuerySigningInfosRequest, error)

ParseSigningInfosArgs parses the arguments for the signing infos query

Types

type EventValidatorUnjailed

type EventValidatorUnjailed struct {
	Validator common.Address
}

Add this struct after the existing constants

type Params

type Params struct {
	SignedBlocksWindow      uint64 `abi:"signedBlocksWindow"`
	MinSignedPerWindow      string `abi:"minSignedPerWindow"`
	DowntimeJailDuration    uint64 `abi:"downtimeJailDuration"`
	SlashFractionDoubleSign string `abi:"slashFractionDoubleSign"`
	SlashFractionDowntime   string `abi:"slashFractionDowntime"`
}

Params defines the parameters for the slashing module

type ParamsOutput

type ParamsOutput struct {
	Params Params
}

ParamsOutput represents the output of the params query

func (*ParamsOutput) FromResponse

type Precompile

type Precompile struct {
	cmn.Precompile
	// contains filtered or unexported fields
}

Precompile defines the precompiled contract for slashing.

func NewPrecompile

func NewPrecompile(
	slashingKeeper slashingkeeper.Keeper,
	authzKeeper authzkeeper.Keeper,
) (*Precompile, error)

NewPrecompile creates a new slashing Precompile instance as a PrecompiledContract interface.

func (Precompile) EmitValidatorUnjailedEvent

func (p Precompile) EmitValidatorUnjailedEvent(ctx sdk.Context, stateDB vm.StateDB, validator common.Address) error

EmitValidatorUnjailedEvent emits the ValidatorUnjailed event

func (*Precompile) GetParams

func (p *Precompile) GetParams(
	ctx sdk.Context,
	method *abi.Method,
	_ *vm.Contract,
	_ []interface{},
) ([]byte, error)

GetParams implements the query to get the slashing parameters.

func (*Precompile) GetSigningInfo

func (p *Precompile) GetSigningInfo(
	ctx sdk.Context,
	method *abi.Method,
	_ *vm.Contract,
	args []interface{},
) ([]byte, error)

GetSigningInfo implements the query to get a validator's signing info.

func (*Precompile) GetSigningInfos

func (p *Precompile) GetSigningInfos(
	ctx sdk.Context,
	method *abi.Method,
	_ *vm.Contract,
	args []interface{},
) ([]byte, error)

GetSigningInfos implements the query to get signing info for all validators.

func (Precompile) IsTransaction

func (Precompile) IsTransaction(method *abi.Method) bool

IsTransaction checks if the given method name corresponds to a transaction or query.

Available slashing transactions are: - Unjail

func (Precompile) Logger

func (p Precompile) Logger(ctx sdk.Context) log.Logger

Logger returns a precompile-specific logger.

func (Precompile) RequiredGas

func (p Precompile) RequiredGas(input []byte) uint64

RequiredGas calculates the precompiled contract's base gas rate.

func (Precompile) Run

func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz []byte, err error)

Run executes the precompiled contract slashing methods defined in the ABI.

func (Precompile) Unjail

func (p Precompile) Unjail(
	ctx sdk.Context,
	method *abi.Method,
	stateDB vm.StateDB,
	_ *vm.Contract,
	args []interface{},
) ([]byte, error)

Unjail implements the unjail precompile transaction, which allows validators to unjail themselves after being jailed for downtime.

type SigningInfo

type SigningInfo struct {
	ValidatorAddress    common.Address `abi:"validatorAddress"`
	StartHeight         uint64         `abi:"startHeight"`
	IndexOffset         uint64         `abi:"indexOffset"`
	JailedUntil         uint64         `abi:"jailedUntil"`
	Tombstoned          bool           `abi:"tombstoned"`
	MissedBlocksCounter uint64         `abi:"missedBlocksCounter"`
}

SigningInfo represents the signing info for a validator

type SigningInfoOutput

type SigningInfoOutput struct {
	SigningInfo SigningInfo
}

SigningInfoOutput represents the output of the signing info query

func (*SigningInfoOutput) FromResponse

type SigningInfosInput

type SigningInfosInput struct {
	Pagination query.PageRequest `abi:"pagination"`
}

SigningInfosInput represents the input for the signing infos query

type SigningInfosOutput

type SigningInfosOutput struct {
	SigningInfos []SigningInfo      `abi:"signingInfos"`
	PageResponse query.PageResponse `abi:"pageResponse"`
}

SigningInfosOutput represents the output of the signing infos query

func (*SigningInfosOutput) FromResponse

type ValidatorUnjailed

type ValidatorUnjailed struct {
	Validator common.Address
}

ValidatorUnjailed defines the data structure for the ValidatorUnjailed event.

Jump to

Keyboard shortcuts

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