Documentation
¶
Index ¶
- func ExecuteCommand(cmd *exec.Cmd, cmdName string, verbose bool)
- func GenerateGovProposalContent(title, summary, metadata, deposit, description string, expedited bool, ...) string
- func GetHermesConfig(hermesVersion, queryNodeIP string, chainCfg ChainConfig, isConsumer bool) string
- func IntPtr(i int) *int
- func UintPtr(i uint) *uint
- type ActionCommands
- type ActionHandler
- type AssignConsumerPubKeyAction
- type ChainCommands
- type ChainConfig
- type ChainID
- type ChainIF
- type ChainState
- type ChainStateCopy
- type ChainStateWithProposalTypes
- type ConsumerAdditionProposal
- type ConsumerID
- type ConsumerModificationProposal
- type ConsumerRemovalProposal
- type ContainerConfig
- type DelegateTokensAction
- type GovernanceProposal
- type IBCTransferParams
- type IBCTransferParamsProposal
- type Param
- type ParamsProposal
- type PlatformDriver
- type Proposal
- type ProposalAndType
- type Rewards
- type StartChainAction
- type StartChainValidator
- type StartConsumerChainAction
- type SubmitConsumerAdditionProposalAction
- type SubmitConsumerRemovalProposalAction
- type TargetDriver
- type TestConfig
- type TextProposal
- type TxResponse
- type UnbondTokensAction
- type UpgradeProposal
- type ValidatorConfig
- type ValidatorID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateGovProposalContent ¶
func GenerateGovProposalContent(title, summary, metadata, deposit, description string, expedited bool, msgs ...sdk.Msg) string
GenerateGovProposalContent creates proposal content ready to be used by `gov submit-proposal` command
func GetHermesConfig ¶
func GetHermesConfig(hermesVersion, queryNodeIP string, chainCfg ChainConfig, isConsumer bool) string
GetHermesConfig returns a configuration string for a given hermes version
Currently templates for Hermes v1.6.0 and v1.4 are supported. If provided version is before v1.6.0 then a configuration based on template for v1.4.x is returned otherwise the returned configuration is based on template v1.4.
Types ¶
type ActionCommands ¶
type ActionCommands interface {
SubmitConsumerAdditionProposal(action SubmitConsumerAdditionProposalAction, verbose bool)
AssignConsumerPubKey(action AssignConsumerPubKeyAction, verbose bool)
StartChain(action StartChainAction, verbose bool)
StartConsumerChain(action StartConsumerChainAction, verbose bool)
SubmitConsumerRemovalProposal(action SubmitConsumerRemovalProposalAction, verbose bool)
DelegateTokens(action DelegateTokensAction, verbose bool)
UnbondTokens(action UnbondTokensAction, verbose bool)
}
type ActionHandler ¶
type ChainCommands ¶
type ChainCommands interface {
// State commands - functions use by test driver to get state information
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
QueryTransaction(chain ChainID, txhash string) ([]byte, error)
CreateConsumer(providerChain, consumerChain ChainID, validator ValidatorID, metadata types.ConsumerMetadata, initParams *types.ConsumerInitializationParameters, powerShapingParams *types.PowerShapingParameters) ([]byte, error)
UpdateConsumer(providerChain ChainID, validator ValidatorID, update types.MsgUpdateConsumer, verbose bool) ([]byte, error)
SubmitGovProposal(chain ChainID, from ValidatorID, command, proposal string, verbose bool) ([]byte, error)
AssignConsumerPubKey(identifier, pubKey string, from ValidatorID, 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 ChainIF ¶
type ChainIF interface {
ActionCommands
}
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 ¶
TODO: this should not be here. mv 'Now' to a better suited type here and then move ContainerConfig back
type DelegateTokensAction ¶
type DelegateTokensAction struct {
Chain ChainID
From ValidatorID
To ValidatorID
Amount uint
}
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
UseCometMock() bool
}
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 StartChainAction ¶
type StartChainAction struct {
Chain ChainID
Validators []StartChainValidator
// Genesis changes specific to this action, appended to genesis changes defined in chain config
GenesisChanges string
IsConsumer bool
}
type StartChainValidator ¶
type StartChainValidator struct {
Id ValidatorID
Allocation uint
Stake uint
}
type StartConsumerChainAction ¶
type StartConsumerChainAction struct {
ConsumerChain ChainID
ProviderChain ChainID
Validators []StartChainValidator
GenesisChanges string
}
type SubmitConsumerAdditionProposalAction ¶
type SubmitConsumerAdditionProposalAction struct {
PreCCV bool
Chain ChainID
From ValidatorID
Deposit uint
ConsumerChain ChainID
SpawnTime uint
InitialHeight clienttypes.Height
DistributionChannel string
TopN uint32
ValidatorsPowerCap uint32
ValidatorSetCap uint32
Allowlist []string
Denylist []string
MinStake uint64
AllowInactiveVals bool
Prioritylist []string
}
type TargetDriver ¶
type TargetDriver interface {
// ChainCommands
ChainCommands
PlatformDriver
}
type TestConfig ¶
type TestConfig struct {
// These are the non altered values during a typical test run, where multiple test runs can exist
// to validate different action sequences and corresponding state checks.
ContainerConfig ContainerConfig
ValidatorConfigs map[ValidatorID]ValidatorConfig
ChainConfigs map[ChainID]ChainConfig
ConsumerChains map[ConsumerID]ChainConfig
ProviderVersion string
ConsumerVersion string
// override config.toml parameters
// usually used to override timeout_commit
// having shorter timeout_commit reduces the test runtime because blocks are produced faster
// lengthening the timeout_commit increases the test runtime because blocks are produced slower but the test is more reliable
TendermintConfigOverride string
UseCometmock bool // if false, nodes run CometBFT
UseGorelayer bool // if false, Hermes is used as the relayer
// chains which are running, i.e. producing blocks, at the moment
RunningChains map[ChainID]bool
// Used with CometMock. The time by which chains have been advanced. Used to keep chains in sync: when a new chain is started, advance its time by this value to keep chains in sync.
TimeOffset time.Duration
TransformGenesis bool
Name string
}
func (*TestConfig) Initialize ¶
func (tr *TestConfig) Initialize()
Initialize initializes the TestConfig instance by setting the runningChains field to an empty map.
func (*TestConfig) SetCometMockConfig ¶
func (s *TestConfig) SetCometMockConfig(useCometmock bool)
func (*TestConfig) SetRelayerConfig ¶
func (s *TestConfig) SetRelayerConfig(useRly bool)
func (*TestConfig) ValidateStringLiterals ¶
func (s *TestConfig) ValidateStringLiterals()
ValidateStringLiterals enforces that configs follow the constraints necessary to execute the tests
Note: Network interfaces (name of virtual ethernet interfaces for ip link) within the container will be named as "$CHAIN_ID-$VAL_ID-out" etc. where this name is constrained to 15 bytes or less. Therefore each string literal used as a validatorID or chainID needs to be 5 char or less.
type TextProposal ¶
type TxResponse ¶
type TxResponse struct {
TxHash string `json:"txhash"`
Code int `json:"code"`
RawLog string `json:"raw_log"`
Events []sdk.Event `json:"events"`
}
func GetTxResponse ¶
func GetTxResponse(rawResponse []byte) TxResponse
type UnbondTokensAction ¶
type UnbondTokensAction struct {
Chain ChainID
Sender ValidatorID
UnbondFrom ValidatorID
Amount uint
}
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