types

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: Apache-2.0 Imports: 22 Imported by: 69

Documentation

Index

Constants

View Source
const (
	// ModuleName defines the CCV consumer module name
	ModuleName = "ccvconsumer"

	// PortID is the default port id that consumer module binds to
	PortID = "consumer"

	// StoreKey is the store key string for IBC consumer
	StoreKey = ModuleName

	// RouterKey is the message route for IBC consumer
	RouterKey = ModuleName

	// QuerierRoute is the querier route for IBC consumer
	QuerierRoute = ModuleName

	// HistoricalEntries is set to 10000 like the staking module parameter DefaultHistoricalEntries
	HistoricalEntries uint32 = 10000

	// ConsumerRedistributeName the root string for the consumer-redistribution account address
	ConsumerRedistributeName = "cons_redistribute"

	// ConsumerToSendToProviderName is a "buffer" address for outgoing fees to be transferred to the provider chain
	ConsumerToSendToProviderName = "cons_to_send_to_provider"

	// UnbondingPeriod is the time duration to mature the VSC packets
	UnbondingPeriod time.Duration = 96 * time.Hour
)
View Source
const (
	// PortByteKey defines the byte key to store the port ID in store
	PortByteKey byte = iota

	// LastDistributionTransmissionByteKey defines the byte key to store the last distribution transmission
	LastDistributionTransmissionByteKey

	// UnbondingTimeKeyString is the byte key for storing the unbonding period
	UnbondingTimeByteKey

	// ProviderClientKeyString is the byte key for storing the clientID of the provider client
	ProviderClientByteKey

	// ProviderChannelKeyString is the byte key for storing the channelID of the CCV channel
	ProviderChannelByteKey

	// PendingChangesKeyString is the byte key that will store any pending validator set changes
	// received over CCV channel but not yet flushed over ABCI
	PendingChangesByteKey

	// HistoricalInfoKey is the byte prefix that will store the historical info for a given height
	HistoricalInfoBytePrefix

	// PacketMaturityTimePrefix is the byte prefix that will store maturity time for each received VSC packet
	PacketMaturityTimeBytePrefix

	// HeightValsetUpdateIDPrefix is the byte prefix that will store the mapping from block height to valset update ID
	HeightValsetUpdateIDBytePrefix

	// OutstandingDowntimePrefix is the byte prefix that will store the validators outstanding downtime by consensus address
	OutstandingDowntimeBytePrefix

	// PendingSlashRequestsPrefix is the byte prefix that will store a list of slash request that must be sent
	// to the provider chain once the CCV channel is established
	PendingSlashRequestsBytePrefix

	// CrossChainValidatorPrefix is the byte prefix that will store cross-chain validators by consensus address
	CrossChainValidatorBytePrefix
)

Iota generated keys/key prefixes (as a byte), supports 256 possible values

Variables

View Source
var (
	ErrInvalidLengthConsumer        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConsumer          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupConsumer = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	KeyEnabled                           = []byte("Enabled")
	KeyBlocksPerDistributionTransmission = []byte("BlocksPerDistributionTransmission")
	KeyDistributionTransmissionChannel   = []byte("DistributionTransmissionChannel")
	KeyProviderFeePoolAddrStr            = []byte("ProviderFeePoolAddrStr")
)
View Source
var (
	ErrNoProposerChannelId = sdkerrors.Register(ModuleName, 1, "no established CCV channel")
)

Consumer sentinel errors

Functions

func CrossChainValidatorKey

func CrossChainValidatorKey(addr []byte) []byte

CrossChainValidatorKey returns the key to a cross chain validator by consensus address

func HeightValsetUpdateIDKey

func HeightValsetUpdateIDKey(height uint64) []byte

HeightValsetUpdateIDKey returns the key to a valset update ID for a given block height

func HistoricalInfoKey

func HistoricalInfoKey(height int64) []byte

HistoricalInfoKey returns the key to historical info to a given block height

func IdFromPacketMaturityTimeKey

func IdFromPacketMaturityTimeKey(key []byte) uint64

IdFromPacketMaturityTimeKey returns the packet id corresponding to a maturity time full key (including prefix)

func LastDistributionTransmissionKey

func LastDistributionTransmissionKey() []byte

LastDistributionTransmissionKey returns the key to the last distribution transmission in the store

func OutstandingDowntimeKey

func OutstandingDowntimeKey(v sdk.ConsAddress) []byte

OutstandingDowntimeKey returns the key to a validators' outstanding downtime by consensus address

func PacketMaturityTimeKey

func PacketMaturityTimeKey(id uint64) []byte

PacketMaturityTimeKey returns the key for storing maturity time for a given received VSC packet id

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable type declaration for parameters

