keeper

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func VerifyEpochSealed

func VerifyEpochSealed(epoch *epochingtypes.Epoch, rawCkpt *checkpointingtypes.RawCheckpoint, proof *types.ProofEpochSealed) error

VerifyEpochSealed verifies that the given `epoch` is sealed by the `rawCkpt` by using the given `proof` The verification rules include: - basic sanity checks - The raw checkpoint's last_commit_hash is same as in the header of the sealer epoch - More than 1/3 (in voting power) validators in the validator set of this epoch have signed last_commit_hash of the sealer epoch - The epoch medatata is committed to the app_hash of the sealer epoch - The validator set is committed to the app_hash of the sealer epoch

func VerifyEpochSubmitted

func VerifyEpochSubmitted(rawCkpt *checkpointingtypes.RawCheckpoint, txsInfo []*btcctypes.TransactionInfo, btcHeaders []*wire.BlockHeader, powLimit *big.Int, babylonTag txformat.BabylonTag) error

VerifyEpochSubmitted verifies whether an epoch's checkpoint has been included in BTC or not verifications include: - basic sanity checks - Merkle proofs in txsInfo are valid - the raw ckpt decoded from txsInfo is same as the expected rawCkpt

func VerifyHeaderInEpoch

func VerifyHeaderInEpoch(header *tmproto.Header, epoch *epochingtypes.Epoch, proof *tmcrypto.Proof) error

func VerifyStore

func VerifyStore(root []byte, moduleStoreKey string, key []byte, value []byte, proof *tmcrypto.ProofOps) error

VerifyStore verifies whether a KV pair is committed to the Merkle root, with the assistance of a Merkle proof (adapted from https://github.com/cosmos/cosmos-sdk/blob/v0.46.6/store/rootmulti/proof_test.go)

func VerifyTxInBlock

func VerifyTxInBlock(txHash []byte, proof *tmproto.TxProof) error

Types

type Hooks

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

func (Hooks) AfterBlsKeyRegistered

func (h Hooks) AfterBlsKeyRegistered(ctx sdk.Context, valAddr sdk.ValAddress) error

func (Hooks) AfterEpochBegins

func (h Hooks) AfterEpochBegins(ctx sdk.Context, epoch uint64)

func (Hooks) AfterEpochEnds

func (h Hooks) AfterEpochEnds(ctx sdk.Context, epoch uint64)

AfterEpochEnds is triggered upon an epoch has ended

func (Hooks) AfterHeaderWithValidCommit

func (h Hooks) AfterHeaderWithValidCommit(ctx sdk.Context, txHash []byte, header *extendedkeeper.HeaderInfo, isOnFork bool)

AfterHeaderWithValidCommit is triggered upon each CZ header with a valid QC

func (Hooks) AfterRawCheckpointBlsSigVerified

func (h Hooks) AfterRawCheckpointBlsSigVerified(ctx sdk.Context, ckpt *checkpointingtypes.RawCheckpoint) error

func (Hooks) AfterRawCheckpointConfirmed

func (h Hooks) AfterRawCheckpointConfirmed(ctx sdk.Context, epoch uint64) error

func (Hooks) AfterRawCheckpointFinalized

func (h Hooks) AfterRawCheckpointFinalized(ctx sdk.Context, epoch uint64) error

AfterRawCheckpointFinalized is triggered upon an epoch has been finalised

func (Hooks) AfterRawCheckpointForgotten

func (h Hooks) AfterRawCheckpointForgotten(ctx sdk.Context, ckpt *checkpointingtypes.RawCheckpoint) error

func (Hooks) BeforeSlashThreshold

func (h Hooks) BeforeSlashThreshold(ctx sdk.Context, valSet epochingtypes.ValidatorSet)

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	ics4Wrapper types.ICS4Wrapper,
	channelKeeper types.ChannelKeeper,
	portKeeper types.PortKeeper,
	authKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	checkpointingKeeper types.CheckpointingKeeper,
	btccKeeper types.BtcCheckpointKeeper,
	epochingKeeper types.EpochingKeeper,
	tmClient types.TMClient,
	storeQuerier sdk.Queryable,
	scopedKeeper types.ScopedKeeper,
) *Keeper

func (Keeper) AuthenticateCapability

func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool

AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function

func (Keeper) BindPort

func (k Keeper) BindPort(ctx sdk.Context, portID string) error

BindPort defines a wrapper function for the ort Keeper's function in order to expose it to module's InitGenesis function

func (Keeper) ChainsInfo added in v0.6.0

ChainsInfo returns the latest info for a given list of chains

func (Keeper) ClaimCapability

func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error

ClaimCapability allows the transfer module that can claim a capability that IBC module passes to it

func (Keeper) EpochChainInfoExists added in v0.6.0

func (k Keeper) EpochChainInfoExists(ctx sdk.Context, chainID string, epochNumber uint64) bool

EpochChainInfoExists checks if the latest chain info exists of a given epoch for a given chain ID

func (Keeper) EpochChainsInfo added in v0.6.0

EpochChainsInfo returns the latest info for list of chains in a given epoch

func (Keeper) FinalizedChainsInfo added in v0.6.0

FinalizedChainsInfo returns the finalized info for a given list of chains

func (Keeper) FindClosestHeader

func (k Keeper) FindClosestHeader(ctx sdk.Context, chainID string, height uint64) (*types.IndexedHeader, error)

FindClosestHeader finds the IndexedHeader that is closest to (but not after) the given height

func (Keeper) GetAllChainIDs

func (k Keeper) GetAllChainIDs(ctx sdk.Context) []string

GetAllChainIDs gets all chain IDs that integrate Babylon

func (Keeper) GetAllChannels

func (k Keeper) GetAllChannels(ctx sdk.Context) []channeltypes.IdentifiedChannel

