keeper

package
v0.0.0-...-4ef5390 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Window for a transaction to be committed on Celestia
	CelestiaResubmissionTime = 75 * time.Second

	// Buffer for relayer polling logic to retrieve a proof
	RelayerPollingBuffer = 15 * time.Second
)
View Source
const DelayAfterUpgrade = int64(10)
View Source
const SnapshotFormat = 1

SnapshotFormat defines the default snapshot extension encoding format. SnapshotFormat 1 is a proto marshalled UnprovenBlock type.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper *Keeper) tiablob.MsgServer

NewMsgServerImpl returns an implementation of the module MsgServer interface.

func NewQueryServerImpl

func NewQueryServerImpl(k *Keeper) tiablob.QueryServer

NewQueryServerImpl returns an implementation of the module QueryServer.

func NewTiablobSnapshotter

func NewTiablobSnapshotter(cms storetypes.MultiStore, keeper *Keeper) snapshot.ExtensionSnapshotter

NewTiablobSnapshotter creates and returns a new snapshot.ExtensionSnapshotter implementation for tiablob.

Types

type Keeper

type Keeper struct {
	Validators              collections.Map[string, string]
	ClientID                collections.Item[string]
	ProvenHeight            collections.Item[int64]
	PendingBlocksToTimeouts collections.Map[int64, int64]
	TimeoutsToPendingBlocks collections.Map[int64, tiablob.PendingBlocks]
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	appOpts servertypes.AppOptions,
	storeService storetypes.KVStoreService,
	sk *stakingkeeper.Keeper,
	uk *upgradekeeper.Keeper,
	key storetypes2.StoreKey,
	publishToCelestiaBlockInterval int,
	celestiaNamespace share.Namespace,
) *Keeper

func (*Keeper) AddPendingBlockToTimeoutsMap

func (k *Keeper) AddPendingBlockToTimeoutsMap(ctx context.Context, height int64, expiration int64) error

func (*Keeper) AddUpdatePendingBlock

func (k *Keeper) AddUpdatePendingBlock(ctx context.Context, pendingBlock int64, currentBlockTime time.Time) error

AddUpdatePendingBlock will add a new pending block or update an existing pending block

func (Keeper) CanUpdateClient

func (k Keeper) CanUpdateClient(ctx sdk.Context, clientMsg celestia.ClientMessage) error

func (Keeper) CreateClient

func (k Keeper) CreateClient(ctx sdk.Context, clientState celestia.ClientState, consensusState celestia.ConsensusState) error

func (*Keeper) ExportGenesis

func (k *Keeper) ExportGenesis(ctx sdk.Context) *tiablob.GenesisState

ExportGenesis exports the module's state to a genesis state.

func (*Keeper) GetAllValidators

func (k *Keeper) GetAllValidators(ctx context.Context) (tiablob.Validators, error)

func (Keeper) GetCelestiaGenesisState

func (k Keeper) GetCelestiaGenesisState(ctx sdk.Context) *celestia.GenesisState

GetCelestiaGenesisState exports the celestia light client's full state

func (*Keeper) GetClientID

func (k *Keeper) GetClientID(ctx context.Context) (string, error)

func (Keeper) GetClientState

func (k Keeper) GetClientState(ctx sdk.Context) (*celestia.ClientState, bool)

func (Keeper) GetExpiredBlocks

func (k Keeper) GetExpiredBlocks(ctx context.Context, currentBlockTime time.Time) []int64

GetExpiredBlocks returns all expired blocks, proposer will propose publishing based on this set

func (*Keeper) GetPendingBlocksWithExpiration

func (k *Keeper) GetPendingBlocksWithExpiration(ctx context.Context) ([]*tiablob.BlockWithExpiration, error)

func (*Keeper) GetProvenHeight

func (k *Keeper) GetProvenHeight(ctx context.Context) (int64, error)

func (*Keeper) GetValidatorCelestiaAddress

func (k *Keeper) GetValidatorCelestiaAddress(ctx context.Context, validatorAddress string) (string, error)

func (*Keeper) InitGenesis

func (k *Keeper) InitGenesis(ctx sdk.Context, data *tiablob.GenesisState) error

InitGenesis initializes the module's state from a genesis state.

func (*Keeper) IsBlockExpired