func PendingChangesKey

func PendingChangesKey() []byte

PendingChangesKey returns the key for storing pending validator set changes

func PortKey

func PortKey() []byte

PortKey returns the key to the port ID in the store

func ProviderChannelKey

func ProviderChannelKey() []byte

ProviderChannelKey returns the key for storing channelID of the provider chain

func ProviderClientKey

func ProviderClientKey() []byte

ProviderClientKey returns the key for storing clientID of the provider

func UnbondingTimeKey

func UnbondingTimeKey() []byte

UnbondingTimeKey returns the key for storing the unbonding period

Types

type CrossChainValidator

type CrossChainValidator struct {
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Power   int64  `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"`
	// pubkey is the consensus public key of the validator, as a Protobuf Any.
	Pubkey *types.Any `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty" yaml:"consensus_pubkey"`
}

CrossChainValidator defines the validators for CCV consumer module

func NewCCValidator

func NewCCValidator(address []byte, power int64, pubKey cryptotypes.PubKey) (CrossChainValidator, error)

func (CrossChainValidator) ConsPubKey

func (ccv CrossChainValidator) ConsPubKey() (cryptotypes.PubKey, error)

ConsPubKey returns the validator PubKey as a cryptotypes.PubKey.

func (*CrossChainValidator) Descriptor

func (*CrossChainValidator) Descriptor() ([]byte, []int)

func (*CrossChainValidator) GetAddress

func (m *CrossChainValidator) GetAddress() []byte

func (*CrossChainValidator) GetPower

func (m *CrossChainValidator) GetPower() int64

func (*CrossChainValidator) GetPubkey

func (m *CrossChainValidator) GetPubkey() *types.Any

func (*CrossChainValidator) Marshal

func (m *CrossChainValidator) Marshal() (dAtA []byte, err error)

func (*CrossChainValidator) MarshalTo

func (m *CrossChainValidator) MarshalTo(dAtA []byte) (int, error)

func (*CrossChainValidator) MarshalToSizedBuffer

func (m *CrossChainValidator) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CrossChainValidator) ProtoMessage

func (*CrossChainValidator) ProtoMessage()

func (*CrossChainValidator) Reset

func (m *CrossChainValidator) Reset()

func (*CrossChainValidator) Size

func (m *CrossChainValidator) Size() (n int)

func (*CrossChainValidator) String

func (m *CrossChainValidator) String() string

func (*CrossChainValidator) Unmarshal

func (m *CrossChainValidator) Unmarshal(dAtA []byte) error

func (CrossChainValidator) UnpackInterfaces

func (ccv CrossChainValidator) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error

UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces

func (*CrossChainValidator) XXX_DiscardUnknown

func (m *CrossChainValidator) XXX_DiscardUnknown()

func (*CrossChainValidator) XXX_Marshal

func (m *CrossChainValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CrossChainValidator) XXX_Merge

func (m *CrossChainValidator) XXX_Merge(src proto.Message)

func (*CrossChainValidator) XXX_Size

func (m *CrossChainValidator) XXX_Size() int

func (*CrossChainValidator) XXX_Unmarshal

func (m *CrossChainValidator) XXX_Unmarshal(b []byte) error

type GenesisState

type GenesisState struct {
	Params            Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	ProviderClientId  string `protobuf:"bytes,2,opt,name=provider_client_id,json=providerClientId,proto3" json:"provider_client_id,omitempty"`
	ProviderChannelId string `protobuf:"bytes,3,opt,name=provider_channel_id,json=providerChannelId,proto3" json:"provider_channel_id,omitempty"`
	NewChain          bool   `protobuf:"varint,4,opt,name=new_chain,json=newChain,proto3" json:"new_chain,omitempty"`
	// ProviderClientState filled in on new chain, nil on restart.
	ProviderClientState *types.ClientState `protobuf:"bytes,5,opt,name=provider_client_state,json=providerClientState,proto3" json:"provider_client_state,omitempty"`
	// ProviderConsensusState filled in on new chain, nil on restart.
	ProviderConsensusState *types.ConsensusState    `` /* 129-byte string literal not displayed */
	MaturingPackets        []MaturingVSCPacket      `protobuf:"bytes,7,rep,name=maturing_packets,json=maturingPackets,proto3" json:"maturing_packets"`
	InitialValSet          []types1.ValidatorUpdate `protobuf:"bytes,8,rep,name=initial_val_set,json=initialValSet,proto3" json:"initial_val_set"`
}

GenesisState defines the CCV consumer chain genesis state

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState returns a default disabled consumer chain genesis state. This allows the module to be hooked up to app without getting use unless explicitly specified in genesis.

func NewInitialGenesisState

