types

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeTimeout                     = "timeout"
	EventTypePacket                      = "ccv_packet"
	EventTypeChannelEstablished          = "channel_established"
	EventTypeFeeTransferChannelOpened    = "fee_transfer_channel_opened"
	EventTypeConsumerClientCreated       = "consumer_client_created"
	EventTypeAssignConsumerKey           = "assign_consumer_key"
	EventTypeRegisterConsumerRewardDenom = "register_consumer_reward_denom"

	EventTypeExecuteConsumerChainSlash = "execute_consumer_chain_slash"
	EventTypeFeeDistribution           = "fee_distribution"
	EventTypeConsumerSlashRequest      = "consumer_slash_request"
	EventTypeVSCMatured                = "vsc_matured"

	AttributeKeyAckSuccess = "success"
	AttributeKeyAck        = "acknowledgement"
	AttributeKeyAckError   = "error"

	AttributeChainID                  = "chain_id"
	AttributeValidatorAddress         = "validator_address"
	AttributeValidatorConsumerAddress = "validator_consumer_address"
	AttributeInfractionType           = "infraction_type"
	AttributeInfractionHeight         = "infraction_height"
	AttributeConsumerHeight           = "consumer_height"
	AttributeValSetUpdateID           = "valset_update_id"
	AttributeTimestamp                = "timestamp"
	AttributeInitialHeight            = "initial_height"
	AttributeInitializationTimeout    = "initialization_timeout"
	AttributeTrustingPeriod           = "trusting_period"
	AttributeUnbondingPeriod          = "unbonding_period"
	AttributeProviderValidatorAddress = "provider_validator_address"
	AttributeConsumerConsensusPubKey  = "consumer_consensus_pub_key"

	AttributeDistributionCurrentHeight = "current_distribution_height"
	AttributeDistributionNextHeight    = "next_distribution_height"
	AttributeDistributionFraction      = "distribution_fraction"
	AttributeDistributionTotal         = "total"
	AttributeDistributionToProvider    = "provider_amount"

	AttributeConsumerRewardDenom     = "consumer_reward_denom"
	AttributeConsumerRewardDepositor = "consumer_reward_depositor"
)

CCV events

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

	// Version defines the current version the IBC CCV provider and consumer
	// module supports
	Version = "1"

	// ProviderPortID is the default port id the provider CCV module binds to
	ProviderPortID = "provider"

	// ConsumerPortID is the default port id the consumer CCV module binds to
	ConsumerPortID = "consumer"

	RouterKey = ModuleName

	// StoreKey defines the primary module store key
	StoreKey = ModuleName

	// MemStoreKey defines the in-memory store key
	MemStoreKey = "mem_ccv"
)
View Source
const (
	// Default timeout period is 4 weeks to ensure channel doesn't close on timeout
	DefaultCCVTimeoutPeriod = 4 * 7 * 24 * time.Hour
)

Variables

View Source
var (
	ErrInvalidLengthCcv        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCcv          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCcv = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (

	// ModuleCdc references the global x/ibc-transfer module codec. Note, the codec
	// should ONLY be used in certain instances of tests and for JSON encoding.
	//
	// The actual codec used for serialization should be provided to x/ibc transfer and
	// defined at the application level.
	ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())

	// AminoCdc is a amino codec created to support amino json compatible msgs.
	AminoCdc = codec.NewAminoCodec(amino)
)
View Source
var (
	ErrInvalidPacketData        = errorsmod.Register(ModuleName, 2, "invalid CCV packet data")
	ErrInvalidPacketTimeout     = errorsmod.Register(ModuleName, 3, "invalid packet timeout")
	ErrInvalidVersion           = errorsmod.Register(ModuleName, 4, "invalid CCV version")
	ErrInvalidChannelFlow       = errorsmod.Register(ModuleName, 5, "invalid message sent to channel end")
	ErrInvalidConsumerChain     = errorsmod.Register(ModuleName, 6, "invalid consumer chain")
	ErrInvalidProviderChain     = errorsmod.Register(ModuleName, 7, "invalid provider chain")
	ErrInvalidStatus            = errorsmod.Register(ModuleName, 8, "invalid channel status")
	ErrInvalidGenesis           = errorsmod.Register(ModuleName, 9, "invalid genesis state")
	ErrDuplicateChannel         = errorsmod.Register(ModuleName, 10, "CCV channel already exists")
	ErrInvalidVSCMaturedId      = errorsmod.Register(ModuleName, 11, "invalid vscId for VSC packet")
	ErrInvalidVSCMaturedTime    = errorsmod.Register(ModuleName, 12, "invalid maturity time for VSC packet")
	ErrInvalidConsumerState     = errorsmod.Register(ModuleName, 13, "provider chain has invalid state for consumer chain")
	ErrInvalidConsumerClient    = errorsmod.Register(ModuleName, 14, "ccv channel is not built on correct client")
	ErrInvalidProposal          = errorsmod.Register(ModuleName, 15, "invalid proposal")
	ErrInvalidHandshakeMetadata = errorsmod.Register(ModuleName, 16, "invalid provider handshake metadata")
	ErrChannelNotFound          = errorsmod.Register(ModuleName, 17, "channel not found")
	ErrClientNotFound           = errorsmod.Register(ModuleName, 18, "client not found")
	ErrDuplicateConsumerChain   = errorsmod.Register(ModuleName, 19, "consumer chain already exists")
	ErrConsumerChainNotFound    = errorsmod.Register(ModuleName, 20, "consumer chain not found")
)