func (Keeper) GetChainInfo

func (k Keeper) GetChainInfo(ctx sdk.Context, chainID string) (*types.ChainInfo, error)

GetChainInfo returns the ChainInfo struct for a chain with a given ID Since IBC does not provide API that allows to initialise chain info right before creating an IBC connection, we can only check its existence every time, and return an empty one if it's not initialised yet.

func (Keeper) GetEpoch

func (k Keeper) GetEpoch(ctx sdk.Context) *epochingtypes.Epoch

func (Keeper) GetEpochChainInfo

func (k Keeper) GetEpochChainInfo(ctx sdk.Context, chainID string, epochNumber uint64) (*types.ChainInfo, error)

GetEpochChainInfo gets the latest chain info of a given epoch for a given chain ID

func (Keeper) GetEpochHeaders

func (k Keeper) GetEpochHeaders(ctx sdk.Context, chainID string, epochNumber uint64) ([]*types.IndexedHeader, error)

GetEpochHeaders gets the headers timestamped in a given epoch, in the ascending order

func (Keeper) GetFinalizedEpoch

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

GetFinalizedEpoch gets the last finalised epoch used upon querying the last BTC-finalised chain info for CZs

func (Keeper) GetForks

func (k Keeper) GetForks(ctx sdk.Context, chainID string, height uint64) *types.Forks

GetForks returns a list of forked headers at a given height

func (Keeper) GetHeader

func (k Keeper) GetHeader(ctx sdk.Context, chainID string, height uint64) (*types.IndexedHeader, error)

func (Keeper) GetPort

func (k Keeper) GetPort(ctx sdk.Context) string

GetPort returns the portID for the transfer module. Used in ExportGenesis

func (Keeper) HasChainInfo

func (k Keeper) HasChainInfo(ctx sdk.Context, chainID string) bool

HasChainInfo returns whether the chain info exists for a given ID Since IBC does not provide API that allows to initialise chain info right before creating an IBC connection, we can only check its existence every time, and return an empty one if it's not initialised yet.

func (Keeper) Header

Header returns the header and fork headers at a given height

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

func (Keeper) InitChainInfo

func (k Keeper) InitChainInfo(ctx sdk.Context, chainID string) (*types.ChainInfo, error)

func (Keeper) IsBound

func (k Keeper) IsBound(ctx sdk.Context, portID string) bool

IsBound checks if the transfer module is already bound to the desired port

func (Keeper) ListEpochHeaders

ListEpochHeaders returns all headers of a chain with given ID TODO: support pagination in this RPC

func (Keeper) ListHeaders

ListHeaders returns all headers of a chain with given ID, with pagination support

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) ProveEpochInfo

func (k Keeper) ProveEpochInfo(epoch *epochingtypes.Epoch) (*tmcrypto.ProofOps, error)

func (Keeper) ProveEpochSealed

func (k Keeper) ProveEpochSealed(ctx sdk.Context, epochNumber uint64) (*types.ProofEpochSealed, error)

ProveEpochSealed proves an epoch has been sealed, i.e., - the epoch's validator set has a valid multisig over the sealer header - the epoch's validator set is committed to the sealer header's last_commit_hash - the epoch's metadata is committed to the sealer header's last_commit_hash

func (Keeper) ProveEpochSubmitted

func (k Keeper) ProveEpochSubmitted(ctx sdk.Context, sk *btcctypes.SubmissionKey) ([]*btcctypes.TransactionInfo, error)

ProveEpochSubmitted generates proof that the epoch's checkpoint is submitted to BTC i.e., the two `TransactionInfo`s for the checkpoint

func (Keeper) ProveHeaderInEpoch

func (k Keeper) ProveHeaderInEpoch(ctx sdk.Context, header *tmproto.Header, epoch *epochingtypes.Epoch) (*tmcrypto.Proof, error)

func (Keeper) ProveTxInBlock

func (k Keeper) ProveTxInBlock(ctx sdk.Context, txHash []byte) (*tmproto.TxProof, error)

func (Keeper) ProveValSet

func (k Keeper) ProveValSet(epoch *epochingtypes.Epoch) (*tmcrypto.ProofOps, error)

func (Keeper) QueryStore

func (k Keeper) QueryStore(moduleStoreKey string, key []byte, queryHeight int64) ([]byte, []byte, *tmcrypto.ProofOps, error)

QueryStore queries a KV pair in the KVStore, where - moduleStoreKey is the store key of a module, e.g., zctypes.StoreKey - key is the key of the queried KV pair, including the prefix, e.g., zctypes.EpochChainInfoKey || chainID in the chain info store and returns - key of this KV pair - value of this KV pair - Merkle proof of this KV pair - error (adapted from https://github.com/cosmos/cosmos-sdk/blob/v0.46.6/baseapp/abci.go#L774-L795)

func (Keeper) SendIBCPacket

func (k Keeper) SendIBCPacket(ctx sdk.Context, channel channeltypes.IdentifiedChannel, packetData *types.ZoneconciergePacketData) error

SendIBCPacket sends an IBC packet to a channel (adapted from https://github.com/cosmos/ibc-go/blob/v5.0.0/modules/apps/transfer/keeper/relay.go)

func (*Keeper) SetBtcCheckpointKeeper

func (k *Keeper) SetBtcCheckpointKeeper(btccKeeper types.BtcCheckpointKeeper)

func (*Keeper) SetCheckpointingKeeper

func (k *Keeper) SetCheckpointingKeeper(checkpointingKeeper types.CheckpointingKeeper)

func (Keeper) SetPort

func (k Keeper) SetPort(ctx sdk.Context, portID string)

SetPort sets the portID for the transfer module. Used in InitGenesis

Jump to

Keyboard shortcuts

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