func NewInitialGenesisState(cs *ibctmtypes.ClientState, consState *ibctmtypes.ConsensusState,
	initValSet []abci.ValidatorUpdate, params Params) *GenesisState

NewInitialGenesisState returns a consumer GenesisState for a completely new consumer chain. TODO: Include chain status

func NewRestartGenesisState

func NewRestartGenesisState(clientID, channelID string,
	maturingPackets []MaturingVSCPacket,
	initValSet []abci.ValidatorUpdate, params Params) *GenesisState

NewRestartGenesisState returns a consumer GenesisState that has already been established.

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetInitialValSet

func (m *GenesisState) GetInitialValSet() []types1.ValidatorUpdate

func (*GenesisState) GetMaturingPackets

func (m *GenesisState) GetMaturingPackets() []MaturingVSCPacket

func (*GenesisState) GetNewChain

func (m *GenesisState) GetNewChain() bool

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) GetProviderChannelId

func (m *GenesisState) GetProviderChannelId() string

func (*GenesisState) GetProviderClientId

func (m *GenesisState) GetProviderClientId() string

func (*GenesisState) GetProviderClientState

func (m *GenesisState) GetProviderClientState() *types.ClientState

func (*GenesisState) GetProviderConsensusState

func (m *GenesisState) GetProviderConsensusState() *types.ConsensusState

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type LastTransmissionBlockHeight

type LastTransmissionBlockHeight struct {
	Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
}

LastTransmissionBlockHeight is the last time validator holding pools were transmitted to the provider chain

func (*LastTransmissionBlockHeight) Descriptor

func (*LastTransmissionBlockHeight) Descriptor() ([]byte, []int)

func (*LastTransmissionBlockHeight) GetHeight

func (m *LastTransmissionBlockHeight) GetHeight() int64

func (*LastTransmissionBlockHeight) Marshal

func (m *LastTransmissionBlockHeight) Marshal() (dAtA []byte, err error)

func (*LastTransmissionBlockHeight) MarshalTo

func (m *LastTransmissionBlockHeight) MarshalTo(dAtA []byte) (int, error)

func (*LastTransmissionBlockHeight) MarshalToSizedBuffer

func (m *LastTransmissionBlockHeight) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*LastTransmissionBlockHeight) ProtoMessage

func (*LastTransmissionBlockHeight) ProtoMessage()

func (*LastTransmissionBlockHeight) Reset

func (m *LastTransmissionBlockHeight) Reset()

func (*LastTransmissionBlockHeight) Size

func (m *LastTransmissionBlockHeight) Size() (n int)

func (*LastTransmissionBlockHeight) String

func (m *LastTransmissionBlockHeight) String() string

func (*LastTransmissionBlockHeight) Unmarshal

func (m *LastTransmissionBlockHeight) Unmarshal(dAtA []byte) error

func (*LastTransmissionBlockHeight) XXX_DiscardUnknown

func (m *LastTransmissionBlockHeight) XXX_DiscardUnknown()

func (*LastTransmissionBlockHeight) XXX_Marshal

func (m *LastTransmissionBlockHeight) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LastTransmissionBlockHeight) XXX_Merge

func (m *LastTransmissionBlockHeight) XXX_Merge(src proto.Message)

func (*LastTransmissionBlockHeight) XXX_Size

func (m *LastTransmissionBlockHeight) XXX_Size() int

func (*LastTransmissionBlockHeight) XXX_Unmarshal

func (m *LastTransmissionBlockHeight) XXX_Unmarshal(b []byte) error

type MaturingVSCPacket

type MaturingVSCPacket struct {
	VscId        uint64 `protobuf:"varint,1,opt,name=vscId,proto3" json:"vscId,omitempty"`
	MaturityTime uint64 `protobuf:"varint,2,opt,name=maturity_time,json=maturityTime,proto3" json:"maturity_time,omitempty"`
}

UnbondingSequence defines the genesis information for each unbonding packet sequence.

func (*MaturingVSCPacket) Descriptor

func (*MaturingVSCPacket) Descriptor() ([]byte, []int)

func (*MaturingVSCPacket) GetMaturityTime

func (m *MaturingVSCPacket) GetMaturityTime() uint64

func (*MaturingVSCPacket) GetVscId

func (m *MaturingVSCPacket) GetVscId() uint64

func (*MaturingVSCPacket) Marshal

func (m *MaturingVSCPacket) Marshal() (dAtA []byte, err error)

func (*MaturingVSCPacket) MarshalTo

func (m *MaturingVSCPacket) MarshalTo(dAtA []byte) (int, error)

func (*MaturingVSCPacket) MarshalToSizedBuffer

func (m *MaturingVSCPacket) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MaturingVSCPacket) ProtoMessage

