keeper

package
v0.4.0-dev.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ZeroHash = "0000000000000000000000000000000000000000000000000000000000000000"

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

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

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) ([][]byte, []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) ([][]byte, []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 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) GetAllTreeEntries

func (k Keeper) GetAllTreeEntries(ctx sdk.Context) ([]types.TreeEntries, error)

GetAllTreeEntries retrieves all tree entries from the store.

func (Keeper) GetBatchAssignment

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

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

func (Keeper) GetBatchByBatchNumber

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

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, validatorAddr string) (types.BatchSignatures, error)

GetBatchSignatures retrieves the batch signatures by a given validator at a given batch number.

func (Keeper) GetBatchSigsForBatch

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

GetBatchSigsForBatch returns all signatures of 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) (*types.DataResult, error)

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

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) GetParams

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

func (Keeper) GetTreeEntries

func (k Keeper) GetTreeEntries(ctx context.Context, batchNum uint64) (types.TreeEntries, error)

GetTreeEntries returns the tree entries corresponding to the given batch number.

func (Keeper) GetValSetTrimPercent

func (k Keeper) GetValSetTrimPercent(ctx sdk.Context) (uint32, 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.Pair[bool, string], 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) IterateTreeEntries

func (k Keeper) IterateTreeEntries(ctx sdk.Context, callback func(types.TreeEntries) (stop bool)) error

IterateBatches iterates over the tree entries and performs a given callback function.

func (Keeper) Logger

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

func (Keeper) SetBatchAssignment

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

SetBatchAssignment assigns a given batch number to the given data request.

func (Keeper) SetBatchSignatures

func (k Keeper) SetBatchSignatures(ctx context.Context, batchNum uint64, sigs types.BatchSignatures) error

SetBatchSignatures stores a validator's signatures of a 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, valEntries [][]byte) error

SetNewBatch increments the current batch number and stores a given batch at that index. It also stores the given data result tree entries and validator tree entries. 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.

Jump to

Keyboard shortcuts

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