CCV sentinel errors

View Source
var ConsumerPacketDataType_name = map[int32]string{
	0: "CONSUMER_PACKET_TYPE_UNSPECIFIED",
	1: "CONSUMER_PACKET_TYPE_SLASH",
	2: "CONSUMER_PACKET_TYPE_VSCM",
}
View Source
var ConsumerPacketDataType_value = map[string]int32{
	"CONSUMER_PACKET_TYPE_UNSPECIFIED": 0,
	"CONSUMER_PACKET_TYPE_SLASH":       1,
	"CONSUMER_PACKET_TYPE_VSCM":        2,
}
View Source
var KeyCCVTimeoutPeriod = []byte("CcvTimeoutPeriod")

Functions

func AccumulateChanges

func AccumulateChanges(currentChanges, newChanges []abci.ValidatorUpdate) []abci.ValidatorUpdate

func AppendMany

func AppendMany(byteses ...[]byte) (out []byte)

AppendMany appends a variable number of byte slices together

func CalculateTrustPeriod

func CalculateTrustPeriod(unbondingPeriod time.Duration, defaultTrustPeriodFraction string) (time.Duration, error)

func PanicIfZeroOrNil

func PanicIfZeroOrNil(x interface{}, nameForPanicMsg string)

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces register the ibc transfer module interfaces to protobuf Any.

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the necessary x/ibc transfer interfaces and concrete types on the provided LegacyAmino codec. These types are used for Amino JSON serialization.

func SendIBCPacket

func SendIBCPacket(
	ctx sdk.Context,
	scopedKeeper ScopedKeeper,
	channelKeeper ChannelKeeper,
	channelID string,
	portID string,
	packetData []byte,
	timeoutPeriod time.Duration,
) error

SendIBCPacket sends an IBC packet with packetData over the source channelID and portID

func TMCryptoPublicKeyToConsAddr

func TMCryptoPublicKeyToConsAddr(k tmprotocrypto.PublicKey) (sdk.ConsAddress, error)

TMCryptoPublicKeyToConsAddr converts a TM public key to an SDK public key and returns the associated consensus address

func ValidateBech32

func ValidateBech32(i interface{}) error

func ValidateBool

func ValidateBool(i interface{}) error

func ValidateChannelIdentifier

func ValidateChannelIdentifier(i interface{}) error

func ValidateDistributionTransmissionChannel

func ValidateDistributionTransmissionChannel(i interface{}) error

func ValidateDuration

func ValidateDuration(i interface{}) error

func ValidateInt64

func ValidateInt64(i interface{}) error

func ValidatePositiveInt64

func ValidatePositiveInt64(i interface{}) error

func ValidateString

func ValidateString(i interface{}) error

func ValidateStringFraction

func ValidateStringFraction(i interface{}) error

Types

type AccountKeeper

type AccountKeeper interface {
	GetModuleAccount(ctx sdk.Context, name string) auth.ModuleAccountI
}

AccountKeeper defines the expected account keeper used for simulations

