evidence

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrInvalidEvidenceHash is raised when the evidence hash is invalid.
	ErrInvalidEvidenceHash = "invalid request; hash is empty"
	// ErrExpectedEquivocation is raised when the evidence is not an Equivocation.
	ErrExpectedEquivocation = "invalid evidence type: expected Equivocation"
)
View Source
const (
	// SubmitEvidenceMethod defines the ABI method name for the evidence SubmitEvidence
	// transaction.
	SubmitEvidenceMethod = "submitEvidence"
	// EvidenceMethod defines the ABI method name for the Evidence query.
	EvidenceMethod = "evidence"
	// GetAllEvidenceMethod defines the ABI method name for the GetAllEvidence query.
	GetAllEvidenceMethod = "getAllEvidence"
)
View Source
const (
	// EventTypeSubmitEvidence defines the event type for the evidence SubmitEvidence transaction.
	EventTypeSubmitEvidence = "SubmitEvidence"
)

Variables

This section is empty.

Functions

func LoadABI

func LoadABI() (abi.ABI, error)

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

func NewMsgSubmitEvidence

func NewMsgSubmitEvidence(origin common.Address, args []interface{}) (*evidencetypes.MsgSubmitEvidence, error)

NewMsgSubmitEvidence creates a new MsgSubmitEvidence instance.

Types

type AllEvidenceOutput

type AllEvidenceOutput struct {
	Evidence     []EquivocationData
	PageResponse query.PageResponse
}

AllEvidenceOutput defines the output for the GetAllEvidence query.

type EquivocationData

type EquivocationData struct {
	Height           int64  `abi:"height"`
	Time             uint64 `abi:"time"`
	Power            int64  `abi:"power"`
	ConsensusAddress string `abi:"consensusAddress"`
}

EquivocationData represents the Solidity Equivocation struct

func (EquivocationData) ToEquivocation

func (e EquivocationData) ToEquivocation() *evidencetypes.Equivocation

ToEquivocation converts the EquivocationData to a types.Equivocation

type EventSubmitEvidence

type EventSubmitEvidence struct {
	Submitter common.Address
	Hash      []byte
}

EventSubmitEvidence defines the event data for the SubmitEvidence transaction.

type Precompile

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

Precompile defines the precompiled contract for evidence.

func NewPrecompile

func NewPrecompile(
	evidenceKeeper evidencekeeper.Keeper,
	authzKeeper authzkeeper.Keeper,
) (*Precompile, error)

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

func (Precompile) EmitSubmitEvidenceEvent

func (p Precompile) EmitSubmitEvidenceEvent(ctx sdk.Context, stateDB vm.StateDB, origin common.Address, evidenceHash []byte) error

EmitSubmitEvidenceEvent creates a new event emitted on a SubmitEvidence transaction.

func (*Precompile) Evidence

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

Evidence implements the query logic for getting evidence by hash.

func (*Precompile) GetAllEvidence

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

GetAllEvidence implements the query logic for getting all evidence.

func (Precompile) IsTransaction

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

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

Available evidence transactions are: - SubmitEvidence

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 evidence methods defined in the ABI.

func (Precompile) SubmitEvidence

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

SubmitEvidence implements the evidence submission logic for the evidence precompile.

type SingleEvidenceOutput

type SingleEvidenceOutput struct {
	Evidence EquivocationData
}

SingleEvidenceOutput defines the output for the Evidence query.

Jump to

Keyboard shortcuts

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