func (*MaturingVSCPacket) ProtoMessage()

func (*MaturingVSCPacket) Reset

func (m *MaturingVSCPacket) Reset()

func (*MaturingVSCPacket) Size

func (m *MaturingVSCPacket) Size() (n int)

func (*MaturingVSCPacket) String

func (m *MaturingVSCPacket) String() string

func (*MaturingVSCPacket) Unmarshal

func (m *MaturingVSCPacket) Unmarshal(dAtA []byte) error

func (MaturingVSCPacket) Validate

func (mat MaturingVSCPacket) Validate() error

func (*MaturingVSCPacket) XXX_DiscardUnknown

func (m *MaturingVSCPacket) XXX_DiscardUnknown()

func (*MaturingVSCPacket) XXX_Marshal

func (m *MaturingVSCPacket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MaturingVSCPacket) XXX_Merge

func (m *MaturingVSCPacket) XXX_Merge(src proto.Message)

func (*MaturingVSCPacket) XXX_Size

func (m *MaturingVSCPacket) XXX_Size() int

func (*MaturingVSCPacket) XXX_Unmarshal

func (m *MaturingVSCPacket) XXX_Unmarshal(b []byte) error

type Params

type Params struct {
	Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
	///////////////////////
	// Distribution Params
	// Number of blocks between ibc-token-transfers from the consumer chain to
	// the provider chain. Note that at this transmission event a fraction of
	// the accumulated tokens are divided and sent consumer redistribution
	// address.
	BlocksPerDistributionTransmission int64 `` /* 165-byte string literal not displayed */
	// Channel, and provider-chain receiving address to send distribution token
	// transfers over. These parameters is auto-set during the consumer <->
	// provider handshake procedure.
	DistributionTransmissionChannel string `` /* 156-byte string literal not displayed */
	ProviderFeePoolAddrStr          string `` /* 133-byte string literal not displayed */
}

Params defines the parameters for CCV consumer module

func DefaultParams

func DefaultParams() Params

DefaultParams is the default params for the consumer module

func NewParams

func NewParams(enabled bool, blocksPerDistributionTransmission int64,
	distributionTransmissionChannel, providerFeePoolAddrStr string) Params

NewParams creates new consumer parameters with provided arguments

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) GetBlocksPerDistributionTransmission

func (m *Params) GetBlocksPerDistributionTransmission() int64

func (*Params) GetDistributionTransmissionChannel

func (m *Params) GetDistributionTransmissionChannel() string

func (*Params) GetEnabled

func (m *Params) GetEnabled() bool

func (*Params) GetProviderFeePoolAddrStr

func (m *Params) GetProviderFeePoolAddrStr() string

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs

ParamSetPairs implements params.ParamSet

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

Validate all ccv-consumer module parameters

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type SlashRequest

type SlashRequest struct {
	Packet     *types1.SlashPacketData `protobuf:"bytes,1,opt,name=packet,proto3" json:"packet,omitempty"`
	Infraction types2.InfractionType   `protobuf:"varint,2,opt,name=infraction,proto3,enum=cosmos.staking.v1beta1.InfractionType" json:"infraction,omitempty"`
}

SlashRequest defines a slashing request for CCV consumer module

func (*SlashRequest) Descriptor

func (*SlashRequest) Descriptor() ([]byte, []int)

func (*SlashRequest) GetInfraction

func (m *SlashRequest) GetInfraction() types2.InfractionType

func (*SlashRequest) GetPacket

func (m *SlashRequest) GetPacket() *types1.SlashPacketData

func (*SlashRequest) Marshal

func (m *SlashRequest) Marshal() (dAtA []byte, err error)

func (*SlashRequest) MarshalTo

func (m *SlashRequest) MarshalTo(dAtA []byte) (int, error)

func (*SlashRequest) MarshalToSizedBuffer

func (m *SlashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SlashRequest) ProtoMessage

func (*SlashRequest) ProtoMessage()

func (*SlashRequest) Reset

func (m *SlashRequest) Reset()

func (*SlashRequest) Size

func (m *SlashRequest) Size() (n int)

func (*SlashRequest) String

func (m *SlashRequest) String() string

func (*SlashRequest) Unmarshal

func (m *SlashRequest) Unmarshal(dAtA []byte) error

func (*SlashRequest) XXX_DiscardUnknown

func (m *SlashRequest) XXX_DiscardUnknown()

func (*SlashRequest) XXX_Marshal

func (m *SlashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SlashRequest) XXX_Merge

func (m *SlashRequest) XXX_Merge(src proto.Message)

func (*SlashRequest) XXX_Size

func (m *SlashRequest) XXX_Size() int

func (*SlashRequest) XXX_Unmarshal

func (m *SlashRequest) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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