type BankKeeper

type BankKeeper interface {
	GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
	GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
}

BankKeeper defines the expected interface needed to retrieve account balances.

type ChannelKeeper

type ChannelKeeper interface {
	GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool)
	GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)
	SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error
	WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error
	ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error
}

ChannelKeeper defines the expected IBC channel keeper

type ClientKeeper

type ClientKeeper interface {
	CreateClient(ctx sdk.Context, clientState ibcexported.ClientState, consensusState ibcexported.ConsensusState) (string, error)
	GetClientState(ctx sdk.Context, clientID string) (ibcexported.ClientState, bool)
	GetLatestClientConsensusState(ctx sdk.Context, clientID string) (ibcexported.ConsensusState, bool)
	GetSelfConsensusState(ctx sdk.Context, height ibcexported.Height) (ibcexported.ConsensusState, error)
}

ClientKeeper defines the expected IBC client keeper

type ConnectionKeeper

type ConnectionKeeper interface {
	GetConnection(ctx sdk.Context, connectionID string) (conntypes.ConnectionEnd, bool)
}

ConnectionKeeper defines the expected IBC connection keeper

type ConsumerHooks

type ConsumerHooks interface {
	AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, _ sdk.ValAddress)
}

ConsumerHooks event hooks for newly bonded cross-chain validators

type ConsumerPacketData

type ConsumerPacketData struct {
	Type ConsumerPacketDataType `protobuf:"varint,1,opt,name=type,proto3,enum=interchain_security.ccv.v1.ConsumerPacketDataType" json:"type,omitempty"`
	// Types that are valid to be assigned to Data:
	//	*ConsumerPacketData_SlashPacketData
	//	*ConsumerPacketData_VscMaturedPacketData
	Data isConsumerPacketData_Data `protobuf_oneof:"data"`
}

ConsumerPacketData contains a consumer packet data and a type tag

func (*ConsumerPacketData) Descriptor

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

func (ConsumerPacketData) GetBytes

func (cp ConsumerPacketData) GetBytes() []byte

func (*ConsumerPacketData) GetData

func (m *ConsumerPacketData) GetData() isConsumerPacketData_Data

func (*ConsumerPacketData) GetSlashPacketData

func (m *ConsumerPacketData) GetSlashPacketData() *SlashPacketData

func (*ConsumerPacketData) GetType

func (*ConsumerPacketData) GetVscMaturedPacketData

func (m *ConsumerPacketData) GetVscMaturedPacketData() *VSCMaturedPacketData

func (*ConsumerPacketData) Marshal

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

func (*ConsumerPacketData) MarshalTo

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

func (*ConsumerPacketData) MarshalToSizedBuffer

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

func (*ConsumerPacketData) ProtoMessage

func (*ConsumerPacketData) ProtoMessage()

func (*ConsumerPacketData) Reset

func (m *ConsumerPacketData) Reset()

func (*ConsumerPacketData) Size

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

func (*ConsumerPacketData) String

func (m *ConsumerPacketData) String() string

func (*ConsumerPacketData) Unmarshal

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

func (ConsumerPacketData) ValidateBasic

func (cp ConsumerPacketData) ValidateBasic() (err error)

func (*ConsumerPacketData) XXX_DiscardUnknown

func (m *ConsumerPacketData) XXX_DiscardUnknown()

func (*ConsumerPacketData) XXX_Marshal

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

func (*ConsumerPacketData) XXX_Merge

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

func (*ConsumerPacketData) XXX_OneofWrappers

func (*ConsumerPacketData) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*ConsumerPacketData) XXX_Size

func (m *ConsumerPacketData) XXX_Size() int

func (*ConsumerPacketData) XXX_Unmarshal

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

type ConsumerPacketDataList

