keeper

package
v0.4.0-dev.7 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerierImpl

func NewQuerierImpl(keeper Keeper) types.QueryServer

Types

type BatchIndexes

type BatchIndexes struct {
	// Number is a unique index that indexes batches by their batch number.
	Number *indexes.Unique[uint64, int64, types.Batch]
}

func NewBatchIndexes

func NewBatchIndexes(sb *collections.SchemaBuilder) BatchIndexes

func (BatchIndexes) IndexesList

func (i BatchIndexes) IndexesList() []collections.Index[int64, types.Batch]

type Keeper

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

func (Keeper) ConstructBatch

ConstructBatch constructs a data result tree from unbatched data results and a validator tree from the current active validator set. It returns a resulting batch, data result tree entries, and validator tree entries in that order.

func (Keeper) ConstructDataResultTree

func (k Keeper) ConstructDataResultTree(ctx sdk.Context, newBatchNum uint64) (types.DataResultTreeEntries, []byte, error)

ConstructDataResultTree constructs a data result tree based on the data results that have not been batched yet. It returns the tree's entries without the domain separators and the tree root.

func (Keeper) ConstructValidatorTree

func (k Keeper) ConstructValidatorTree(ctx sdk.Context) ([]types.ValidatorTreeEntry, []byte, error)

ConstructValidatorTree constructs a validator tree based on the validators in the active set and their registered public keys. It returns the tree's entries without the domain separators, batch signature entries with validator address and public key fields populated, and the tree root.

func (Keeper) EndBlock

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

func (Keeper) ExportGenesis

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

ExportGenesis extracts all data from store to genesis state.

func (Keeper) GetAllBatches

func (k Keeper) GetAllBatches(ctx sdk.Context) ([]types.Batch, error)

GetAllBatches returns all batches in the store.

func (Keeper) GetBatchAssignment

func (k Keeper) GetBatchAssignment(ctx context.Context, dataReqID string, dataReqHeight uint64) (uint64, error)

GetBatchAssignment returns the given data request's assigned batch number for a given height.

func (Keeper) GetBatchByBatchNumber

func (k Keeper) GetBatchByBatchNumber(ctx context.Context, batchNumber uint64) (types.Batch, error)

func (Keeper) GetBatchData

func (k Keeper) GetBatchData(ctx context.Context, batchNum uint64) (types.BatchData, error)

GetBatchData returns various data for a given batch.

func (Keeper) GetBatchForHeight

func (k Keeper) GetBatchForHeight(ctx context.Context, blockHeight int64) (types.Batch, error)

func (Keeper) GetBatchSignatures

func (k Keeper) GetBatchSignatures(ctx context.Context, batchNum uint64) ([]types.BatchSignatures, error)

GetBatchSignatures returns all batch signatures for a given batch.

func (Keeper) GetCurrentBatchNum

func (k Keeper) GetCurrentBatchNum(ctx context.Context) (uint64, error)

func (Keeper) GetDataResult

func (k Keeper) GetDataResult(ctx context.Context, dataReqID string, dataReqHeight uint64) (*types.DataResult, error)

GetDataResult returns a data result given the associated data request's ID and height.

func (Keeper) GetDataResults

func (k Keeper) GetDataResults(ctx context.Context, batched bool) ([]types.DataResult, error)

GetDataResults returns a list of data results under a given status (batched or not).

func (Keeper) GetLatestBatch

func (k Keeper) GetLatestBatch(ctx context.Context) (types.Batch, error)

GetLatestBatch returns the most recently created batch. If batching has not begun, it returns an error ErrBatchingHasNotStarted.

func (Keeper) GetLatestDataResult

func (k Keeper) GetLatestDataResult(ctx context.Context, dataReqID string) (*types.DataResult, error)

GetLatestDataResult returns the latest data result given the associated data request's ID.

func (Keeper) GetLatestSignedBatch

func (k Keeper) GetLatestSignedBatch(ctx sdk.Context) (types.Batch, error)

GetLatestSignedBatch returns the latest batch whose signatures have been collected.

func (Keeper) GetValidatorTreeEntry

func (k Keeper) GetValidatorTreeEntry(ctx context.Context, batchNum uint64, valAddr sdk.ValAddress) (types.ValidatorTreeEntry, error)

func (Keeper) InitGenesis

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

InitGenesis puts all data from genesis state into store.

func (Keeper) IterateBatches

func (k Keeper) IterateBatches(ctx sdk.Context, callback func(types.Batch) (stop bool)) error

IterateBatches iterates over the batches and performs a given callback function.

func (Keeper) IterateDataResults

func (k Keeper) IterateDataResults(ctx context.Context, batched bool, cb func(key collections.Triple[bool, string, uint64], value types.DataResult) (bool, error)) error

IterateDataResults iterates over all data results under a given status (batched or not) and performs a given callback function.

func (Keeper) Logger

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

func (Keeper) MarkDataResultAsBatched

func (k Keeper) MarkDataResultAsBatched(ctx context.Context, result types.DataResult, batchNum uint64) error

MarkDataResultAsBatched removes the "unbatched" variant of the given data result and stores a "batched" variant.

func (Keeper) SetBatchAssignment

func (k Keeper) SetBatchAssignment(ctx context.Context, dataReqID string, dataReqHeight uint64, batchNumber uint64) error

SetBatchAssignment assigns a given batch number to the given data request ID and data request height.

func (Keeper) SetBatchSigSecp256k1

func (k Keeper) SetBatchSigSecp256k1(ctx context.Context, batchNum uint64, valAddr sdk.ValAddress, signature []byte) error

SetBatchSigSecp256k1 stores a given validator's secp256k1 signature for a specified batch.

func (Keeper) SetDataResultForBatching

func (k Keeper) SetDataResultForBatching(ctx context.Context, result types.DataResult) error

SetDataResultForBatching stores a data result so that it is ready to be batched.

func (Keeper) SetNewBatch

func (k Keeper) SetNewBatch(ctx context.Context, batch types.Batch, dataEntries types.DataResultTreeEntries, valEntries []types.ValidatorTreeEntry) error

SetNewBatch increments the current batch number and stores a given batch at that index. It also stores the given data result tree entries, validator tree entries, and batch signature entries (at the next batch index, to be populated with signatures later). It returns an error if a batch already exists at the given batch's block height or if the given batch's batch number does not match the next batch number.

type Querier

type Querier struct {
	Keeper
}

func (Querier) Batch

func (Querier) Batches

Jump to

Keyboard shortcuts

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