func (k *Keeper) IsBlockExpired(ctx context.Context, currentBlockTime time.Time, blockHeight int64) bool

IsBlockExpired will return true if a block is pending and expired, otherwise it returns false

func (Keeper) IsBlockPending

func (k Keeper) IsBlockPending(ctx context.Context, blockHeight int64) bool

IsBlockPending return true if a block height is already pending

func (*Keeper) PreBlocker

func (k *Keeper) PreBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock) error

func (*Keeper) RemovePendingBlock

func (k *Keeper) RemovePendingBlock(ctx context.Context, provenBlock int64) error

RemovePendingBlock removes proven block from pending state This function will remove the proven block from the PendingBlocksToTimeouts map and TimeoutsToPendingBlocks map

func (Keeper) SetCelestiaGenesisState

func (k Keeper) SetCelestiaGenesisState(ctx sdk.Context, gs *celestia.GenesisState)

SetCelestiaGenesisState imports celestia light client's full state

func (*Keeper) SetClientID

func (k *Keeper) SetClientID(ctx context.Context, clientID string) error

func (*Keeper) SetProvenHeight

func (k *Keeper) SetProvenHeight(ctx context.Context, height int64) error

func (*Keeper) SetRelayer

func (k *Keeper) SetRelayer(r *tiablobrelayer.Relayer)

func (*Keeper) SetValidatorCelestiaAddress

func (k *Keeper) SetValidatorCelestiaAddress(ctx context.Context, validator tiablob.Validator) error

func (Keeper) UpdateClient

func (k Keeper) UpdateClient(ctx sdk.Context, clientMsg celestia.ClientMessage) error

func (Keeper) VerifyMembership

func (k Keeper) VerifyMembership(ctx sdk.Context, height uint64, proof *celestia.ShareProof) error

type ProofOfBlobProposalHandler

type ProofOfBlobProposalHandler struct {
	// contains filtered or unexported fields
}

func NewProofOfBlobProposalHandler

func NewProofOfBlobProposalHandler(
	k *Keeper,
	prepareProposalHandler sdk.PrepareProposalHandler,
	processProposalHandler sdk.ProcessProposalHandler,
) *ProofOfBlobProposalHandler

func (*ProofOfBlobProposalHandler) PrepareProposal

func (*ProofOfBlobProposalHandler) ProcessProposal

type TiaBlobSnapshotter

type TiaBlobSnapshotter struct {
	// contains filtered or unexported fields
}

TiaBlobSnapshotter implements the snapshot.ExtensionSnapshotter interface and is used to import and export unproven blocks so they can be proven when needed. State sync would otherwise missed these blocks and the node would panic.

func (*TiaBlobSnapshotter) RestoreExtension

func (s *TiaBlobSnapshotter) RestoreExtension(height uint64, format uint32, payloadReader snapshot.ExtensionPayloadReader) error

RestoreExtension implements the snapshot.ExtensionSnapshotter interface. RestoreExtension is used to read data from an existing extension state snapshot into the tiablob keeper. The payload reader returns io.EOF when it has reached the end of the extension state snapshot.

func (*TiaBlobSnapshotter) SnapshotExtension

func (s *TiaBlobSnapshotter) SnapshotExtension(height uint64, payloadWriter snapshot.ExtensionPayloadWriter) error

SnapshotExtension implements the snapshot.ExntensionSnapshotter interface. SnapshotExtension is used to write data payloads into the underlying protobuf stream from the local client.

func (*TiaBlobSnapshotter) SnapshotFormat

func (*TiaBlobSnapshotter) SnapshotFormat() uint32

SnapshotFormat implements the snapshot.ExtensionSnapshotter interface. This is the default format used for encoding payloads when taking a snapshot.

func (*TiaBlobSnapshotter) SnapshotName

func (*TiaBlobSnapshotter) SnapshotName() string

SnapshotName implements the snapshot.ExtensionSnapshotter interface. A unique name should be provided such that the implementation can be identified by the manager.

func (*TiaBlobSnapshotter) SupportedFormats

func (*TiaBlobSnapshotter) SupportedFormats() []uint32

SupportedFormats implements the snapshot.ExtensionSnapshotter interface. This defines a list of supported formats the snapshotter extension can restore from.

Jump to

Keyboard shortcuts

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