type ConsumerPacketDataList struct {
	List []ConsumerPacketData `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
}

ConsumerPacketDataList is a list of consumer packet data packets.

func (*ConsumerPacketDataList) Descriptor

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

func (*ConsumerPacketDataList) GetList

func (*ConsumerPacketDataList) Marshal

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

func (*ConsumerPacketDataList) MarshalTo

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

func (*ConsumerPacketDataList) MarshalToSizedBuffer

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

func (*ConsumerPacketDataList) ProtoMessage

func (*ConsumerPacketDataList) ProtoMessage()

func (*ConsumerPacketDataList) Reset

func (m *ConsumerPacketDataList) Reset()

func (*ConsumerPacketDataList) Size

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

func (*ConsumerPacketDataList) String

func (m *ConsumerPacketDataList) String() string

func (*ConsumerPacketDataList) Unmarshal

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

func (*ConsumerPacketDataList) XXX_DiscardUnknown

func (m *ConsumerPacketDataList) XXX_DiscardUnknown()

func (*ConsumerPacketDataList) XXX_Marshal

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

func (*ConsumerPacketDataList) XXX_Merge

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

func (*ConsumerPacketDataList) XXX_Size

func (m *ConsumerPacketDataList) XXX_Size() int

func (*ConsumerPacketDataList) XXX_Unmarshal

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

type ConsumerPacketDataType

type ConsumerPacketDataType int32

ConsumerPacketType indicates interchain security specific packet types.

const (
	// UNSPECIFIED packet type
	UnspecifiedPacket ConsumerPacketDataType = 0
	// Slash packet
	SlashPacket ConsumerPacketDataType = 1
	// VSCMatured packet
	VscMaturedPacket ConsumerPacketDataType = 2
)

func (ConsumerPacketDataType) EnumDescriptor

func (ConsumerPacketDataType) EnumDescriptor() ([]byte, []int)

func (ConsumerPacketDataType) String

func (x ConsumerPacketDataType) String() string

type ConsumerPacketData_SlashPacketData

type ConsumerPacketData_SlashPacketData struct {
	SlashPacketData *SlashPacketData `protobuf:"bytes,2,opt,name=slashPacketData,proto3,oneof" json:"slashPacketData,omitempty"`
}

func (*ConsumerPacketData_SlashPacketData) MarshalTo

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

func (*ConsumerPacketData_SlashPacketData) MarshalToSizedBuffer

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

func (*ConsumerPacketData_SlashPacketData) Size

type ConsumerPacketData_VscMaturedPacketData

type ConsumerPacketData_VscMaturedPacketData struct {
	VscMaturedPacketData *VSCMaturedPacketData `protobuf:"bytes,3,opt,name=vscMaturedPacketData,proto3,oneof" json:"vscMaturedPacketData,omitempty"`
}

func (*ConsumerPacketData_VscMaturedPacketData) MarshalTo

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

func (*ConsumerPacketData_VscMaturedPacketData) MarshalToSizedBuffer

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

func (*ConsumerPacketData_VscMaturedPacketData) Size

type DistributionKeeper

type DistributionKeeper interface {
	FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error
}

DistributionKeeper defines the expected interface of the distribution keeper

type EvidenceKeeper

type EvidenceKeeper interface {
	HandleEquivocationEvidence(ctx sdk.Context, evidence *evidencetypes.Equivocation)
}

type IBCCoreKeeper

type IBCCoreKeeper interface {
	ChannelOpenInit(
		goCtx context.Context,
		msg *channeltypes.MsgChannelOpenInit,
	) (*channeltypes.MsgChannelOpenInitResponse, error)
}

IBCKeeper defines the expected interface needed for openning a channel

type IBCTransferKeeper

type IBCTransferKeeper interface {
	SendTransfer(
		ctx sdk.Context,
		sourcePort,
		sourceChannel string,
		token sdk.Coin,
		sender sdk.AccAddress,
		receiver string,
		timeoutHeight clienttypes.Height,
		timeoutTimestamp uint64,
	) error
}

IBCTransferKeeper defines the expected interface needed for distribution transfer of tokens from the consumer to the provider chain

type MaturedUnbondingOps

type MaturedUnbondingOps struct {
	Ids []uint64 `protobuf:"varint,1,rep,packed,name=ids,proto3" json:"ids,omitempty"`
}

MaturedUnbondingOps defines a list of ids corresponding to ids of matured unbonding operations.

func (*MaturedUnbondingOps) Descriptor

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

func (*MaturedUnbondingOps) GetIds

func (m *MaturedUnbondingOps) GetIds() []uint64

func (*MaturedUnbondingOps) Marshal

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

func (*MaturedUnbondingOps) MarshalTo

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

func (*MaturedUnbondingOps) MarshalToSizedBuffer

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

func (*MaturedUnbondingOps) ProtoMessage

func (*MaturedUnbondingOps) ProtoMessage()

func (*MaturedUnbondingOps) Reset

func (m *MaturedUnbondingOps) Reset()

func (*MaturedUnbondingOps) Size

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

func (*MaturedUnbondingOps) String

func (m *MaturedUnbondingOps) String() string

func (*MaturedUnbondingOps) Unmarshal

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

func (*MaturedUnbondingOps) XXX_DiscardUnknown

func (m *MaturedUnbondingOps) XXX_DiscardUnknown()

func (*MaturedUnbondingOps) XXX_Marshal

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

func (*MaturedUnbondingOps) XXX_Merge

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

func (*MaturedUnbondingOps) XXX_Size

func (m *MaturedUnbondingOps) XXX_Size() int

func (*MaturedUnbondingOps) XXX_Unmarshal

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

type PortKeeper

type PortKeeper interface {
	BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability
}

PortKeeper defines the expected IBC port keeper

type ScopedKeeper

type ScopedKeeper interface {
	GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool)
	AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
	ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
}

type SlashPacketData

type SlashPacketData struct {
	Validator types.Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator" yaml:"validator"`
	// map to the infraction block height on the provider
	ValsetUpdateId uint64 `protobuf:"varint,2,opt,name=valset_update_id,json=valsetUpdateId,proto3" json:"valset_update_id,omitempty"`
	// tell if the slashing is for a downtime or a double-signing infraction
	Infraction types1.InfractionType `protobuf:"varint,3,opt,name=infraction,proto3,enum=cosmos.staking.v1beta1.InfractionType" json:"infraction,omitempty"`
}

