keeper

package
v0.5.0-dev.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TallyExitCodeNotEnoughCommits   = 200 // tally VM not executed due to not enough commits
	TallyExitCodeInvalidFilterInput = 253 // tally VM not executed due to invalid filter input
	TallyExitCodeFilterError        = 254 // tally VM not executed due to filter error
	TallyExitCodeExecError          = 255 // error while executing tally VM
)

Variables

This section is empty.

Functions

func BuildFilter

func BuildFilter(filterInput string, replicationFactor uint16, params types.Params, gasMeter *types.GasMeter) (types.Filter, error)

BuildFilter builds a filter based on the requestor-provided input.

func MeterExecutorGasDivergent

func MeterExecutorGasDivergent(executors []string, gasReports []uint64, replicationFactor uint16, gasMeter *types.GasMeter)

MeterExecutorGasDivergent computes and records the gas consumption of executors when their gas reports are divergent.

func MeterExecutorGasFallback

func MeterExecutorGasFallback(req types.Request, gasCostCommit uint64, gasMeter *types.GasMeter)

MeterExecutorGasFallback computes and records the gas consumption of committers of a data request when basic consensus has not been reached. If checkReveal is set to true, it will only consume gas for committers that have also revealed.

func MeterExecutorGasUniform

func MeterExecutorGasUniform(executors []string, gasReport uint64, replicationFactor uint16, gasMeter *types.GasMeter)

MeterExecutorGasUniform computes and records the gas consumption of executors when their gas reports are uniformly at "gasReport".

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type FilterResult

type FilterResult struct {
	Errors       []bool   // i-th item is true if i-th reveal is non-zero exit or corrupt
	Outliers     []bool   // i-th item is non-zero if i-th reveal is an outlier
	Consensus    bool     // whether consensus (either in data or in error) is reached
	ProxyPubKeys []string // data proxy public keys in consensus
}

func ExecuteFilter

func ExecuteFilter(reveals []types.RevealBody, filterInput string, replicationFactor uint16, params types.Params, gasMeter *types.GasMeter) (FilterResult, error)

ExecuteFilter builds a filter using the given filter input and applies it to the given reveals to determine consensus, proxy public keys in consensus, and outliers. It assumes that the reveals are sorted by their keys and that their proxy public keys are sorted.

type Keeper

type Keeper struct {
	Schema collections.Schema
	// contains filtered or unexported fields
}

func (Keeper) DistributionsFromGasMeter

func (k Keeper) DistributionsFromGasMeter(ctx sdk.Context, reqID string, reqHeight uint64, gasMeter *types.GasMeter, burnRatio math.LegacyDec) []types.Distribution

DistributionsFromGasMeter constructs a list of distribution messages to be sent to the core contract based on the given gas meter. It takes the ID and the height of the request for event emission.

func (Keeper) EndBlock

func (k Keeper) EndBlock(ctx sdk.Context) (err error)

func (Keeper) ExecuteTallyProgram

func (k Keeper) ExecuteTallyProgram(ctx sdk.Context, req types.Request, filterResult FilterResult, reveals []types.RevealBody, gasMeter *types.GasMeter) (types.VMResult, error)

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) types.GenesisState

ExportGenesis extracts all data from store to genesis state.

func (Keeper) FilterAndTally

func (k Keeper) FilterAndTally(ctx sdk.Context, req types.Request, params types.Params, gasMeter *types.GasMeter) (FilterResult, TallyResult)

FilterAndTally builds and applies filter, executes tally program, and calculates canonical gas consumption.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the module's authority.

func (Keeper) GetMaxTallyGasLimit

func (k Keeper) GetMaxTallyGasLimit(ctx sdk.Context) (uint64, error)

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (types.Params, error)

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)

InitGenesis initializes the store based on the given genesis state.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) MeterProxyGas

func (k Keeper) MeterProxyGas(ctx sdk.Context, proxyPubKeys []string, replicationFactor uint16, gasMeter *types.GasMeter)

MeterProxyGas computes and records the gas consumption of data proxies given proxy public keys in basic consensus and the request's replication factor.

func (Keeper) ProcessTallies

func (k Keeper) ProcessTallies(ctx sdk.Context, coreContract sdk.AccAddress) error

ProcessTallies fetches from the core contract the list of requests to be tallied and then goes through it to filter and tally.

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error

type Querier

type Querier struct {
	Keeper
}

type TallyResult

type TallyResult struct {
	Consensus    bool
	StdOut       []string
	StdErr       []string
	Result       []byte
	ExitCode     int
	ExecGasUsed  uint64
	TallyGasUsed uint64
	ProxyPubKeys []string // data proxy pubkeys in basic consensus
}

Jump to

Keyboard shortcuts

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