Documentation
¶
Index ¶
- func ExecuteCommand(cmd *exec.Cmd, cmdName string, verbose bool)
- func GenerateGovProposalContent(title, summary, metadata, deposit, description string, expedited bool, ...) string
- type AssignConsumerPubKeyAction
- type ChainCommands
- type ChainConfig
- type ChainID
- type ChainState
- type ChainStateCopy
- type ChainStateWithProposalTypes
- type ConsumerAdditionProposal
- type ConsumerID
- type ConsumerModificationProposal
- type ConsumerRemovalProposal
- type ContainerConfig
- type GovernanceProposal
- type IBCTransferParams
- type IBCTransferParamsProposal
- type Param
- type ParamsProposal
- type PlatformDriver
- type Proposal
- type ProposalAndType
- type Rewards
- type TargetDriver
- type TextProposal
- type UpgradeProposal
- type ValidatorConfig
- type ValidatorID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChainCommands ¶
type ChainCommands interface {
GetBlockHeight(chain ChainID) uint
GetBalance(chain ChainID, validator ValidatorID) uint
GetConsumerChains(chain ChainID) map[ChainID]bool
GetConsumerAddress(consumerChain ChainID, validator ValidatorID) string
GetClientFrozenHeight(chain ChainID, clientID string) (RevisionNumber, RevisionHeight uint64)
GetHasToValidate(validator ValidatorID) []ChainID
GetIBCTransferParams(chain ChainID) IBCTransferParams
GetProposal(chain ChainID, proposal uint) Proposal
GetParam(chain ChainID, param Param) string
GetProviderAddressFromConsumer(consumerChain ChainID, validator ValidatorID) string
GetReward(chain ChainID, validator ValidatorID, blockHeight uint, denom string) float64
GetRegisteredConsumerRewardDenoms(chain ChainID) []string
GetSlashMeter() int64
GetPendingPacketQueueSize(chain ChainID) uint
GetProposedConsumerChains(chain ChainID) []string
GetQueryNode(chain ChainID) string
GetQueryNodeRPCAddress(chain ChainID) string
GetTrustedHeight(chain ChainID, clientID string, index int) (uint64, uint64)
GetValPower(chain ChainID, validator ValidatorID) uint
GetValStakedTokens(chain ChainID, validatorAddress string) uint
GetQueryNodeIP(chain ChainID) string
GetInflationRate(chain ChainID) float64
GetConsumerCommissionRate(chain ChainID, validator ValidatorID) float64
// Action commands
AssignConsumerPubKey(action AssignConsumerPubKeyAction, gas, home, node string, verbose bool) ([]byte, error)
}
type ChainConfig ¶
type ChainConfig struct {
ChainId ChainID
ConsumerId ConsumerID
// The account prefix configured on the chain. For example, on the Hub, this is "cosmos"
AccountPrefix string
// Must be unique per chain
IpPrefix string
VotingWaitTime uint
// Any transformations to apply to the genesis file of all chains instantiated with this chain config, as a jq string.
// Example: ".app_state.gov.params.voting_period = \"5s\" | .app_state.slashing.params.signed_blocks_window = \"2\" | .app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\""
GenesisChanges string
BinaryName string
// binary to use after upgrade height
UpgradeBinary string
}
Attributes that are unique to a chain. Allows us to map (part of) the set of strings defined above to a set of viable chains
type ChainState ¶
type ChainState struct {
ValBalances *map[ValidatorID]uint
Proposals *map[uint]Proposal
ProposedConsumerChains *[]string
ValPowers *map[ValidatorID]uint
StakedTokens *map[ValidatorID]uint
IBCTransferParams *IBCTransferParams
Params *[]Param
Rewards *Rewards
ConsumerChains *map[ChainID]bool
AssignedKeys *map[ValidatorID]string
ProviderKeys *map[ValidatorID]string // validatorID: validator provider key
ConsumerPendingPacketQueueSize *uint // Only relevant to consumer chains
RegisteredConsumerRewardDenoms *[]string
ClientsFrozenHeights *map[string]clienttypes.Height
HasToValidate *map[ValidatorID][]ChainID // only relevant to provider chain
InflationRateChange *int // whether the inflation rate between two blocks changes negatively (any negative number), is equal (0), or changes positively (any positive number)
ConsumerCommissionRates *map[ValidatorID]float64
}
func (ChainState) MarshalJSON ¶
func (c ChainState) MarshalJSON() ([]byte, error)
MarshalJSON transforms the ChainState into a ChainStateWithProposalTypes by adding type info to the proposals
func (*ChainState) UnmarshalJSON ¶
func (c *ChainState) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the ChainStateWithProposalTypes into a ChainState by removing the type info from the proposals and getting back standard proposals
type ChainStateCopy ¶
type ChainStateCopy ChainState
to have a ChainState object that does not have the overridden Marshal/Unmarshal method
type ChainStateWithProposalTypes ¶
type ChainStateWithProposalTypes struct {
ChainStateCopy
Proposals *map[uint]ProposalAndType // the only thing changed from the real ChainState
}
duplicated from the ChainState with a minor change to the Proposals field
type ConsumerID ¶
type ConsumerID string
type ConsumerRemovalProposal ¶
type ContainerConfig ¶
type ContainerConfig struct {
ContainerName string
InstanceName string
CcvVersion string
Now time.Time
}
TODO: this should not be here. mv 'Now' to a better suited type here and then move ContainerConfig back
type GovernanceProposal ¶
type GovernanceProposal struct {
// Msgs defines an array of sdk.Msgs proto-JSON-encoded as Anys.
Messages []json.RawMessage `json:"messages,omitempty"`
Metadata string `json:"metadata"`
Deposit string `json:"deposit"`
Title string `json:"title"`
Summary string `json:"summary"`
Expedited bool `json:"expedited"`
}
GovernanceProposal is used to generate content to be used for `gov submit-proposal` command
type IBCTransferParams ¶
type IBCTransferParamsProposal ¶
type IBCTransferParamsProposal struct {
Title string
Deposit uint
Status string
Params IBCTransferParams
}
type ParamsProposal ¶
type PlatformDriver ¶
type PlatformDriver interface {
ExecCommand(name string, arg ...string) *exec.Cmd
// ExecDetachedCommand: when executed the command will be run in the background and call will return immediately
ExecDetachedCommand(name string, args ...string) *exec.Cmd
GetTestScriptPath(isConsumer bool, script string) string
}
TODO: replace ExecutionTarget with new TargetDriver interface
type Proposal ¶
type Proposal interface {
// contains filtered or unexported methods
}
func UnmarshalProposalWithType ¶
func UnmarshalProposalWithType(inputMap json.RawMessage, proposalType string) (Proposal, error)
UnmarshalProposalWithType takes a JSON object and a proposal type and marshals into an object of the corresponding proposal.
type ProposalAndType ¶
type ProposalAndType struct {
RawProposal json.RawMessage
Type string
}
stores a proposal as a raw json, together with its type
type Rewards ¶
type Rewards struct {
IsRewarded map[ValidatorID]bool
// if true it will calculate if the validator/delegator is rewarded between 2 successive blocks,
// otherwise it will calculate if it received any rewards since the 1st block
IsIncrementalReward bool
// The reward denom to be checked. This can be either the native "stake" denom or
// a denom from other chains (e.g. if provider received rewards from a consumer chain)
Denom string
}
type TargetDriver ¶
type TargetDriver interface {
// ChainCommands
ChainCommands
PlatformDriver
}
type TextProposal ¶
type UpgradeProposal ¶
type ValidatorConfig ¶
type ValidatorConfig struct {
// Seed phrase to generate a secp256k1 key used by the validator on the provider
Mnemonic string
// Validator account address on provider marshaled to string using Bech32
// with Bech32Prefix = ProviderAccountPrefix
DelAddress string
// Validator account address on provider marshaled to string using Bech32
// with Bech32Prefix = ConsumerAccountPrefix
DelAddressOnConsumer string
// Validator operator address on provider marshaled to string using Bech32
// with Bech32Prefix = ProviderAccountPrefix
ValoperAddress string
// Validator operator address on provider marshaled to string using Bech32
// with Bech32Prefix = ConsumerAccountPrefix
ValoperAddressOnConsumer string
// Validator consensus address on provider marshaled to string using Bech32
// with Bech32Prefix = ProviderAccountPrefix. It matches the PrivValidatorKey below.
ValconsAddress string
// Validator consensus address on provider marshaled to string using Bech32
// with Bech32Prefix = ConsumerAccountPrefix.
ValconsAddressOnConsumer string
// Key used for consensus on provider
PrivValidatorKey string
NodeKey string
// Must be an integer greater than 0 and less than 253
IpSuffix string
// Seed phrase to generate a secp256k1 key used by the validator on the consumer
ConsumerMnemonic string
// Validator account address on consumer marshaled to string using Bech32
// with Bech32Prefix = ConsumerAccountPrefix
ConsumerDelAddress string
// Validator account address on consumer marshaled to string using Bech32
// with Bech32Prefix = ProviderAccountPrefix
ConsumerDelAddressOnProvider string
// Validator operator address on consumer marshaled to string using Bech32
// with Bech32Prefix = ConsumerAccountPrefix
ConsumerValoperAddress string
// Validator operator address on consumer marshaled to string using Bech32
// with Bech32Prefix = ProviderAccountPrefix
ConsumerValoperAddressOnProvider string
// Validator consensus address on consumer marshaled to string using Bech32
// with Bech32Prefix = ConsumerAccountPrefix. It matches the PrivValidatorKey below.
ConsumerValconsAddress string
// Validator consensus address on consumer marshaled to string using Bech32
// with Bech32Prefix = ProviderAccountPrefix.
ConsumerValconsAddressOnProvider string
ConsumerValPubKey string
// Key used for consensus on consumer
ConsumerPrivValidatorKey string
ConsumerNodeKey string
UseConsumerKey bool // if true the validator node will start with consumer key
}
Attributes that are unique to a validator. Allows us to map (part of) the set of strings defined above to a set of viable validators
type ValidatorID ¶
type ValidatorID string