This packet is sent from the consumer chain to the provider chain to request the slashing of a validator as a result of an infraction committed on the consumer chain.

func NewSlashPacketData

func NewSlashPacketData(validator abci.Validator, valUpdateId uint64, infractionType stakingtypes.InfractionType) *SlashPacketData

func (*SlashPacketData) Descriptor

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

func (SlashPacketData) GetBytes

func (vdt SlashPacketData) GetBytes() []byte

func (*SlashPacketData) GetInfraction

func (m *SlashPacketData) GetInfraction() types1.InfractionType

func (*SlashPacketData) GetValidator

func (m *SlashPacketData) GetValidator() types.Validator

func (*SlashPacketData) GetValsetUpdateId

func (m *SlashPacketData) GetValsetUpdateId() uint64

func (*SlashPacketData) Marshal

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

func (*SlashPacketData) MarshalTo

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

func (*SlashPacketData) MarshalToSizedBuffer

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

func (*SlashPacketData) ProtoMessage

func (*SlashPacketData) ProtoMessage()

func (*SlashPacketData) Reset

func (m *SlashPacketData) Reset()

func (*SlashPacketData) Size

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

func (*SlashPacketData) String

func (m *SlashPacketData) String() string

func (*SlashPacketData) Unmarshal

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

func (SlashPacketData) ValidateBasic

func (vdt SlashPacketData) ValidateBasic() error

func (*SlashPacketData) XXX_DiscardUnknown

func (m *SlashPacketData) XXX_DiscardUnknown()

func (*SlashPacketData) XXX_Marshal

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

func (*SlashPacketData) XXX_Merge

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

func (*SlashPacketData) XXX_Size

func (m *SlashPacketData) XXX_Size() int

func (*SlashPacketData) XXX_Unmarshal

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

type SlashingKeeper

type SlashingKeeper interface {
	JailUntil(sdk.Context, sdk.ConsAddress, time.Time) // called from provider keeper only
	GetValidatorSigningInfo(ctx sdk.Context, address sdk.ConsAddress) (info slashingtypes.ValidatorSigningInfo, found bool)
	DowntimeJailDuration(sdk.Context) time.Duration
	SlashFractionDowntime(sdk.Context) sdk.Dec
	SlashFractionDoubleSign(ctx sdk.Context) (res sdk.Dec)
	Tombstone(sdk.Context, sdk.ConsAddress)
	IsTombstoned(sdk.Context, sdk.ConsAddress) bool
}

SlashingKeeper defines the contract expected to perform ccv slashing

type StakingKeeper

