Skip to content

Commit

Permalink
Add tests for commission rates & changing an allowlist after launchin…
Browse files Browse the repository at this point in the history
…g. (#3351)

These are ports from hypha's `cosmos-release-testing` suite.
  • Loading branch information
fastfadingviolets authored Sep 30, 2024
1 parent 3275ccc commit abbace9
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 15 deletions.
7 changes: 7 additions & 0 deletions tests/interchain/chainsuite/chain_ics.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ type ConsumerConfig struct {
ValidatorPowerCap int
AllowInactiveVals bool
MinStake uint64
Allowlist []string
Denylist []string
spec *interchaintest.ChainSpec

DuringDepositPeriod ConsumerBootstrapCb
Expand Down Expand Up @@ -227,6 +229,8 @@ func (p *Chain) CreateConsumerPermissionless(ctx context.Context, chainID string
ValidatorsPowerCap: uint32(config.ValidatorPowerCap),
AllowInactiveVals: config.AllowInactiveVals,
MinStake: config.MinStake,
Allowlist: config.Allowlist,
Denylist: config.Denylist,
}
params := providertypes.MsgCreateConsumer{
ChainId: chainID,
Expand Down Expand Up @@ -344,6 +348,9 @@ func (p *Chain) DefaultConsumerChainSpec(ctx context.Context, chainID string, co
}
genesisOverrides := []cosmos.GenesisKV{
cosmos.NewGenesisKV("app_state.slashing.params.signed_blocks_window", strconv.Itoa(SlashingWindowConsumer)),
cosmos.NewGenesisKV("app_state.ccvconsumer.params.reward_denoms", []string{denom}),
cosmos.NewGenesisKV("app_state.ccvconsumer.params.provider_reward_denoms", []string{p.Config().Denom}),
cosmos.NewGenesisKV("app_state.ccvconsumer.params.blocks_per_distribution_transmission", BlocksPerDistribution),
}
if config.TopN >= 0 {
genesisOverrides = append(genesisOverrides, cosmos.NewGenesisKV("app_state.ccvconsumer.params.soft_opt_out_threshold", "0.0"))
Expand Down
1 change: 1 addition & 0 deletions tests/interchain/chainsuite/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const (
ValidatorFunds = 11_000_000_000
ChainSpawnWait = 155 * time.Second
SlashingWindowConsumer = 20
BlocksPerDistribution = 10
)

func (c SuiteConfig) Merge(other SuiteConfig) SuiteConfig {
Expand Down
17 changes: 17 additions & 0 deletions tests/interchain/chainsuite/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package chainsuite

import (
"fmt"
"strings"

sdkmath "cosmossdk.io/math"
)

func StrToSDKInt(s string) (sdkmath.Int, error) {
s, _, _ = strings.Cut(s, ".")
i, ok := sdkmath.NewIntFromString(s)
if !ok {
return sdkmath.Int{}, fmt.Errorf("s: %s", s)
}
return i, nil
}
Loading

0 comments on commit abbace9

Please sign in to comment.