Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func VerifyEpochSealed(epoch *epochingtypes.Epoch, rawCkpt *checkpointingtypes.RawCheckpoint, ...) error
- func VerifyEpochSubmitted(rawCkpt *checkpointingtypes.RawCheckpoint, ...) error
- func VerifyHeaderInEpoch(header *tmproto.Header, epoch *epochingtypes.Epoch, proof *tmcrypto.Proof) error
- func VerifyStore(root []byte, moduleStoreKey string, key []byte, value []byte, ...) error
- func VerifyTxInBlock(txHash []byte, proof *tmproto.TxProof) error
- type Hooks
- func (h Hooks) AfterBlsKeyRegistered(ctx sdk.Context, valAddr sdk.ValAddress) error
- func (h Hooks) AfterEpochBegins(ctx sdk.Context, epoch uint64)
- func (h Hooks) AfterEpochEnds(ctx sdk.Context, epoch uint64)
- func (h Hooks) AfterHeaderWithValidCommit(ctx sdk.Context, txHash []byte, header *extendedkeeper.HeaderInfo, ...)
- func (h Hooks) AfterRawCheckpointBlsSigVerified(ctx sdk.Context, ckpt *checkpointingtypes.RawCheckpoint) error
- func (h Hooks) AfterRawCheckpointConfirmed(ctx sdk.Context, epoch uint64) error
- func (h Hooks) AfterRawCheckpointFinalized(ctx sdk.Context, epoch uint64) error
- func (h Hooks) AfterRawCheckpointForgotten(ctx sdk.Context, ckpt *checkpointingtypes.RawCheckpoint) error
- func (h Hooks) BeforeSlashThreshold(ctx sdk.Context, valSet epochingtypes.ValidatorSet)
- type Keeper
- func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
- func (k Keeper) BindPort(ctx sdk.Context, portID string) error
- func (k Keeper) BroadcastBTCTimestamps(ctx sdk.Context, epochNum uint64)
- func (k Keeper) ChainList(c context.Context, req *types.QueryChainListRequest) (*types.QueryChainListResponse, error)
- func (k Keeper) ChainsInfo(c context.Context, req *types.QueryChainsInfoRequest) (*types.QueryChainsInfoResponse, error)
- func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
- func (k Keeper) EpochChainInfoExists(ctx sdk.Context, chainID string, epochNumber uint64) bool
- func (k Keeper) EpochChainsInfo(c context.Context, req *types.QueryEpochChainsInfoRequest) (*types.QueryEpochChainsInfoResponse, error)
- func (k Keeper) FinalizedChainInfoUntilHeight(c context.Context, req *types.QueryFinalizedChainInfoUntilHeightRequest) (*types.QueryFinalizedChainInfoUntilHeightResponse, error)
- func (k Keeper) FinalizedChainsInfo(c context.Context, req *types.QueryFinalizedChainsInfoRequest) (*types.QueryFinalizedChainsInfoResponse, error)
- func (k Keeper) FindClosestHeader(ctx sdk.Context, chainID string, height uint64) (*types.IndexedHeader, error)
- func (k Keeper) GetAllChainIDs(ctx sdk.Context) []string
- func (k Keeper) GetAllChannels(ctx sdk.Context) []channeltypes.IdentifiedChannel
- func (k Keeper) GetAllOpenZCChannels(ctx sdk.Context) []channeltypes.IdentifiedChannel
- func (k Keeper) GetChainInfo(ctx sdk.Context, chainID string) (*types.ChainInfo, error)
- func (k Keeper) GetEpoch(ctx sdk.Context) *epochingtypes.Epoch
- func (k Keeper) GetEpochChainInfo(ctx sdk.Context, chainID string, epochNumber uint64) (*types.ChainInfo, error)
- func (k Keeper) GetEpochHeaders(ctx sdk.Context, chainID string, epochNumber uint64) ([]*types.IndexedHeader, error)
- func (k Keeper) GetFinalizedEpoch(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetFinalizingBTCTip(ctx sdk.Context) *btclctypes.BTCHeaderInfo
- func (k Keeper) GetForks(ctx sdk.Context, chainID string, height uint64) *types.Forks
- func (k Keeper) GetHeader(ctx sdk.Context, chainID string, height uint64) (*types.IndexedHeader, error)
- func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)
- func (k Keeper) GetPort(ctx sdk.Context) string
- func (k Keeper) HasChainInfo(ctx sdk.Context, chainID string) bool
- func (k Keeper) Header(c context.Context, req *types.QueryHeaderRequest) (*types.QueryHeaderResponse, error)
- func (k Keeper) Hooks() Hooks
- func (k Keeper) InitChainInfo(ctx sdk.Context, chainID string) (*types.ChainInfo, error)
- func (k Keeper) IsBound(ctx sdk.Context, portID string) bool
- func (k Keeper) ListEpochHeaders(c context.Context, req *types.QueryListEpochHeadersRequest) (*types.QueryListEpochHeadersResponse, error)
- func (k Keeper) ListHeaders(c context.Context, req *types.QueryListHeadersRequest) (*types.QueryListHeadersResponse, error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) ProveEpochInfo(epoch *epochingtypes.Epoch) (*tmcrypto.ProofOps, error)
- func (k Keeper) ProveEpochSealed(ctx sdk.Context, epochNumber uint64) (*types.ProofEpochSealed, error)
- func (k Keeper) ProveEpochSubmitted(ctx sdk.Context, sk *btcctypes.SubmissionKey) ([]*btcctypes.TransactionInfo, error)
- func (k Keeper) ProveHeaderInEpoch(ctx sdk.Context, header *tmproto.Header, epoch *epochingtypes.Epoch) (*tmcrypto.Proof, error)
- func (k Keeper) ProveTxInBlock(ctx sdk.Context, txHash []byte) (*tmproto.TxProof, error)
- func (k Keeper) ProveValSet(epoch *epochingtypes.Epoch) (*tmcrypto.ProofOps, error)
- func (k Keeper) QueryStore(moduleStoreKey string, key []byte, queryHeight int64) ([]byte, []byte, *tmcrypto.ProofOps, error)
- func (k Keeper) SendIBCPacket(ctx sdk.Context, channel channeltypes.IdentifiedChannel, ...) error
- func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error
- func (k Keeper) SetPort(ctx sdk.Context, portID string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
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 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)
Types ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
func (Hooks) AfterBlsKeyRegistered ¶
func (Hooks) AfterEpochEnds ¶
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 (Hooks) AfterRawCheckpointFinalized ¶
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, btclcKeeper types.BTCLightClientKeeper, checkpointingKeeper types.CheckpointingKeeper, btccKeeper types.BtcCheckpointKeeper, epochingKeeper types.EpochingKeeper, tmClient types.TMClient, storeQuerier sdk.Queryable, scopedKeeper types.ScopedKeeper, authority string, ) *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 ¶
BindPort defines a wrapper function for the ort Keeper's function in order to expose it to module's InitGenesis function
func (Keeper) BroadcastBTCTimestamps ¶ added in v0.7.0
BroadcastBTCTimestamps sends an IBC packet of BTC timestamp to all open IBC channels to ZoneConcierge
func (Keeper) ChainList ¶
func (k Keeper) ChainList(c context.Context, req *types.QueryChainListRequest) (*types.QueryChainListResponse, error)
func (Keeper) ChainsInfo ¶ added in v0.6.0
func (k Keeper) ChainsInfo(c context.Context, req *types.QueryChainsInfoRequest) (*types.QueryChainsInfoResponse, error)
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
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
func (k Keeper) EpochChainsInfo(c context.Context, req *types.QueryEpochChainsInfoRequest) (*types.QueryEpochChainsInfoResponse, error)
EpochChainsInfo returns the latest info for list of chains in a given epoch
func (Keeper) FinalizedChainInfoUntilHeight ¶
func (k Keeper) FinalizedChainInfoUntilHeight(c context.Context, req *types.QueryFinalizedChainInfoUntilHeightRequest) (*types.QueryFinalizedChainInfoUntilHeightResponse, error)
func (Keeper) FinalizedChainsInfo ¶ added in v0.6.0
func (k Keeper) FinalizedChainsInfo(c context.Context, req *types.QueryFinalizedChainsInfoRequest) (*types.QueryFinalizedChainsInfoResponse, error)
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 ¶
GetAllChainIDs gets all chain IDs that integrate Babylon
func (Keeper) GetAllChannels ¶
func (k Keeper) GetAllChannels(ctx sdk.Context) []channeltypes.IdentifiedChannel
func (Keeper) GetAllOpenZCChannels ¶ added in v0.7.0
func (k Keeper) GetAllOpenZCChannels(ctx sdk.Context) []channeltypes.IdentifiedChannel
GetAllOpenZCChannels returns all open channels that are connected to ZoneConcierge's port
func (Keeper) GetChainInfo ¶
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) 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 ¶
GetFinalizedEpoch gets the last finalised epoch used upon querying the last BTC-finalised chain info for CZs
func (Keeper) GetFinalizingBTCTip ¶ added in v0.7.0
func (k Keeper) GetFinalizingBTCTip(ctx sdk.Context) *btclctypes.BTCHeaderInfo
GetFinalizingBTCTip gets the BTC tip when the last epoch is finalised
func (Keeper) HasChainInfo ¶
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 ¶
func (k Keeper) Header(c context.Context, req *types.QueryHeaderRequest) (*types.QueryHeaderResponse, error)
Header returns the header and fork headers at a given height
func (Keeper) InitChainInfo ¶
func (Keeper) ListEpochHeaders ¶
func (k Keeper) ListEpochHeaders(c context.Context, req *types.QueryListEpochHeadersRequest) (*types.QueryListEpochHeadersResponse, error)
ListEpochHeaders returns all headers of a chain with given ID TODO: support pagination in this RPC
func (Keeper) ListHeaders ¶
func (k Keeper) ListHeaders(c context.Context, req *types.QueryListHeadersRequest) (*types.QueryListHeadersResponse, error)
ListHeaders returns all headers of a chain with given ID, with pagination support
func (Keeper) Params ¶
func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) ProveEpochInfo ¶
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 (Keeper) ProveTxInBlock ¶
func (Keeper) ProveValSet ¶
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)
Source Files ¶
- canonical_chain_indexer.go
- chain_info_indexer.go
- epoch_chain_info_indexer.go
- epochs.go
- fork_indexer.go
- grpc_query.go
- hooks.go
- ibc_channels.go
- ibc_packet.go
- ibc_packet_btc_timestamp.go
- keeper.go
- msg_server.go
- params.go
- proof_block_in_epoch.go
- proof_epoch_sealed.go
- proof_epoch_submitted.go
- proof_finalized_chain_info.go
- proof_tx_in_block.go
- query_kvstore.go