type StakingKeeper interface {
	GetValidatorUpdates(ctx sdk.Context) []abci.ValidatorUpdate
	UnbondingCanComplete(ctx sdk.Context, id uint64) error
	UnbondingTime(ctx sdk.Context) time.Duration
	GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (validator stakingtypes.Validator, found bool)
	GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) (power int64)
	// slash the validator and delegators of the validator, specifying offence height, offence power, and slash fraction
	Jail(sdk.Context, sdk.ConsAddress) // jail a validator
	Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec, stakingtypes.InfractionType)
	Unjail(ctx sdk.Context, addr sdk.ConsAddress)
	GetValidator(ctx sdk.Context, addr sdk.ValAddress) (validator stakingtypes.Validator, found bool)
	IterateLastValidatorPowers(ctx sdk.Context, cb func(addr sdk.ValAddress, power int64) (stop bool))
	PowerReduction(ctx sdk.Context) sdk.Int
	PutUnbondingOnHold(ctx sdk.Context, id uint64) error
	IterateValidators(ctx sdk.Context, f func(index int64, validator stakingtypes.ValidatorI) (stop bool))
	Validator(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI
	IsValidatorJailed(ctx sdk.Context, addr sdk.ConsAddress) bool
	ValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) stakingtypes.ValidatorI
	Delegation(ctx sdk.Context, addr sdk.AccAddress, valAddr sdk.ValAddress) stakingtypes.DelegationI
	MaxValidators(ctx sdk.Context) uint32
	GetLastTotalPower(ctx sdk.Context) sdk.Int
	GetLastValidators(ctx sdk.Context) (validators []stakingtypes.Validator)
	BondDenom(ctx sdk.Context) (res string)
}

StakingKeeper defines the contract expected by provider-chain ccv module from a Staking Module that will keep track of the provider validator set. This version of the interchain-security protocol will mirror the provider chain's changes so we do not need a registry module between the staking module and CCV.

type VSCMaturedPacketData

type VSCMaturedPacketData struct {
	// the id of the VSC packet that reached maturity
	ValsetUpdateId uint64 `protobuf:"varint,1,opt,name=valset_update_id,json=valsetUpdateId,proto3" json:"valset_update_id,omitempty"`
}

This packet is sent from the consumer chain to the provider chain to notify that a VSC packet reached maturity on the consumer chain.

func NewVSCMaturedPacketData

func NewVSCMaturedPacketData(valUpdateID uint64) *VSCMaturedPacketData

func (*VSCMaturedPacketData) Descriptor

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

func (VSCMaturedPacketData) GetBytes

func (mat VSCMaturedPacketData) GetBytes() []byte

func (*VSCMaturedPacketData) GetValsetUpdateId

func (m *VSCMaturedPacketData) GetValsetUpdateId() uint64

func (*VSCMaturedPacketData) Marshal

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

func (*VSCMaturedPacketData) MarshalTo

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

func (*VSCMaturedPacketData) MarshalToSizedBuffer

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

func (*VSCMaturedPacketData) ProtoMessage

func (*VSCMaturedPacketData) ProtoMessage()

func (*VSCMaturedPacketData) Reset

func (m *VSCMaturedPacketData) Reset()

func (*VSCMaturedPacketData) Size

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

func (*VSCMaturedPacketData) String

func (m *VSCMaturedPacketData) String() string

func (*VSCMaturedPacketData) Unmarshal

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

func (VSCMaturedPacketData) ValidateBasic

func (mat VSCMaturedPacketData) ValidateBasic() error

ValidateBasic is used for validating the VSCMatured packet data.

func (*VSCMaturedPacketData) XXX_DiscardUnknown

func (m *VSCMaturedPacketData) XXX_DiscardUnknown()

func (*VSCMaturedPacketData) XXX_Marshal

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

func (*VSCMaturedPacketData) XXX_Merge

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

func (*VSCMaturedPacketData) XXX_Size

func (m *VSCMaturedPacketData) XXX_Size() int

func (*VSCMaturedPacketData) XXX_Unmarshal

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

type ValidatorSetChangePacketData

type ValidatorSetChangePacketData struct {
	ValidatorUpdates []types.ValidatorUpdate `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates,proto3" json:"validator_updates" yaml:"validator_updates"`
	ValsetUpdateId   uint64                  `protobuf:"varint,2,opt,name=valset_update_id,json=valsetUpdateId,proto3" json:"valset_update_id,omitempty"`
	// consensus address of consumer chain validators
	// successfully slashed on the provider chain
	SlashAcks []string `protobuf:"bytes,3,rep,name=slash_acks,json=slashAcks,proto3" json:"slash_acks,omitempty"`
}

This packet is sent from provider chain to consumer chain if the validator set for consumer chain changes (due to new bonding/unbonding messages or slashing events) A VSCMatured packet from consumer chain will be sent asynchronously once unbonding period is over, and this will function as `UnbondingOver` message for this packet.

func NewValidatorSetChangePacketData

func NewValidatorSetChangePacketData(valUpdates []abci.ValidatorUpdate, valUpdateID uint64, slashAcks []string) ValidatorSetChangePacketData

func (*ValidatorSetChangePacketData) Descriptor

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

func (ValidatorSetChangePacketData) GetBytes

func (vsc ValidatorSetChangePacketData) GetBytes() []byte

func (*ValidatorSetChangePacketData) GetSlashAcks

func (m *ValidatorSetChangePacketData) GetSlashAcks() []string

func (*ValidatorSetChangePacketData) GetValidatorUpdates

func (m *ValidatorSetChangePacketData) GetValidatorUpdates() []types.ValidatorUpdate

func (*ValidatorSetChangePacketData) GetValsetUpdateId

func (m *ValidatorSetChangePacketData) GetValsetUpdateId() uint64

func (*ValidatorSetChangePacketData) Marshal

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

func (*ValidatorSetChangePacketData) MarshalTo

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

func (*ValidatorSetChangePacketData) MarshalToSizedBuffer

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

func (*ValidatorSetChangePacketData) ProtoMessage

func (*ValidatorSetChangePacketData) ProtoMessage()

func (*ValidatorSetChangePacketData) Reset

func (m *ValidatorSetChangePacketData) Reset()

func (*ValidatorSetChangePacketData) Size

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

func (*ValidatorSetChangePacketData) String

func (*ValidatorSetChangePacketData) Unmarshal

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

func (ValidatorSetChangePacketData) ValidateBasic

func (vsc ValidatorSetChangePacketData) ValidateBasic() error

ValidateBasic is used for validating the CCV packet data.

func (*ValidatorSetChangePacketData) XXX_DiscardUnknown

func (m *ValidatorSetChangePacketData) XXX_DiscardUnknown()

func (*ValidatorSetChangePacketData) XXX_Marshal

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

func (*ValidatorSetChangePacketData) XXX_Merge

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

func (*ValidatorSetChangePacketData) XXX_Size

func (m *ValidatorSetChangePacketData) XXX_Size() int

func (*ValidatorSetChangePacketData) XXX_Unmarshal

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

type ValidatorSetChangePackets

type ValidatorSetChangePackets struct {
	List []ValidatorSetChangePacketData `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
}

List of ccv.ValidatorSetChangePacketData.

func (*ValidatorSetChangePackets) Descriptor

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

func (*ValidatorSetChangePackets) GetList

func (*ValidatorSetChangePackets) Marshal

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

func (*ValidatorSetChangePackets) MarshalTo

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

func (*ValidatorSetChangePackets) MarshalToSizedBuffer

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

func (*ValidatorSetChangePackets) ProtoMessage

func (*ValidatorSetChangePackets) ProtoMessage()

func (*ValidatorSetChangePackets) Reset

func (m *ValidatorSetChangePackets) Reset()

func (*ValidatorSetChangePackets) Size

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

func (*ValidatorSetChangePackets) String

func (m *ValidatorSetChangePackets) String() string

func (*ValidatorSetChangePackets) Unmarshal

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

func (*ValidatorSetChangePackets) XXX_DiscardUnknown

func (m *ValidatorSetChangePackets) XXX_DiscardUnknown()

func (*ValidatorSetChangePackets) XXX_Marshal

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

func (*ValidatorSetChangePackets) XXX_Merge

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

func (*ValidatorSetChangePackets) XXX_Size

func (m *ValidatorSetChangePackets) XXX_Size() int

func (*ValidatorSetChangePackets) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

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