From ccc633699fc92e215b2f9aa1144ca7a8f1affc9e Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Mon, 8 May 2023 09:59:58 -0700 Subject: [PATCH 01/11] Merge pull request from GHSA-chqw-ff63-95r8 * squash commit of multisig fix + everything involving denom fix * rebuild proto * fix todos --------- Co-authored-by: Jehan Tremback --- app/provider/app.go | 28 +- .../ccv/consumer/v1/consumer.proto | 7 + .../ccv/provider/v1/provider.proto | 5 + .../ccv/provider/v1/query.proto | 12 + .../ccv/provider/v1/tx.proto | 17 +- tests/difference/core/driver/setup.go | 2 + tests/e2e/actions.go | 30 + tests/e2e/config.go | 23 +- tests/e2e/main.go | 5 +- tests/e2e/state.go | 50 +- tests/e2e/steps.go | 8 + tests/e2e/steps_democracy.go | 43 +- tests/integration/distribution.go | 100 +- tests/integration/steps_reward_denom.go | 281 +++ testutil/integration/interfaces.go | 19 +- testutil/keeper/mocks.go | 51 + testutil/keeper/unit_test_helpers.go | 31 +- x/ccv/consumer/keeper/distribution.go | 69 +- x/ccv/consumer/keeper/distribution_test.go | 23 + x/ccv/consumer/keeper/params.go | 14 + x/ccv/consumer/keeper/params_test.go | 6 +- x/ccv/consumer/types/consumer.pb.go | 211 +- x/ccv/consumer/types/genesis_test.go | 4 + x/ccv/consumer/types/params.go | 42 +- x/ccv/consumer/types/params_test.go | 86 +- x/ccv/provider/client/cli/query.go | 36 + x/ccv/provider/client/cli/tx.go | 39 + x/ccv/provider/handler.go | 3 + x/ccv/provider/handler_test.go | 9 +- x/ccv/provider/ibc_module.go | 2 +- x/ccv/provider/ibc_module_test.go | 4 +- x/ccv/provider/keeper/distribution.go | 75 +- x/ccv/provider/keeper/genesis_test.go | 2 + x/ccv/provider/keeper/grpc_query.go | 14 + x/ccv/provider/keeper/keeper.go | 59 +- x/ccv/provider/keeper/msg_server.go | 21 + x/ccv/provider/keeper/params.go | 13 + x/ccv/provider/keeper/params_test.go | 10 +- x/ccv/provider/keeper/proposal.go | 2 + x/ccv/provider/keeper/proposal_test.go | 29 +- x/ccv/provider/module.go | 2 + x/ccv/provider/module_test.go | 4 +- x/ccv/provider/proposal_handler_test.go | 12 +- x/ccv/provider/types/codec.go | 5 + x/ccv/provider/types/errors.go | 27 +- x/ccv/provider/types/genesis_test.go | 63 +- x/ccv/provider/types/keys.go | 11 + x/ccv/provider/types/msg.go | 48 +- x/ccv/provider/types/params.go | 57 +- x/ccv/provider/types/params_test.go | 29 +- x/ccv/provider/types/provider.pb.go | 1956 ++++------------- x/ccv/provider/types/query.pb.go | 501 ++++- x/ccv/provider/types/query.pb.gw.go | 65 + x/ccv/provider/types/tx.pb.go | 422 +++- x/ccv/types/events.go | 16 +- x/ccv/types/expected_keepers.go | 6 +- 56 files changed, 2755 insertions(+), 1954 deletions(-) create mode 100644 tests/integration/steps_reward_denom.go diff --git a/app/provider/app.go b/app/provider/app.go index 5546f60b51..ca4bfd2e3d 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -155,13 +155,14 @@ var ( // module account permissions maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + providertypes.ConsumerRewardsPool: nil, } ) @@ -308,12 +309,14 @@ func New( maccPerms, ) - // Remove the fee-pool from the group of blocked recipient addresses in bank + // Remove the ConsumerRewardsPool from the group of blocked recipient addresses in bank // this is required for the provider chain to be able to receive tokens from // the consumer chain bankBlockedAddrs := app.ModuleAccountAddrs() delete(bankBlockedAddrs, authtypes.NewModuleAddress( - authtypes.FeeCollectorName).String()) + providertypes.ConsumerRewardsPool).String()) + + // bankBlockedAddrs := make(map[string]bool) app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, @@ -409,6 +412,8 @@ func New( app.SlashingKeeper, app.AccountKeeper, app.EvidenceKeeper, + app.DistrKeeper, + app.BankKeeper, authtypes.FeeCollectorName, ) @@ -777,6 +782,11 @@ func (app *App) GetTestDistributionKeeper() testutil.TestDistributionKeeper { return app.DistrKeeper } +// GetTestAccountKeeper implements the ProviderApp interface. +func (app *App) GetE2eAccountKeeper() e2e.E2eAccountKeeper { + return app.AccountKeeper +} + // TestingApp functions // GetBaseApp implements the TestingApp interface. diff --git a/proto/interchain_security/ccv/consumer/v1/consumer.proto b/proto/interchain_security/ccv/consumer/v1/consumer.proto index 3ee887c22b..d2959983a4 100644 --- a/proto/interchain_security/ccv/consumer/v1/consumer.proto +++ b/proto/interchain_security/ccv/consumer/v1/consumer.proto @@ -57,6 +57,13 @@ message Params { // can opt out of running the consumer chain without being punished. For example, a // value of 0.05 means that the validators in the bottom 5% of the set can opt out string soft_opt_out_threshold = 10; + + // Reward denoms. These are the denominations which are allowed to be sent to the provider as rewards. + repeated string reward_denoms = 11; + + // Provider-originated reward denoms. These are denoms coming from the provider + // which are allowed to be used as rewards. e.g. "uatom" + repeated string provider_reward_denoms = 12; } // LastTransmissionBlockHeight is the last time validator holding diff --git a/proto/interchain_security/ccv/provider/v1/provider.proto b/proto/interchain_security/ccv/provider/v1/provider.proto index 0f3e4f3c9f..8a3861f55a 100644 --- a/proto/interchain_security/ccv/provider/v1/provider.proto +++ b/proto/interchain_security/ccv/provider/v1/provider.proto @@ -11,6 +11,7 @@ import "ibc/core/client/v1/client.proto"; import "ibc/lightclients/tendermint/v1/tendermint.proto"; import "tendermint/crypto/keys.proto"; import "cosmos/evidence/v1beta1/evidence.proto"; +import "cosmos/base/v1beta1/coin.proto"; // ConsumerAdditionProposal is a governance proposal on the provider chain to spawn a new consumer chain. // If it passes, then all validators on the provider chain are expected to validate the consumer chain at spawn time @@ -136,6 +137,10 @@ message Params { // The maximum amount of throttled slash or vsc matured packets // that can be queued for a single consumer before the provider chain halts. int64 max_throttled_packets = 8; + + // The fee required to be paid to add a reward denom + cosmos.base.v1beta1.Coin consumer_reward_denom_registration_fee = 9 + [(gogoproto.nullable) = false]; } message HandshakeMetadata { diff --git a/proto/interchain_security/ccv/provider/v1/query.proto b/proto/interchain_security/ccv/provider/v1/query.proto index b1ef9a620c..3100502699 100644 --- a/proto/interchain_security/ccv/provider/v1/query.proto +++ b/proto/interchain_security/ccv/provider/v1/query.proto @@ -68,6 +68,12 @@ service Query { returns (QueryThrottledConsumerPacketDataResponse) { option (google.api.http).get = "/interchain_security/ccv/provider/pending_consumer_packets"; } + + // QueryRegisteredConsumerRewardDenoms returns a list of consumer reward denoms that are registered + rpc QueryRegisteredConsumerRewardDenoms(QueryRegisteredConsumerRewardDenomsRequest) + returns (QueryRegisteredConsumerRewardDenomsResponse) { + option (google.api.http).get = "/interchain_security/ccv/provider/registered_consumer_reward_denoms"; + } } message QueryConsumerGenesisRequest { string chain_id = 1; } @@ -169,3 +175,9 @@ message ThrottledPacketDataWrapper { interchain_security.ccv.v1.VSCMaturedPacketData vsc_matured_packet = 2; } } + +message QueryRegisteredConsumerRewardDenomsRequest {} + +message QueryRegisteredConsumerRewardDenomsResponse { + repeated string denoms = 1; +} diff --git a/proto/interchain_security/ccv/provider/v1/tx.proto b/proto/interchain_security/ccv/provider/v1/tx.proto index 1e1a3d3fe6..f69bb93e08 100644 --- a/proto/interchain_security/ccv/provider/v1/tx.proto +++ b/proto/interchain_security/ccv/provider/v1/tx.proto @@ -11,6 +11,7 @@ import "google/protobuf/any.proto"; // Msg defines the Msg service. service Msg { rpc AssignConsumerKey(MsgAssignConsumerKey) returns (MsgAssignConsumerKeyResponse); + rpc RegisterConsumerRewardDenom(MsgRegisterConsumerRewardDenom) returns (MsgRegisterConsumerRewardDenomResponse); } message MsgAssignConsumerKey { @@ -27,4 +28,18 @@ message MsgAssignConsumerKey { string consumer_key = 3; } -message MsgAssignConsumerKeyResponse {} \ No newline at end of file +message MsgAssignConsumerKeyResponse {} + +// MsgRegisterConsumerRewardDenom allows an account to register +// a consumer reward denom, i.e., add it to the list of denoms +// accepted by the provider as rewards. +message MsgRegisterConsumerRewardDenom { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string denom = 1; + string depositor = 2; +} + +// MsgRegisterConsumerRewardDenomResponse defines the Msg/RegisterConsumerRewardDenom response type. +message MsgRegisterConsumerRewardDenomResponse {} \ No newline at end of file diff --git a/tests/difference/core/driver/setup.go b/tests/difference/core/driver/setup.go index 64611da7cc..905869441e 100644 --- a/tests/difference/core/driver/setup.go +++ b/tests/difference/core/driver/setup.go @@ -514,6 +514,8 @@ func (b *Builder) createConsumerGenesis(client *ibctmtypes.ClientState) *consume consumertypes.DefaultHistoricalEntries, b.initState.UnbondingC, "0", // disable soft opt-out + []string{}, + []string{}, ) return consumertypes.NewInitialGenesisState(client, providerConsState, valUpdates, params) } diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index e17d751c24..3455b41075 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -1160,6 +1160,36 @@ func (tr TestRun) registerRepresentative( wg.Wait() } +type registerConsumerRewardDenomAction struct { + chain chainID + from validatorID + denom string +} + +func (tr TestRun) registerConsumerRewardDenom(action registerConsumerRewardDenomAction, verbose bool) { + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. + bz, err := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[action.chain].binaryName, + "tx", "provider", "register-consumer-reward-denom", action.denom, + + `--from`, `validator`+fmt.Sprint(action.from), + `--chain-id`, string(action.chain), + `--home`, tr.getValidatorHome(action.chain, action.from), + `--node`, tr.getValidatorNode(action.chain, action.from), + `--gas`, "9000000", + `--keyring-backend`, `test`, + `-b`, `block`, + `-y`, + ).CombinedOutput() + + if verbose { + fmt.Println("redelegate cmd:", string(bz)) + } + + if err != nil { + log.Fatal(err, "\n", string(bz)) + } +} + // Creates an additional node on selected chain // by copying an existing validator's home folder // diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 0379ef2c90..6419dae8ab 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -223,7 +223,19 @@ func DefaultTestRun() TestRun { } } -func DemocracyTestRun() TestRun { +func DemocracyTestRun(allowReward bool) TestRun { + consumerGenChanges := ".app_state.ccvconsumer.params.blocks_per_distribution_transmission = \"20\" | " + + ".app_state.gov.voting_params.voting_period = \"10s\" | " + + ".app_state.slashing.params.signed_blocks_window = \"2\" | " + + ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + + ".app_state.slashing.params.downtime_jail_duration = \"2s\" | " + + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"" + + if allowReward { + // This allows the consumer chain to send rewards in the stake denom + consumerGenChanges += " | .app_state.ccvconsumer.params.reward_denoms = [\"stake\"]" + } + return TestRun{ name: "democracy", containerConfig: ContainerConfig{ @@ -246,19 +258,14 @@ func DemocracyTestRun() TestRun { ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"2s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + - ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", }, chainID("democ"): { chainId: chainID("democ"), binaryName: "interchain-security-cdd", ipPrefix: "7.7.9", votingWaitTime: 20, - genesisChanges: ".app_state.ccvconsumer.params.blocks_per_distribution_transmission = \"20\" | " + - ".app_state.gov.voting_params.voting_period = \"10s\" | " + - ".app_state.slashing.params.signed_blocks_window = \"2\" | " + - ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + - ".app_state.slashing.params.downtime_jail_duration = \"2s\" | " + - ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"", + genesisChanges: consumerGenChanges, }, }, tendermintConfigOverride: `s/timeout_commit = "5s"/timeout_commit = "1s"/;` + diff --git a/tests/e2e/main.go b/tests/e2e/main.go index 07253693a3..8ef9d93b7a 100644 --- a/tests/e2e/main.go +++ b/tests/e2e/main.go @@ -44,7 +44,8 @@ func main() { testRuns := []testRunWithSteps{ {DefaultTestRun(), happyPathSteps}, - {DemocracyTestRun(), democracySteps}, + {DemocracyTestRun(true), democracySteps}, + {DemocracyTestRun(false), rewardDenomConsumerSteps}, {SlashThrottleTestRun(), slashThrottleSteps}, } if includeMultiConsumer != nil && *includeMultiConsumer { @@ -143,6 +144,8 @@ func (tr *TestRun) runStep(step Step, verbose bool) { tr.waitForSlashThrottleDequeue(action, verbose) case startHermesAction: tr.startHermes(action, verbose) + case registerConsumerRewardDenomAction: + tr.registerConsumerRewardDenom(action, verbose) default: log.Fatalf("unknown action in testRun %s: %#v", tr.name, action) } diff --git a/tests/e2e/state.go b/tests/e2e/state.go index 68a9ff0d2f..98483ffb7e 100644 --- a/tests/e2e/state.go +++ b/tests/e2e/state.go @@ -16,17 +16,18 @@ import ( type State map[chainID]ChainState type ChainState struct { - ValBalances *map[validatorID]uint - Proposals *map[uint]Proposal - ValPowers *map[validatorID]uint - RepresentativePowers *map[validatorID]uint - Params *[]Param - Rewards *Rewards - ConsumerChains *map[chainID]bool - AssignedKeys *map[validatorID]string - ProviderKeys *map[validatorID]string // validatorID: validator provider key - ConsumerChainQueueSizes *map[chainID]uint - GlobalSlashQueueSize *uint + ValBalances *map[validatorID]uint + Proposals *map[uint]Proposal + ValPowers *map[validatorID]uint + RepresentativePowers *map[validatorID]uint + Params *[]Param + Rewards *Rewards + ConsumerChains *map[chainID]bool + AssignedKeys *map[validatorID]string + ProviderKeys *map[validatorID]string // validatorID: validator provider key + ConsumerChainQueueSizes *map[chainID]uint + GlobalSlashQueueSize *uint + RegisteredConsumerRewardDenoms *[]string } type Proposal interface { @@ -167,6 +168,11 @@ func (tr TestRun) getChainState(chain chainID, modelState ChainState) ChainState chainState.ConsumerChainQueueSizes = &consumerChainQueueSizes } + if modelState.RegisteredConsumerRewardDenoms != nil { + registeredConsumerRewardDenoms := tr.getRegisteredConsumerRewardDenoms(chain) + chainState.RegisteredConsumerRewardDenoms = ®isteredConsumerRewardDenoms + } + return chainState } @@ -640,6 +646,28 @@ func (tr TestRun) getConsumerChainPacketQueueSize(consumerChain chainID) uint { return uint(size) } +func (tr TestRun) getRegisteredConsumerRewardDenoms(chain chainID) []string { + //#nosec G204 -- Bypass linter warning for spawning subprocess with cmd arguments. + cmd := exec.Command("docker", "exec", tr.containerConfig.instanceName, tr.chainConfigs[chain].binaryName, + + "query", "provider", "registered-consumer-reward-denoms", + `--node`, tr.getQueryNode(chain), + `-o`, `json`, + ) + bz, err := cmd.CombinedOutput() + if err != nil { + log.Fatal(err, "\n", string(bz)) + } + + denoms := gjson.Get(string(bz), "denoms").Array() + rewardDenoms := make([]string, len(denoms)) + for i, d := range denoms { + rewardDenoms[i] = d.String() + } + + return rewardDenoms +} + func (tr TestRun) getValidatorNode(chain chainID, validator validatorID) string { return "tcp://" + tr.getValidatorIP(chain, validator) + ":26658" } diff --git a/tests/e2e/steps.go b/tests/e2e/steps.go index 286115da84..234672546b 100644 --- a/tests/e2e/steps.go +++ b/tests/e2e/steps.go @@ -45,6 +45,14 @@ var democracySteps = concatSteps( stepsDemocracy("democ"), ) +var rewardDenomConsumerSteps = concatSteps( + // democracySteps requires a transfer channel + stepsStartChains([]string{"democ"}, true), + // delegation needs to happen so the first VSC packet can be delivered + stepsDelegate("democ"), + stepsRewardDenomConsumer("democ"), +) + var multipleConsumers = concatSteps( stepsStartChains([]string{"consu", "densu"}, false), stepsMultiConsumerDelegate("consu", "densu"), diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index 376b176c0c..59b4cae750 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -114,7 +114,48 @@ func stepsDemocracy(consumerName string) []Step { }, state: State{ chainID("provi"): ChainState{ - // Check that tokens are minted and sent to provider chain and distributed to validators and their delegators on provider chain + // Check that tokens are not distributed before the denom has been registered + Rewards: &Rewards{ + IsRewarded: map[validatorID]bool{ + validatorID("alice"): false, + validatorID("bob"): false, + validatorID("carol"): false, + }, + IsIncrementalReward: false, + IsNativeDenom: false, + }, + // Check that the denom is not registered on provider chain + RegisteredConsumerRewardDenoms: &[]string{}, + }, + }, + }, + { + action: registerConsumerRewardDenomAction{ + chain: chainID("provi"), + from: validatorID("bob"), + denom: "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9", + }, + state: State{ + chainID("provi"): ChainState{ + // Check that the denom is registered on provider chain + RegisteredConsumerRewardDenoms: &[]string{"ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9"}, + ValBalances: &map[validatorID]uint{ + // make sure that bob's account was debited + validatorID("bob"): 9490000000, + }, + }, + }, + }, + { + action: relayRewardPacketsToProviderAction{ + consumerChain: chainID(consumerName), + providerChain: chainID("provi"), + port: "transfer", + channel: 1, + }, + state: State{ + chainID("provi"): ChainState{ + //Check that tokens are minted and sent to provider chain and distributed to validators and their delegators on provider chain Rewards: &Rewards{ IsRewarded: map[validatorID]bool{ validatorID("alice"): true, diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index 66eff6d5de..4372c1e730 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -5,8 +5,10 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" consumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types" + providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" ccv "github.com/cosmos/interchain-security/x/ccv/types" ) @@ -20,6 +22,11 @@ func (s *CCVTestSuite) TestRewardsDistribution() { delegate(s, delAddr, bondAmt) s.providerChain.NextBlock() + // register a consumer reward denom + params := s.consumerApp.GetConsumerKeeper().GetParams(s.consumerCtx()) + params.RewardDenoms = []string{sdk.DefaultBondDenom} + s.consumerApp.GetConsumerKeeper().SetParams(s.consumerCtx(), params) + // relay VSC packets from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) @@ -28,8 +35,10 @@ func (s *CCVTestSuite) TestRewardsDistribution() { consumerParams.Set(s.consumerCtx(), consumertypes.KeyBlocksPerDistributionTransmission, int64(2)) s.consumerChain.NextBlock() - consumerAccountKeeper := s.consumerApp.GetTestAccountKeeper() - consumerBankKeeper := s.consumerApp.GetTestBankKeeper() + consumerAccountKeeper := s.consumerApp.GetE2eAccountKeeper() + providerAccountKeeper := s.providerApp.GetE2eAccountKeeper() + consumerBankKeeper := s.consumerApp.GetE2eBankKeeper() + providerBankKeeper := s.providerApp.GetE2eBankKeeper() // send coins to the fee pool which is used for reward distribution consumerFeePoolAddr := consumerAccountKeeper.GetModuleAccount(s.consumerCtx(), authtypes.FeeCollectorName).GetAddress() @@ -65,14 +74,66 @@ func (s *CCVTestSuite) TestRewardsDistribution() { relayAllCommittedPackets(s, s.consumerChain, s.transferPath, transfertypes.PortID, s.transferPath.EndpointA.ChannelID, 1) s.providerChain.NextBlock() - communityCoins := s.providerApp.GetTestDistributionKeeper().GetFeePoolCommunityCoins(s.providerCtx()) + + // Since consumer reward denom is not yet registered, the coins never get into the fee pool, staying in the ConsumerRewardsPool + rewardPool := providerAccountKeeper.GetModuleAccount(s.providerCtx(), providertypes.ConsumerRewardsPool).GetAddress() + rewardCoins := providerBankKeeper.GetAllBalances(s.providerCtx(), rewardPool) + ibcCoinIndex := -1 - for i, coin := range communityCoins { + for i, coin := range rewardCoins { if strings.HasPrefix(coin.Denom, "ibc") { ibcCoinIndex = i } } + + // Check that we found an ibc denom in the reward pool s.Require().Greater(ibcCoinIndex, -1) + + // Check that the coins got into the ConsumerRewardsPool + s.Require().True(rewardCoins[ibcCoinIndex].Amount.Equal(providerExpectedRewards[0].Amount)) + + // Attempt to register the consumer reward denom, but fail because the account has no coins + + // Get the balance of delAddr to send it out + senderCoins := providerBankKeeper.GetAllBalances(s.providerCtx(), delAddr) + + // Send the coins to the governance module just to have a place to send them + providerBankKeeper.SendCoinsFromAccountToModule(s.providerCtx(), delAddr, govtypes.ModuleName, senderCoins) + + // Attempt to register the consumer reward denom, but fail because the account has no coins + err = s.providerApp.GetProviderKeeper().RegisterConsumerRewardDenom(s.providerCtx(), rewardCoins[ibcCoinIndex].Denom, delAddr) + s.Require().Error(err) + + // Advance a block and check that the coins are still in the ConsumerRewardsPool + s.providerChain.NextBlock() + rewardCoins = providerBankKeeper.GetAllBalances(s.providerCtx(), rewardPool) + s.Require().True(rewardCoins[ibcCoinIndex].Amount.Equal(providerExpectedRewards[0].Amount)) + + // Successfully register the consumer reward denom this time + + // Send the coins back to the delAddr + providerBankKeeper.SendCoinsFromModuleToAccount(s.providerCtx(), govtypes.ModuleName, delAddr, senderCoins) + + // log the sender's coins + senderCoins1 := providerBankKeeper.GetAllBalances(s.providerCtx(), delAddr) + + // Register the consumer reward denom + err = s.providerApp.GetProviderKeeper().RegisterConsumerRewardDenom(s.providerCtx(), rewardCoins[ibcCoinIndex].Denom, delAddr) + s.Require().NoError(err) + + // Check that the delAddr has the right amount less money in it after paying the fee + senderCoins2 := providerBankKeeper.GetAllBalances(s.providerCtx(), delAddr) + consumerRewardDenomRegistrationFee := s.providerApp.GetProviderKeeper().GetConsumerRewardDenomRegistrationFee(s.providerCtx()) + s.Require().Equal(senderCoins1.Sub(senderCoins2), sdk.NewCoins(consumerRewardDenomRegistrationFee)) + + s.providerChain.NextBlock() + + // Check that the reward pool has no more coins because they were transferred to the fee pool + rewardCoins = providerBankKeeper.GetAllBalances(s.providerCtx(), rewardPool) + s.Require().Equal(0, len(rewardCoins)) + + // check that the fee pool has the expected amount of coins + communityCoins := s.providerApp.GetE2eDistributionKeeper().GetFeePoolCommunityCoins(s.providerCtx()) s.Require().True(communityCoins[ibcCoinIndex].Amount.Equal(sdk.NewDecCoinFromCoin(providerExpectedRewards[0]).Amount)) } @@ -88,6 +149,11 @@ func (s *CCVTestSuite) TestSendRewardsRetries() { delegate(s, delAddr, bondAmt) s.providerChain.NextBlock() + // Register denom on consumer chain + params := s.consumerApp.GetConsumerKeeper().GetParams(s.consumerCtx()) + params.RewardDenoms = []string{sdk.DefaultBondDenom} + s.consumerApp.GetConsumerKeeper().SetParams(s.consumerCtx(), params) + // relay VSC packets from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) @@ -156,12 +222,14 @@ func (s *CCVTestSuite) TestEndBlockRD() { corruptTransChannel bool expLBThUpdated bool expEscrowBalanceChanged bool + denomRegistered bool }{ { name: "should not update LBTH before blocks per dist trans block are passed", prepareRewardDist: false, corruptTransChannel: false, expLBThUpdated: false, + denomRegistered: true, expEscrowBalanceChanged: false, }, { @@ -169,6 +237,7 @@ func (s *CCVTestSuite) TestEndBlockRD() { prepareRewardDist: true, corruptTransChannel: false, expLBThUpdated: true, + denomRegistered: true, expEscrowBalanceChanged: true, }, { @@ -176,8 +245,25 @@ func (s *CCVTestSuite) TestEndBlockRD() { prepareRewardDist: true, corruptTransChannel: true, expLBThUpdated: true, + denomRegistered: true, + expEscrowBalanceChanged: false, + }, + { + name: "should not change escrow balance when denom is not registered", + prepareRewardDist: true, + corruptTransChannel: false, + expLBThUpdated: true, + denomRegistered: false, expEscrowBalanceChanged: false, }, + { + name: "should change escrow balance when denom is registered", + prepareRewardDist: true, + corruptTransChannel: false, + expLBThUpdated: true, + denomRegistered: true, + expEscrowBalanceChanged: true, + }, } for _, tc := range testCases { @@ -192,6 +278,12 @@ func (s *CCVTestSuite) TestEndBlockRD() { delegate(s, delAddr, bondAmt) s.providerChain.NextBlock() + if tc.denomRegistered { + params := s.consumerApp.GetConsumerKeeper().GetParams(s.consumerCtx()) + params.RewardDenoms = []string{sdk.DefaultBondDenom} + s.consumerApp.GetConsumerKeeper().SetParams(s.consumerCtx(), params) + } + // relay VSC packets from provider to consumer relayAllCommittedPackets(s, s.providerChain, s.path, ccv.ProviderPortID, s.path.EndpointB.ChannelID, 1) diff --git a/tests/integration/steps_reward_denom.go b/tests/integration/steps_reward_denom.go new file mode 100644 index 0000000000..51cabf427c --- /dev/null +++ b/tests/integration/steps_reward_denom.go @@ -0,0 +1,281 @@ +package main + +func stepsRewardDenomConsumer(consumerName string) []Step { + return []Step{ + { + action: registerRepresentativeAction{ + chain: chainID(consumerName), + representatives: []validatorID{validatorID("alice"), validatorID("bob")}, + stakes: []uint{100000000, 40000000}, + }, + state: State{ + chainID(consumerName): ChainState{ + RepresentativePowers: &map[validatorID]uint{ + validatorID("alice"): 100000000, + validatorID("bob"): 40000000, + }, + Rewards: &Rewards{ + IsRewarded: map[validatorID]bool{ + validatorID("alice"): true, + validatorID("bob"): true, + validatorID("carol"): false, + }, + IsIncrementalReward: true, + IsNativeDenom: true, + }, + }, + }, + }, + { + action: delegateTokensAction{ + chain: chainID(consumerName), + from: validatorID("carol"), + to: validatorID("alice"), + amount: 500000, + }, + state: State{ + chainID(consumerName): ChainState{ + //Check that delegators on gov-consumer chain can change representative powers + RepresentativePowers: &map[validatorID]uint{ + validatorID("alice"): 100500000, + validatorID("bob"): 40000000, + }, + // Check that delegating on gov-consumer does not change validator powers + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 500, + validatorID("carol"): 500, + }, + //Check that tokens are minted and distributed to representatives and their delegators + Rewards: &Rewards{ + IsRewarded: map[validatorID]bool{ + validatorID("alice"): true, + validatorID("bob"): true, + validatorID("carol"): true, + }, + IsIncrementalReward: true, + IsNativeDenom: true, + }, + }, + }, + }, + { + action: submitParamChangeProposalAction{ + chain: chainID(consumerName), + from: validatorID("alice"), + deposit: 10000001, + subspace: "staking", + key: "MaxValidators", + value: 105, + }, + state: State{ + chainID(consumerName): ChainState{ + ValBalances: &map[validatorID]uint{ + validatorID("alice"): 9889999998, + validatorID("bob"): 9960000001, + }, + Proposals: &map[uint]Proposal{ + 1: ParamsProposal{ + Deposit: 10000001, + Status: "PROPOSAL_STATUS_VOTING_PERIOD", + Subspace: "staking", + Key: "MaxValidators", + Value: "105", + }, + }, + }, + }, + }, + { + //Have accounts vote on something on the gov-consumer chain + action: voteGovProposalAction{ + chain: chainID(consumerName), + from: []validatorID{validatorID("alice"), validatorID("bob")}, + vote: []string{"yes", "no"}, + propNumber: 1, + }, + state: State{ + chainID(consumerName): ChainState{ + ValBalances: &map[validatorID]uint{ + validatorID("alice"): 9899999999, + validatorID("bob"): 9960000001, + }, + //Check that the parameter is changed on gov-consumer chain + Params: &([]Param{{Subspace: "staking", Key: "MaxValidators", Value: "105"}}), + }, + }, + }, + { + action: relayRewardPacketsToProviderAction{ + consumerChain: chainID(consumerName), + providerChain: chainID("provi"), + port: "transfer", + channel: 1, + }, + state: State{ + chainID("provi"): ChainState{ + // Check that tokens are not distributed before the denom has been registered + Rewards: &Rewards{ + IsRewarded: map[validatorID]bool{ + validatorID("alice"): false, + validatorID("bob"): false, + validatorID("carol"): false, + }, + IsIncrementalReward: false, + IsNativeDenom: false, + }, + // Check that the denom is not registered on provider chain + RegisteredConsumerRewardDenoms: &[]string{}, + }, + }, + }, + { + action: registerConsumerRewardDenomAction{ + chain: chainID("provi"), + from: validatorID("bob"), + denom: "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9", + }, + state: State{ + chainID("provi"): ChainState{ + // Check that the denom is registered on provider chain + RegisteredConsumerRewardDenoms: &[]string{"ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9"}, + ValBalances: &map[validatorID]uint{ + // make sure that bob's account was debited + validatorID("bob"): 9490000000, + }, + }, + }, + }, + { + action: relayRewardPacketsToProviderAction{ + consumerChain: chainID(consumerName), + providerChain: chainID("provi"), + port: "transfer", + channel: 1, + }, + state: State{ + chainID("provi"): ChainState{ + //Check that tokens are not minted and sent to provider chain and distributed to validators and their delegators on provider chain + Rewards: &Rewards{ + IsRewarded: map[validatorID]bool{ + validatorID("alice"): false, + validatorID("bob"): false, + validatorID("carol"): false, + }, + IsIncrementalReward: false, + IsNativeDenom: false, + }, + }, + }, + }, + { + action: downtimeSlashAction{ + chain: chainID(consumerName), + validator: validatorID("bob"), + }, + state: State{ + // validator should be slashed on consumer, powers not affected on either chain yet + chainID("provi"): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 500, + validatorID("carol"): 500, + }, + }, + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 500, + validatorID("carol"): 500, + }, + }, + }, + }, + { + action: relayPacketsAction{ + chain: chainID("provi"), + port: "provider", + channel: 0, + }, + state: State{ + chainID("provi"): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + // Downtime jailing and corresponding voting power change are processed by provider + validatorID("bob"): 0, + validatorID("carol"): 500, + }, + }, + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 500, + validatorID("carol"): 500, + }, + }, + }, + }, + // A block is incremented each action, hence why VSC is committed on provider, + // and can now be relayed as packet to consumer + { + action: relayPacketsAction{ + chain: chainID("provi"), + port: "provider", + channel: 0, + }, + state: State{ + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + // VSC now seen on consumer + validatorID("bob"): 0, + validatorID("carol"): 500, + }, + }, + }, + }, + { + action: unjailValidatorAction{ + provider: chainID("provi"), + validator: validatorID("bob"), + }, + state: State{ + chainID("provi"): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 500, + validatorID("carol"): 500, + }, + }, + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 0, + validatorID("carol"): 500, + }, + }, + }, + }, + { + action: relayPacketsAction{ + chain: chainID("provi"), + port: "provider", + channel: 0, + }, + state: State{ + chainID(consumerName): ChainState{ + ValPowers: &map[validatorID]uint{ + validatorID("alice"): 511, + validatorID("bob"): 500, + validatorID("carol"): 500, + }, + //Check that slashing on the gov-consumer chain does not result in slashing for the representatives or their delegators + RepresentativePowers: &map[validatorID]uint{ + validatorID("alice"): 100500000, + validatorID("bob"): 40000000, + }, + }, + }, + }, + } +} diff --git a/testutil/integration/interfaces.go b/testutil/integration/interfaces.go index 8546b7a6f8..1c78ab22eb 100644 --- a/testutil/integration/interfaces.go +++ b/testutil/integration/interfaces.go @@ -24,6 +24,7 @@ import ( // This is a wrapper around the ibc testing app interface with additional constraints. type ProviderApp interface { ibctesting.TestingApp + GetSubspace(moduleName string) paramstypes.Subspace // // Keeper getters @@ -31,13 +32,15 @@ type ProviderApp interface { GetProviderKeeper() providerkeeper.Keeper // Returns a staking keeper interface with more capabilities than the expected_keepers interface - GetTestStakingKeeper() TestStakingKeeper - // Testurns a bank keeper interface with more capabilities than the expected_keepers interface - GetTestBankKeeper() TestBankKeeper - // Testurns a slashing keeper interface with more capabilities than the expected_keepers interface - GetTestSlashingKeeper() TestSlashingKeeper - // Integrurns a distribution keeper interface with more capabilities than the expected_keepers interface - GetTestDistributionKeeper() TestDistributionKeeper + GetE2eStakingKeeper() E2eStakingKeeper + // Returns a bank keeper interface with more capabilities than the expected_keepers interface + GetE2eBankKeeper() E2eBankKeeper + // Returns a slashing keeper interface with more capabilities than the expected_keepers interface + GetE2eSlashingKeeper() E2eSlashingKeeper + // Returns a distribution keeper interface with more capabilities than the expected_keepers interface + GetE2eDistributionKeeper() E2eDistributionKeeper + // Tests an account keeper interface with more capabilities than the expected_keepers interface + GetE2eAccountKeeper() E2eAccountKeeper } // The interface that any consumer app must implement to be compatible with integration tests @@ -104,6 +107,8 @@ type TestBankKeeper interface { ccvtypes.BankKeeper SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, + recipientAddr sdk.AccAddress, amt sdk.Coins) error } type TestAccountKeeper interface { diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index a3f1c48f6d..8b77d0dde7 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -60,6 +60,20 @@ func (mr *MockStakingKeeperMockRecorder) Delegation(ctx, addr, valAddr interface return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delegation", reflect.TypeOf((*MockStakingKeeper)(nil).Delegation), ctx, addr, valAddr) } +// BondDenom mocks base method. +func (m *MockStakingKeeper) BondDenom(ctx types.Context) string { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BondDenom", ctx) + ret0, _ := ret[0].(string) + return ret0 +} + +// BondDenom indicates an expected call of BondDenom. +func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) +} + // GetLastTotalPower mocks base method. func (m *MockStakingKeeper) GetLastTotalPower(ctx types.Context) types.Int { m.ctrl.T.Helper() @@ -724,6 +738,43 @@ func (mr *MockClientKeeperMockRecorder) GetSelfConsensusState(ctx, height interf return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSelfConsensusState", reflect.TypeOf((*MockClientKeeper)(nil).GetSelfConsensusState), ctx, height) } +// MockDistributionKeeper is a mock of DistributionKeeper interface. +type MockDistributionKeeper struct { + ctrl *gomock.Controller + recorder *MockDistributionKeeperMockRecorder +} + +// MockDistributionKeeperMockRecorder is the mock recorder for MockDistributionKeeper. +type MockDistributionKeeperMockRecorder struct { + mock *MockDistributionKeeper +} + +// NewMockDistributionKeeper creates a new mock instance. +func NewMockDistributionKeeper(ctrl *gomock.Controller) *MockDistributionKeeper { + mock := &MockDistributionKeeper{ctrl: ctrl} + mock.recorder = &MockDistributionKeeperMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDistributionKeeper) EXPECT() *MockDistributionKeeperMockRecorder { + return m.recorder +} + +// FundCommunityPool mocks base method. +func (m *MockDistributionKeeper) FundCommunityPool(ctx types.Context, amount types.Coins, sender types.AccAddress) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "FundCommunityPool", ctx, amount, sender) + ret0, _ := ret[0].(error) + return ret0 +} + +// FundCommunityPool indicates an expected call of FundCommunityPool. +func (mr *MockDistributionKeeperMockRecorder) FundCommunityPool(ctx, amount, sender interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FundCommunityPool", reflect.TypeOf((*MockDistributionKeeper)(nil).FundCommunityPool), ctx, amount, sender) +} + // MockConsumerHooks is a mock of ConsumerHooks interface. type MockConsumerHooks struct { ctrl *gomock.Controller diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index 93789dbb60..ca9b8cb655 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -88,23 +88,25 @@ type MockedKeepers struct { *MockIBCTransferKeeper *MockIBCCoreKeeper *MockEvidenceKeeper + *MockDistributionKeeper } // NewMockedKeepers instantiates a struct with pointers to properly instantiated mocked keepers. func NewMockedKeepers(ctrl *gomock.Controller) MockedKeepers { return MockedKeepers{ - MockScopedKeeper: NewMockScopedKeeper(ctrl), - MockChannelKeeper: NewMockChannelKeeper(ctrl), - MockPortKeeper: NewMockPortKeeper(ctrl), - MockConnectionKeeper: NewMockConnectionKeeper(ctrl), - MockClientKeeper: NewMockClientKeeper(ctrl), - MockStakingKeeper: NewMockStakingKeeper(ctrl), - MockSlashingKeeper: NewMockSlashingKeeper(ctrl), - MockAccountKeeper: NewMockAccountKeeper(ctrl), - MockBankKeeper: NewMockBankKeeper(ctrl), - MockIBCTransferKeeper: NewMockIBCTransferKeeper(ctrl), - MockIBCCoreKeeper: NewMockIBCCoreKeeper(ctrl), - MockEvidenceKeeper: NewMockEvidenceKeeper(ctrl), + MockScopedKeeper: NewMockScopedKeeper(ctrl), + MockChannelKeeper: NewMockChannelKeeper(ctrl), + MockPortKeeper: NewMockPortKeeper(ctrl), + MockConnectionKeeper: NewMockConnectionKeeper(ctrl), + MockClientKeeper: NewMockClientKeeper(ctrl), + MockStakingKeeper: NewMockStakingKeeper(ctrl), + MockSlashingKeeper: NewMockSlashingKeeper(ctrl), + MockAccountKeeper: NewMockAccountKeeper(ctrl), + MockBankKeeper: NewMockBankKeeper(ctrl), + MockIBCTransferKeeper: NewMockIBCTransferKeeper(ctrl), + MockIBCCoreKeeper: NewMockIBCCoreKeeper(ctrl), + MockEvidenceKeeper: NewMockEvidenceKeeper(ctrl), + MockDistributionKeeper: NewMockDistributionKeeper(ctrl), } } @@ -123,6 +125,8 @@ func NewInMemProviderKeeper(params InMemKeeperParams, mocks MockedKeepers) provi mocks.MockSlashingKeeper, mocks.MockAccountKeeper, mocks.MockEvidenceKeeper, + mocks.MockDistributionKeeper, + mocks.MockBankKeeper, authtypes.FeeCollectorName, ) } @@ -212,8 +216,9 @@ func SetupForStoppingConsumerChain(t *testing.T, ctx sdk.Context, "chainID", clienttypes.NewHeight(4, 5)) expectations = append(expectations, GetMocksForSetConsumerChain(ctx, &mocks, "chainID")...) expectations = append(expectations, GetMocksForStopConsumerChain(ctx, &mocks)...) + expectations = append(expectations, mocks.MockStakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake").AnyTimes()) - gomock.InOrder(expectations...) + gomock.InAnyOrder(expectations) prop := GetTestConsumerAdditionProp() err := providerKeeper.CreateConsumerClient(ctx, prop) diff --git a/x/ccv/consumer/keeper/distribution.go b/x/ccv/consumer/keeper/distribution.go index 140e135c12..91ee28ea27 100644 --- a/x/ccv/consumer/keeper/distribution.go +++ b/x/ccv/consumer/keeper/distribution.go @@ -107,23 +107,34 @@ func (k Keeper) SendRewardsToProvider(ctx sdk.Context) error { if found && transferChannel.State == channeltypes.OPEN { tstProviderAddr := k.authKeeper.GetModuleAccount(ctx, types.ConsumerToSendToProviderName).GetAddress() - tstProviderTokens := k.bankKeeper.GetAllBalances(ctx, tstProviderAddr) providerAddr := k.GetProviderFeePoolAddrStr(ctx) timeoutHeight := clienttypes.ZeroHeight() transferTimeoutPeriod := k.GetTransferTimeoutPeriod(ctx) timeoutTimestamp := uint64(ctx.BlockTime().Add(transferTimeoutPeriod).UnixNano()) - for _, token := range tstProviderTokens { - err := k.ibcTransferKeeper.SendTransfer(ctx, - transfertypes.PortID, - ch, - token, - tstProviderAddr, - providerAddr, - timeoutHeight, - timeoutTimestamp, - ) - if err != nil { - return err + + sentCoins := sdk.NewCoins() + + // iterate over all whitelisted reward denoms + for _, denom := range k.AllowedRewardDenoms(ctx) { + // get the balance of the denom in the toSendToProviderTokens address + balance := k.bankKeeper.GetBalance(ctx, tstProviderAddr, denom) + + // if the balance is not zero, + if !balance.IsZero() { + // send the balance to the provider + err := k.ibcTransferKeeper.SendTransfer(ctx, + transfertypes.PortID, + ch, + balance, + tstProviderAddr, + providerAddr, + timeoutHeight, + timeoutTimestamp, + ) + if err != nil { + return err + } + sentCoins = sentCoins.Add(balance) } } @@ -132,7 +143,7 @@ func (k Keeper) SendRewardsToProvider(ctx sdk.Context) error { k.Logger(ctx).Info("sent block rewards to provider", "total fee pool", fpTokens.String(), - "sent", tstProviderTokens.String(), + "sent", sentCoins.String(), ) currentHeight := ctx.BlockHeight() ctx.EventManager().EmitEvent( @@ -143,7 +154,7 @@ func (k Keeper) SendRewardsToProvider(ctx sdk.Context) error { sdk.NewAttribute(ccv.AttributeDistributionNextHeight, strconv.Itoa(int(currentHeight+k.GetBlocksPerDistributionTransmission(ctx)))), sdk.NewAttribute(ccv.AttributeDistributionFraction, (k.GetConsumerRedistributionFrac(ctx))), sdk.NewAttribute(ccv.AttributeDistributionTotal, fpTokens.String()), - sdk.NewAttribute(ccv.AttributeDistributionToProvider, tstProviderTokens.String()), + sdk.NewAttribute(ccv.AttributeDistributionToProvider, sentCoins.String()), ), ) } @@ -151,6 +162,34 @@ func (k Keeper) SendRewardsToProvider(ctx sdk.Context) error { return nil } +// AllowedRewardDenoms returns a list of all denoms that are allowed +// to be sent to the provider as rewards +func (k Keeper) AllowedRewardDenoms(ctx sdk.Context) []string { + var rewardDenoms []string + + // first, append the native reward denoms + rewardDenoms = append(rewardDenoms, k.GetRewardDenoms(ctx)...) + + // then, append the provider-originated reward denoms + for _, denom := range k.GetProviderRewardDenoms(ctx) { + // every provider denom was sent over IBC, + // so we must prefix the denom + sourcePrefix := transfertypes.GetDenomPrefix( + transfertypes.PortID, + k.GetDistributionTransmissionChannel(ctx), + ) + // NOTE: sourcePrefix contains the trailing "/" + prefixedDenom := sourcePrefix + denom + // construct the denomination trace from the full raw denomination + denomTrace := transfertypes.ParseDenomTrace(prefixedDenom) + + // append the IBC denom to the list of allowed reward denoms + rewardDenoms = append(rewardDenoms, denomTrace.IBCDenom()) + } + + return rewardDenoms +} + func (k Keeper) GetLastTransmissionBlockHeight(ctx sdk.Context) types.LastTransmissionBlockHeight { store := ctx.KVStore(k.storeKey) bz := store.Get(types.LastDistributionTransmissionKey()) diff --git a/x/ccv/consumer/keeper/distribution_test.go b/x/ccv/consumer/keeper/distribution_test.go index 39d7e22e5e..d1bd7c2164 100644 --- a/x/ccv/consumer/keeper/distribution_test.go +++ b/x/ccv/consumer/keeper/distribution_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "strings" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -65,3 +66,25 @@ func TestGetEstimatedNextFeeDistribution(t *testing.T) { require.NotEmpty(t, res) require.EqualValues(t, expect, res, "fee distribution data does not match") } + +func TestAllowedRewardDenoms(t *testing.T) { + keeperParams := testkeeper.NewInMemKeeperParams(t) + ctx := keeperParams.Ctx + + ctrl := gomock.NewController(t) + defer ctrl.Finish() + mocks := testkeeper.NewMockedKeepers(ctrl) + consumerKeeper := testkeeper.NewInMemConsumerKeeper(keeperParams, mocks) + params := types.DefaultParams() + params.RewardDenoms = []string{"ustake"} + params.ProviderRewardDenoms = []string{"uatom"} + consumerKeeper.SetParams(ctx, params) + + transferChannelID := "channel-5" + consumerKeeper.SetDistributionTransmissionChannel(ctx, transferChannelID) + + allowedDenoms := consumerKeeper.AllowedRewardDenoms(ctx) + require.Len(t, allowedDenoms, 2) + require.Equal(t, allowedDenoms[0], "ustake") + require.True(t, strings.HasPrefix(allowedDenoms[1], "ibc/")) +} diff --git a/x/ccv/consumer/keeper/params.go b/x/ccv/consumer/keeper/params.go index 69e975f702..1a0a071ce2 100644 --- a/x/ccv/consumer/keeper/params.go +++ b/x/ccv/consumer/keeper/params.go @@ -22,6 +22,8 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { k.GetHistoricalEntries(ctx), k.GetUnbondingPeriod(ctx), k.GetSoftOptOutThreshold(ctx), + k.GetRewardDenoms(ctx), + k.GetProviderRewardDenoms(ctx), ) } @@ -115,3 +117,15 @@ func (k Keeper) GetSoftOptOutThreshold(ctx sdk.Context) string { k.paramStore.Get(ctx, types.KeySoftOptOutThreshold, &str) return str } + +func (k Keeper) GetRewardDenoms(ctx sdk.Context) []string { + var denoms []string + k.paramStore.Get(ctx, types.KeyRewardDenoms, &denoms) + return denoms +} + +func (k Keeper) GetProviderRewardDenoms(ctx sdk.Context) []string { + var denoms []string + k.paramStore.Get(ctx, types.KeyProviderRewardDenoms, &denoms) + return denoms +} diff --git a/x/ccv/consumer/keeper/params_test.go b/x/ccv/consumer/keeper/params_test.go index 6b3dcd57e1..674b57226c 100644 --- a/x/ccv/consumer/keeper/params_test.go +++ b/x/ccv/consumer/keeper/params_test.go @@ -16,6 +16,8 @@ func TestParams(t *testing.T) { defer ctrl.Finish() consumerKeeper.SetParams(ctx, types.DefaultParams()) + var rewardDenoms []string + var provideRewardDenoms []string expParams := types.NewParams( false, 1000, @@ -27,6 +29,8 @@ func TestParams(t *testing.T) { types.DefaultHistoricalEntries, types.DefaultConsumerUnbondingPeriod, types.DefaultSoftOptOutThreshold, + rewardDenoms, + provideRewardDenoms, ) // these are the default params, IBC suite independently sets enabled=true params := consumerKeeper.GetParams(ctx) @@ -34,7 +38,7 @@ func TestParams(t *testing.T) { newParams := types.NewParams(false, 1000, "channel-2", "cosmos19pe9pg5dv9k5fzgzmsrgnw9rl9asf7ddwhu7lm", - 7*24*time.Hour, 25*time.Hour, "0.5", 500, 24*21*time.Hour, "0.05") + 7*24*time.Hour, 25*time.Hour, "0.5", 500, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}) consumerKeeper.SetParams(ctx, newParams) params = consumerKeeper.GetParams(ctx) require.Equal(t, newParams, params) diff --git a/x/ccv/consumer/types/consumer.pb.go b/x/ccv/consumer/types/consumer.pb.go index 3c3e3e8d04..34ef7d0718 100644 --- a/x/ccv/consumer/types/consumer.pb.go +++ b/x/ccv/consumer/types/consumer.pb.go @@ -67,6 +67,11 @@ type Params struct { // can opt out of running the consumer chain without being punished. For example, a // value of 0.05 means that the validators in the bottom 5% of the set can opt out SoftOptOutThreshold string `protobuf:"bytes,10,opt,name=soft_opt_out_threshold,json=softOptOutThreshold,proto3" json:"soft_opt_out_threshold,omitempty"` + // Reward denoms. These are the denominations which are allowed to be sent to the provider as rewards. + RewardDenoms []string `protobuf:"bytes,11,rep,name=reward_denoms,json=rewardDenoms,proto3" json:"reward_denoms,omitempty"` + // Provider-originated reward denoms. These are denoms coming from the provider + // which are allowed to be used as rewards. e.g. "uatom" + ProviderRewardDenoms []string `protobuf:"bytes,12,rep,name=provider_reward_denoms,json=providerRewardDenoms,proto3" json:"provider_reward_denoms,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -172,6 +177,20 @@ func (m *Params) GetSoftOptOutThreshold() string { return "" } +func (m *Params) GetRewardDenoms() []string { + if m != nil { + return m.RewardDenoms + } + return nil +} + +func (m *Params) GetProviderRewardDenoms() []string { + if m != nil { + return m.ProviderRewardDenoms + } + return nil +} + // LastTransmissionBlockHeight is the last time validator holding // pools were transmitted to the provider chain type LastTransmissionBlockHeight struct { @@ -345,54 +364,56 @@ func init() { } var fileDescriptor_5b27a82b276e7f93 = []byte{ - // 742 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xe3, 0x36, - 0x10, 0xb6, 0x9a, 0x8d, 0x37, 0xcb, 0x6c, 0xd1, 0x5d, 0xad, 0x9b, 0xd5, 0xba, 0x80, 0xec, 0x75, - 0xf7, 0xe0, 0x4b, 0x64, 0xac, 0x83, 0x5e, 0x72, 0x5b, 0x3b, 0x0d, 0x92, 0xfe, 0xc5, 0x55, 0x8c, - 0x1c, 0xda, 0x03, 0x41, 0x51, 0xb4, 0x44, 0x44, 0x22, 0x05, 0x92, 0x52, 0xab, 0xb7, 0xc8, 0xb1, - 0x8f, 0xd0, 0xde, 0xfb, 0x10, 0x41, 0x4f, 0x39, 0xf6, 0x94, 0x16, 0xc9, 0x1b, 0xf4, 0x09, 0x0a, - 0x52, 0x92, 0x13, 0x27, 0x1b, 0x20, 0xb7, 0x19, 0x7c, 0xdf, 0x7c, 0x9c, 0x19, 0x7e, 0x24, 0x18, - 0x53, 0xa6, 0x88, 0xc0, 0x31, 0xa2, 0x0c, 0x4a, 0x82, 0x73, 0x41, 0x55, 0x39, 0xc2, 0xb8, 0x18, - 0x61, 0xce, 0x64, 0x9e, 0x12, 0x31, 0x2a, 0xde, 0x2f, 0x63, 0x2f, 0x13, 0x5c, 0x71, 0xfb, 0xcb, - 0x8f, 0xd4, 0x78, 0x18, 0x17, 0xde, 0x92, 0x57, 0xbc, 0xef, 0xbe, 0x7b, 0x48, 0x58, 0xeb, 0xe1, - 0xa2, 0x92, 0xea, 0xbe, 0x89, 0x38, 0x8f, 0x12, 0x32, 0x32, 0x59, 0x90, 0x2f, 0x46, 0x88, 0x95, - 0x35, 0xd4, 0x89, 0x78, 0xc4, 0x4d, 0x38, 0xd2, 0x51, 0x53, 0x80, 0xb9, 0x4c, 0xb9, 0x84, 0x15, - 0x50, 0x25, 0x35, 0xe4, 0xde, 0xd5, 0x0a, 0x73, 0x81, 0x14, 0xe5, 0xac, 0xc6, 0x7b, 0x77, 0x71, - 0x45, 0x53, 0x22, 0x15, 0x4a, 0xb3, 0x8a, 0x30, 0xf8, 0x63, 0x1d, 0xb4, 0x67, 0x48, 0xa0, 0x54, - 0xda, 0x0e, 0x78, 0x4a, 0x18, 0x0a, 0x12, 0x12, 0x3a, 0x56, 0xdf, 0x1a, 0x6e, 0xf8, 0x4d, 0x6a, - 0x1f, 0x81, 0x77, 0x41, 0xc2, 0xf1, 0xa9, 0x84, 0x19, 0x11, 0x30, 0xa4, 0x52, 0x09, 0x1a, 0xe4, - 0xfa, 0x18, 0xa8, 0x04, 0x62, 0x32, 0xa5, 0x52, 0x52, 0xce, 0x9c, 0x4f, 0xfa, 0xd6, 0x70, 0xcd, - 0x7f, 0x5b, 0x71, 0x67, 0x44, 0xec, 0xdd, 0x62, 0xce, 0x6f, 0x11, 0xed, 0x6f, 0xc0, 0xdb, 0x07, - 0x55, 0x20, 0x8e, 0x11, 0x63, 0x24, 0x71, 0xd6, 0xfa, 0xd6, 0xf0, 0x99, 0xdf, 0x0b, 0x1f, 0x10, - 0x99, 0x56, 0x34, 0x7b, 0x17, 0x74, 0x33, 0xc1, 0x0b, 0x1a, 0x12, 0x01, 0x17, 0x84, 0xc0, 0x8c, - 0xf3, 0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4c, 0xdf, 0xc7, 0xf3, 0xa6, 0x54, - 0x83, 0x93, 0xf9, 0xf9, 0x95, 0x6b, 0x5d, 0x5c, 0xb9, 0xd6, 0xbf, 0x57, 0xae, 0x75, 0x76, 0xed, - 0xb6, 0x2e, 0xae, 0xdd, 0xd6, 0xdf, 0xd7, 0x6e, 0xeb, 0xa7, 0xdd, 0x88, 0xaa, 0x38, 0x0f, 0x3c, - 0xcc, 0xd3, 0xfa, 0xdf, 0x19, 0xdd, 0x7c, 0x71, 0xdb, 0xcb, 0x2f, 0xee, 0xd7, 0xd5, 0xdf, 0x53, - 0x95, 0x19, 0x91, 0x41, 0xdb, 0x74, 0xb0, 0xf3, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x71, 0xcd, - 0x22, 0x5f, 0x6e, 0x05, 0x00, 0x00, + // 781 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x6e, 0xdb, 0x36, + 0x18, 0x8f, 0x96, 0xd6, 0x4d, 0x98, 0x14, 0x6b, 0x59, 0x2f, 0x55, 0x3d, 0x40, 0x76, 0xdd, 0x1e, + 0x7c, 0x89, 0x8c, 0x3a, 0xdb, 0x25, 0xb7, 0xda, 0x59, 0xd1, 0xee, 0x5f, 0x3c, 0xd5, 0xe8, 0x61, + 0x3b, 0x10, 0x14, 0x45, 0x4b, 0x44, 0x24, 0x52, 0x20, 0x29, 0x75, 0xba, 0xef, 0x01, 0x7a, 0xdc, + 0x23, 0xec, 0x01, 0xf6, 0x10, 0xc5, 0x4e, 0x3d, 0xee, 0xd4, 0x0d, 0xc9, 0x1b, 0xec, 0x09, 0x06, + 0x52, 0x92, 0x6b, 0xa7, 0x0d, 0x90, 0x1b, 0x3f, 0xfd, 0x7e, 0xdf, 0x4f, 0xdf, 0x7f, 0x30, 0x61, + 0x5c, 0x53, 0x49, 0x12, 0xcc, 0x38, 0x52, 0x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, 0x1d, 0xad, 0x82, 0x46, 0x78, + 0xa8, 0xc1, 0xdd, 0x1f, 0xb0, 0x2e, 0x24, 0xe3, 0xf1, 0xab, 0x97, 0xb3, 0x39, 0x26, 0x67, 0x54, + 0x9b, 0x68, 0x4a, 0x45, 0x5e, 0xd4, 0x0b, 0x7f, 0x23, 0xa8, 0x0d, 0xf8, 0x02, 0xdc, 0xce, 0x2c, + 0x55, 0x57, 0x76, 0x84, 0x6d, 0xac, 0x7b, 0x93, 0xde, 0x47, 0x41, 0x2d, 0xda, 0x63, 0x52, 0xb7, + 0xfa, 0x8d, 0x69, 0xf5, 0x7e, 0xeb, 0x6a, 0xc0, 0xe9, 0xe2, 0xed, 0xb9, 0xe7, 0xbc, 0x3b, 0xf7, + 0x9c, 0x7f, 0xcf, 0x3d, 0xe7, 0xcd, 0x85, 0xb7, 0xf5, 0xee, 0xc2, 0xdb, 0xfa, 0xfb, 0xc2, 0xdb, + 0xfa, 0xf9, 0x38, 0x66, 0x3a, 0x29, 0x42, 0x9f, 0x88, 0xac, 0x39, 0x69, 0xe3, 0x0f, 0xd7, 0xf3, + 0x70, 0x75, 0x3d, 0x7f, 0xdd, 0x3c, 0xcc, 0xba, 0xca, 0xa9, 0x0a, 0x3b, 0x36, 0x82, 0xa3, 0xff, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x95, 0x65, 0x18, 0x5a, 0xc9, 0x05, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -415,6 +436,24 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ProviderRewardDenoms) > 0 { + for iNdEx := len(m.ProviderRewardDenoms) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ProviderRewardDenoms[iNdEx]) + copy(dAtA[i:], m.ProviderRewardDenoms[iNdEx]) + i = encodeVarintConsumer(dAtA, i, uint64(len(m.ProviderRewardDenoms[iNdEx]))) + i-- + dAtA[i] = 0x62 + } + } + if len(m.RewardDenoms) > 0 { + for iNdEx := len(m.RewardDenoms) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RewardDenoms[iNdEx]) + copy(dAtA[i:], m.RewardDenoms[iNdEx]) + i = encodeVarintConsumer(dAtA, i, uint64(len(m.RewardDenoms[iNdEx]))) + i-- + dAtA[i] = 0x5a + } + } if len(m.SoftOptOutThreshold) > 0 { i -= len(m.SoftOptOutThreshold) copy(dAtA[i:], m.SoftOptOutThreshold) @@ -649,6 +688,18 @@ func (m *Params) Size() (n int) { if l > 0 { n += 1 + l + sovConsumer(uint64(l)) } + if len(m.RewardDenoms) > 0 { + for _, s := range m.RewardDenoms { + l = len(s) + n += 1 + l + sovConsumer(uint64(l)) + } + } + if len(m.ProviderRewardDenoms) > 0 { + for _, s := range m.ProviderRewardDenoms { + l = len(s) + n += 1 + l + sovConsumer(uint64(l)) + } + } return n } @@ -1018,6 +1069,70 @@ func (m *Params) Unmarshal(dAtA []byte) error { } m.SoftOptOutThreshold = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardDenoms", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsumer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthConsumer + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConsumer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardDenoms = append(m.RewardDenoms, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderRewardDenoms", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsumer + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthConsumer + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConsumer + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProviderRewardDenoms = append(m.ProviderRewardDenoms, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipConsumer(dAtA[iNdEx:]) diff --git a/x/ccv/consumer/types/genesis_test.go b/x/ccv/consumer/types/genesis_test.go index 010f42d035..3a727cdcce 100644 --- a/x/ccv/consumer/types/genesis_test.go +++ b/x/ccv/consumer/types/genesis_test.go @@ -223,6 +223,8 @@ func TestValidateInitialGenesisState(t *testing.T) { types.DefaultHistoricalEntries, types.DefaultConsumerUnbondingPeriod, types.DefaultSoftOptOutThreshold, + []string{}, + []string{}, )), true, }, @@ -422,6 +424,8 @@ func TestValidateRestartGenesisState(t *testing.T) { types.DefaultHistoricalEntries, types.DefaultConsumerUnbondingPeriod, types.DefaultSoftOptOutThreshold, + []string{}, + []string{}, )), true, }, diff --git a/x/ccv/consumer/types/params.go b/x/ccv/consumer/types/params.go index 928900b207..16bd449e27 100644 --- a/x/ccv/consumer/types/params.go +++ b/x/ccv/consumer/types/params.go @@ -53,6 +53,8 @@ var ( KeyHistoricalEntries = []byte("HistoricalEntries") KeyConsumerUnbondingPeriod = []byte("UnbondingPeriod") KeySoftOptOutThreshold = []byte("SoftOptOutThreshold") + KeyRewardDenoms = []byte("RewardDenoms") + KeyProviderRewardDenoms = []byte("ProviderRewardDenoms") ) // ParamKeyTable type declaration for parameters @@ -65,8 +67,7 @@ func NewParams(enabled bool, blocksPerDistributionTransmission int64, distributionTransmissionChannel, providerFeePoolAddrStr string, ccvTimeoutPeriod, transferTimeoutPeriod time.Duration, consumerRedistributionFraction string, historicalEntries int64, - consumerUnbondingPeriod time.Duration, softOptOutThreshold string, -) Params { + consumerUnbondingPeriod time.Duration, softOptOutThreshold string, rewardDenoms []string, providerRewardDenoms []string) Params { return Params{ Enabled: enabled, BlocksPerDistributionTransmission: blocksPerDistributionTransmission, @@ -78,11 +79,15 @@ func NewParams(enabled bool, blocksPerDistributionTransmission int64, HistoricalEntries: historicalEntries, UnbondingPeriod: consumerUnbondingPeriod, SoftOptOutThreshold: softOptOutThreshold, + RewardDenoms: rewardDenoms, + ProviderRewardDenoms: providerRewardDenoms, } } // DefaultParams is the default params for the consumer module func DefaultParams() Params { + var rewardDenoms []string + var provideRewardDenoms []string return NewParams( false, DefaultBlocksPerDistributionTransmission, @@ -94,6 +99,8 @@ func DefaultParams() Params { DefaultHistoricalEntries, DefaultConsumerUnbondingPeriod, DefaultSoftOptOutThreshold, + rewardDenoms, + provideRewardDenoms, ) } @@ -129,6 +136,12 @@ func (p Params) Validate() error { if err := validateSoftOptOutThreshold(p.SoftOptOutThreshold); err != nil { return err } + if err := validateDenoms(p.RewardDenoms); err != nil { + return err + } + if err := validateDenoms(p.ProviderRewardDenoms); err != nil { + return err + } return nil } @@ -154,6 +167,10 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { p.UnbondingPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySoftOptOutThreshold, p.SoftOptOutThreshold, validateSoftOptOutThreshold), + paramtypes.NewParamSetPair(KeyRewardDenoms, + p.RewardDenoms, validateDenoms), + paramtypes.NewParamSetPair(KeyProviderRewardDenoms, + p.ProviderRewardDenoms, validateDenoms), } } @@ -192,3 +209,24 @@ func validateSoftOptOutThreshold(i interface{}) error { } return nil } + +func validateDenoms(i interface{}) error { + v, ok := i.([]string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + // iterate over the denoms, turning them into coins and validating them + for _, denom := range v { + coin := sdktypes.Coin{ + Denom: denom, + Amount: sdktypes.NewInt(0), + } + + if err := coin.Validate(); err != nil { + return err + } + } + + return nil +} diff --git a/x/ccv/consumer/types/params_test.go b/x/ccv/consumer/types/params_test.go index cad6a58ae1..83b641b18d 100644 --- a/x/ccv/consumer/types/params_test.go +++ b/x/ccv/consumer/types/params_test.go @@ -17,62 +17,36 @@ func TestValidateParams(t *testing.T) { expPass bool }{ {"default params", consumertypes.DefaultParams(), true}, - { - "custom valid params", - consumertypes.NewParams(true, 5, "", "", 1004, 1005, "0.5", 1000, 24*21*time.Hour, "0.1"), true, - }, - { - "custom invalid params, block per dist transmission", - consumertypes.NewParams(true, -5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, dist transmission channel", - consumertypes.NewParams(true, 5, "badchannel/", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, provider fee pool addr string", - consumertypes.NewParams(true, 5, "", "imabadaddress", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, ccv timeout", - consumertypes.NewParams(true, 5, "", "", -5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, transfer timeout", - consumertypes.NewParams(true, 5, "", "", 1004, -7, "0.5", 1000, 24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, consumer redist fraction is negative", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "-0.5", 1000, 24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, consumer redist fraction is over 1", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "1.2", 1000, 24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, bad consumer redist fraction ", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "notFrac", 1000, 24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, negative num historical entries", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", -100, 24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, negative unbonding period", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, -24*21*time.Hour, "0.05"), false, - }, - { - "custom invalid params, soft opt out threshold is negative", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "-0.05"), false, - }, - { - "custom invalid params, soft opt out threshold is over 0.2", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.44"), false, - }, - { - "custom invalid params, bad soft opt out threshold ", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "nickelback"), false, - }, + {"custom valid params", + consumertypes.NewParams(true, 5, "", "", 1004, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), true}, + {"custom invalid params, block per dist transmission", + consumertypes.NewParams(true, -5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, dist transmission channel", + consumertypes.NewParams(true, 5, "badchannel/", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, provider fee pool addr string", + consumertypes.NewParams(true, 5, "", "imabadaddress", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, ccv timeout", + consumertypes.NewParams(true, 5, "", "", -5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, transfer timeout", + consumertypes.NewParams(true, 5, "", "", 1004, -7, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, consumer redist fraction is negative", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "-0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, consumer redist fraction is over 1", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "1.2", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, bad consumer redist fraction ", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "notFrac", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, negative num historical entries", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", -100, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, negative unbonding period", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, -24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, + {"custom invalid params, invalid soft opt out threshold", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "-0.05", []string{"u"}, []string{}), false}, + {"custom invalid params, invalid soft opt out threshold", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.5", []string{"u"}, []string{}), false}, + {"custom invalid params, invalid reward denom", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"u"}, []string{}), false}, + {"custom invalid params, invalid provider reward denom", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{}, []string{"a"}), false}, } for _, tc := range testCases { diff --git a/x/ccv/provider/client/cli/query.go b/x/ccv/provider/client/cli/query.go index 922fccd49f..18109db18c 100644 --- a/x/ccv/provider/client/cli/query.go +++ b/x/ccv/provider/client/cli/query.go @@ -32,6 +32,7 @@ func NewQueryCmd() *cobra.Command { cmd.AddCommand(CmdProviderValidatorKey()) cmd.AddCommand(CmdThrottleState()) cmd.AddCommand(CmdThrottledConsumerPacketData()) + cmd.AddCommand(CmdRegisteredConsumerRewardDenoms()) return cmd } @@ -320,3 +321,38 @@ $ %s query provider throttled-consumer-packet-data foochain return cmd } + +func CmdRegisteredConsumerRewardDenoms() *cobra.Command { + cmd := &cobra.Command{ + Use: "registered-consumer-reward-denoms", + Short: "Query registered consumer reward denoms", + Long: strings.TrimSpace( + fmt.Sprintf(`Returns the registered consumer reward denoms. +Example: +$ %s query provider registered-consumer-reward-denoms +`, + version.AppName, + ), + ), + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + req := &types.QueryRegisteredConsumerRewardDenomsRequest{} + res, err := queryClient.QueryRegisteredConsumerRewardDenoms(cmd.Context(), req) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index 667ae4425b..c9f39cff3e 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -2,12 +2,16 @@ package cli import ( "fmt" + "strings" + + "github.com/spf13/cobra" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/version" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/interchain-security/x/ccv/provider/types" @@ -24,6 +28,7 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand(NewAssignConsumerKeyCmd()) + cmd.AddCommand(NewRegisterConsumerRewardDenomCmd()) return cmd } @@ -62,3 +67,37 @@ func NewAssignConsumerKeyCmd() *cobra.Command { return cmd } + +func NewRegisterConsumerRewardDenomCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "register-consumer-reward-denom [denom]", + Args: cobra.ExactArgs(1), + Short: "Registers a denom that can be sent from consumer chains to all validators and delegators as a reward", + Long: strings.TrimSpace( + fmt.Sprintf(`Registers a denom that can be sent from consumer chains to all validators and delegators as a reward. + +Costs a fee, which is specified in genesis.json under the "consumer_reward_denom_fee" key. Will fail if the sending account has an insufficient balance. + +Example: +$ %s tx provider register-consumer-reward-denom untrn --from mykey +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + depositorAddr := clientCtx.GetFromAddress() + + msg := types.NewMsgRegisterConsumerRewardDenom(args[0], depositorAddr) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/ccv/provider/handler.go b/x/ccv/provider/handler.go index 4751b8460c..253c1bf118 100644 --- a/x/ccv/provider/handler.go +++ b/x/ccv/provider/handler.go @@ -17,6 +17,9 @@ func NewHandler(k *keeper.Keeper) sdk.Handler { case *types.MsgAssignConsumerKey: res, err := msgServer.AssignConsumerKey(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgRegisterConsumerRewardDenom: + res, err := msgServer.RegisterConsumerRewardDenom(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) default: return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s message type: %T", types.ModuleName, msg) } diff --git a/x/ccv/provider/handler_test.go b/x/ccv/provider/handler_test.go index 9e723d9858..3b4d1a32f8 100644 --- a/x/ccv/provider/handler_test.go +++ b/x/ccv/provider/handler_test.go @@ -32,8 +32,11 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { providerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(0) providerConsAddr := providerCryptoId.ProviderConsAddress() + providerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(0) + providerConsAddr := providerCryptoId.SDKValConsAddress() + consumerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(1) - consumerConsAddr := consumerCryptoId.ConsumerConsAddress() + consumerConsAddr := consumerCryptoId.SDKValConsAddress() consumerKeyBz := base64.StdEncoding.EncodeToString(consumerCryptoId.ConsensusSDKPubKey().Bytes()) consumerKey := `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"` + consumerKeyBz + `"}` @@ -55,7 +58,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { // Return a valid validator, found! ).Return(providerCryptoId.SDKStakingValidator(), true).Times(1), mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - consumerConsAddr.ToSdkConsAddr(), + consumerConsAddr, ).Return(stakingtypes.Validator{}, false), ) }, @@ -91,7 +94,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { // Return a valid validator, found! ).Return(providerCryptoId.SDKStakingValidator(), true).Times(1), mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - consumerConsAddr.ToSdkConsAddr(), + consumerConsAddr, ).Return(stakingtypes.Validator{}, false), ) }, diff --git a/x/ccv/provider/ibc_module.go b/x/ccv/provider/ibc_module.go index 265310d283..cd91abc614 100644 --- a/x/ccv/provider/ibc_module.go +++ b/x/ccv/provider/ibc_module.go @@ -84,7 +84,7 @@ func (am AppModule) OnChanOpenTry( // the consumer chain must be excluded from the blocked addresses // blacklist or all all ibc-transfers from the consumer chain to the // provider chain will fail - ProviderFeePoolAddr: am.keeper.GetFeeCollectorAddressStr(ctx), + ProviderFeePoolAddr: am.keeper.GetConsumerRewardsPoolAddressStr(ctx), Version: ccv.Version, } mdBz, err := (&md).Marshal() diff --git a/x/ccv/provider/ibc_module_test.go b/x/ccv/provider/ibc_module_test.go index 831464ac1f..7aa0d5de04 100644 --- a/x/ccv/provider/ibc_module_test.go +++ b/x/ccv/provider/ibc_module_test.go @@ -133,7 +133,7 @@ func TestOnChanOpenTry(t *testing.T) { // Expected mock calls moduleAcct := authtypes.ModuleAccount{BaseAccount: &authtypes.BaseAccount{}} - moduleAcct.BaseAccount.Address = authtypes.NewModuleAddress(authtypes.FeeCollectorName).String() + moduleAcct.BaseAccount.Address = authtypes.NewModuleAddress(providertypes.ConsumerRewardsPool).String() // Number of calls is not asserted, since not all code paths are hit for failures gomock.InOrder( @@ -145,7 +145,7 @@ func TestOnChanOpenTry(t *testing.T) { mocks.MockClientKeeper.EXPECT().GetClientState(ctx, "clientIDToConsumer").Return( &ibctmtypes.ClientState{ChainId: "consumerChainID"}, true, ).AnyTimes(), - mocks.MockAccountKeeper.EXPECT().GetModuleAccount(ctx, authtypes.FeeCollectorName).Return(&moduleAcct).AnyTimes(), + mocks.MockAccountKeeper.EXPECT().GetModuleAccount(ctx, providertypes.ConsumerRewardsPool).Return(&moduleAcct).AnyTimes(), ) tc.mutateParams(¶ms, &providerKeeper) diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index b00ec81deb..80e59280c7 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -2,9 +2,80 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/interchain-security/x/ccv/provider/types" ) -func (k Keeper) GetFeeCollectorAddressStr(ctx sdk.Context) string { +// EndBlockRD executes EndBlock logic for the Reward Distribution sub-protocol. +// Reward Distribution follows a simple model: send tokens to the ConsumerRewardsPool, +// from where they sent to the fee collector address +func (k Keeper) EndBlockRD(ctx sdk.Context) { + // transfers all whitelisted consumer rewards to the fee collector address + k.TransferRewardsToFeeCollector(ctx) +} + +func (k Keeper) RegisterConsumerRewardDenom(ctx sdk.Context, denom string, sender sdk.AccAddress) error { + // Send the consumer reward denom registration fee to the community pool + err := k.distributionKeeper.FundCommunityPool(ctx, sdk.NewCoins(k.GetConsumerRewardDenomRegistrationFee(ctx)), sender) + if err != nil { + return err + } + k.SetConsumerRewardDenom(ctx, denom) + k.Logger(ctx).Info("new consumer reward denom registered:", "denom", denom, "sender", sender.String()) + return nil +} + +func (k Keeper) GetConsumerRewardsPoolAddressStr(ctx sdk.Context) string { return k.accountKeeper.GetModuleAccount( - ctx, k.feeCollectorName).GetAddress().String() + ctx, types.ConsumerRewardsPool).GetAddress().String() +} + +func (k Keeper) SetConsumerRewardDenom( + ctx sdk.Context, + denom string, +) { + store := ctx.KVStore(k.storeKey) + store.Set(types.ConsumerRewardDenomsKey(denom), []byte{}) +} + +func (k Keeper) GetAllConsumerRewardDenoms(ctx sdk.Context) (consumerRewardDenoms []string) { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, []byte{types.ConsumerRewardDenomsBytePrefix}) + + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + key := iterator.Key()[1:] + consumerRewardDenoms = append(consumerRewardDenoms, string(key)) + } + + return consumerRewardDenoms +} + +// TransferRewardsToFeeCollector transfers all consumer rewards to the fee collector address +func (k Keeper) TransferRewardsToFeeCollector(ctx sdk.Context) { + // 1. Get the denom whitelist from the store + denoms := k.GetAllConsumerRewardDenoms(ctx) + + // 2. Iterate over the whitelist + for _, denom := range denoms { + // 3. For each denom, retrieve the balance from the consumer rewards pool + balance := k.bankKeeper.GetBalance( + ctx, + k.accountKeeper.GetModuleAccount(ctx, types.ConsumerRewardsPool).GetAddress(), + denom, + ) + + // if the balance is not zero, + if !balance.IsZero() { + // 4. Transfer the balance to the fee collector address + err := k.bankKeeper.SendCoinsFromModuleToModule( + ctx, + types.ConsumerRewardsPool, + k.feeCollectorName, + sdk.NewCoins(balance), + ) + if err != nil { + k.Logger(ctx).Error("cannot sent consumer rewards to fee collector:", "reward", balance.String()) + } + } + } } diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index 20f69aac2c..ff4ffd94b4 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -109,6 +109,8 @@ func TestInitAndExportGenesis(t *testing.T) { ).Return(nil, true).Times(1), mocks.MockStakingKeeper.EXPECT().GetLastTotalPower( ctx).Return(sdk.NewInt(100)).Times(1), // Return total voting power as 100 + mocks.MockStakingKeeper.EXPECT().BondDenom( + ctx).Return("stake").AnyTimes(), // Return bond denom as "stake" ) // init provider chain diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index caebb91deb..9df40b46f8 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -236,3 +236,17 @@ func (k Keeper) getSlashPacketData(ctx sdk.Context, consumerChainID string, ibcS return packet, true } + +func (k Keeper) QueryRegisteredConsumerRewardDenoms(goCtx context.Context, req *types.QueryRegisteredConsumerRewardDenomsRequest) (*types.QueryRegisteredConsumerRewardDenomsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "empty request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + denoms := k.GetAllConsumerRewardDenoms(ctx) + + return &types.QueryRegisteredConsumerRewardDenomsResponse{ + Denoms: denoms, + }, nil +} diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 2a6638cfef..9fae9a5df7 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -28,19 +28,21 @@ import ( // Keeper defines the Cross-Chain Validation Provider Keeper type Keeper struct { - storeKey sdk.StoreKey - cdc codec.BinaryCodec - paramSpace paramtypes.Subspace - scopedKeeper ccv.ScopedKeeper - channelKeeper ccv.ChannelKeeper - portKeeper ccv.PortKeeper - connectionKeeper ccv.ConnectionKeeper - accountKeeper ccv.AccountKeeper - clientKeeper ccv.ClientKeeper - stakingKeeper ccv.StakingKeeper - slashingKeeper ccv.SlashingKeeper - evidenceKeeper ccv.EvidenceKeeper - feeCollectorName string + storeKey sdk.StoreKey + cdc codec.BinaryCodec + paramSpace paramtypes.Subspace + scopedKeeper ccv.ScopedKeeper + channelKeeper ccv.ChannelKeeper + portKeeper ccv.PortKeeper + connectionKeeper ccv.ConnectionKeeper + accountKeeper ccv.AccountKeeper + bankKeeper ccv.BankKeeper + distributionKeeper ccv.DistributionKeeper + clientKeeper ccv.ClientKeeper + stakingKeeper ccv.StakingKeeper + slashingKeeper ccv.SlashingKeeper + evidenceKeeper ccv.EvidenceKeeper + feeCollectorName string } // NewKeeper creates a new provider Keeper instance @@ -50,6 +52,7 @@ func NewKeeper( connectionKeeper ccv.ConnectionKeeper, clientKeeper ccv.ClientKeeper, stakingKeeper ccv.StakingKeeper, slashingKeeper ccv.SlashingKeeper, accountKeeper ccv.AccountKeeper, evidenceKeeper ccv.EvidenceKeeper, + distributionKeeper ccv.DistributionKeeper, bankKeeper ccv.BankKeeper, feeCollectorName string, ) Keeper { // set KeyTable if it has not already been set @@ -57,20 +60,22 @@ func NewKeeper( paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) } - k := Keeper{ - cdc: cdc, - storeKey: key, - paramSpace: paramSpace, - scopedKeeper: scopedKeeper, - channelKeeper: channelKeeper, - portKeeper: portKeeper, - connectionKeeper: connectionKeeper, - accountKeeper: accountKeeper, - clientKeeper: clientKeeper, - stakingKeeper: stakingKeeper, - slashingKeeper: slashingKeeper, - evidenceKeeper: evidenceKeeper, - feeCollectorName: feeCollectorName, + return Keeper{ + cdc: cdc, + storeKey: key, + paramSpace: paramSpace, + scopedKeeper: scopedKeeper, + channelKeeper: channelKeeper, + portKeeper: portKeeper, + connectionKeeper: connectionKeeper, + accountKeeper: accountKeeper, + clientKeeper: clientKeeper, + stakingKeeper: stakingKeeper, + slashingKeeper: slashingKeeper, + evidenceKeeper: evidenceKeeper, + distributionKeeper: distributionKeeper, + bankKeeper: bankKeeper, + feeCollectorName: feeCollectorName, } k.mustValidateFields() diff --git a/x/ccv/provider/keeper/msg_server.go b/x/ccv/provider/keeper/msg_server.go index f4e3a9038e..cd9bb4b673 100644 --- a/x/ccv/provider/keeper/msg_server.go +++ b/x/ccv/provider/keeper/msg_server.go @@ -105,3 +105,24 @@ func (k msgServer) AssignConsumerKey(goCtx context.Context, msg *types.MsgAssign return &types.MsgAssignConsumerKeyResponse{}, nil } + +func (k msgServer) RegisterConsumerRewardDenom(goCtx context.Context, msg *types.MsgRegisterConsumerRewardDenom) (*types.MsgRegisterConsumerRewardDenomResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + depositer, err := sdk.AccAddressFromBech32(msg.Depositor) + if err != nil { + return nil, err + } + + if err := k.Keeper.RegisterConsumerRewardDenom(ctx, msg.Denom, depositer); err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent(sdk.NewEvent( + ccvtypes.EventTypeRegisterConsumerRewardDenom, + sdk.NewAttribute(ccvtypes.AttributeConsumerRewardDenom, msg.Denom), + sdk.NewAttribute(ccvtypes.AttributeConsumerRewardDepositor, msg.Depositor), + )) + + return &types.MsgRegisterConsumerRewardDenomResponse{}, nil +} diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index 8484dd2426..849d582187 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -77,6 +77,18 @@ func (k Keeper) GetMaxThrottledPackets(ctx sdk.Context) int64 { return p } +func (k Keeper) GetConsumerRewardDenomRegistrationFee(ctx sdk.Context) sdk.Coin { + // var c sdk.Coin + // k.paramSpace.Get(ctx, types.KeyConsumerRewardDenomRegistrationFee, &c) + // return c + + // The above commented code is what we should use, however due to difficulties doing + // migrations in coordinated upgrades, we will hardcode the value for now. + // A future scheduled upgrade will change this to the above code and run migrations to add the param. + // This will allow us to change the fee by governance, but for now it is set at 10 Atoms. + return sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), sdk.NewInt(10000000)) +} + // GetParams returns the paramset for the provider module func (k Keeper) GetParams(ctx sdk.Context) types.Params { return types.NewParams( @@ -88,6 +100,7 @@ func (k Keeper) GetParams(ctx sdk.Context) types.Params { k.GetSlashMeterReplenishPeriod(ctx), k.GetSlashMeterReplenishFraction(ctx), k.GetMaxThrottledPackets(ctx), + k.GetConsumerRewardDenomRegistrationFee(ctx), ) } diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index f0c749bcf6..ea93a53a24 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -4,11 +4,13 @@ import ( "testing" "time" + sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types" testkeeper "github.com/cosmos/interchain-security/testutil/keeper" providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" ) @@ -16,7 +18,9 @@ import ( func TestParams(t *testing.T) { // Construct an in-mem keeper with registered key table keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) + providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) + gomock.InAnyOrder(mocks.MockStakingKeeper.EXPECT().BondDenom( + ctx).Return("stake").AnyTimes()) defer ctrl.Finish() defaultParams := providertypes.DefaultParams() @@ -44,6 +48,10 @@ func TestParams(t *testing.T) { time.Hour, "0.4", 100, + sdk.Coin{ + Denom: "stake", + Amount: sdk.NewInt(10000000), + }, ) providerKeeper.SetParams(ctx, newParams) params = providerKeeper.GetParams(ctx) diff --git a/x/ccv/provider/keeper/proposal.go b/x/ccv/provider/keeper/proposal.go index 158b4af3ce..a047a004ad 100644 --- a/x/ccv/provider/keeper/proposal.go +++ b/x/ccv/provider/keeper/proposal.go @@ -310,6 +310,8 @@ func (k Keeper) MakeConsumerGenesis( prop.HistoricalEntries, prop.UnbondingPeriod, "0.05", + []string{}, + []string{}, ) gen = *consumertypes.NewInitialGenesisState( diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index 9ef1d594aa..0a599b0a89 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -104,8 +104,9 @@ func TestHandleConsumerAdditionProposal(t *testing.T) { if tc.expAppendProp { // Mock calls are only asserted if we expect a client to be created. - gomock.InOrder( - testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, tc.prop.ChainId, clienttypes.NewHeight(2, 3))..., + gomock.InAnyOrder( + append(testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, tc.prop.ChainId, clienttypes.NewHeight(2, 3)), + mocks.MockStakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake").AnyTimes()), ) } @@ -147,9 +148,10 @@ func TestCreateConsumerClient(t *testing.T) { description: "No state mutation, new client should be created", setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) { // Valid client creation is asserted with mock expectations here - gomock.InOrder( - testkeeper.GetMocksForCreateConsumerClient(ctx, mocks, "chainID", clienttypes.NewHeight(4, 5))..., - ) + gomock.InAnyOrder(append( + testkeeper.GetMocksForCreateConsumerClient(ctx, mocks, "chainID", clienttypes.NewHeight(4, 5)), + mocks.MockStakingKeeper.EXPECT().BondDenom(ctx).Return("stake").AnyTimes(), + )) }, expClientCreated: true, }, @@ -819,6 +821,10 @@ func TestMakeConsumerGenesis(t *testing.T) { SlashMeterReplenishPeriod: providertypes.DefaultSlashMeterReplenishPeriod, SlashMeterReplenishFraction: providertypes.DefaultSlashMeterReplenishFraction, MaxThrottledPackets: providertypes.DefaultMaxThrottledPackets, + ConsumerRewardDenomRegistrationFee: sdk.Coin{ + Denom: "stake", + Amount: sdk.NewInt(1000000), + }, } providerKeeper.SetParams(ctx, moduleParams) defer ctrl.Finish() @@ -845,7 +851,7 @@ func TestMakeConsumerGenesis(t *testing.T) { actualGenesis, _, err := providerKeeper.MakeConsumerGenesis(ctx, &prop) require.NoError(t, err) - jsonString := `{"params":{"enabled":true, "blocks_per_distribution_transmission":1000, "ccv_timeout_period":2419200000000000, "transfer_timeout_period": 3600000000000, "consumer_redistribution_fraction":"0.75", "historical_entries":10000, "unbonding_period": 1728000000000000, "soft_opt_out_threshold": "0.05"},"new_chain":true,"provider_client_state":{"chain_id":"testchain1","trust_level":{"numerator":1,"denominator":3},"trusting_period":1197504000000000,"unbonding_period":1814400000000000,"max_clock_drift":10000000000,"frozen_height":{},"latest_height":{"revision_height":5},"proof_specs":[{"leaf_spec":{"hash":1,"prehash_value":1,"length":1,"prefix":"AA=="},"inner_spec":{"child_order":[0,1],"child_size":33,"min_prefix_length":4,"max_prefix_length":12,"hash":1}},{"leaf_spec":{"hash":1,"prehash_value":1,"length":1,"prefix":"AA=="},"inner_spec":{"child_order":[0,1],"child_size":32,"min_prefix_length":1,"max_prefix_length":1,"hash":1}}],"upgrade_path":["upgrade","upgradedIBCState"],"allow_update_after_expiry":true,"allow_update_after_misbehaviour":true},"provider_consensus_state":{"timestamp":"2020-01-02T00:00:10Z","root":{"hash":"LpGpeyQVLUo9HpdsgJr12NP2eCICspcULiWa5u9udOA="},"next_validators_hash":"E30CE736441FB9101FADDAF7E578ABBE6DFDB67207112350A9A904D554E1F5BE"},"unbonding_sequences":null,"initial_val_set":[{"pub_key":{"type":"tendermint/PubKeyEd25519","value":"dcASx5/LIKZqagJWN0frOlFtcvz91frYmj/zmoZRWro="},"power":1}]}` + jsonString := `{"params":{"enabled":true, "blocks_per_distribution_transmission":1000, "ccv_timeout_period":2419200000000000, "transfer_timeout_period": 3600000000000, "consumer_redistribution_fraction":"0.75", "historical_entries":10000, "unbonding_period": 1728000000000000, "soft_opt_out_threshold": "0.05", "reward_denoms": [], "provider_reward_denoms": []},"new_chain":true,"provider_client_state":{"chain_id":"testchain1","trust_level":{"numerator":1,"denominator":3},"trusting_period":1197504000000000,"unbonding_period":1814400000000000,"max_clock_drift":10000000000,"frozen_height":{},"latest_height":{"revision_height":5},"proof_specs":[{"leaf_spec":{"hash":1,"prehash_value":1,"length":1,"prefix":"AA=="},"inner_spec":{"child_order":[0,1],"child_size":33,"min_prefix_length":4,"max_prefix_length":12,"hash":1}},{"leaf_spec":{"hash":1,"prehash_value":1,"length":1,"prefix":"AA=="},"inner_spec":{"child_order":[0,1],"child_size":32,"min_prefix_length":1,"max_prefix_length":1,"hash":1}}],"upgrade_path":["upgrade","upgradedIBCState"],"allow_update_after_expiry":true,"allow_update_after_misbehaviour":true},"provider_consensus_state":{"timestamp":"2020-01-02T00:00:10Z","root":{"hash":"LpGpeyQVLUo9HpdsgJr12NP2eCICspcULiWa5u9udOA="},"next_validators_hash":"E30CE736441FB9101FADDAF7E578ABBE6DFDB67207112350A9A904D554E1F5BE"},"unbonding_sequences":null,"initial_val_set":[{"pub_key":{"type":"tendermint/PubKeyEd25519","value":"dcASx5/LIKZqagJWN0frOlFtcvz91frYmj/zmoZRWro="},"power":1}]}` var expectedGenesis consumertypes.GenesisState err = json.Unmarshal([]byte(jsonString), &expectedGenesis) @@ -917,9 +923,11 @@ func TestBeginBlockInit(t *testing.T) { } // Expect client creation for only for the 1st and second proposals (spawn time already passed and valid) - gomock.InOrder( - append(testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain1", clienttypes.NewHeight(3, 4)), - testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain2", clienttypes.NewHeight(3, 4))...)..., + gomock.InAnyOrder( + append(append(testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain1", clienttypes.NewHeight(3, 4)), + testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain2", clienttypes.NewHeight(3, 4))...), + mocks.MockStakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake").AnyTimes(), + ), ) for _, prop := range pendingProps { @@ -985,8 +993,9 @@ func TestBeginBlockCCR(t *testing.T) { // Only first two consumer chains should be stopped expectations = append(expectations, testkeeper.GetMocksForStopConsumerChain(ctx, &mocks)...) expectations = append(expectations, testkeeper.GetMocksForStopConsumerChain(ctx, &mocks)...) + expectations = append(expectations, mocks.MockStakingKeeper.EXPECT().BondDenom(ctx).Return("stake").AnyTimes()) - gomock.InOrder(expectations...) + gomock.InAnyOrder(expectations) // // Remaining setup diff --git a/x/ccv/provider/module.go b/x/ccv/provider/module.go index cba9af2ae7..39347f9709 100644 --- a/x/ccv/provider/module.go +++ b/x/ccv/provider/module.go @@ -163,6 +163,8 @@ func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.V am.keeper.EndBlockCCR(ctx) // EndBlock logic needed for the Validator Set Update sub-protocol am.keeper.EndBlockVSU(ctx) + // EndBlock logic need for the Reward Distribution sub-protocol + am.keeper.EndBlockRD(ctx) return []abci.ValidatorUpdate{} } diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index 28a4b26b5d..4d4fe0e8d3 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -122,6 +122,8 @@ func TestInitGenesis(t *testing.T) { &capabilitytypes.Capability{}, tc.isBound, // Capability is returned successfully if port capability is already bound to this module. ), + mocks.MockStakingKeeper.EXPECT().BondDenom( + ctx).Return("stake").AnyTimes(), } // If port capability is not already bound, port will be bound and capability claimed. @@ -144,7 +146,7 @@ func TestInitGenesis(t *testing.T) { ) } - gomock.InOrder(orderedCalls...) + gomock.InAnyOrder(orderedCalls) // // Execute method, then assert expected results diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 570598034c..129a9f3158 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -95,16 +95,20 @@ func TestProviderProposalHandler(t *testing.T) { // Mock expectations depending on expected outcome switch { case tc.expValidConsumerAddition: - gomock.InOrder(testkeeper.GetMocksForCreateConsumerClient( + gomock.InAnyOrder(append(testkeeper.GetMocksForCreateConsumerClient( ctx, &mocks, "chainID", clienttypes.NewHeight(2, 3), - )...) + ), mocks.MockStakingKeeper.EXPECT().BondDenom( + gomock.Any()).Return("stake").AnyTimes())) case tc.expValidConsumerRemoval: testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) case tc.expValidEquivocation: - providerKeeper.SetSlashLog(ctx, providertypes.NewProviderConsAddress(equivocation.GetConsensusAddress())) - mocks.MockEvidenceKeeper.EXPECT().HandleEquivocationEvidence(ctx, equivocation) + providerKeeper.SetSlashLog(ctx, equivocation.GetConsensusAddress()) + gomock.InAnyOrder([]*gomock.Call{ + mocks.MockEvidenceKeeper.EXPECT().HandleEquivocationEvidence(ctx, equivocation), + mocks.MockStakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake").AnyTimes(), + }) } // Execution diff --git a/x/ccv/provider/types/codec.go b/x/ccv/provider/types/codec.go index 97772e7f00..3e4b34dd42 100644 --- a/x/ccv/provider/types/codec.go +++ b/x/ccv/provider/types/codec.go @@ -27,10 +27,15 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*sdk.Msg)(nil), &MsgAssignConsumerKey{}, ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgRegisterConsumerRewardDenom{}, + ) registry.RegisterImplementations( (*govtypes.Content)(nil), &EquivocationProposal{}, ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/ccv/provider/types/errors.go b/x/ccv/provider/types/errors.go index 89505e3fd4..01e0473049 100644 --- a/x/ccv/provider/types/errors.go +++ b/x/ccv/provider/types/errors.go @@ -6,17 +6,18 @@ import ( // Provider sentinel errors var ( - ErrInvalidConsumerAdditionProposal = sdkerrors.Register(ModuleName, 1, "invalid consumer addition proposal") - ErrInvalidConsumerRemovalProp = sdkerrors.Register(ModuleName, 2, "invalid consumer removal proposal") - ErrUnknownConsumerChainId = sdkerrors.Register(ModuleName, 3, "no consumer chain with this chain id") - ErrUnknownConsumerChannelId = sdkerrors.Register(ModuleName, 4, "no consumer chain with this channel id") - ErrInvalidConsumerConsensusPubKey = sdkerrors.Register(ModuleName, 5, "empty consumer consensus public key") - ErrBlankConsumerChainID = sdkerrors.Register(ModuleName, 6, "consumer chain id must not be blank") - ErrConsumerKeyNotFound = sdkerrors.Register(ModuleName, 7, "consumer key not found") - ErrNoValidatorConsumerAddress = sdkerrors.Register(ModuleName, 8, "error getting validator consumer address") - ErrNoValidatorProviderAddress = sdkerrors.Register(ModuleName, 9, "error getting validator provider address") - ErrConsumerKeyInUse = sdkerrors.Register(ModuleName, 10, "consumer key is already in use by a validator") - ErrCannotAssignDefaultKeyAssignment = sdkerrors.Register(ModuleName, 11, "cannot re-assign default key assignment") - ErrInvalidConsumerParams = sdkerrors.Register(ModuleName, 12, "invalid consumer params") - ErrInvalidProviderAddress = sdkerrors.Register(ModuleName, 13, "invalid provider address") + ErrInvalidConsumerAdditionProposal = sdkerrors.Register(ModuleName, 1, "invalid consumer addition proposal") + ErrInvalidConsumerRemovalProp = sdkerrors.Register(ModuleName, 2, "invalid consumer removal proposal") + ErrUnknownConsumerChainId = sdkerrors.Register(ModuleName, 3, "no consumer chain with this chain id") + ErrUnknownConsumerChannelId = sdkerrors.Register(ModuleName, 4, "no consumer chain with this channel id") + ErrInvalidConsumerConsensusPubKey = sdkerrors.Register(ModuleName, 5, "empty consumer consensus public key") + ErrBlankConsumerChainID = sdkerrors.Register(ModuleName, 6, "consumer chain id must not be blank") + ErrConsumerKeyNotFound = sdkerrors.Register(ModuleName, 7, "consumer key not found") + ErrNoValidatorConsumerAddress = sdkerrors.Register(ModuleName, 8, "error getting validator consumer address") + ErrNoValidatorProviderAddress = sdkerrors.Register(ModuleName, 9, "error getting validator provider address") + ErrConsumerKeyInUse = sdkerrors.Register(ModuleName, 10, "consumer key is already in use by a validator") + ErrInvalidConsumerParams = sdkerrors.Register(ModuleName, 11, "invalid consumer params") + ErrInvalidProviderAddress = sdkerrors.Register(ModuleName, 12, "invalid provider address") + ErrInvalidConsumerRewardDenom = sdkerrors.Register(ModuleName, 14, "invalid consumer reward denom") + ErrInvalidDepositorAddress = sdkerrors.Register(ModuleName, 15, "invalid depositor address") ) diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go index 3d39beab7d..2c908686a7 100644 --- a/x/ccv/provider/types/genesis_test.go +++ b/x/ccv/provider/types/genesis_test.go @@ -4,6 +4,7 @@ import ( "testing" "time" + sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types" @@ -74,7 +75,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -93,7 +94,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -112,7 +113,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -131,7 +132,7 @@ func TestValidateGenesisState(t *testing.T) { nil, types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -156,7 +157,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - types.DefaultMaxThrottledPackets), + types.DefaultMaxThrottledPackets, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -181,7 +182,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - types.DefaultMaxThrottledPackets), + types.DefaultMaxThrottledPackets, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -206,7 +207,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - types.DefaultMaxThrottledPackets), + types.DefaultMaxThrottledPackets, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(1000000)}), nil, nil, nil, @@ -231,7 +232,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - types.DefaultMaxThrottledPackets), + types.DefaultMaxThrottledPackets, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -256,7 +257,7 @@ func TestValidateGenesisState(t *testing.T) { 0, // 0 vsc timeout here types.DefaultSlashMeterReplenishPeriod, types.DefaultSlashMeterReplenishFraction, - types.DefaultMaxThrottledPackets), + types.DefaultMaxThrottledPackets, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -281,7 +282,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, 0, // 0 slash meter replenish period here types.DefaultSlashMeterReplenishFraction, - types.DefaultMaxThrottledPackets), + types.DefaultMaxThrottledPackets, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -306,7 +307,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, "1.15", - types.DefaultMaxThrottledPackets), + types.DefaultMaxThrottledPackets, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -331,7 +332,7 @@ func TestValidateGenesisState(t *testing.T) { types.DefaultVscTimeoutPeriod, types.DefaultSlashMeterReplenishPeriod, "1.15", - -1), + -1, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), nil, nil, nil, @@ -643,6 +644,44 @@ func TestValidateGenesisState(t *testing.T) { ), false, }, + { + "invalid params- invalid consumer registration fee denom", + types.NewGenesisState( + types.DefaultValsetUpdateID, + nil, + []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, + nil, + nil, + nil, + nil, + types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, + time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400, sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}), + nil, + nil, + nil, + ), + false, + }, + { + "invalid params- invalid consumer registration fee amount", + types.NewGenesisState( + types.DefaultValsetUpdateID, + nil, + []types.ConsumerState{{ChainId: "chainid-1", ChannelId: "channelid", ClientId: "client-id", ConsumerGenesis: getInitialConsumerGenesis(t, "chainid-1")}}, + nil, + nil, + nil, + nil, + types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, + time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), + types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", 400, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}), + nil, + nil, + nil, + ), + false, + }, } for _, tc := range testCases { diff --git a/x/ccv/provider/types/keys.go b/x/ccv/provider/types/keys.go index 18218cf560..65d57da9e4 100644 --- a/x/ccv/provider/types/keys.go +++ b/x/ccv/provider/types/keys.go @@ -28,6 +28,9 @@ const ( // Default validator set update ID DefaultValsetUpdateID = 1 + + // This address receives rewards from consumer chains + ConsumerRewardsPool = "consumer_rewards_pool" ) // Iota generated keys/byte prefixes (as a byte), supports 256 possible values @@ -128,6 +131,9 @@ const ( // denoting whether the provider address has committed any double signign infractions SlashLogBytePrefix + // ConsumerRewardDenomsBytePrefix is the byte prefix that will store a list of consumer reward denoms + ConsumerRewardDenomsBytePrefix + // NOTE: DO NOT ADD NEW BYTE PREFIXES HERE WITHOUT ADDING THEM TO getAllKeyPrefixes() IN keys_test.go ) @@ -362,6 +368,11 @@ func SlashLogKey(providerAddr ProviderConsAddress) []byte { return append([]byte{SlashLogBytePrefix}, providerAddr.ToSdkConsAddr().Bytes()...) } +// ConsumerRewardDenomsKey returns the key under which consumer reward denoms are stored +func ConsumerRewardDenomsKey(denom string) []byte { + return append([]byte{ConsumerRewardDenomsBytePrefix}, []byte(denom)...) +} + // NOTE: DO NOT ADD FULLY DEFINED KEY FUNCTIONS WITHOUT ADDING THEM TO getAllFullyDefinedKeys() IN keys_test.go // diff --git a/x/ccv/provider/types/msg.go b/x/ccv/provider/types/msg.go index 901aa03600..67ad99d10c 100644 --- a/x/ccv/provider/types/msg.go +++ b/x/ccv/provider/types/msg.go @@ -9,7 +9,8 @@ import ( // provider message types const ( - TypeMsgAssignConsumerKey = "assign_consumer_key" + TypeMsgAssignConsumerKey = "assign_consumer_key" + TypeMsgRegisterConsumerRewardDenom = "register_consumer_reward_denom" ) var _ sdk.Msg = &MsgAssignConsumerKey{} @@ -93,3 +94,48 @@ func ParseConsumerKeyFromJson(jsonStr string) (pkType, key string, err error) { } return pubKey.Type, pubKey.Key, nil } + +// NewMsgRegisterConsumerRewardDenom returns a new MsgRegisterConsumerRewardDenom with a sender and +// a funding amount. +func NewMsgRegisterConsumerRewardDenom(denom string, depositor sdk.AccAddress) *MsgRegisterConsumerRewardDenom { + return &MsgRegisterConsumerRewardDenom{ + Denom: denom, + Depositor: depositor.String(), + } +} + +// Route returns the MsgRegisterConsumerRewardDenom message route. +func (msg MsgRegisterConsumerRewardDenom) Route() string { return ModuleName } + +// Type returns the MsgRegisterConsumerRewardDenom message type. +func (msg MsgRegisterConsumerRewardDenom) Type() string { return TypeMsgRegisterConsumerRewardDenom } + +// GetSigners returns the signer addresses that are expected to sign the result +// of GetSignBytes. +func (msg MsgRegisterConsumerRewardDenom) GetSigners() []sdk.AccAddress { + depoAddr, err := sdk.AccAddressFromBech32(msg.Depositor) + if err != nil { + panic(err) + } + return []sdk.AccAddress{depoAddr} +} + +// GetSignBytes returns the raw bytes for a MsgRegisterConsumerRewardDenom message that +// the expected signer needs to sign. +func (msg MsgRegisterConsumerRewardDenom) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic performs basic MsgRegisterConsumerRewardDenom message validation. +func (msg MsgRegisterConsumerRewardDenom) ValidateBasic() error { + if !sdk.NewCoin(msg.Denom, sdk.NewInt(0)).IsValid() { + return ErrInvalidConsumerRewardDenom + } + _, err := sdk.AccAddressFromBech32(msg.Depositor) + if err != nil { + return ErrInvalidDepositorAddress + } + + return nil +} diff --git a/x/ccv/provider/types/params.go b/x/ccv/provider/types/params.go index f1d96d4247..4bfb906f4b 100644 --- a/x/ccv/provider/types/params.go +++ b/x/ccv/provider/types/params.go @@ -4,6 +4,7 @@ import ( "fmt" "time" + sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types" @@ -42,13 +43,14 @@ const ( // Reflection based keys for params subspace var ( - KeyTemplateClient = []byte("TemplateClient") - KeyTrustingPeriodFraction = []byte("TrustingPeriodFraction") - KeyInitTimeoutPeriod = []byte("InitTimeoutPeriod") - KeyVscTimeoutPeriod = []byte("VscTimeoutPeriod") - KeySlashMeterReplenishPeriod = []byte("SlashMeterReplenishPeriod") - KeySlashMeterReplenishFraction = []byte("SlashMeterReplenishFraction") - KeyMaxThrottledPackets = []byte("MaxThrottledPackets") + KeyTemplateClient = []byte("TemplateClient") + KeyTrustingPeriodFraction = []byte("TrustingPeriodFraction") + KeyInitTimeoutPeriod = []byte("InitTimeoutPeriod") + KeyVscTimeoutPeriod = []byte("VscTimeoutPeriod") + KeySlashMeterReplenishPeriod = []byte("SlashMeterReplenishPeriod") + KeySlashMeterReplenishFraction = []byte("SlashMeterReplenishFraction") + KeyMaxThrottledPackets = []byte("MaxThrottledPackets") + KeyConsumerRewardDenomRegistrationFee = []byte("ConsumerRewardDenomRegistrationFee") ) // ParamKeyTable returns a key table with the necessary registered provider params @@ -66,16 +68,18 @@ func NewParams( slashMeterReplenishPeriod time.Duration, slashMeterReplenishFraction string, maxThrottledPackets int64, + consumerRewardDenomRegistrationFee sdk.Coin, ) Params { return Params{ - TemplateClient: cs, - TrustingPeriodFraction: trustingPeriodFraction, - CcvTimeoutPeriod: ccvTimeoutPeriod, - InitTimeoutPeriod: initTimeoutPeriod, - VscTimeoutPeriod: vscTimeoutPeriod, - SlashMeterReplenishPeriod: slashMeterReplenishPeriod, - SlashMeterReplenishFraction: slashMeterReplenishFraction, - MaxThrottledPackets: maxThrottledPackets, + TemplateClient: cs, + TrustingPeriodFraction: trustingPeriodFraction, + CcvTimeoutPeriod: ccvTimeoutPeriod, + InitTimeoutPeriod: initTimeoutPeriod, + VscTimeoutPeriod: vscTimeoutPeriod, + SlashMeterReplenishPeriod: slashMeterReplenishPeriod, + SlashMeterReplenishFraction: slashMeterReplenishFraction, + MaxThrottledPackets: maxThrottledPackets, + ConsumerRewardDenomRegistrationFee: consumerRewardDenomRegistrationFee, } } @@ -103,6 +107,12 @@ func DefaultParams() Params { DefaultSlashMeterReplenishPeriod, DefaultSlashMeterReplenishFraction, DefaultMaxThrottledPackets, + // Defining this inline because it's not possible to define a constant of type sdk.Coin. + // Following the pattern from cosmos-sdk/staking/types/params.go + sdk.Coin{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(10000000), + }, ) } @@ -135,6 +145,9 @@ func (p Params) Validate() error { if err := ccvtypes.ValidatePositiveInt64(p.MaxThrottledPackets); err != nil { return fmt.Errorf("max throttled packets is invalid: %s", err) } + if err := validateCoin(p.ConsumerRewardDenomRegistrationFee); err != nil { + return fmt.Errorf("consumer reward denom registration fee is invalid: %s", err) + } return nil } @@ -149,6 +162,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeySlashMeterReplenishPeriod, p.SlashMeterReplenishPeriod, ccvtypes.ValidateDuration), paramtypes.NewParamSetPair(KeySlashMeterReplenishFraction, p.SlashMeterReplenishFraction, ccvtypes.ValidateStringFraction), paramtypes.NewParamSetPair(KeyMaxThrottledPackets, p.MaxThrottledPackets, ccvtypes.ValidatePositiveInt64), + paramtypes.NewParamSetPair(KeyConsumerRewardDenomRegistrationFee, p.ConsumerRewardDenomRegistrationFee, validateCoin), } } @@ -178,3 +192,16 @@ func validateTemplateClient(i interface{}) error { } return nil } + +func validateCoin(i interface{}) error { + v, ok := i.(sdk.Coin) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if !v.IsValid() { + return fmt.Errorf("invalid consumer reward denom registration fee: %s", v) + } + + return nil +} diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go index acee7abe11..b0e4e8485d 100644 --- a/x/ccv/provider/types/params_test.go +++ b/x/ccv/provider/types/params_test.go @@ -4,6 +4,7 @@ import ( "testing" "time" + sdk "github.com/cosmos/cosmos-sdk/types" clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" commitmenttypes "github.com/cosmos/ibc-go/v4/modules/core/23-commitment/types" ibctmtypes "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types" @@ -21,35 +22,41 @@ func TestValidateParams(t *testing.T) { {"default params", types.DefaultParams(), true}, {"custom valid params", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100), true}, + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), true}, {"custom invalid params", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, 0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}, true, false), - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100), false}, + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, {"blank client", types.NewParams(&ibctmtypes.ClientState{}, - "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100), false}, - {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100), false}, + "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, + {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, // Check if "0.00" is valid or if a zero dec TrustFraction needs to return an error {"0 trusting period fraction", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - "0.00", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100), true}, + "0.00", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), true}, {"0 ccv timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - "0.33", 0, time.Hour, time.Hour, 30*time.Minute, "0.1", 100), false}, + "0.33", 0, time.Hour, time.Hour, 30*time.Minute, "0.1", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, {"0 init timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - "0.33", time.Hour, 0, time.Hour, 30*time.Minute, "0.1", 100), false}, + "0.33", time.Hour, 0, time.Hour, 30*time.Minute, "0.1", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, {"0 vsc timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - "0.33", time.Hour, time.Hour, 0, 30*time.Minute, "0.1", 100), false}, + "0.33", time.Hour, time.Hour, 0, 30*time.Minute, "0.1", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, {"0 slash meter replenish period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - "0.33", time.Hour, time.Hour, 24*time.Hour, 0, "0.1", 100), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, 0, "0.1", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, {"slash meter replenish fraction over 1", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "1.5", 100), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "1.5", 100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, {"negative max pending slash packets", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), - "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", -100), false}, + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", -100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}), false}, + {"invalid consumer reward denom registration fee denom", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, + time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", -100, sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}), false}, + {"invalid consumer reward denom registration fee amount", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0, + time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}, true, false), + "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", -100, sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-10000000)}), false}, } for _, tc := range testCases { diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index ec9ef7f40c..4c2c262e08 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -5,6 +5,7 @@ package types import ( fmt "fmt" + types3 "github.com/cosmos/cosmos-sdk/types" types1 "github.com/cosmos/cosmos-sdk/x/evidence/types" types "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" types2 "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types" @@ -260,7 +261,7 @@ type GlobalSlashEntry struct { // This field is used to obtain validator power in HandleThrottleQueues. // // This field is not used in the store key, but is persisted in value bytes, see QueueGlobalSlashEntry. - ProviderValConsAddr *ProviderConsAddress `protobuf:"bytes,4,opt,name=provider_val_cons_addr,json=providerValConsAddr,proto3" json:"provider_val_cons_addr,omitempty"` + ProviderValConsAddr []byte `protobuf:"bytes,4,opt,name=provider_val_cons_addr,json=providerValConsAddr,proto3" json:"provider_val_cons_addr,omitempty"` } func (m *GlobalSlashEntry) Reset() { *m = GlobalSlashEntry{} } @@ -317,7 +318,7 @@ func (m *GlobalSlashEntry) GetIbcSeqNum() uint64 { return 0 } -func (m *GlobalSlashEntry) GetProviderValConsAddr() *ProviderConsAddress { +func (m *GlobalSlashEntry) GetProviderValConsAddr() []byte { if m != nil { return m.ProviderValConsAddr } @@ -346,6 +347,8 @@ type Params struct { // The maximum amount of throttled slash or vsc matured packets // that can be queued for a single consumer before the provider chain halts. MaxThrottledPackets int64 `protobuf:"varint,8,opt,name=max_throttled_packets,json=maxThrottledPackets,proto3" json:"max_throttled_packets,omitempty"` + // The fee required to be paid to add a reward denom + ConsumerRewardDenomRegistrationFee types3.Coin `protobuf:"bytes,9,opt,name=consumer_reward_denom_registration_fee,json=consumerRewardDenomRegistrationFee,proto3" json:"consumer_reward_denom_registration_fee"` } func (m *Params) Reset() { *m = Params{} } @@ -437,6 +440,13 @@ func (m *Params) GetMaxThrottledPackets() int64 { return 0 } +func (m *Params) GetConsumerRewardDenomRegistrationFee() types3.Coin { + if m != nil { + return m.ConsumerRewardDenomRegistrationFee + } + return types3.Coin{} +} + type HandshakeMetadata struct { ProviderFeePoolAddr string `protobuf:"bytes,1,opt,name=provider_fee_pool_addr,json=providerFeePoolAddr,proto3" json:"provider_fee_pool_addr,omitempty"` Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` @@ -489,7 +499,7 @@ func (m *HandshakeMetadata) GetVersion() string { return "" } -// SlashAcks contains cons addresses of consumer chain validators +// SlashAcks contains addesses of consumer chain validators // successfully slashed on the provider chain type SlashAcks struct { Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` @@ -627,6 +637,51 @@ func (m *ConsumerRemovalProposals) GetPending() []*ConsumerRemovalProposal { return nil } +// AddressList contains a list of consensus addresses +type AddressList struct { + Addresses [][]byte `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` +} + +func (m *AddressList) Reset() { *m = AddressList{} } +func (m *AddressList) String() string { return proto.CompactTextString(m) } +func (*AddressList) ProtoMessage() {} +func (*AddressList) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{9} +} +func (m *AddressList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AddressList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AddressList.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AddressList) XXX_Merge(src proto.Message) { + xxx_messageInfo_AddressList.Merge(m, src) +} +func (m *AddressList) XXX_Size() int { + return m.Size() +} +func (m *AddressList) XXX_DiscardUnknown() { + xxx_messageInfo_AddressList.DiscardUnknown(m) +} + +var xxx_messageInfo_AddressList proto.InternalMessageInfo + +func (m *AddressList) GetAddresses() [][]byte { + if m != nil { + return m.Addresses + } + return nil +} + type ChannelToChain struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -636,7 +691,7 @@ func (m *ChannelToChain) Reset() { *m = ChannelToChain{} } func (m *ChannelToChain) String() string { return proto.CompactTextString(m) } func (*ChannelToChain) ProtoMessage() {} func (*ChannelToChain) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{9} + return fileDescriptor_f22ec409a72b7b72, []int{10} } func (m *ChannelToChain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -690,7 +745,7 @@ func (m *VscUnbondingOps) Reset() { *m = VscUnbondingOps{} } func (m *VscUnbondingOps) String() string { return proto.CompactTextString(m) } func (*VscUnbondingOps) ProtoMessage() {} func (*VscUnbondingOps) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{10} + return fileDescriptor_f22ec409a72b7b72, []int{11} } func (m *VscUnbondingOps) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -745,7 +800,7 @@ func (m *UnbondingOp) Reset() { *m = UnbondingOp{} } func (m *UnbondingOp) String() string { return proto.CompactTextString(m) } func (*UnbondingOp) ProtoMessage() {} func (*UnbondingOp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{11} + return fileDescriptor_f22ec409a72b7b72, []int{12} } func (m *UnbondingOp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -797,7 +852,7 @@ func (m *InitTimeoutTimestamp) Reset() { *m = InitTimeoutTimestamp{} } func (m *InitTimeoutTimestamp) String() string { return proto.CompactTextString(m) } func (*InitTimeoutTimestamp) ProtoMessage() {} func (*InitTimeoutTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{12} + return fileDescriptor_f22ec409a72b7b72, []int{13} } func (m *InitTimeoutTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -849,7 +904,7 @@ func (m *VscSendTimestamp) Reset() { *m = VscSendTimestamp{} } func (m *VscSendTimestamp) String() string { return proto.CompactTextString(m) } func (*VscSendTimestamp) ProtoMessage() {} func (*VscSendTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{13} + return fileDescriptor_f22ec409a72b7b72, []int{14} } func (m *VscSendTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -892,152 +947,17 @@ func (m *VscSendTimestamp) GetTimestamp() time.Time { return time.Time{} } -// A validator's assigned consensus address for a consumer chain. -// Note this type is for type safety within provider code, consumer code uses normal sdk.ConsAddress, -// since there's no notion of provider vs consumer address. -type ConsumerConsAddress struct { - Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` -} - -func (m *ConsumerConsAddress) Reset() { *m = ConsumerConsAddress{} } -func (*ConsumerConsAddress) ProtoMessage() {} -func (*ConsumerConsAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{14} -} -func (m *ConsumerConsAddress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConsumerConsAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ConsumerConsAddress.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ConsumerConsAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsumerConsAddress.Merge(m, src) -} -func (m *ConsumerConsAddress) XXX_Size() int { - return m.Size() -} -func (m *ConsumerConsAddress) XXX_DiscardUnknown() { - xxx_messageInfo_ConsumerConsAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_ConsumerConsAddress proto.InternalMessageInfo - -func (m *ConsumerConsAddress) GetAddress() []byte { - if m != nil { - return m.Address - } - return nil -} - -// A validator's consensus address on the provider chain -type ProviderConsAddress struct { - Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` -} - -func (m *ProviderConsAddress) Reset() { *m = ProviderConsAddress{} } -func (*ProviderConsAddress) ProtoMessage() {} -func (*ProviderConsAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{15} -} -func (m *ProviderConsAddress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProviderConsAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProviderConsAddress.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ProviderConsAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProviderConsAddress.Merge(m, src) -} -func (m *ProviderConsAddress) XXX_Size() int { - return m.Size() -} -func (m *ProviderConsAddress) XXX_DiscardUnknown() { - xxx_messageInfo_ProviderConsAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_ProviderConsAddress proto.InternalMessageInfo - -func (m *ProviderConsAddress) GetAddress() []byte { - if m != nil { - return m.Address - } - return nil -} - -// ConsumerAddressList contains a list of consumer consensus addresses -type ConsumerAddressList struct { - Addresses []*ConsumerConsAddress `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` -} - -func (m *ConsumerAddressList) Reset() { *m = ConsumerAddressList{} } -func (m *ConsumerAddressList) String() string { return proto.CompactTextString(m) } -func (*ConsumerAddressList) ProtoMessage() {} -func (*ConsumerAddressList) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{16} -} -func (m *ConsumerAddressList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConsumerAddressList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ConsumerAddressList.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ConsumerAddressList) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsumerAddressList.Merge(m, src) -} -func (m *ConsumerAddressList) XXX_Size() int { - return m.Size() -} -func (m *ConsumerAddressList) XXX_DiscardUnknown() { - xxx_messageInfo_ConsumerAddressList.DiscardUnknown(m) -} - -var xxx_messageInfo_ConsumerAddressList proto.InternalMessageInfo - -func (m *ConsumerAddressList) GetAddresses() []*ConsumerConsAddress { - if m != nil { - return m.Addresses - } - return nil -} - type KeyAssignmentReplacement struct { - ProviderAddr *ProviderConsAddress `protobuf:"bytes,1,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` - PrevCKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=prev_c_key,json=prevCKey,proto3" json:"prev_c_key,omitempty"` - Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` + ProviderAddr []byte `protobuf:"bytes,1,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` + PrevCKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=prev_c_key,json=prevCKey,proto3" json:"prev_c_key,omitempty"` + Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` } func (m *KeyAssignmentReplacement) Reset() { *m = KeyAssignmentReplacement{} } func (m *KeyAssignmentReplacement) String() string { return proto.CompactTextString(m) } func (*KeyAssignmentReplacement) ProtoMessage() {} func (*KeyAssignmentReplacement) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{17} + return fileDescriptor_f22ec409a72b7b72, []int{15} } func (m *KeyAssignmentReplacement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1066,7 +986,7 @@ func (m *KeyAssignmentReplacement) XXX_DiscardUnknown() { var xxx_messageInfo_KeyAssignmentReplacement proto.InternalMessageInfo -func (m *KeyAssignmentReplacement) GetProviderAddr() *ProviderConsAddress { +func (m *KeyAssignmentReplacement) GetProviderAddr() []byte { if m != nil { return m.ProviderAddr } @@ -1087,192 +1007,6 @@ func (m *KeyAssignmentReplacement) GetPower() int64 { return 0 } -// Used to serialize the ValidatorConsumerPubKey index from key assignment -// ValidatorConsumerPubKey: (chainID, providerAddr consAddr) -> consumerKey tmprotocrypto.PublicKey -type ValidatorConsumerPubKey struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - ProviderAddr *ProviderConsAddress `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` - ConsumerKey *crypto.PublicKey `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` -} - -func (m *ValidatorConsumerPubKey) Reset() { *m = ValidatorConsumerPubKey{} } -func (m *ValidatorConsumerPubKey) String() string { return proto.CompactTextString(m) } -func (*ValidatorConsumerPubKey) ProtoMessage() {} -func (*ValidatorConsumerPubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{18} -} -func (m *ValidatorConsumerPubKey) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ValidatorConsumerPubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ValidatorConsumerPubKey.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ValidatorConsumerPubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorConsumerPubKey.Merge(m, src) -} -func (m *ValidatorConsumerPubKey) XXX_Size() int { - return m.Size() -} -func (m *ValidatorConsumerPubKey) XXX_DiscardUnknown() { - xxx_messageInfo_ValidatorConsumerPubKey.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidatorConsumerPubKey proto.InternalMessageInfo - -func (m *ValidatorConsumerPubKey) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *ValidatorConsumerPubKey) GetProviderAddr() *ProviderConsAddress { - if m != nil { - return m.ProviderAddr - } - return nil -} - -func (m *ValidatorConsumerPubKey) GetConsumerKey() *crypto.PublicKey { - if m != nil { - return m.ConsumerKey - } - return nil -} - -// Used to serialize the ValidatorConsumerAddr index from key assignment -// ValidatorByConsumerAddr: (chainID, consumerAddr consAddr) -> providerAddr consAddr -type ValidatorByConsumerAddr struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - ConsumerAddr *ConsumerConsAddress `protobuf:"bytes,2,opt,name=consumer_addr,json=consumerAddr,proto3" json:"consumer_addr,omitempty"` - ProviderAddr *ProviderConsAddress `protobuf:"bytes,3,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` -} - -func (m *ValidatorByConsumerAddr) Reset() { *m = ValidatorByConsumerAddr{} } -func (m *ValidatorByConsumerAddr) String() string { return proto.CompactTextString(m) } -func (*ValidatorByConsumerAddr) ProtoMessage() {} -func (*ValidatorByConsumerAddr) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{19} -} -func (m *ValidatorByConsumerAddr) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ValidatorByConsumerAddr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ValidatorByConsumerAddr.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ValidatorByConsumerAddr) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorByConsumerAddr.Merge(m, src) -} -func (m *ValidatorByConsumerAddr) XXX_Size() int { - return m.Size() -} -func (m *ValidatorByConsumerAddr) XXX_DiscardUnknown() { - xxx_messageInfo_ValidatorByConsumerAddr.DiscardUnknown(m) -} - -var xxx_messageInfo_ValidatorByConsumerAddr proto.InternalMessageInfo - -func (m *ValidatorByConsumerAddr) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *ValidatorByConsumerAddr) GetConsumerAddr() *ConsumerConsAddress { - if m != nil { - return m.ConsumerAddr - } - return nil -} - -func (m *ValidatorByConsumerAddr) GetProviderAddr() *ProviderConsAddress { - if m != nil { - return m.ProviderAddr - } - return nil -} - -// Used to serialize the ConsumerAddrsToPrune index from key assignment -// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList -type ConsumerAddrsToPrune struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - VscId uint64 `protobuf:"varint,2,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` - ConsumerAddrs *ConsumerAddressList `protobuf:"bytes,3,opt,name=consumer_addrs,json=consumerAddrs,proto3" json:"consumer_addrs,omitempty"` -} - -func (m *ConsumerAddrsToPrune) Reset() { *m = ConsumerAddrsToPrune{} } -func (m *ConsumerAddrsToPrune) String() string { return proto.CompactTextString(m) } -func (*ConsumerAddrsToPrune) ProtoMessage() {} -func (*ConsumerAddrsToPrune) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{20} -} -func (m *ConsumerAddrsToPrune) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ConsumerAddrsToPrune) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ConsumerAddrsToPrune.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *ConsumerAddrsToPrune) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsumerAddrsToPrune.Merge(m, src) -} -func (m *ConsumerAddrsToPrune) XXX_Size() int { - return m.Size() -} -func (m *ConsumerAddrsToPrune) XXX_DiscardUnknown() { - xxx_messageInfo_ConsumerAddrsToPrune.DiscardUnknown(m) -} - -var xxx_messageInfo_ConsumerAddrsToPrune proto.InternalMessageInfo - -func (m *ConsumerAddrsToPrune) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -func (m *ConsumerAddrsToPrune) GetVscId() uint64 { - if m != nil { - return m.VscId - } - return 0 -} - -func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *ConsumerAddressList { - if m != nil { - return m.ConsumerAddrs - } - return nil -} - func init() { proto.RegisterType((*ConsumerAdditionProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposal") proto.RegisterType((*ConsumerRemovalProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposal") @@ -1283,18 +1017,13 @@ func init() { proto.RegisterType((*SlashAcks)(nil), "interchain_security.ccv.provider.v1.SlashAcks") proto.RegisterType((*ConsumerAdditionProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposals") proto.RegisterType((*ConsumerRemovalProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposals") + proto.RegisterType((*AddressList)(nil), "interchain_security.ccv.provider.v1.AddressList") proto.RegisterType((*ChannelToChain)(nil), "interchain_security.ccv.provider.v1.ChannelToChain") proto.RegisterType((*VscUnbondingOps)(nil), "interchain_security.ccv.provider.v1.VscUnbondingOps") proto.RegisterType((*UnbondingOp)(nil), "interchain_security.ccv.provider.v1.UnbondingOp") proto.RegisterType((*InitTimeoutTimestamp)(nil), "interchain_security.ccv.provider.v1.InitTimeoutTimestamp") proto.RegisterType((*VscSendTimestamp)(nil), "interchain_security.ccv.provider.v1.VscSendTimestamp") - proto.RegisterType((*ConsumerConsAddress)(nil), "interchain_security.ccv.provider.v1.ConsumerConsAddress") - proto.RegisterType((*ProviderConsAddress)(nil), "interchain_security.ccv.provider.v1.ProviderConsAddress") - proto.RegisterType((*ConsumerAddressList)(nil), "interchain_security.ccv.provider.v1.ConsumerAddressList") proto.RegisterType((*KeyAssignmentReplacement)(nil), "interchain_security.ccv.provider.v1.KeyAssignmentReplacement") - proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") - proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") - proto.RegisterType((*ConsumerAddrsToPrune)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPrune") } func init() { @@ -1302,106 +1031,99 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1570 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6e, 0x1b, 0xc9, - 0x11, 0xd6, 0x90, 0xd4, 0x0f, 0x9b, 0xfa, 0x1d, 0xc9, 0x2b, 0xca, 0x51, 0x28, 0xee, 0xe4, 0x07, - 0x0c, 0x82, 0x1d, 0x42, 0x5a, 0x2c, 0xb0, 0x10, 0x12, 0x2c, 0x24, 0x7a, 0x77, 0xa5, 0x28, 0xbb, - 0xe6, 0x8e, 0x18, 0x05, 0x49, 0x10, 0x0c, 0x7a, 0x7a, 0x5a, 0x64, 0x43, 0x33, 0xd3, 0xe3, 0xee, - 0x9e, 0x59, 0xf3, 0x0d, 0x72, 0x5c, 0x20, 0x97, 0x05, 0x72, 0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ae, - 0xde, 0x29, 0xbf, 0x57, 0x68, 0x68, 0x13, 0x97, 0x37, 0x2b, 0xed, 0x6a, 0xa7, 0x66, 0xad, 0x47, - 0x85, 0xf9, 0xb9, 0xcb, 0x8d, 0x3f, 0x80, 0x46, 0x09, 0x50, 0x5f, 0x07, 0x95, 0x1c, 0xab, 0x42, - 0x5c, 0xfd, 0x18, 0xec, 0x15, 0x40, 0x93, 0x34, 0x9c, 0x20, 0xd6, 0xad, 0xdd, 0x5c, 0x61, 0x82, - 0x89, 0xb9, 0xf1, 0x10, 0xec, 0x9c, 0x17, 0xad, 0x9b, 0x93, 0xfc, 0x44, 0x84, 0xda, 0xe4, 0x90, - 0xdc, 0x07, 0xf5, 0xfc, 0xd1, 0xad, 0xa2, 0xaf, 0x59, 0x85, 0xc0, 0xf0, 0xc1, 0xe6, 0x15, 0x47, - 0x97, 0x38, 0x70, 0x0b, 0xb0, 0xd7, 0x24, 0xe0, 0x74, 0x1a, 0x68, 0xee, 0x47, 0x5f, 0xe1, 0xee, - 0x13, 0xb0, 0x9d, 0x47, 0x54, 0x90, 0xba, 0x6c, 0x80, 0xb4, 0x90, 0x95, 0xcb, 0x55, 0x2b, 0x5b, - 0x1e, 0xd7, 0xd4, 0xbb, 0xe2, 0x13, 0xb0, 0x3d, 0x63, 0x16, 0xbc, 0xd5, 0xcc, 0x2f, 0xbc, 0xa5, - 0x26, 0xbf, 0x25, 0x5c, 0xe8, 0x57, 0xd3, 0x7d, 0x34, 0xef, 0x3c, 0x9a, 0x71, 0xf4, 0x72, 0x07, - 0xfe, 0x4b, 0x03, 0xcd, 0x0b, 0x3c, 0x3e, 0xe1, 0x9c, 0x0c, 0x03, 0x1f, 0x07, 0x42, 0xf2, 0x0c, - 0x44, 0x58, 0x7e, 0xea, 0x7f, 0x06, 0x6b, 0x39, 0x31, 0xe4, 0x7c, 0xf0, 0x2e, 0x83, 0x70, 0x35, - 0x53, 0x50, 0x14, 0x72, 0x0c, 0x40, 0xc8, 0x70, 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0x77, 0xd3, 0x9f, - 0xe9, 0x85, 0xcf, 0x8f, 0xf2, 0x7f, 0x33, 0x1e, 0x4f, 0xfe, 0x9f, 0x21, 0xc6, 0x21, 0xe6, 0xce, - 0x92, 0x62, 0xa8, 0x8f, 0xff, 0x1f, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x0a, 0x32, 0xf6, 0x00, 0x11, - 0x00, 0x00, + // 1468 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcd, 0x6e, 0x1b, 0x47, + 0x12, 0x16, 0x45, 0xea, 0x87, 0x4d, 0xfd, 0x8e, 0x64, 0x9b, 0xf2, 0x6a, 0x29, 0x9a, 0xde, 0x35, + 0xb8, 0x30, 0x3c, 0x84, 0xe4, 0xcb, 0x42, 0xd8, 0xc5, 0x42, 0xa2, 0x6c, 0x4b, 0xab, 0xb5, 0x2d, + 0x8f, 0xb4, 0x0a, 0x92, 0x1c, 0x06, 0x3d, 0x3d, 0x25, 0xb2, 0xa1, 0x99, 0xe9, 0x71, 0x77, 0x73, + 0x6c, 0xbe, 0x41, 0x8e, 0x0e, 0x72, 0x31, 0x90, 0x8b, 0xdf, 0x20, 0xaf, 0xe1, 0xa3, 0x8f, 0x39, + 0x39, 0x81, 0x7c, 0xc8, 0x21, 0x2f, 0x11, 0x74, 0xcf, 0x1f, 0x87, 0x96, 0x01, 0x19, 0x49, 0x6e, + 0xd3, 0xf5, 0xf3, 0x75, 0x75, 0x57, 0xd5, 0x57, 0x3d, 0x68, 0x8b, 0x06, 0x12, 0x38, 0xe9, 0x63, + 0x1a, 0xd8, 0x02, 0xc8, 0x80, 0x53, 0x39, 0xec, 0x10, 0x12, 0x75, 0x42, 0xce, 0x22, 0xea, 0x02, + 0xef, 0x44, 0x9b, 0xd9, 0xb7, 0x19, 0x72, 0x26, 0x99, 0x71, 0xfb, 0x12, 0x1f, 0x93, 0x90, 0xc8,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0xe5, 0xdf, 0x43, 0x2e, 0xc7, 0x68, 0x45, 0x31, + 0xf3, 0x38, 0x66, 0xe5, 0xea, 0x98, 0xcb, 0xca, 0xbf, 0x08, 0xfa, 0x0c, 0x19, 0x91, 0x20, 0xe3, + 0x98, 0x53, 0x9f, 0x11, 0x67, 0x24, 0x48, 0x11, 0xd2, 0x45, 0xeb, 0x42, 0x15, 0x9f, 0xed, 0x83, + 0xd4, 0x54, 0x15, 0x7a, 0x10, 0x50, 0xd1, 0x4f, 0xc1, 0xa7, 0xaf, 0x0e, 0xbe, 0xa6, 0x81, 0x1e, + 0x2b, 0x1c, 0x2b, 0x85, 0x49, 0x76, 0xe9, 0xa2, 0xc6, 0xe5, 0xbb, 0x64, 0x09, 0x9a, 0xd1, 0x09, + 0xfa, 0xcb, 0x25, 0x10, 0x59, 0x96, 0xb6, 0xd0, 0x35, 0x1f, 0xbf, 0xb4, 0x65, 0x9f, 0x33, 0x29, + 0x3d, 0x70, 0xed, 0x10, 0x93, 0x73, 0x90, 0x42, 0xcf, 0x95, 0xb2, 0xb5, 0xe2, 0xe3, 0x97, 0x27, + 0xa9, 0xee, 0x28, 0x56, 0x19, 0x02, 0xdd, 0x19, 0xa1, 0xe1, 0x17, 0x98, 0xbb, 0xb6, 0x0b, 0x01, + 0xf3, 0x6d, 0x0e, 0x3d, 0xc5, 0x8f, 0x38, 0x66, 0x64, 0x80, 0x6c, 0x94, 0x24, 0x8d, 0xac, 0x5e, + 0x06, 0x59, 0x13, 0x77, 0x19, 0x0d, 0x92, 0x79, 0xdb, 0xca, 0xd9, 0x5a, 0xa1, 0xed, 0x29, 0x30, + 0x6b, 0x04, 0xeb, 0x21, 0x40, 0xcb, 0x41, 0xcb, 0xfb, 0x38, 0x70, 0x45, 0x1f, 0x9f, 0xc3, 0x63, + 0x90, 0xd8, 0xc5, 0x12, 0x17, 0x7a, 0xe6, 0x0c, 0xc0, 0x0e, 0x19, 0xf3, 0xe2, 0x9e, 0x89, 0x29, + 0x28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c4, 0x57, 0xdb, + 0x3d, 0x2a, 0xfb, 0x03, 0xc7, 0x24, 0xcc, 0xef, 0x24, 0xff, 0x1d, 0x79, 0xb5, 0xdf, 0xcb, 0x7e, + 0xe3, 0x5e, 0x16, 0x7f, 0xe4, 0xe4, 0x30, 0x04, 0xe1, 0x4c, 0xeb, 0x2b, 0xb9, 0xff, 0x5b, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x5c, 0xf4, 0xc4, 0x31, 0xf9, 0x0d, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -1644,15 +1366,10 @@ func (m *GlobalSlashEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ProviderValConsAddr != nil { - { - size, err := m.ProviderValConsAddr.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } + if len(m.ProviderValConsAddr) > 0 { + i -= len(m.ProviderValConsAddr) + copy(dAtA[i:], m.ProviderValConsAddr) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderValConsAddr))) i-- dAtA[i] = 0x22 } @@ -1668,12 +1385,12 @@ func (m *GlobalSlashEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RecvTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RecvTime):]) - if err8 != nil { - return 0, err8 + n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RecvTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RecvTime):]) + if err7 != nil { + return 0, err7 } - i -= n8 - i = encodeVarintProvider(dAtA, i, uint64(n8)) + i -= n7 + i = encodeVarintProvider(dAtA, i, uint64(n7)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil @@ -1699,6 +1416,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.ConsumerRewardDenomRegistrationFee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a if m.MaxThrottledPackets != 0 { i = encodeVarintProvider(dAtA, i, uint64(m.MaxThrottledPackets)) i-- @@ -1908,7 +1635,7 @@ func (m *ConsumerRemovalProposals) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *ChannelToChain) Marshal() (dAtA []byte, err error) { +func (m *AddressList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1918,7 +1645,39 @@ func (m *ChannelToChain) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ChannelToChain) MarshalTo(dAtA []byte) (int, error) { +func (m *AddressList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AddressList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addresses[iNdEx]) + copy(dAtA[i:], m.Addresses[iNdEx]) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Addresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *ChannelToChain) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ChannelToChain) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } @@ -2099,103 +1858,6 @@ func (m *VscSendTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *ConsumerConsAddress) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ConsumerConsAddress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ConsumerConsAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintProvider(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ProviderConsAddress) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ProviderConsAddress) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProviderConsAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintProvider(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ConsumerAddressList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ConsumerAddressList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ConsumerAddressList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Addresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func (m *KeyAssignmentReplacement) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2233,170 +1895,10 @@ func (m *KeyAssignmentReplacement) MarshalToSizedBuffer(dAtA []byte) (int, error i-- dAtA[i] = 0x12 } - if m.ProviderAddr != nil { - { - size, err := m.ProviderAddr.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ValidatorConsumerPubKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ValidatorConsumerPubKey) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidatorConsumerPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ConsumerKey != nil { - { - size, err := m.ConsumerKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.ProviderAddr != nil { - { - size, err := m.ProviderAddr.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ValidatorByConsumerAddr) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ValidatorByConsumerAddr) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ValidatorByConsumerAddr) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProviderAddr != nil { - { - size, err := m.ProviderAddr.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.ConsumerAddr != nil { - { - size, err := m.ConsumerAddr.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ConsumerAddrsToPrune) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ConsumerAddrsToPrune) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ConsumerAddrs != nil { - { - size, err := m.ConsumerAddrs.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProvider(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.VscId != 0 { - i = encodeVarintProvider(dAtA, i, uint64(m.VscId)) - i-- - dAtA[i] = 0x10 - } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) + if len(m.ProviderAddr) > 0 { + i -= len(m.ProviderAddr) + copy(dAtA[i:], m.ProviderAddr) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderAddr))) i-- dAtA[i] = 0xa } @@ -2524,8 +2026,8 @@ func (m *GlobalSlashEntry) Size() (n int) { if m.IbcSeqNum != 0 { n += 1 + sovProvider(uint64(m.IbcSeqNum)) } - if m.ProviderValConsAddr != nil { - l = m.ProviderValConsAddr.Size() + l = len(m.ProviderValConsAddr) + if l > 0 { n += 1 + l + sovProvider(uint64(l)) } return n @@ -2560,6 +2062,8 @@ func (m *Params) Size() (n int) { if m.MaxThrottledPackets != 0 { n += 1 + sovProvider(uint64(m.MaxThrottledPackets)) } + l = m.ConsumerRewardDenomRegistrationFee.Size() + n += 1 + l + sovProvider(uint64(l)) return n } @@ -2625,7 +2129,22 @@ func (m *ConsumerRemovalProposals) Size() (n int) { return n } -func (m *ChannelToChain) Size() (n int) { +func (m *AddressList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, b := range m.Addresses { + l = len(b) + n += 1 + l + sovProvider(uint64(l)) + } + } + return n +} + +func (m *ChannelToChain) Size() (n int) { if m == nil { return 0 } @@ -2709,55 +2228,14 @@ func (m *VscSendTimestamp) Size() (n int) { return n } -func (m *ConsumerConsAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - return n -} - -func (m *ProviderConsAddress) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - return n -} - -func (m *ConsumerAddressList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, e := range m.Addresses { - l = e.Size() - n += 1 + l + sovProvider(uint64(l)) - } - } - return n -} - func (m *KeyAssignmentReplacement) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ProviderAddr != nil { - l = m.ProviderAddr.Size() + l = len(m.ProviderAddr) + if l > 0 { n += 1 + l + sovProvider(uint64(l)) } if m.PrevCKey != nil { @@ -2770,68 +2248,6 @@ func (m *KeyAssignmentReplacement) Size() (n int) { return n } -func (m *ValidatorConsumerPubKey) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if m.ProviderAddr != nil { - l = m.ProviderAddr.Size() - n += 1 + l + sovProvider(uint64(l)) - } - if m.ConsumerKey != nil { - l = m.ConsumerKey.Size() - n += 1 + l + sovProvider(uint64(l)) - } - return n -} - -func (m *ValidatorByConsumerAddr) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if m.ConsumerAddr != nil { - l = m.ConsumerAddr.Size() - n += 1 + l + sovProvider(uint64(l)) - } - if m.ProviderAddr != nil { - l = m.ProviderAddr.Size() - n += 1 + l + sovProvider(uint64(l)) - } - return n -} - -func (m *ConsumerAddrsToPrune) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovProvider(uint64(l)) - } - if m.VscId != 0 { - n += 1 + sovProvider(uint64(m.VscId)) - } - if m.ConsumerAddrs != nil { - l = m.ConsumerAddrs.Size() - n += 1 + l + sovProvider(uint64(l)) - } - return n -} - func sovProvider(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3731,7 +3147,7 @@ func (m *GlobalSlashEntry) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProviderValConsAddr", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -3741,26 +3157,24 @@ func (m *GlobalSlashEntry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } + m.ProviderValConsAddr = append(m.ProviderValConsAddr[:0], dAtA[iNdEx:postIndex]...) if m.ProviderValConsAddr == nil { - m.ProviderValConsAddr = &ProviderConsAddress{} - } - if err := m.ProviderValConsAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.ProviderValConsAddr = []byte{} } iNdEx = postIndex default: @@ -4064,6 +3478,39 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerRewardDenomRegistrationFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ConsumerRewardDenomRegistrationFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipProvider(dAtA[iNdEx:]) @@ -4449,6 +3896,88 @@ func (m *ConsumerRemovalProposals) Unmarshal(dAtA []byte) error { } return nil } +func (m *AddressList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AddressList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AddressList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, make([]byte, postIndex-iNdEx)) + copy(m.Addresses[len(m.Addresses)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ChannelToChain) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -5012,7 +4541,7 @@ func (m *VscSendTimestamp) Unmarshal(dAtA []byte) error { } return nil } -func (m *ConsumerConsAddress) Unmarshal(dAtA []byte) error { +func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5035,15 +4564,15 @@ func (m *ConsumerConsAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ConsumerConsAddress: wiretype end group for non-group") + return fmt.Errorf("proto: KeyAssignmentReplacement: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerConsAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: KeyAssignmentReplacement: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -5070,292 +4599,38 @@ func (m *ConsumerConsAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) - if m.Address == nil { - m.Address = []byte{} + m.ProviderAddr = append(m.ProviderAddr[:0], dAtA[iNdEx:postIndex]...) + if m.ProviderAddr == nil { + m.ProviderAddr = []byte{} } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevCKey", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { return ErrInvalidLengthProvider } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProviderConsAddress) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProviderConsAddress: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProviderConsAddress: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) - if m.Address == nil { - m.Address = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ConsumerAddressList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ConsumerAddressList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerAddressList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, &ConsumerConsAddress{}) - if err := m.Addresses[len(m.Addresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KeyAssignmentReplacement: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KeyAssignmentReplacement: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ProviderAddr == nil { - m.ProviderAddr = &ProviderConsAddress{} - } - if err := m.ProviderAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevCKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { return io.ErrUnexpectedEOF } if m.PrevCKey == nil { @@ -5405,451 +4680,6 @@ func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { } return nil } -func (m *ValidatorConsumerPubKey) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ValidatorConsumerPubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorConsumerPubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ProviderAddr == nil { - m.ProviderAddr = &ProviderConsAddress{} - } - if err := m.ProviderAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsumerKey == nil { - m.ConsumerKey = &crypto.PublicKey{} - } - if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ValidatorByConsumerAddr) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ValidatorByConsumerAddr: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValidatorByConsumerAddr: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddr", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsumerAddr == nil { - m.ConsumerAddr = &ConsumerConsAddress{} - } - if err := m.ConsumerAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ProviderAddr == nil { - m.ProviderAddr = &ProviderConsAddress{} - } - if err := m.ProviderAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ConsumerAddrsToPrune: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ConsumerAddrsToPrune: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VscId", wireType) - } - m.VscId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.VscId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ConsumerAddrs == nil { - m.ConsumerAddrs = &ConsumerAddressList{} - } - if err := m.ConsumerAddrs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipProvider(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/query.pb.go b/x/ccv/provider/types/query.pb.go index 26a533a8a8..51df34a76f 100644 --- a/x/ccv/provider/types/query.pb.go +++ b/x/ccv/provider/types/query.pb.go @@ -949,6 +949,94 @@ func (*ThrottledPacketDataWrapper) XXX_OneofWrappers() []interface{} { } } +type QueryRegisteredConsumerRewardDenomsRequest struct { +} + +func (m *QueryRegisteredConsumerRewardDenomsRequest) Reset() { + *m = QueryRegisteredConsumerRewardDenomsRequest{} +} +func (m *QueryRegisteredConsumerRewardDenomsRequest) String() string { + return proto.CompactTextString(m) +} +func (*QueryRegisteredConsumerRewardDenomsRequest) ProtoMessage() {} +func (*QueryRegisteredConsumerRewardDenomsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{19} +} +func (m *QueryRegisteredConsumerRewardDenomsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRegisteredConsumerRewardDenomsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRegisteredConsumerRewardDenomsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryRegisteredConsumerRewardDenomsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRegisteredConsumerRewardDenomsRequest.Merge(m, src) +} +func (m *QueryRegisteredConsumerRewardDenomsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRegisteredConsumerRewardDenomsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRegisteredConsumerRewardDenomsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRegisteredConsumerRewardDenomsRequest proto.InternalMessageInfo + +type QueryRegisteredConsumerRewardDenomsResponse struct { + Denoms []string `protobuf:"bytes,1,rep,name=denoms,proto3" json:"denoms,omitempty"` +} + +func (m *QueryRegisteredConsumerRewardDenomsResponse) Reset() { + *m = QueryRegisteredConsumerRewardDenomsResponse{} +} +func (m *QueryRegisteredConsumerRewardDenomsResponse) String() string { + return proto.CompactTextString(m) +} +func (*QueryRegisteredConsumerRewardDenomsResponse) ProtoMessage() {} +func (*QueryRegisteredConsumerRewardDenomsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_422512d7b7586cd7, []int{20} +} +func (m *QueryRegisteredConsumerRewardDenomsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRegisteredConsumerRewardDenomsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRegisteredConsumerRewardDenomsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryRegisteredConsumerRewardDenomsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRegisteredConsumerRewardDenomsResponse.Merge(m, src) +} +func (m *QueryRegisteredConsumerRewardDenomsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRegisteredConsumerRewardDenomsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRegisteredConsumerRewardDenomsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRegisteredConsumerRewardDenomsResponse proto.InternalMessageInfo + +func (m *QueryRegisteredConsumerRewardDenomsResponse) GetDenoms() []string { + if m != nil { + return m.Denoms + } + return nil +} + func init() { proto.RegisterType((*QueryConsumerGenesisRequest)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisRequest") proto.RegisterType((*QueryConsumerGenesisResponse)(nil), "interchain_security.ccv.provider.v1.QueryConsumerGenesisResponse") @@ -969,6 +1057,8 @@ func init() { proto.RegisterType((*QueryThrottledConsumerPacketDataResponse)(nil), "interchain_security.ccv.provider.v1.QueryThrottledConsumerPacketDataResponse") proto.RegisterType((*ThrottledSlashPacket)(nil), "interchain_security.ccv.provider.v1.ThrottledSlashPacket") proto.RegisterType((*ThrottledPacketDataWrapper)(nil), "interchain_security.ccv.provider.v1.ThrottledPacketDataWrapper") + proto.RegisterType((*QueryRegisteredConsumerRewardDenomsRequest)(nil), "interchain_security.ccv.provider.v1.QueryRegisteredConsumerRewardDenomsRequest") + proto.RegisterType((*QueryRegisteredConsumerRewardDenomsResponse)(nil), "interchain_security.ccv.provider.v1.QueryRegisteredConsumerRewardDenomsResponse") } func init() { @@ -976,85 +1066,90 @@ func init() { } var fileDescriptor_422512d7b7586cd7 = []byte{ - // 1236 bytes of a gzipped FileDescriptorProto - 0x1f, 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, 0x6d, 0xd4, 0xf2, 0x53, 0x20, 0xc4, 0xa3, 0xae, 0x6d, 0x7c, 0xf7, 0xe8, 0xaf, 0x9f, - 0xc7, 0x4a, 0x70, 0x75, 0x70, 0xfa, 0x6c, 0xbe, 0xb2, 0x22, 0xc5, 0x18, 0x5f, 0xc9, 0x4b, 0xf2, - 0x0d, 0x7c, 0xa4, 0x80, 0xd9, 0x84, 0xb8, 0x02, 0x4b, 0xc3, 0x33, 0xec, 0x88, 0x41, 0xea, 0xda, - 0xe8, 0x00, 0x42, 0xe1, 0x32, 0x57, 0x78, 0x09, 0x16, 0x86, 0x50, 0x18, 0x07, 0x24, 0xf8, 0xed, - 0x18, 0xc8, 0xf6, 0x48, 0x3d, 0x14, 0x5e, 0x1f, 0x91, 0x59, 0x62, 0xc0, 0x52, 0xb7, 0x9f, 0x11, - 0x9a, 0x10, 0x7d, 0x8d, 0x8b, 0xae, 0xc0, 0xb5, 0x61, 0x45, 0x47, 0x41, 0x37, 0x60, 0xd5, 0x66, - 0x76, 0x81, 0xff, 0x29, 0xe0, 0xa5, 0xe4, 0x10, 0x45, 0xe1, 0xfb, 0x23, 0x93, 0xee, 0x4e, 0x6b, - 0xea, 0xf5, 0x67, 0x03, 0x26, 0x0c, 0xd8, 0xe4, 0x06, 0x94, 0x61, 0x69, 0x04, 0x03, 0x88, 0xdf, - 0xa6, 0xff, 0x1f, 0x45, 0x7c, 0x4f, 0x27, 0x26, 0x1e, 0xf8, 0x5e, 0x7a, 0xd6, 0xfd, 0xb2, 0x9b, - 0xba, 0xf9, 0xd4, 0x38, 0x42, 0x78, 0x99, 0x0b, 0x7f, 0x07, 0x2e, 0xa7, 0xf8, 0x39, 0x29, 0x81, - 0xaa, 0x1d, 0x01, 0x2a, 0x41, 0x72, 0x7b, 0x12, 0x1a, 0x49, 0x72, 0x42, 0xa6, 0x1b, 0x49, 0x72, - 0x52, 0x24, 0x1b, 0x4d, 0x72, 0x47, 0x88, 0x83, 0xbf, 0x29, 0x00, 0x76, 0xa7, 0x31, 0x78, 0x25, - 0x3d, 0xc5, 0xa4, 0x90, 0xa7, 0x96, 0x46, 0xae, 0x17, 0xd2, 0x2e, 0x73, 0x69, 0x45, 0x78, 0x71, - 0xb0, 0x34, 0x26, 0x00, 0xe2, 0x9f, 0xaa, 0xf0, 0xfb, 0x31, 0xb0, 0x38, 0x28, 0xf0, 0x0c, 0xf3, - 0x86, 0x0d, 0x8e, 0x5f, 0xc3, 0xbc, 0x61, 0x29, 0x52, 0x98, 0x56, 0xe1, 0xda, 0xdf, 0x85, 0x2b, - 0x83, 0xb5, 0xfb, 0xd8, 0xb3, 0x1d, 0xaf, 0xd6, 0x9a, 0x63, 0x11, 0x1e, 0x2b, 0x7b, 0x0f, 0x8e, - 0x72, 0xca, 0xc3, 0xa3, 0x9c, 0xf2, 0xe7, 0x51, 0x4e, 0xb9, 0x77, 0x9c, 0xcb, 0x3c, 0x3c, 0xce, - 0x65, 0x1e, 0x1f, 0xe7, 0x32, 0x1f, 0xaf, 0xd4, 0x1c, 0x76, 0xd0, 0xd8, 0xd7, 0x2d, 0x52, 0x37, - 0x2c, 0x42, 0xeb, 0x84, 0xb6, 0xb5, 0x79, 0xab, 0xd9, 0xe6, 0xce, 0x09, 0x93, 0x0f, 0x7d, 0x4c, - 0xf7, 0x4f, 0xf3, 0x74, 0x7c, 0xe9, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0xf5, 0x7d, 0x58, - 0xb2, 0x11, 0x00, 0x00, + // 1321 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0xcf, 0x6f, 0x1b, 0xc5, + 0x1f, 0xf5, 0x3a, 0x69, 0x9a, 0x4c, 0xfa, 0xfd, 0xb6, 0x4c, 0x43, 0x71, 0x37, 0x91, 0x1d, 0xb6, + 0x08, 0xd2, 0x16, 0x76, 0x6b, 0x57, 0x48, 0x4d, 0x20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, 0xa9, 0x68, 0x93, 0x03, + 0x93, 0xd4, 0x41, 0x74, 0xd7, 0xa8, 0x62, 0x86, 0x7d, 0xde, 0x61, 0x44, 0x07, 0x7c, 0x69, 0x23, + 0x58, 0x81, 0x05, 0xf0, 0x72, 0xcb, 0x06, 0x03, 0x39, 0x0e, 0xd9, 0x43, 0xae, 0x89, 0xb9, 0xf6, + 0x11, 0xfd, 0x6c, 0x73, 0x6b, 0x29, 0x7a, 0x04, 0xef, 0x82, 0x8c, 0x8b, 0xef, 0x33, 0xc3, 0xc7, + 0x9e, 0x83, 0x5d, 0x9b, 0xee, 0x1a, 0x26, 0x72, 0xad, 0x40, 0x2c, 0xce, 0x8c, 0xf0, 0x99, 0x97, + 0xd5, 0xf0, 0xea, 0x57, 0xa3, 0xab, 0x5f, 0xdd, 0x8e, 0xae, 0xfe, 0xf2, 0x78, 0x70, 0x87, 0x3d, + 0xfc, 0x3d, 0x27, 0xe9, 0xe7, 0x02, 0x14, 0x3d, 0x02, 0x59, 0x8e, 0x30, 0xe0, 0x16, 0x38, 0xe9, + 0x21, 0xf3, 0x33, 0xcc, 0x68, 0x66, 0x94, 0xdf, 0x4a, 0xf3, 0x89, 0x8e, 0x50, 0xe4, 0x80, 0xb5, + 0x15, 0x70, 0xde, 0xe4, 0x08, 0x7a, 0x84, 0xa4, 0xac, 0x88, 0x43, 0xdc, 0xd8, 0x15, 0x4d, 0x5c, + 0xb8, 0x71, 0x05, 0x31, 0x94, 0xe0, 0xaa, 0xff, 0x2d, 0xba, 0xc0, 0x7a, 0xc2, 0x08, 0xf3, 0x7b, + 0x4c, 0x1b, 0x04, 0xa3, 0xd4, 0xfe, 0x3c, 0x74, 0x79, 0x54, 0xe7, 0xbf, 0xe1, 0x1e, 0x38, 0xeb, + 0x35, 0x40, 0xd6, 0x5d, 0xca, 0x02, 0xb3, 0x69, 0x66, 0x84, 0x5b, 0x50, 0x1c, 0xcc, 0x82, 0x26, + 0x9b, 0x0f, 0x7c, 0xe4, 0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0x36, 0x70, 0x29, 0xd1, 0x0c, + 0xf4, 0xc8, 0x53, 0x72, 0xe9, 0x05, 0x10, 0x42, 0xfe, 0xca, 0xea, 0x37, 0x4f, 0xff, 0xfc, 0x21, + 0x5d, 0x84, 0x8b, 0xfd, 0x23, 0x6f, 0xe3, 0x6a, 0x17, 0xd1, 0x49, 0xfb, 0x22, 0x3a, 0x99, 0x5f, + 0xc1, 0xa7, 0x12, 0x38, 0x1b, 0x93, 0x91, 0x60, 0x71, 0x70, 0x86, 0x6d, 0xd9, 0x4b, 0x5e, 0x1a, + 0x1e, 0x40, 0x28, 0x9c, 0xe7, 0x0a, 0xaf, 0xc2, 0xfc, 0x00, 0x0a, 0xc3, 0x54, 0x06, 0xbf, 0x4e, + 0x83, 0x4c, 0x97, 0xa8, 0x45, 0xe1, 0xad, 0x21, 0x99, 0xc5, 0xa6, 0x3a, 0x79, 0xe3, 0x98, 0xd0, + 0x84, 0xe8, 0x1b, 0x5c, 0x74, 0x19, 0x2e, 0x0d, 0x2a, 0x3a, 0x48, 0xd7, 0x3e, 0x33, 0x1a, 0x81, + 0x09, 0xfe, 0x2b, 0x81, 0x57, 0xe2, 0x93, 0x1b, 0x85, 0x37, 0x87, 0x26, 0xdd, 0x19, 0x11, 0xe5, + 0x5b, 0xc7, 0x03, 0x26, 0x0c, 0x58, 0xe3, 0x06, 0x94, 0x60, 0x71, 0x08, 0x03, 0x88, 0xd7, 0xa2, + 0xff, 0x6f, 0x49, 0x84, 0x83, 0xd8, 0x98, 0x05, 0xdf, 0x4b, 0xce, 0xba, 0x57, 0x60, 0x94, 0xd7, + 0x5e, 0x18, 0x47, 0x08, 0x2f, 0x71, 0xe1, 0xef, 0xc0, 0xf9, 0x04, 0xdf, 0xb0, 0x11, 0x90, 0xd1, + 0x96, 0xda, 0x62, 0x24, 0xb7, 0xc6, 0xaf, 0xa1, 0x24, 0xc7, 0x04, 0xc9, 0xa1, 0x24, 0xc7, 0xe5, + 0xc0, 0xe1, 0x24, 0xb7, 0x25, 0x47, 0xf8, 0xab, 0x04, 0x60, 0x67, 0x04, 0x84, 0xd7, 0x93, 0x53, + 0x8c, 0x4b, 0x96, 0x72, 0x71, 0xe8, 0x7a, 0x21, 0xed, 0x1a, 0x97, 0x56, 0x80, 0x57, 0xfa, 0x4b, + 0x63, 0x02, 0x20, 0xfc, 0x3e, 0x86, 0xdf, 0xa6, 0xc1, 0x6c, 0xbf, 0x94, 0x35, 0xc8, 0x1d, 0xd6, + 0x3f, 0xf3, 0x0d, 0x72, 0x87, 0x25, 0x88, 0x7e, 0x4a, 0x99, 0x6b, 0x7f, 0x17, 0x2e, 0xf4, 0xd7, + 0xee, 0x61, 0xd7, 0xb2, 0xdd, 0x4a, 0x73, 0x8e, 0x45, 0x62, 0x85, 0x3f, 0xa6, 0xc1, 0x85, 0x04, + 0xaf, 0x73, 0x78, 0x3b, 0x39, 0xf5, 0x44, 0x31, 0x42, 0xde, 0x3c, 0x3e, 0x40, 0x61, 0xc7, 0x4d, + 0x6e, 0xc7, 0x2a, 0x5c, 0xee, 0x6f, 0x87, 0xdf, 0x40, 0x6c, 0x3a, 0xe2, 0x73, 0x4c, 0x23, 0x8c, + 0x27, 0xe5, 0xed, 0xc7, 0x07, 0x59, 0xe9, 0xc9, 0x41, 0x56, 0xfa, 0xe3, 0x20, 0x2b, 0x3d, 0x3c, + 0xcc, 0xa6, 0x9e, 0x1c, 0x66, 0x53, 0xcf, 0x0e, 0xb3, 0xa9, 0x0f, 0x17, 0x2a, 0x36, 0xdb, 0xad, + 0xed, 0xa8, 0x26, 0xa9, 0x6a, 0x26, 0xa1, 0x55, 0x42, 0x5b, 0xfa, 0xbd, 0xd5, 0xe8, 0x77, 0xff, + 0xc8, 0xf0, 0xed, 0x7b, 0x98, 0xee, 0x8c, 0xf1, 0x4f, 0x95, 0xab, 0xff, 0x05, 0x00, 0x00, 0xff, + 0xff, 0x99, 0xe0, 0xf2, 0x45, 0x3f, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1090,6 +1185,8 @@ type QueryClient interface { // QueryThrottledConsumerPacketData returns a list of pending packet data instances // (slash packet and vsc matured) for a single consumer chain QueryThrottledConsumerPacketData(ctx context.Context, in *QueryThrottledConsumerPacketDataRequest, opts ...grpc.CallOption) (*QueryThrottledConsumerPacketDataResponse, error) + // QueryRegisteredConsumerRewardDenoms returns a list of consumer reward denoms that are registered + QueryRegisteredConsumerRewardDenoms(ctx context.Context, in *QueryRegisteredConsumerRewardDenomsRequest, opts ...grpc.CallOption) (*QueryRegisteredConsumerRewardDenomsResponse, error) } type queryClient struct { @@ -1172,6 +1269,15 @@ func (c *queryClient) QueryThrottledConsumerPacketData(ctx context.Context, in * return out, nil } +func (c *queryClient) QueryRegisteredConsumerRewardDenoms(ctx context.Context, in *QueryRegisteredConsumerRewardDenomsRequest, opts ...grpc.CallOption) (*QueryRegisteredConsumerRewardDenomsResponse, error) { + out := new(QueryRegisteredConsumerRewardDenomsResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Query/QueryRegisteredConsumerRewardDenoms", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // ConsumerGenesis queries the genesis state needed to start a consumer chain @@ -1195,6 +1301,8 @@ type QueryServer interface { // QueryThrottledConsumerPacketData returns a list of pending packet data instances // (slash packet and vsc matured) for a single consumer chain QueryThrottledConsumerPacketData(context.Context, *QueryThrottledConsumerPacketDataRequest) (*QueryThrottledConsumerPacketDataResponse, error) + // QueryRegisteredConsumerRewardDenoms returns a list of consumer reward denoms that are registered + QueryRegisteredConsumerRewardDenoms(context.Context, *QueryRegisteredConsumerRewardDenomsRequest) (*QueryRegisteredConsumerRewardDenomsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1225,6 +1333,9 @@ func (*UnimplementedQueryServer) QueryThrottleState(ctx context.Context, req *Qu func (*UnimplementedQueryServer) QueryThrottledConsumerPacketData(ctx context.Context, req *QueryThrottledConsumerPacketDataRequest) (*QueryThrottledConsumerPacketDataResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryThrottledConsumerPacketData not implemented") } +func (*UnimplementedQueryServer) QueryRegisteredConsumerRewardDenoms(ctx context.Context, req *QueryRegisteredConsumerRewardDenomsRequest) (*QueryRegisteredConsumerRewardDenomsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryRegisteredConsumerRewardDenoms not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1374,6 +1485,24 @@ func _Query_QueryThrottledConsumerPacketData_Handler(srv interface{}, ctx contex return interceptor(ctx, in, info, handler) } +func _Query_QueryRegisteredConsumerRewardDenoms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRegisteredConsumerRewardDenomsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryRegisteredConsumerRewardDenoms(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Query/QueryRegisteredConsumerRewardDenoms", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryRegisteredConsumerRewardDenoms(ctx, req.(*QueryRegisteredConsumerRewardDenomsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "interchain_security.ccv.provider.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1410,6 +1539,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryThrottledConsumerPacketData", Handler: _Query_QueryThrottledConsumerPacketData_Handler, }, + { + MethodName: "QueryRegisteredConsumerRewardDenoms", + Handler: _Query_QueryRegisteredConsumerRewardDenoms_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "interchain_security/ccv/provider/v1/query.proto", @@ -2099,6 +2232,61 @@ func (m *ThrottledPacketDataWrapper_VscMaturedPacket) MarshalToSizedBuffer(dAtA } return len(dAtA) - i, nil } +func (m *QueryRegisteredConsumerRewardDenomsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryRegisteredConsumerRewardDenomsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRegisteredConsumerRewardDenomsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryRegisteredConsumerRewardDenomsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryRegisteredConsumerRewardDenomsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRegisteredConsumerRewardDenomsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Denoms) > 0 { + for iNdEx := len(m.Denoms) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Denoms[iNdEx]) + copy(dAtA[i:], m.Denoms[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denoms[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -2395,6 +2583,29 @@ func (m *ThrottledPacketDataWrapper_VscMaturedPacket) Size() (n int) { } return n } +func (m *QueryRegisteredConsumerRewardDenomsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryRegisteredConsumerRewardDenomsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Denoms) > 0 { + for _, s := range m.Denoms { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 @@ -4137,6 +4348,138 @@ func (m *ThrottledPacketDataWrapper) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryRegisteredConsumerRewardDenomsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRegisteredConsumerRewardDenomsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRegisteredConsumerRewardDenomsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/provider/types/query.pb.gw.go b/x/ccv/provider/types/query.pb.gw.go index cb5e2f2411..6a249ca2a2 100644 --- a/x/ccv/provider/types/query.pb.gw.go +++ b/x/ccv/provider/types/query.pb.gw.go @@ -267,6 +267,24 @@ func local_request_Query_QueryThrottledConsumerPacketData_0(ctx context.Context, } +func request_Query_QueryRegisteredConsumerRewardDenoms_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRegisteredConsumerRewardDenomsRequest + var metadata runtime.ServerMetadata + + msg, err := client.QueryRegisteredConsumerRewardDenoms(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryRegisteredConsumerRewardDenoms_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRegisteredConsumerRewardDenomsRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryRegisteredConsumerRewardDenoms(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -457,6 +475,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryRegisteredConsumerRewardDenoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_QueryRegisteredConsumerRewardDenoms_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryRegisteredConsumerRewardDenoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -658,6 +699,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryRegisteredConsumerRewardDenoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_QueryRegisteredConsumerRewardDenoms_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_QueryRegisteredConsumerRewardDenoms_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -677,6 +738,8 @@ var ( pattern_Query_QueryThrottleState_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "throttle_state"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryThrottledConsumerPacketData_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "pending_consumer_packets"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryRegisteredConsumerRewardDenoms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"interchain_security", "ccv", "provider", "registered_consumer_reward_denoms"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -695,4 +758,6 @@ var ( forward_Query_QueryThrottleState_0 = runtime.ForwardResponseMessage forward_Query_QueryThrottledConsumerPacketData_0 = runtime.ForwardResponseMessage + + forward_Query_QueryRegisteredConsumerRewardDenoms_0 = runtime.ForwardResponseMessage ) diff --git a/x/ccv/provider/types/tx.pb.go b/x/ccv/provider/types/tx.pb.go index 89366fc381..3bc162ceb2 100644 --- a/x/ccv/provider/types/tx.pb.go +++ b/x/ccv/provider/types/tx.pb.go @@ -111,9 +111,91 @@ func (m *MsgAssignConsumerKeyResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAssignConsumerKeyResponse proto.InternalMessageInfo +// MsgRegisterConsumerRewardDenom allows an account to register +// a consumer reward denom, i.e., add it to the list of denoms +// accepted by the provider as rewards. +type MsgRegisterConsumerRewardDenom struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` +} + +func (m *MsgRegisterConsumerRewardDenom) Reset() { *m = MsgRegisterConsumerRewardDenom{} } +func (m *MsgRegisterConsumerRewardDenom) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterConsumerRewardDenom) ProtoMessage() {} +func (*MsgRegisterConsumerRewardDenom) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{2} +} +func (m *MsgRegisterConsumerRewardDenom) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterConsumerRewardDenom) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterConsumerRewardDenom.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterConsumerRewardDenom) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterConsumerRewardDenom.Merge(m, src) +} +func (m *MsgRegisterConsumerRewardDenom) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterConsumerRewardDenom) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterConsumerRewardDenom.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterConsumerRewardDenom proto.InternalMessageInfo + +// MsgRegisterConsumerRewardDenomResponse defines the Msg/RegisterConsumerRewardDenom response type. +type MsgRegisterConsumerRewardDenomResponse struct { +} + +func (m *MsgRegisterConsumerRewardDenomResponse) Reset() { + *m = MsgRegisterConsumerRewardDenomResponse{} +} +func (m *MsgRegisterConsumerRewardDenomResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterConsumerRewardDenomResponse) ProtoMessage() {} +func (*MsgRegisterConsumerRewardDenomResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_43221a4391e9fbf4, []int{3} +} +func (m *MsgRegisterConsumerRewardDenomResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterConsumerRewardDenomResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterConsumerRewardDenomResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterConsumerRewardDenomResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterConsumerRewardDenomResponse.Merge(m, src) +} +func (m *MsgRegisterConsumerRewardDenomResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterConsumerRewardDenomResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterConsumerRewardDenomResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterConsumerRewardDenomResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgAssignConsumerKey)(nil), "interchain_security.ccv.provider.v1.MsgAssignConsumerKey") proto.RegisterType((*MsgAssignConsumerKeyResponse)(nil), "interchain_security.ccv.provider.v1.MsgAssignConsumerKeyResponse") + proto.RegisterType((*MsgRegisterConsumerRewardDenom)(nil), "interchain_security.ccv.provider.v1.MsgRegisterConsumerRewardDenom") + proto.RegisterType((*MsgRegisterConsumerRewardDenomResponse)(nil), "interchain_security.ccv.provider.v1.MsgRegisterConsumerRewardDenomResponse") } func init() { @@ -121,31 +203,35 @@ func init() { } var fileDescriptor_43221a4391e9fbf4 = []byte{ - // 369 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x3d, 0x4f, 0xeb, 0x30, - 0x14, 0x8d, 0x5f, 0xa5, 0xf7, 0xfa, 0x4c, 0x41, 0x22, 0xea, 0xd0, 0x56, 0x55, 0x0a, 0x61, 0x61, - 0x80, 0x58, 0x85, 0x01, 0xd1, 0xad, 0x65, 0x42, 0xa8, 0x4b, 0xc5, 0xc4, 0x12, 0xa5, 0x8e, 0x71, - 0x2d, 0x1a, 0x3b, 0xb2, 0x9d, 0xa8, 0xf9, 0x07, 0x8c, 0x30, 0x21, 0xb6, 0xfe, 0x1c, 0xc6, 0x8e, - 0x4c, 0x08, 0xb5, 0x0b, 0x33, 0xbf, 0x00, 0x35, 0x1f, 0x54, 0x88, 0x0e, 0x88, 0xed, 0xde, 0x7b, - 0x8e, 0xcf, 0x39, 0xf2, 0xbd, 0xf0, 0x80, 0x71, 0x4d, 0x24, 0x1e, 0x79, 0x8c, 0xbb, 0x8a, 0xe0, - 0x48, 0x32, 0x9d, 0x20, 0x8c, 0x63, 0x14, 0x4a, 0x11, 0x33, 0x9f, 0x48, 0x14, 0xb7, 0x91, 0x9e, - 0x38, 0xa1, 0x14, 0x5a, 0x98, 0x7b, 0x6b, 0xd8, 0x0e, 0xc6, 0xb1, 0x53, 0xb0, 0x9d, 0xb8, 0xdd, - 0x68, 0x52, 0x21, 0xe8, 0x98, 0x20, 0x2f, 0x64, 0xc8, 0xe3, 0x5c, 0x68, 0x4f, 0x33, 0xc1, 0x55, - 0x26, 0xd1, 0xa8, 0x52, 0x41, 0x45, 0x5a, 0xa2, 0x65, 0x95, 0x4f, 0xeb, 0x58, 0xa8, 0x40, 0x28, - 0x37, 0x03, 0xb2, 0xa6, 0x80, 0x72, 0xb9,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x09, 0x89, 0x1a, 0xfe, - 0x4d, 0x57, 0x76, 0xfc, 0x11, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x60, 0x67, 0xb6, 0x71, 0x02, 0x00, - 0x00, + // 448 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0x3d, 0x6f, 0xd3, 0x40, + 0x18, 0xc7, 0xed, 0x56, 0x40, 0x7b, 0x14, 0x24, 0x4e, 0x19, 0xd2, 0x10, 0x39, 0x60, 0x24, 0xd4, + 0x01, 0x7c, 0x2a, 0x0c, 0x88, 0x6c, 0x69, 0x59, 0x50, 0x95, 0xc5, 0x62, 0x62, 0x20, 0x72, 0xee, + 0x8e, 0xeb, 0x89, 0xfa, 0x1e, 0xeb, 0x9e, 0x8b, 0xa9, 0xbf, 0x01, 0x23, 0x4c, 0xac, 0xfd, 0x06, + 0x7c, 0x0d, 0x24, 0x96, 0x8e, 0x4c, 0x08, 0x25, 0x0b, 0x33, 0x9f, 0x00, 0xf9, 0x8d, 0x80, 0x88, + 0xa2, 0x0a, 0x75, 0x7b, 0xde, 0xfc, 0xff, 0xff, 0x7c, 0x77, 0x0f, 0x79, 0xa0, 0x8d, 0x93, 0x96, + 0x1f, 0x27, 0xda, 0x4c, 0x50, 0xf2, 0x99, 0xd5, 0xae, 0x60, 0x9c, 0xe7, 0x2c, 0xb3, 0x90, 0x6b, + 0x21, 0x2d, 0xcb, 0xf7, 0x99, 0x3b, 0x8d, 0x32, 0x0b, 0x0e, 0xe8, 0xbd, 0x15, 0xd3, 0x11, 0xe7, + 0x79, 0xd4, 0x4e, 0x47, 0xf9, 0x7e, 0xaf, 0xaf, 0x00, 0xd4, 0x89, 0x64, 0x49, 0xa6, 0x59, 0x62, + 0x0c, 0xb8, 0xc4, 0x69, 0x30, 0x58, 0x4b, 0xf4, 0x3a, 0x0a, 0x14, 0x54, 0x21, 0x2b, 0xa3, 0xa6,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0f, 0x3e, 0xb9, 0xf5, 0xef, 0x41, 0x3e, 0x8d, 0x2e, 0x70, + 0xe3, 0xd1, 0xaa, 0x5f, 0xed, 0x8d, 0xfe, 0xfb, 0xd3, 0x96, 0x8d, 0x7e, 0xf2, 0xc9, 0xed, 0x75, + 0x67, 0x74, 0x78, 0x51, 0x8b, 0x35, 0x22, 0xbd, 0xa3, 0x4b, 0x10, 0x69, 0x89, 0x0f, 0x5e, 0x7c, + 0x9e, 0x07, 0xfe, 0xf9, 0x3c, 0xf0, 0xbf, 0xcf, 0x03, 0xff, 0xfd, 0x22, 0xf0, 0xce, 0x17, 0x81, + 0xf7, 0x75, 0x11, 0x78, 0x2f, 0x87, 0x4a, 0xbb, 0xe3, 0xd9, 0x34, 0xe2, 0x90, 0x36, 0xef, 0x9b, + 0x2d, 0x7d, 0x1f, 0xfe, 0x5e, 0xbd, 0xd3, 0xbf, 0x97, 0xcf, 0x15, 0x99, 0xc4, 0xe9, 0xd5, 0xea, + 0xb9, 0x3f, 0xfe, 0x15, 0x00, 0x00, 0xff, 0xff, 0xb4, 0xbc, 0x30, 0xff, 0xad, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -161,6 +247,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { AssignConsumerKey(ctx context.Context, in *MsgAssignConsumerKey, opts ...grpc.CallOption) (*MsgAssignConsumerKeyResponse, error) + RegisterConsumerRewardDenom(ctx context.Context, in *MsgRegisterConsumerRewardDenom, opts ...grpc.CallOption) (*MsgRegisterConsumerRewardDenomResponse, error) } type msgClient struct { @@ -180,9 +267,19 @@ func (c *msgClient) AssignConsumerKey(ctx context.Context, in *MsgAssignConsumer return out, nil } +func (c *msgClient) RegisterConsumerRewardDenom(ctx context.Context, in *MsgRegisterConsumerRewardDenom, opts ...grpc.CallOption) (*MsgRegisterConsumerRewardDenomResponse, error) { + out := new(MsgRegisterConsumerRewardDenomResponse) + err := c.cc.Invoke(ctx, "/interchain_security.ccv.provider.v1.Msg/RegisterConsumerRewardDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { AssignConsumerKey(context.Context, *MsgAssignConsumerKey) (*MsgAssignConsumerKeyResponse, error) + RegisterConsumerRewardDenom(context.Context, *MsgRegisterConsumerRewardDenom) (*MsgRegisterConsumerRewardDenomResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -192,6 +289,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) AssignConsumerKey(ctx context.Context, req *MsgAssignConsumerKey) (*MsgAssignConsumerKeyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AssignConsumerKey not implemented") } +func (*UnimplementedMsgServer) RegisterConsumerRewardDenom(ctx context.Context, req *MsgRegisterConsumerRewardDenom) (*MsgRegisterConsumerRewardDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterConsumerRewardDenom not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -215,6 +315,24 @@ func _Msg_AssignConsumerKey_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Msg_RegisterConsumerRewardDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterConsumerRewardDenom) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterConsumerRewardDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/interchain_security.ccv.provider.v1.Msg/RegisterConsumerRewardDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterConsumerRewardDenom(ctx, req.(*MsgRegisterConsumerRewardDenom)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "interchain_security.ccv.provider.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -223,6 +341,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "AssignConsumerKey", Handler: _Msg_AssignConsumerKey_Handler, }, + { + MethodName: "RegisterConsumerRewardDenom", + Handler: _Msg_RegisterConsumerRewardDenom_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "interchain_security/ccv/provider/v1/tx.proto", @@ -295,6 +417,66 @@ func (m *MsgAssignConsumerKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *MsgRegisterConsumerRewardDenom) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterConsumerRewardDenom) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterConsumerRewardDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterConsumerRewardDenomResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterConsumerRewardDenomResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterConsumerRewardDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -336,6 +518,32 @@ func (m *MsgAssignConsumerKeyResponse) Size() (n int) { return n } +func (m *MsgRegisterConsumerRewardDenom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRegisterConsumerRewardDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -538,6 +746,170 @@ func (m *MsgAssignConsumerKeyResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgRegisterConsumerRewardDenom) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterConsumerRewardDenom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterConsumerRewardDenom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterConsumerRewardDenomResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterConsumerRewardDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterConsumerRewardDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/ccv/types/events.go b/x/ccv/types/events.go index 1cab3e8a15..ba71e063f3 100644 --- a/x/ccv/types/events.go +++ b/x/ccv/types/events.go @@ -2,12 +2,13 @@ package types // CCV events const ( - EventTypeTimeout = "timeout" - EventTypePacket = "ccv_packet" - EventTypeChannelEstablished = "channel_established" - EventTypeFeeTransferChannelOpened = "fee_transfer_channel_opened" - EventTypeConsumerClientCreated = "consumer_client_created" - EventTypeAssignConsumerKey = "assign_consumer_key" + 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" @@ -38,4 +39,7 @@ const ( AttributeDistributionFraction = "distribution_fraction" AttributeDistributionTotal = "total" AttributeDistributionToProvider = "provider_amount" + + AttributeConsumerRewardDenom = "consumer_reward_denom" + AttributeConsumerRewardDepositor = "consumer_reward_depositor" ) diff --git a/x/ccv/types/expected_keepers.go b/x/ccv/types/expected_keepers.go index 56025820e6..7f18324c8d 100644 --- a/x/ccv/types/expected_keepers.go +++ b/x/ccv/types/expected_keepers.go @@ -43,6 +43,7 @@ type StakingKeeper interface { MaxValidators(ctx sdk.Context) uint32 GetLastTotalPower(ctx sdk.Context) sdk.Int GetLastValidators(ctx sdk.Context) (validators []stakingtypes.Validator) + BondDenom(ctx sdk.Context) (res string) } type EvidenceKeeper interface { @@ -87,7 +88,10 @@ type ClientKeeper interface { GetSelfConsensusState(ctx sdk.Context, height ibcexported.Height) (ibcexported.ConsensusState, error) } -// TODO: Expected interfaces for distribution on provider and consumer chains +// DistributionKeeper defines the expected interface of the distribution keeper +type DistributionKeeper interface { + FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error +} // ConsumerHooks event hooks for newly bonded cross-chain validators type ConsumerHooks interface { From cf8f2fbb9bbee945d46c4533d638ed3104707f6f Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Tue, 9 May 2023 11:17:07 -0700 Subject: [PATCH 02/11] regen proto --- x/ccv/provider/types/provider.pb.go | 1934 ++++++++++++++++++++++----- 1 file changed, 1581 insertions(+), 353 deletions(-) diff --git a/x/ccv/provider/types/provider.pb.go b/x/ccv/provider/types/provider.pb.go index 4c2c262e08..edcf40dcc6 100644 --- a/x/ccv/provider/types/provider.pb.go +++ b/x/ccv/provider/types/provider.pb.go @@ -261,7 +261,7 @@ type GlobalSlashEntry struct { // This field is used to obtain validator power in HandleThrottleQueues. // // This field is not used in the store key, but is persisted in value bytes, see QueueGlobalSlashEntry. - ProviderValConsAddr []byte `protobuf:"bytes,4,opt,name=provider_val_cons_addr,json=providerValConsAddr,proto3" json:"provider_val_cons_addr,omitempty"` + ProviderValConsAddr *ProviderConsAddress `protobuf:"bytes,4,opt,name=provider_val_cons_addr,json=providerValConsAddr,proto3" json:"provider_val_cons_addr,omitempty"` } func (m *GlobalSlashEntry) Reset() { *m = GlobalSlashEntry{} } @@ -318,7 +318,7 @@ func (m *GlobalSlashEntry) GetIbcSeqNum() uint64 { return 0 } -func (m *GlobalSlashEntry) GetProviderValConsAddr() []byte { +func (m *GlobalSlashEntry) GetProviderValConsAddr() *ProviderConsAddress { if m != nil { return m.ProviderValConsAddr } @@ -499,7 +499,7 @@ func (m *HandshakeMetadata) GetVersion() string { return "" } -// SlashAcks contains addesses of consumer chain validators +// SlashAcks contains cons addresses of consumer chain validators // successfully slashed on the provider chain type SlashAcks struct { Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` @@ -637,51 +637,6 @@ func (m *ConsumerRemovalProposals) GetPending() []*ConsumerRemovalProposal { return nil } -// AddressList contains a list of consensus addresses -type AddressList struct { - Addresses [][]byte `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` -} - -func (m *AddressList) Reset() { *m = AddressList{} } -func (m *AddressList) String() string { return proto.CompactTextString(m) } -func (*AddressList) ProtoMessage() {} -func (*AddressList) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{9} -} -func (m *AddressList) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *AddressList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_AddressList.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *AddressList) XXX_Merge(src proto.Message) { - xxx_messageInfo_AddressList.Merge(m, src) -} -func (m *AddressList) XXX_Size() int { - return m.Size() -} -func (m *AddressList) XXX_DiscardUnknown() { - xxx_messageInfo_AddressList.DiscardUnknown(m) -} - -var xxx_messageInfo_AddressList proto.InternalMessageInfo - -func (m *AddressList) GetAddresses() [][]byte { - if m != nil { - return m.Addresses - } - return nil -} - type ChannelToChain struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -691,7 +646,7 @@ func (m *ChannelToChain) Reset() { *m = ChannelToChain{} } func (m *ChannelToChain) String() string { return proto.CompactTextString(m) } func (*ChannelToChain) ProtoMessage() {} func (*ChannelToChain) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{10} + return fileDescriptor_f22ec409a72b7b72, []int{9} } func (m *ChannelToChain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -745,7 +700,7 @@ func (m *VscUnbondingOps) Reset() { *m = VscUnbondingOps{} } func (m *VscUnbondingOps) String() string { return proto.CompactTextString(m) } func (*VscUnbondingOps) ProtoMessage() {} func (*VscUnbondingOps) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{11} + return fileDescriptor_f22ec409a72b7b72, []int{10} } func (m *VscUnbondingOps) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -800,7 +755,7 @@ func (m *UnbondingOp) Reset() { *m = UnbondingOp{} } func (m *UnbondingOp) String() string { return proto.CompactTextString(m) } func (*UnbondingOp) ProtoMessage() {} func (*UnbondingOp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{12} + return fileDescriptor_f22ec409a72b7b72, []int{11} } func (m *UnbondingOp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -852,7 +807,7 @@ func (m *InitTimeoutTimestamp) Reset() { *m = InitTimeoutTimestamp{} } func (m *InitTimeoutTimestamp) String() string { return proto.CompactTextString(m) } func (*InitTimeoutTimestamp) ProtoMessage() {} func (*InitTimeoutTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{13} + return fileDescriptor_f22ec409a72b7b72, []int{12} } func (m *InitTimeoutTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -904,7 +859,7 @@ func (m *VscSendTimestamp) Reset() { *m = VscSendTimestamp{} } func (m *VscSendTimestamp) String() string { return proto.CompactTextString(m) } func (*VscSendTimestamp) ProtoMessage() {} func (*VscSendTimestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{14} + return fileDescriptor_f22ec409a72b7b72, []int{13} } func (m *VscSendTimestamp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -947,17 +902,152 @@ func (m *VscSendTimestamp) GetTimestamp() time.Time { return time.Time{} } +// A validator's assigned consensus address for a consumer chain. +// Note this type is for type safety within provider code, consumer code uses normal sdk.ConsAddress, +// since there's no notion of provider vs consumer address. +type ConsumerConsAddress struct { + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *ConsumerConsAddress) Reset() { *m = ConsumerConsAddress{} } +func (*ConsumerConsAddress) ProtoMessage() {} +func (*ConsumerConsAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{14} +} +func (m *ConsumerConsAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerConsAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerConsAddress.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsumerConsAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerConsAddress.Merge(m, src) +} +func (m *ConsumerConsAddress) XXX_Size() int { + return m.Size() +} +func (m *ConsumerConsAddress) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerConsAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerConsAddress proto.InternalMessageInfo + +func (m *ConsumerConsAddress) GetAddress() []byte { + if m != nil { + return m.Address + } + return nil +} + +// A validator's consensus address on the provider chain +type ProviderConsAddress struct { + Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *ProviderConsAddress) Reset() { *m = ProviderConsAddress{} } +func (*ProviderConsAddress) ProtoMessage() {} +func (*ProviderConsAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{15} +} +func (m *ProviderConsAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProviderConsAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProviderConsAddress.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProviderConsAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProviderConsAddress.Merge(m, src) +} +func (m *ProviderConsAddress) XXX_Size() int { + return m.Size() +} +func (m *ProviderConsAddress) XXX_DiscardUnknown() { + xxx_messageInfo_ProviderConsAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_ProviderConsAddress proto.InternalMessageInfo + +func (m *ProviderConsAddress) GetAddress() []byte { + if m != nil { + return m.Address + } + return nil +} + +// ConsumerAddressList contains a list of consumer consensus addresses +type ConsumerAddressList struct { + Addresses []*ConsumerConsAddress `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` +} + +func (m *ConsumerAddressList) Reset() { *m = ConsumerAddressList{} } +func (m *ConsumerAddressList) String() string { return proto.CompactTextString(m) } +func (*ConsumerAddressList) ProtoMessage() {} +func (*ConsumerAddressList) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{16} +} +func (m *ConsumerAddressList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerAddressList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerAddressList.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsumerAddressList) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerAddressList.Merge(m, src) +} +func (m *ConsumerAddressList) XXX_Size() int { + return m.Size() +} +func (m *ConsumerAddressList) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerAddressList.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerAddressList proto.InternalMessageInfo + +func (m *ConsumerAddressList) GetAddresses() []*ConsumerConsAddress { + if m != nil { + return m.Addresses + } + return nil +} + type KeyAssignmentReplacement struct { - ProviderAddr []byte `protobuf:"bytes,1,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` - PrevCKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=prev_c_key,json=prevCKey,proto3" json:"prev_c_key,omitempty"` - Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` + ProviderAddr *ProviderConsAddress `protobuf:"bytes,1,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` + PrevCKey *crypto.PublicKey `protobuf:"bytes,2,opt,name=prev_c_key,json=prevCKey,proto3" json:"prev_c_key,omitempty"` + Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` } func (m *KeyAssignmentReplacement) Reset() { *m = KeyAssignmentReplacement{} } func (m *KeyAssignmentReplacement) String() string { return proto.CompactTextString(m) } func (*KeyAssignmentReplacement) ProtoMessage() {} func (*KeyAssignmentReplacement) Descriptor() ([]byte, []int) { - return fileDescriptor_f22ec409a72b7b72, []int{15} + return fileDescriptor_f22ec409a72b7b72, []int{17} } func (m *KeyAssignmentReplacement) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -986,7 +1076,7 @@ func (m *KeyAssignmentReplacement) XXX_DiscardUnknown() { var xxx_messageInfo_KeyAssignmentReplacement proto.InternalMessageInfo -func (m *KeyAssignmentReplacement) GetProviderAddr() []byte { +func (m *KeyAssignmentReplacement) GetProviderAddr() *ProviderConsAddress { if m != nil { return m.ProviderAddr } @@ -1007,6 +1097,192 @@ func (m *KeyAssignmentReplacement) GetPower() int64 { return 0 } +// Used to serialize the ValidatorConsumerPubKey index from key assignment +// ValidatorConsumerPubKey: (chainID, providerAddr consAddr) -> consumerKey tmprotocrypto.PublicKey +type ValidatorConsumerPubKey struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ProviderAddr *ProviderConsAddress `protobuf:"bytes,2,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` + ConsumerKey *crypto.PublicKey `protobuf:"bytes,3,opt,name=consumer_key,json=consumerKey,proto3" json:"consumer_key,omitempty"` +} + +func (m *ValidatorConsumerPubKey) Reset() { *m = ValidatorConsumerPubKey{} } +func (m *ValidatorConsumerPubKey) String() string { return proto.CompactTextString(m) } +func (*ValidatorConsumerPubKey) ProtoMessage() {} +func (*ValidatorConsumerPubKey) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{18} +} +func (m *ValidatorConsumerPubKey) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorConsumerPubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorConsumerPubKey.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorConsumerPubKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorConsumerPubKey.Merge(m, src) +} +func (m *ValidatorConsumerPubKey) XXX_Size() int { + return m.Size() +} +func (m *ValidatorConsumerPubKey) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorConsumerPubKey.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorConsumerPubKey proto.InternalMessageInfo + +func (m *ValidatorConsumerPubKey) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *ValidatorConsumerPubKey) GetProviderAddr() *ProviderConsAddress { + if m != nil { + return m.ProviderAddr + } + return nil +} + +func (m *ValidatorConsumerPubKey) GetConsumerKey() *crypto.PublicKey { + if m != nil { + return m.ConsumerKey + } + return nil +} + +// Used to serialize the ValidatorConsumerAddr index from key assignment +// ValidatorByConsumerAddr: (chainID, consumerAddr consAddr) -> providerAddr consAddr +type ValidatorByConsumerAddr struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ConsumerAddr *ConsumerConsAddress `protobuf:"bytes,2,opt,name=consumer_addr,json=consumerAddr,proto3" json:"consumer_addr,omitempty"` + ProviderAddr *ProviderConsAddress `protobuf:"bytes,3,opt,name=provider_addr,json=providerAddr,proto3" json:"provider_addr,omitempty"` +} + +func (m *ValidatorByConsumerAddr) Reset() { *m = ValidatorByConsumerAddr{} } +func (m *ValidatorByConsumerAddr) String() string { return proto.CompactTextString(m) } +func (*ValidatorByConsumerAddr) ProtoMessage() {} +func (*ValidatorByConsumerAddr) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{19} +} +func (m *ValidatorByConsumerAddr) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ValidatorByConsumerAddr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ValidatorByConsumerAddr.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ValidatorByConsumerAddr) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorByConsumerAddr.Merge(m, src) +} +func (m *ValidatorByConsumerAddr) XXX_Size() int { + return m.Size() +} +func (m *ValidatorByConsumerAddr) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorByConsumerAddr.DiscardUnknown(m) +} + +var xxx_messageInfo_ValidatorByConsumerAddr proto.InternalMessageInfo + +func (m *ValidatorByConsumerAddr) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *ValidatorByConsumerAddr) GetConsumerAddr() *ConsumerConsAddress { + if m != nil { + return m.ConsumerAddr + } + return nil +} + +func (m *ValidatorByConsumerAddr) GetProviderAddr() *ProviderConsAddress { + if m != nil { + return m.ProviderAddr + } + return nil +} + +// Used to serialize the ConsumerAddrsToPrune index from key assignment +// ConsumerAddrsToPrune: (chainID, vscID uint64) -> consumerAddrs AddressList +type ConsumerAddrsToPrune struct { + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + VscId uint64 `protobuf:"varint,2,opt,name=vsc_id,json=vscId,proto3" json:"vsc_id,omitempty"` + ConsumerAddrs *ConsumerAddressList `protobuf:"bytes,3,opt,name=consumer_addrs,json=consumerAddrs,proto3" json:"consumer_addrs,omitempty"` +} + +func (m *ConsumerAddrsToPrune) Reset() { *m = ConsumerAddrsToPrune{} } +func (m *ConsumerAddrsToPrune) String() string { return proto.CompactTextString(m) } +func (*ConsumerAddrsToPrune) ProtoMessage() {} +func (*ConsumerAddrsToPrune) Descriptor() ([]byte, []int) { + return fileDescriptor_f22ec409a72b7b72, []int{20} +} +func (m *ConsumerAddrsToPrune) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ConsumerAddrsToPrune) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ConsumerAddrsToPrune.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ConsumerAddrsToPrune) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsumerAddrsToPrune.Merge(m, src) +} +func (m *ConsumerAddrsToPrune) XXX_Size() int { + return m.Size() +} +func (m *ConsumerAddrsToPrune) XXX_DiscardUnknown() { + xxx_messageInfo_ConsumerAddrsToPrune.DiscardUnknown(m) +} + +var xxx_messageInfo_ConsumerAddrsToPrune proto.InternalMessageInfo + +func (m *ConsumerAddrsToPrune) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *ConsumerAddrsToPrune) GetVscId() uint64 { + if m != nil { + return m.VscId + } + return 0 +} + +func (m *ConsumerAddrsToPrune) GetConsumerAddrs() *ConsumerAddressList { + if m != nil { + return m.ConsumerAddrs + } + return nil +} + func init() { proto.RegisterType((*ConsumerAdditionProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposal") proto.RegisterType((*ConsumerRemovalProposal)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposal") @@ -1017,13 +1293,18 @@ func init() { proto.RegisterType((*SlashAcks)(nil), "interchain_security.ccv.provider.v1.SlashAcks") proto.RegisterType((*ConsumerAdditionProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerAdditionProposals") proto.RegisterType((*ConsumerRemovalProposals)(nil), "interchain_security.ccv.provider.v1.ConsumerRemovalProposals") - proto.RegisterType((*AddressList)(nil), "interchain_security.ccv.provider.v1.AddressList") proto.RegisterType((*ChannelToChain)(nil), "interchain_security.ccv.provider.v1.ChannelToChain") proto.RegisterType((*VscUnbondingOps)(nil), "interchain_security.ccv.provider.v1.VscUnbondingOps") proto.RegisterType((*UnbondingOp)(nil), "interchain_security.ccv.provider.v1.UnbondingOp") proto.RegisterType((*InitTimeoutTimestamp)(nil), "interchain_security.ccv.provider.v1.InitTimeoutTimestamp") proto.RegisterType((*VscSendTimestamp)(nil), "interchain_security.ccv.provider.v1.VscSendTimestamp") + proto.RegisterType((*ConsumerConsAddress)(nil), "interchain_security.ccv.provider.v1.ConsumerConsAddress") + proto.RegisterType((*ProviderConsAddress)(nil), "interchain_security.ccv.provider.v1.ProviderConsAddress") + proto.RegisterType((*ConsumerAddressList)(nil), "interchain_security.ccv.provider.v1.ConsumerAddressList") proto.RegisterType((*KeyAssignmentReplacement)(nil), "interchain_security.ccv.provider.v1.KeyAssignmentReplacement") + proto.RegisterType((*ValidatorConsumerPubKey)(nil), "interchain_security.ccv.provider.v1.ValidatorConsumerPubKey") + proto.RegisterType((*ValidatorByConsumerAddr)(nil), "interchain_security.ccv.provider.v1.ValidatorByConsumerAddr") + proto.RegisterType((*ConsumerAddrsToPrune)(nil), "interchain_security.ccv.provider.v1.ConsumerAddrsToPrune") } func init() { @@ -1031,99 +1312,109 @@ func init() { } var fileDescriptor_f22ec409a72b7b72 = []byte{ - // 1468 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcd, 0x6e, 0x1b, 0x47, - 0x12, 0x16, 0x45, 0xea, 0x87, 0x4d, 0xfd, 0x8e, 0x64, 0x9b, 0xf2, 0x6a, 0x29, 0x9a, 0xde, 0x35, - 0xb8, 0x30, 0x3c, 0x84, 0xe4, 0xcb, 0x42, 0xd8, 0xc5, 0x42, 0xa2, 0x6c, 0x4b, 0xab, 0xb5, 0x2d, - 0x8f, 0xb4, 0x0a, 0x92, 0x1c, 0x06, 0x3d, 0x3d, 0x25, 0xb2, 0xa1, 0x99, 0xe9, 0x71, 0x77, 0x73, - 0x6c, 0xbe, 0x41, 0x8e, 0x0e, 0x72, 0x31, 0x90, 0x8b, 0xdf, 0x20, 0xaf, 0xe1, 0xa3, 0x8f, 0x39, - 0x39, 0x81, 0x7c, 0xc8, 0x21, 0x2f, 0x11, 0x74, 0xcf, 0x1f, 0x87, 0x96, 0x01, 0x19, 0x49, 0x6e, - 0xd3, 0xf5, 0xf3, 0x75, 0x75, 0x57, 0xd5, 0x57, 0x3d, 0x68, 0x8b, 0x06, 0x12, 0x38, 0xe9, 0x63, - 0x1a, 0xd8, 0x02, 0xc8, 0x80, 0x53, 0x39, 0xec, 0x10, 0x12, 0x75, 0x42, 0xce, 0x22, 0xea, 0x02, - 0xef, 0x44, 0x9b, 0xd9, 0xb7, 0x19, 0x72, 0x26, 0x99, 0x71, 0xfb, 0x12, 0x1f, 0x93, 0x90, 0xc8, - 0xcc, 0xec, 0xa2, 0xcd, 0x9b, 0xab, 0x3d, 0xd6, 0x63, 0xda, 0xbe, 0xa3, 0xbe, 0x62, 0xd7, 0x9b,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, 0x08, 0xfa, 0x0c, 0x19, 0x91, 0x20, 0xe3, - 0x98, 0x53, 0x9f, 0x11, 0x67, 0x24, 0x48, 0x11, 0xd2, 0x45, 0xeb, 0x42, 0x15, 0x9f, 0xed, 0x83, - 0xd4, 0x54, 0x15, 0x7a, 0x10, 0x50, 0xd1, 0x4f, 0xc1, 0xa7, 0xaf, 0x0e, 0xbe, 0xa6, 0x81, 0x1e, - 0x2b, 0x1c, 0x2b, 0x85, 0x49, 0x76, 0xe9, 0xa2, 0xc6, 0xe5, 0xbb, 0x64, 0x09, 0x9a, 0xd1, 0x09, - 0xfa, 0xcb, 0x25, 0x10, 0x59, 0x96, 0xb6, 0xd0, 0x35, 0x1f, 0xbf, 0xb4, 0x65, 0x9f, 0x33, 0x29, - 0x3d, 0x70, 0xed, 0x10, 0x93, 0x73, 0x90, 0x42, 0xcf, 0x95, 0xb2, 0xb5, 0xe2, 0xe3, 0x97, 0x27, - 0xa9, 0xee, 0x28, 0x56, 0x19, 0x02, 0xdd, 0x19, 0xa1, 0xe1, 0x17, 0x98, 0xbb, 0xb6, 0x0b, 0x01, - 0xf3, 0x6d, 0x0e, 0x3d, 0xc5, 0x8f, 0x38, 0x66, 0x64, 0x80, 0x6c, 0x94, 0x24, 0x8d, 0xac, 0x5e, - 0x06, 0x59, 0x13, 0x77, 0x19, 0x0d, 0x92, 0x79, 0xdb, 0xca, 0xd9, 0x5a, 0xa1, 0xed, 0x29, 0x30, - 0x6b, 0x04, 0xeb, 0x21, 0x40, 0xcb, 0x41, 0xcb, 0xfb, 0x38, 0x70, 0x45, 0x1f, 0x9f, 0xc3, 0x63, - 0x90, 0xd8, 0xc5, 0x12, 0x17, 0x7a, 0xe6, 0x0c, 0xc0, 0x0e, 0x19, 0xf3, 0xe2, 0x9e, 0x89, 0x29, - 0x28, 0xeb, 0x99, 0x87, 0x00, 0x47, 0x8c, 0x79, 0xaa, 0x67, 0x8c, 0x3a, 0x9a, 0x89, 0x80, 0x8b, - 0xbc, 0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, 0xcb, 0x7e, - 0xe3, 0x5e, 0x16, 0x7f, 0xe4, 0xe4, 0x30, 0x04, 0xe1, 0x4c, 0xeb, 0x2b, 0xb9, 0xff, 0x5b, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x5c, 0xf4, 0xc4, 0x31, 0xf9, 0x0d, 0x00, 0x00, + // 1632 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcd, 0x6e, 0x23, 0xc7, + 0x11, 0xd6, 0x88, 0xd4, 0x0f, 0x9b, 0xfa, 0xd9, 0x1d, 0x69, 0xbd, 0xd4, 0x46, 0xa1, 0xe8, 0x49, + 0x62, 0x28, 0x08, 0x3c, 0x84, 0x64, 0x18, 0x30, 0x84, 0x04, 0x86, 0xc4, 0xf5, 0x7a, 0x15, 0xc5, + 0x5e, 0x7a, 0xa4, 0x28, 0x48, 0x82, 0x60, 0xd0, 0xd3, 0x53, 0x4b, 0x36, 0x34, 0x33, 0x3d, 0xdb, + 0xdd, 0x33, 0xbb, 0x7c, 0x83, 0x1c, 0x0d, 0xe4, 0x62, 0x20, 0x17, 0x5f, 0x72, 0xc8, 0x29, 0xaf, + 0x61, 0x20, 0x17, 0x1f, 0x72, 0xc8, 0xc9, 0x09, 0xb4, 0x87, 0xdc, 0xf3, 0x04, 0x41, 0xf7, 0xfc, + 0x92, 0xab, 0xb5, 0x29, 0x78, 0x73, 0x9b, 0xae, 0xae, 0xfa, 0xba, 0xaa, 0xba, 0xea, 0xab, 0x26, + 0xd1, 0x21, 0x8d, 0x24, 0x70, 0x32, 0xc6, 0x34, 0x72, 0x05, 0x90, 0x84, 0x53, 0x39, 0xe9, 0x13, + 0x92, 0xf6, 0x63, 0xce, 0x52, 0xea, 0x03, 0xef, 0xa7, 0x07, 0xe5, 0xb7, 0x1d, 0x73, 0x26, 0x99, + 0xf9, 0xa3, 0x1b, 0x6c, 0x6c, 0x42, 0x52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 0xd3, 0x7f, 0xb2, 0xc8, 0x49, 0x0c, 0xc2, 0x5b, 0xd6, 0x0c, + 0xf5, 0xde, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x76, 0xa0, 0xbe, 0x95, 0x11, 0x00, 0x00, } func (m *ConsumerAdditionProposal) Marshal() (dAtA []byte, err error) { @@ -1366,10 +1657,15 @@ func (m *GlobalSlashEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ProviderValConsAddr) > 0 { - i -= len(m.ProviderValConsAddr) - copy(dAtA[i:], m.ProviderValConsAddr) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderValConsAddr))) + if m.ProviderValConsAddr != nil { + { + size, err := m.ProviderValConsAddr.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x22 } @@ -1385,12 +1681,12 @@ func (m *GlobalSlashEntry) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RecvTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RecvTime):]) - if err7 != nil { - return 0, err7 + n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.RecvTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.RecvTime):]) + if err8 != nil { + return 0, err8 } - i -= n7 - i = encodeVarintProvider(dAtA, i, uint64(n7)) + i -= n8 + i = encodeVarintProvider(dAtA, i, uint64(n8)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil @@ -1438,37 +1734,37 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - n9, err9 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.SlashMeterReplenishPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.SlashMeterReplenishPeriod):]) - if err9 != nil { - return 0, err9 - } - i -= n9 - i = encodeVarintProvider(dAtA, i, uint64(n9)) - i-- - dAtA[i] = 0x32 - n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VscTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VscTimeoutPeriod):]) + n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.SlashMeterReplenishPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.SlashMeterReplenishPeriod):]) if err10 != nil { return 0, err10 } i -= n10 i = encodeVarintProvider(dAtA, i, uint64(n10)) i-- - dAtA[i] = 0x2a - n11, err11 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.InitTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.InitTimeoutPeriod):]) + dAtA[i] = 0x32 + n11, err11 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VscTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VscTimeoutPeriod):]) if err11 != nil { return 0, err11 } i -= n11 i = encodeVarintProvider(dAtA, i, uint64(n11)) i-- - dAtA[i] = 0x22 - n12, err12 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) + dAtA[i] = 0x2a + n12, err12 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.InitTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.InitTimeoutPeriod):]) if err12 != nil { return 0, err12 } i -= n12 i = encodeVarintProvider(dAtA, i, uint64(n12)) i-- + dAtA[i] = 0x22 + n13, err13 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.CcvTimeoutPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.CcvTimeoutPeriod):]) + if err13 != nil { + return 0, err13 + } + i -= n13 + i = encodeVarintProvider(dAtA, i, uint64(n13)) + i-- dAtA[i] = 0x1a if len(m.TrustingPeriodFraction) > 0 { i -= len(m.TrustingPeriodFraction) @@ -1635,7 +1931,7 @@ func (m *ConsumerRemovalProposals) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *AddressList) Marshal() (dAtA []byte, err error) { +func (m *ChannelToChain) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1645,44 +1941,12 @@ func (m *AddressList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *AddressList) MarshalTo(dAtA []byte) (int, error) { +func (m *ChannelToChain) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *AddressList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addresses[iNdEx]) - copy(dAtA[i:], m.Addresses[iNdEx]) - i = encodeVarintProvider(dAtA, i, uint64(len(m.Addresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *ChannelToChain) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ChannelToChain) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ChannelToChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ChannelToChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1725,20 +1989,20 @@ func (m *VscUnbondingOps) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if len(m.UnbondingOpIds) > 0 { - dAtA15 := make([]byte, len(m.UnbondingOpIds)*10) - var j14 int + dAtA16 := make([]byte, len(m.UnbondingOpIds)*10) + var j15 int for _, num := range m.UnbondingOpIds { for num >= 1<<7 { - dAtA15[j14] = uint8(uint64(num)&0x7f | 0x80) + dAtA16[j15] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j14++ + j15++ } - dAtA15[j14] = uint8(num) - j14++ + dAtA16[j15] = uint8(num) + j15++ } - i -= j14 - copy(dAtA[i:], dAtA15[:j14]) - i = encodeVarintProvider(dAtA, i, uint64(j14)) + i -= j15 + copy(dAtA[i:], dAtA16[:j15]) + i = encodeVarintProvider(dAtA, i, uint64(j15)) i-- dAtA[i] = 0x12 } @@ -1842,12 +2106,12 @@ func (m *VscSendTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n16, err16 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) - if err16 != nil { - return 0, err16 + n17, err17 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + if err17 != nil { + return 0, err17 } - i -= n16 - i = encodeVarintProvider(dAtA, i, uint64(n16)) + i -= n17 + i = encodeVarintProvider(dAtA, i, uint64(n17)) i-- dAtA[i] = 0x12 if m.VscId != 0 { @@ -1858,6 +2122,103 @@ func (m *VscSendTimestamp) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ConsumerConsAddress) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsumerConsAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerConsAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ProviderConsAddress) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProviderConsAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProviderConsAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintProvider(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ConsumerAddressList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsumerAddressList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerAddressList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Addresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *KeyAssignmentReplacement) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1895,10 +2256,170 @@ func (m *KeyAssignmentReplacement) MarshalToSizedBuffer(dAtA []byte) (int, error i-- dAtA[i] = 0x12 } - if len(m.ProviderAddr) > 0 { - i -= len(m.ProviderAddr) - copy(dAtA[i:], m.ProviderAddr) - i = encodeVarintProvider(dAtA, i, uint64(len(m.ProviderAddr))) + if m.ProviderAddr != nil { + { + size, err := m.ProviderAddr.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ValidatorConsumerPubKey) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorConsumerPubKey) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorConsumerPubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ConsumerKey != nil { + { + size, err := m.ConsumerKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.ProviderAddr != nil { + { + size, err := m.ProviderAddr.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ValidatorByConsumerAddr) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ValidatorByConsumerAddr) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorByConsumerAddr) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProviderAddr != nil { + { + size, err := m.ProviderAddr.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.ConsumerAddr != nil { + { + size, err := m.ConsumerAddr.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ConsumerAddrsToPrune) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ConsumerAddrsToPrune) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsumerAddrsToPrune) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ConsumerAddrs != nil { + { + size, err := m.ConsumerAddrs.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProvider(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.VscId != 0 { + i = encodeVarintProvider(dAtA, i, uint64(m.VscId)) + i-- + dAtA[i] = 0x10 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintProvider(dAtA, i, uint64(len(m.ChainId))) i-- dAtA[i] = 0xa } @@ -2026,8 +2547,8 @@ func (m *GlobalSlashEntry) Size() (n int) { if m.IbcSeqNum != 0 { n += 1 + sovProvider(uint64(m.IbcSeqNum)) } - l = len(m.ProviderValConsAddr) - if l > 0 { + if m.ProviderValConsAddr != nil { + l = m.ProviderValConsAddr.Size() n += 1 + l + sovProvider(uint64(l)) } return n @@ -2129,22 +2650,7 @@ func (m *ConsumerRemovalProposals) Size() (n int) { return n } -func (m *AddressList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, b := range m.Addresses { - l = len(b) - n += 1 + l + sovProvider(uint64(l)) - } - } - return n -} - -func (m *ChannelToChain) Size() (n int) { +func (m *ChannelToChain) Size() (n int) { if m == nil { return 0 } @@ -2228,16 +2734,57 @@ func (m *VscSendTimestamp) Size() (n int) { return n } -func (m *KeyAssignmentReplacement) Size() (n int) { +func (m *ConsumerConsAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + return n +} + +func (m *ProviderConsAddress) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ProviderAddr) + l = len(m.Address) if l > 0 { n += 1 + l + sovProvider(uint64(l)) } + return n +} + +func (m *ConsumerAddressList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, e := range m.Addresses { + l = e.Size() + n += 1 + l + sovProvider(uint64(l)) + } + } + return n +} + +func (m *KeyAssignmentReplacement) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProviderAddr != nil { + l = m.ProviderAddr.Size() + n += 1 + l + sovProvider(uint64(l)) + } if m.PrevCKey != nil { l = m.PrevCKey.Size() n += 1 + l + sovProvider(uint64(l)) @@ -2248,6 +2795,68 @@ func (m *KeyAssignmentReplacement) Size() (n int) { return n } +func (m *ValidatorConsumerPubKey) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + if m.ProviderAddr != nil { + l = m.ProviderAddr.Size() + n += 1 + l + sovProvider(uint64(l)) + } + if m.ConsumerKey != nil { + l = m.ConsumerKey.Size() + n += 1 + l + sovProvider(uint64(l)) + } + return n +} + +func (m *ValidatorByConsumerAddr) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + if m.ConsumerAddr != nil { + l = m.ConsumerAddr.Size() + n += 1 + l + sovProvider(uint64(l)) + } + if m.ProviderAddr != nil { + l = m.ProviderAddr.Size() + n += 1 + l + sovProvider(uint64(l)) + } + return n +} + +func (m *ConsumerAddrsToPrune) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovProvider(uint64(l)) + } + if m.VscId != 0 { + n += 1 + sovProvider(uint64(m.VscId)) + } + if m.ConsumerAddrs != nil { + l = m.ConsumerAddrs.Size() + n += 1 + l + sovProvider(uint64(l)) + } + return n +} + func sovProvider(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3147,7 +3756,7 @@ func (m *GlobalSlashEntry) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProviderValConsAddr", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -3157,24 +3766,26 @@ func (m *GlobalSlashEntry) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderValConsAddr = append(m.ProviderValConsAddr[:0], dAtA[iNdEx:postIndex]...) if m.ProviderValConsAddr == nil { - m.ProviderValConsAddr = []byte{} + m.ProviderValConsAddr = &ProviderConsAddress{} + } + if err := m.ProviderValConsAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex default: @@ -3896,88 +4507,6 @@ func (m *ConsumerRemovalProposals) Unmarshal(dAtA []byte) error { } return nil } -func (m *AddressList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AddressList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AddressList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProvider - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProvider - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProvider - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, make([]byte, postIndex-iNdEx)) - copy(m.Addresses[len(m.Addresses)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProvider(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProvider - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *ChannelToChain) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4541,7 +5070,7 @@ func (m *VscSendTimestamp) Unmarshal(dAtA []byte) error { } return nil } -func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { +func (m *ConsumerConsAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4564,15 +5093,15 @@ func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: KeyAssignmentReplacement: wiretype end group for non-group") + return fmt.Errorf("proto: ConsumerConsAddress: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: KeyAssignmentReplacement: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ConsumerConsAddress: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -4599,16 +5128,66 @@ func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProviderAddr = append(m.ProviderAddr[:0], dAtA[iNdEx:postIndex]...) - if m.ProviderAddr == nil { - m.ProviderAddr = []byte{} + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} } iNdEx = postIndex - case 2: + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProviderConsAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProviderConsAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProviderConsAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevCKey", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) } - var msglen int + var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProvider @@ -4618,29 +5197,233 @@ func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + if byteLen < 0 { return ErrInvalidLengthProvider } - postIndex := iNdEx + msglen + postIndex := iNdEx + byteLen if postIndex < 0 { return ErrInvalidLengthProvider } if postIndex > l { return io.ErrUnexpectedEOF } - if m.PrevCKey == nil { - m.PrevCKey = &crypto.PublicKey{} + m.Address = append(m.Address[:0], dAtA[iNdEx:postIndex]...) + if m.Address == nil { + m.Address = []byte{} } - if err := m.PrevCKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { return err } - iNdEx = postIndex - case 3: + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsumerAddressList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsumerAddressList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerAddressList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, &ConsumerConsAddress{}) + if err := m.Addresses[len(m.Addresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: KeyAssignmentReplacement: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: KeyAssignmentReplacement: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ProviderAddr == nil { + m.ProviderAddr = &ProviderConsAddress{} + } + if err := m.ProviderAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PrevCKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PrevCKey == nil { + m.PrevCKey = &crypto.PublicKey{} + } + if err := m.PrevCKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Power", wireType) } @@ -4680,6 +5463,451 @@ func (m *KeyAssignmentReplacement) Unmarshal(dAtA []byte) error { } return nil } +func (m *ValidatorConsumerPubKey) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorConsumerPubKey: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorConsumerPubKey: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ProviderAddr == nil { + m.ProviderAddr = &ProviderConsAddress{} + } + if err := m.ProviderAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConsumerKey == nil { + m.ConsumerKey = &crypto.PublicKey{} + } + if err := m.ConsumerKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ValidatorByConsumerAddr) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ValidatorByConsumerAddr: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ValidatorByConsumerAddr: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddr", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConsumerAddr == nil { + m.ConsumerAddr = &ConsumerConsAddress{} + } + if err := m.ConsumerAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddr", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ProviderAddr == nil { + m.ProviderAddr = &ProviderConsAddress{} + } + if err := m.ProviderAddr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ConsumerAddrsToPrune) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ConsumerAddrsToPrune: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ConsumerAddrsToPrune: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VscId", wireType) + } + m.VscId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VscId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddrs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProvider + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProvider + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProvider + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ConsumerAddrs == nil { + m.ConsumerAddrs = &ConsumerAddressList{} + } + if err := m.ConsumerAddrs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProvider(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProvider + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipProvider(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From dba21169ca08352d4ef008c765bb6f22c7c77dfb Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Tue, 9 May 2023 11:56:37 -0700 Subject: [PATCH 03/11] fix cherrypick issues --- app/provider/app.go | 2 +- .../steps_reward_denom.go | 0 tests/integration/distribution.go | 10 ++--- testutil/integration/interfaces.go | 10 ++--- x/ccv/provider/client/cli/tx.go | 2 - x/ccv/provider/handler_test.go | 9 ++-- x/ccv/provider/keeper/keeper.go | 42 ++++++++++--------- x/ccv/provider/proposal_handler_test.go | 2 +- x/ccv/provider/types/errors.go | 29 ++++++------- 9 files changed, 52 insertions(+), 54 deletions(-) rename tests/{integration => e2e}/steps_reward_denom.go (100%) diff --git a/app/provider/app.go b/app/provider/app.go index ca4bfd2e3d..7643042145 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -783,7 +783,7 @@ func (app *App) GetTestDistributionKeeper() testutil.TestDistributionKeeper { } // GetTestAccountKeeper implements the ProviderApp interface. -func (app *App) GetE2eAccountKeeper() e2e.E2eAccountKeeper { +func (app *App) GetTestAccountKeeper() testutil.TestAccountKeeper { return app.AccountKeeper } diff --git a/tests/integration/steps_reward_denom.go b/tests/e2e/steps_reward_denom.go similarity index 100% rename from tests/integration/steps_reward_denom.go rename to tests/e2e/steps_reward_denom.go diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index 4372c1e730..7c4d6e987d 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -35,10 +35,10 @@ func (s *CCVTestSuite) TestRewardsDistribution() { consumerParams.Set(s.consumerCtx(), consumertypes.KeyBlocksPerDistributionTransmission, int64(2)) s.consumerChain.NextBlock() - consumerAccountKeeper := s.consumerApp.GetE2eAccountKeeper() - providerAccountKeeper := s.providerApp.GetE2eAccountKeeper() - consumerBankKeeper := s.consumerApp.GetE2eBankKeeper() - providerBankKeeper := s.providerApp.GetE2eBankKeeper() + consumerAccountKeeper := s.consumerApp.GetTestAccountKeeper() + providerAccountKeeper := s.providerApp.GetTestAccountKeeper() + consumerBankKeeper := s.consumerApp.GetTestBankKeeper() + providerBankKeeper := s.providerApp.GetTestBankKeeper() // send coins to the fee pool which is used for reward distribution consumerFeePoolAddr := consumerAccountKeeper.GetModuleAccount(s.consumerCtx(), authtypes.FeeCollectorName).GetAddress() @@ -133,7 +133,7 @@ func (s *CCVTestSuite) TestRewardsDistribution() { s.Require().Equal(0, len(rewardCoins)) // check that the fee pool has the expected amount of coins - communityCoins := s.providerApp.GetE2eDistributionKeeper().GetFeePoolCommunityCoins(s.providerCtx()) + communityCoins := s.providerApp.GetTestDistributionKeeper().GetFeePoolCommunityCoins(s.providerCtx()) s.Require().True(communityCoins[ibcCoinIndex].Amount.Equal(sdk.NewDecCoinFromCoin(providerExpectedRewards[0]).Amount)) } diff --git a/testutil/integration/interfaces.go b/testutil/integration/interfaces.go index 1c78ab22eb..d906691c53 100644 --- a/testutil/integration/interfaces.go +++ b/testutil/integration/interfaces.go @@ -32,15 +32,15 @@ type ProviderApp interface { GetProviderKeeper() providerkeeper.Keeper // Returns a staking keeper interface with more capabilities than the expected_keepers interface - GetE2eStakingKeeper() E2eStakingKeeper + GetTestStakingKeeper() TestStakingKeeper // Returns a bank keeper interface with more capabilities than the expected_keepers interface - GetE2eBankKeeper() E2eBankKeeper + GetTestBankKeeper() TestBankKeeper // Returns a slashing keeper interface with more capabilities than the expected_keepers interface - GetE2eSlashingKeeper() E2eSlashingKeeper + GetTestSlashingKeeper() TestSlashingKeeper // Returns a distribution keeper interface with more capabilities than the expected_keepers interface - GetE2eDistributionKeeper() E2eDistributionKeeper + GetTestDistributionKeeper() TestDistributionKeeper // Tests an account keeper interface with more capabilities than the expected_keepers interface - GetE2eAccountKeeper() E2eAccountKeeper + GetTestAccountKeeper() TestAccountKeeper } // The interface that any consumer app must implement to be compatible with integration tests diff --git a/x/ccv/provider/client/cli/tx.go b/x/ccv/provider/client/cli/tx.go index c9f39cff3e..ef4df5f455 100644 --- a/x/ccv/provider/client/cli/tx.go +++ b/x/ccv/provider/client/cli/tx.go @@ -6,8 +6,6 @@ import ( "github.com/spf13/cobra" - "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" diff --git a/x/ccv/provider/handler_test.go b/x/ccv/provider/handler_test.go index 3b4d1a32f8..9e723d9858 100644 --- a/x/ccv/provider/handler_test.go +++ b/x/ccv/provider/handler_test.go @@ -32,11 +32,8 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { providerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(0) providerConsAddr := providerCryptoId.ProviderConsAddress() - providerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(0) - providerConsAddr := providerCryptoId.SDKValConsAddress() - consumerCryptoId := testcrypto.NewCryptoIdentityFromIntSeed(1) - consumerConsAddr := consumerCryptoId.SDKValConsAddress() + consumerConsAddr := consumerCryptoId.ConsumerConsAddress() consumerKeyBz := base64.StdEncoding.EncodeToString(consumerCryptoId.ConsensusSDKPubKey().Bytes()) consumerKey := `{"@type":"/cosmos.crypto.ed25519.PubKey","key":"` + consumerKeyBz + `"}` @@ -58,7 +55,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { // Return a valid validator, found! ).Return(providerCryptoId.SDKStakingValidator(), true).Times(1), mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - consumerConsAddr, + consumerConsAddr.ToSdkConsAddr(), ).Return(stakingtypes.Validator{}, false), ) }, @@ -94,7 +91,7 @@ func TestAssignConsensusKeyForConsumerChain(t *testing.T) { // Return a valid validator, found! ).Return(providerCryptoId.SDKStakingValidator(), true).Times(1), mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, - consumerConsAddr, + consumerConsAddr.ToSdkConsAddr(), ).Return(stakingtypes.Validator{}, false), ) }, diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 9fae9a5df7..4f6e6569bc 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -35,13 +35,13 @@ type Keeper struct { channelKeeper ccv.ChannelKeeper portKeeper ccv.PortKeeper connectionKeeper ccv.ConnectionKeeper - accountKeeper ccv.AccountKeeper - bankKeeper ccv.BankKeeper - distributionKeeper ccv.DistributionKeeper clientKeeper ccv.ClientKeeper stakingKeeper ccv.StakingKeeper slashingKeeper ccv.SlashingKeeper + accountKeeper ccv.AccountKeeper evidenceKeeper ccv.EvidenceKeeper + distributionKeeper ccv.DistributionKeeper + bankKeeper ccv.BankKeeper feeCollectorName string } @@ -60,7 +60,7 @@ func NewKeeper( paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) } - return Keeper{ + k := Keeper{ cdc: cdc, storeKey: key, paramSpace: paramSpace, @@ -68,10 +68,10 @@ func NewKeeper( channelKeeper: channelKeeper, portKeeper: portKeeper, connectionKeeper: connectionKeeper, - accountKeeper: accountKeeper, clientKeeper: clientKeeper, stakingKeeper: stakingKeeper, slashingKeeper: slashingKeeper, + accountKeeper: accountKeeper, evidenceKeeper: evidenceKeeper, distributionKeeper: distributionKeeper, bankKeeper: bankKeeper, @@ -86,23 +86,25 @@ func NewKeeper( // non-nil values for all its fields. Otherwise this method will panic. func (k Keeper) mustValidateFields() { // Ensures no fields are missed in this validation - if reflect.ValueOf(k).NumField() != 13 { - panic("number of fields in provider keeper is not 13") + if reflect.ValueOf(k).NumField() != 15 { + panic("number of fields in provider keeper is not 15") } - ccv.PanicIfZeroOrNil(k.cdc, "cdc") // 1 - ccv.PanicIfZeroOrNil(k.storeKey, "storeKey") // 2 - ccv.PanicIfZeroOrNil(k.paramSpace, "paramSpace") // 3 - ccv.PanicIfZeroOrNil(k.scopedKeeper, "scopedKeeper") // 4 - ccv.PanicIfZeroOrNil(k.channelKeeper, "channelKeeper") // 5 - ccv.PanicIfZeroOrNil(k.portKeeper, "portKeeper") // 6 - ccv.PanicIfZeroOrNil(k.connectionKeeper, "connectionKeeper") // 7 - ccv.PanicIfZeroOrNil(k.accountKeeper, "accountKeeper") // 8 - ccv.PanicIfZeroOrNil(k.clientKeeper, "clientKeeper") // 9 - ccv.PanicIfZeroOrNil(k.stakingKeeper, "stakingKeeper") // 10 - ccv.PanicIfZeroOrNil(k.slashingKeeper, "slashingKeeper") // 11 - ccv.PanicIfZeroOrNil(k.evidenceKeeper, "evidenceKeeper") // 12 - ccv.PanicIfZeroOrNil(k.feeCollectorName, "feeCollectorName") // 13 + ccv.PanicIfZeroOrNil(k.cdc, "cdc") // 1 + ccv.PanicIfZeroOrNil(k.storeKey, "storeKey") // 2 + ccv.PanicIfZeroOrNil(k.paramSpace, "paramSpace") // 3 + ccv.PanicIfZeroOrNil(k.scopedKeeper, "scopedKeeper") // 4 + ccv.PanicIfZeroOrNil(k.channelKeeper, "channelKeeper") // 5 + ccv.PanicIfZeroOrNil(k.portKeeper, "portKeeper") // 6 + ccv.PanicIfZeroOrNil(k.connectionKeeper, "connectionKeeper") // 7 + ccv.PanicIfZeroOrNil(k.accountKeeper, "accountKeeper") // 8 + ccv.PanicIfZeroOrNil(k.clientKeeper, "clientKeeper") // 9 + ccv.PanicIfZeroOrNil(k.stakingKeeper, "stakingKeeper") // 10 + ccv.PanicIfZeroOrNil(k.slashingKeeper, "slashingKeeper") // 11 + ccv.PanicIfZeroOrNil(k.evidenceKeeper, "evidenceKeeper") // 12 + ccv.PanicIfZeroOrNil(k.distributionKeeper, "distributionKeeper") // 13 + ccv.PanicIfZeroOrNil(k.bankKeeper, "bankKeeper") // 14 + ccv.PanicIfZeroOrNil(k.feeCollectorName, "feeCollectorName") // 15 } // Logger returns a module-specific logger. diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 129a9f3158..9639d4b94d 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -104,7 +104,7 @@ func TestProviderProposalHandler(t *testing.T) { testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) case tc.expValidEquivocation: - providerKeeper.SetSlashLog(ctx, equivocation.GetConsensusAddress()) + providerKeeper.SetSlashLog(ctx, providertypes.NewProviderConsAddress(equivocation.GetConsensusAddress())) gomock.InAnyOrder([]*gomock.Call{ mocks.MockEvidenceKeeper.EXPECT().HandleEquivocationEvidence(ctx, equivocation), mocks.MockStakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake").AnyTimes(), diff --git a/x/ccv/provider/types/errors.go b/x/ccv/provider/types/errors.go index 01e0473049..c86a7ff706 100644 --- a/x/ccv/provider/types/errors.go +++ b/x/ccv/provider/types/errors.go @@ -6,18 +6,19 @@ import ( // Provider sentinel errors var ( - ErrInvalidConsumerAdditionProposal = sdkerrors.Register(ModuleName, 1, "invalid consumer addition proposal") - ErrInvalidConsumerRemovalProp = sdkerrors.Register(ModuleName, 2, "invalid consumer removal proposal") - ErrUnknownConsumerChainId = sdkerrors.Register(ModuleName, 3, "no consumer chain with this chain id") - ErrUnknownConsumerChannelId = sdkerrors.Register(ModuleName, 4, "no consumer chain with this channel id") - ErrInvalidConsumerConsensusPubKey = sdkerrors.Register(ModuleName, 5, "empty consumer consensus public key") - ErrBlankConsumerChainID = sdkerrors.Register(ModuleName, 6, "consumer chain id must not be blank") - ErrConsumerKeyNotFound = sdkerrors.Register(ModuleName, 7, "consumer key not found") - ErrNoValidatorConsumerAddress = sdkerrors.Register(ModuleName, 8, "error getting validator consumer address") - ErrNoValidatorProviderAddress = sdkerrors.Register(ModuleName, 9, "error getting validator provider address") - ErrConsumerKeyInUse = sdkerrors.Register(ModuleName, 10, "consumer key is already in use by a validator") - ErrInvalidConsumerParams = sdkerrors.Register(ModuleName, 11, "invalid consumer params") - ErrInvalidProviderAddress = sdkerrors.Register(ModuleName, 12, "invalid provider address") - ErrInvalidConsumerRewardDenom = sdkerrors.Register(ModuleName, 14, "invalid consumer reward denom") - ErrInvalidDepositorAddress = sdkerrors.Register(ModuleName, 15, "invalid depositor address") + ErrInvalidConsumerAdditionProposal = sdkerrors.Register(ModuleName, 1, "invalid consumer addition proposal") + ErrInvalidConsumerRemovalProp = sdkerrors.Register(ModuleName, 2, "invalid consumer removal proposal") + ErrUnknownConsumerChainId = sdkerrors.Register(ModuleName, 3, "no consumer chain with this chain id") + ErrUnknownConsumerChannelId = sdkerrors.Register(ModuleName, 4, "no consumer chain with this channel id") + ErrInvalidConsumerConsensusPubKey = sdkerrors.Register(ModuleName, 5, "empty consumer consensus public key") + ErrBlankConsumerChainID = sdkerrors.Register(ModuleName, 6, "consumer chain id must not be blank") + ErrConsumerKeyNotFound = sdkerrors.Register(ModuleName, 7, "consumer key not found") + ErrNoValidatorConsumerAddress = sdkerrors.Register(ModuleName, 8, "error getting validator consumer address") + ErrNoValidatorProviderAddress = sdkerrors.Register(ModuleName, 9, "error getting validator provider address") + ErrConsumerKeyInUse = sdkerrors.Register(ModuleName, 10, "consumer key is already in use by a validator") + ErrCannotAssignDefaultKeyAssignment = sdkerrors.Register(ModuleName, 11, "cannot re-assign default key assignment") + ErrInvalidConsumerParams = sdkerrors.Register(ModuleName, 12, "invalid consumer params") + ErrInvalidProviderAddress = sdkerrors.Register(ModuleName, 13, "invalid provider address") + ErrInvalidConsumerRewardDenom = sdkerrors.Register(ModuleName, 14, "invalid consumer reward denom") + ErrInvalidDepositorAddress = sdkerrors.Register(ModuleName, 15, "invalid depositor address") ) From 86a041728e43413b2812699ee4c3f38327f8f8a7 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Tue, 9 May 2023 11:57:16 -0700 Subject: [PATCH 04/11] lint --- tests/e2e/steps_democracy.go | 2 +- tests/e2e/steps_reward_denom.go | 12 ++-- x/ccv/consumer/types/params.go | 3 +- x/ccv/consumer/types/params_test.go | 90 +++++++++++++++++++---------- 4 files changed, 69 insertions(+), 38 deletions(-) diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index 59b4cae750..d123c37248 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -155,7 +155,7 @@ func stepsDemocracy(consumerName string) []Step { }, state: State{ chainID("provi"): ChainState{ - //Check that tokens are minted and sent to provider chain and distributed to validators and their delegators on provider chain + // Check that tokens are minted and sent to provider chain and distributed to validators and their delegators on provider chain Rewards: &Rewards{ IsRewarded: map[validatorID]bool{ validatorID("alice"): true, diff --git a/tests/e2e/steps_reward_denom.go b/tests/e2e/steps_reward_denom.go index 51cabf427c..bc26f38d27 100644 --- a/tests/e2e/steps_reward_denom.go +++ b/tests/e2e/steps_reward_denom.go @@ -35,7 +35,7 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, state: State{ chainID(consumerName): ChainState{ - //Check that delegators on gov-consumer chain can change representative powers + // Check that delegators on gov-consumer chain can change representative powers RepresentativePowers: &map[validatorID]uint{ validatorID("alice"): 100500000, validatorID("bob"): 40000000, @@ -46,7 +46,7 @@ func stepsRewardDenomConsumer(consumerName string) []Step { validatorID("bob"): 500, validatorID("carol"): 500, }, - //Check that tokens are minted and distributed to representatives and their delegators + // Check that tokens are minted and distributed to representatives and their delegators Rewards: &Rewards{ IsRewarded: map[validatorID]bool{ validatorID("alice"): true, @@ -87,7 +87,7 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, }, { - //Have accounts vote on something on the gov-consumer chain + // Have accounts vote on something on the gov-consumer chain action: voteGovProposalAction{ chain: chainID(consumerName), from: []validatorID{validatorID("alice"), validatorID("bob")}, @@ -100,7 +100,7 @@ func stepsRewardDenomConsumer(consumerName string) []Step { validatorID("alice"): 9899999999, validatorID("bob"): 9960000001, }, - //Check that the parameter is changed on gov-consumer chain + // Check that the parameter is changed on gov-consumer chain Params: &([]Param{{Subspace: "staking", Key: "MaxValidators", Value: "105"}}), }, }, @@ -155,7 +155,7 @@ func stepsRewardDenomConsumer(consumerName string) []Step { }, state: State{ chainID("provi"): ChainState{ - //Check that tokens are not minted and sent to provider chain and distributed to validators and their delegators on provider chain + // Check that tokens are not minted and sent to provider chain and distributed to validators and their delegators on provider chain Rewards: &Rewards{ IsRewarded: map[validatorID]bool{ validatorID("alice"): false, @@ -269,7 +269,7 @@ func stepsRewardDenomConsumer(consumerName string) []Step { validatorID("bob"): 500, validatorID("carol"): 500, }, - //Check that slashing on the gov-consumer chain does not result in slashing for the representatives or their delegators + // Check that slashing on the gov-consumer chain does not result in slashing for the representatives or their delegators RepresentativePowers: &map[validatorID]uint{ validatorID("alice"): 100500000, validatorID("bob"): 40000000, diff --git a/x/ccv/consumer/types/params.go b/x/ccv/consumer/types/params.go index 16bd449e27..55340b205f 100644 --- a/x/ccv/consumer/types/params.go +++ b/x/ccv/consumer/types/params.go @@ -67,7 +67,8 @@ func NewParams(enabled bool, blocksPerDistributionTransmission int64, distributionTransmissionChannel, providerFeePoolAddrStr string, ccvTimeoutPeriod, transferTimeoutPeriod time.Duration, consumerRedistributionFraction string, historicalEntries int64, - consumerUnbondingPeriod time.Duration, softOptOutThreshold string, rewardDenoms []string, providerRewardDenoms []string) Params { + consumerUnbondingPeriod time.Duration, softOptOutThreshold string, rewardDenoms, providerRewardDenoms []string, +) Params { return Params{ Enabled: enabled, BlocksPerDistributionTransmission: blocksPerDistributionTransmission, diff --git a/x/ccv/consumer/types/params_test.go b/x/ccv/consumer/types/params_test.go index 83b641b18d..4b1e8e0d03 100644 --- a/x/ccv/consumer/types/params_test.go +++ b/x/ccv/consumer/types/params_test.go @@ -17,36 +17,66 @@ func TestValidateParams(t *testing.T) { expPass bool }{ {"default params", consumertypes.DefaultParams(), true}, - {"custom valid params", - consumertypes.NewParams(true, 5, "", "", 1004, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), true}, - {"custom invalid params, block per dist transmission", - consumertypes.NewParams(true, -5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, dist transmission channel", - consumertypes.NewParams(true, 5, "badchannel/", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, provider fee pool addr string", - consumertypes.NewParams(true, 5, "", "imabadaddress", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, ccv timeout", - consumertypes.NewParams(true, 5, "", "", -5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, transfer timeout", - consumertypes.NewParams(true, 5, "", "", 1004, -7, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, consumer redist fraction is negative", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "-0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, consumer redist fraction is over 1", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "1.2", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, bad consumer redist fraction ", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "notFrac", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, negative num historical entries", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", -100, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, negative unbonding period", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, -24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false}, - {"custom invalid params, invalid soft opt out threshold", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "-0.05", []string{"u"}, []string{}), false}, - {"custom invalid params, invalid soft opt out threshold", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.5", []string{"u"}, []string{}), false}, - {"custom invalid params, invalid reward denom", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"u"}, []string{}), false}, - {"custom invalid params, invalid provider reward denom", - consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{}, []string{"a"}), false}, + { + "custom valid params", + consumertypes.NewParams(true, 5, "", "", 1004, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), true, + }, + { + "custom invalid params, block per dist transmission", + consumertypes.NewParams(true, -5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, dist transmission channel", + consumertypes.NewParams(true, 5, "badchannel/", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, provider fee pool addr string", + consumertypes.NewParams(true, 5, "", "imabadaddress", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, ccv timeout", + consumertypes.NewParams(true, 5, "", "", -5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, transfer timeout", + consumertypes.NewParams(true, 5, "", "", 1004, -7, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, consumer redist fraction is negative", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "-0.5", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, consumer redist fraction is over 1", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "1.2", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, bad consumer redist fraction ", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "notFrac", 1000, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, negative num historical entries", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", -100, 24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, negative unbonding period", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, -24*21*time.Hour, "0.05", []string{"untrn"}, []string{"uatom"}), false, + }, + { + "custom invalid params, invalid soft opt out threshold", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "-0.05", []string{"u"}, []string{}), false, + }, + { + "custom invalid params, invalid soft opt out threshold", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.5", []string{"u"}, []string{}), false, + }, + { + "custom invalid params, invalid reward denom", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{"u"}, []string{}), false, + }, + { + "custom invalid params, invalid provider reward denom", + consumertypes.NewParams(true, 5, "", "", 5, 1005, "0.5", 1000, 24*21*time.Hour, "0.05", []string{}, []string{"a"}), false, + }, } for _, tc := range testCases { From 20c7776f399b4b6b4d77de6304acb13c29ace746 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Tue, 9 May 2023 12:16:38 -0700 Subject: [PATCH 05/11] cleans --- app/provider/app.go | 2 -- tests/e2e/config.go | 2 +- testutil/integration/interfaces.go | 2 +- testutil/keeper/mocks.go | 28 ++++++++++++++-------------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/provider/app.go b/app/provider/app.go index 7643042145..27100a3c83 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -316,8 +316,6 @@ func New( delete(bankBlockedAddrs, authtypes.NewModuleAddress( providertypes.ConsumerRewardsPool).String()) - // bankBlockedAddrs := make(map[string]bool) - app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, keys[banktypes.StoreKey], diff --git a/tests/e2e/config.go b/tests/e2e/config.go index 6419dae8ab..fe21208834 100644 --- a/tests/e2e/config.go +++ b/tests/e2e/config.go @@ -258,7 +258,7 @@ func DemocracyTestRun(allowReward bool) TestRun { ".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " + ".app_state.slashing.params.downtime_jail_duration = \"2s\" | " + ".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " + - ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", + ".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling }, chainID("democ"): { chainId: chainID("democ"), diff --git a/testutil/integration/interfaces.go b/testutil/integration/interfaces.go index d906691c53..a9e48e3ede 100644 --- a/testutil/integration/interfaces.go +++ b/testutil/integration/interfaces.go @@ -39,7 +39,7 @@ type ProviderApp interface { GetTestSlashingKeeper() TestSlashingKeeper // Returns a distribution keeper interface with more capabilities than the expected_keepers interface GetTestDistributionKeeper() TestDistributionKeeper - // Tests an account keeper interface with more capabilities than the expected_keepers interface + // Returns an account keeper interface with more capabilities than the expected_keepers interface GetTestAccountKeeper() TestAccountKeeper } diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks.go index 8b77d0dde7..4f931d8152 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks.go @@ -46,20 +46,6 @@ func (m *MockStakingKeeper) EXPECT() *MockStakingKeeperMockRecorder { return m.recorder } -// Delegation mocks base method. -func (m *MockStakingKeeper) Delegation(ctx types.Context, addr types.AccAddress, valAddr types.ValAddress) types4.DelegationI { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Delegation", ctx, addr, valAddr) - ret0, _ := ret[0].(types4.DelegationI) - return ret0 -} - -// Delegation indicates an expected call of Delegation. -func (mr *MockStakingKeeperMockRecorder) Delegation(ctx, addr, valAddr interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delegation", reflect.TypeOf((*MockStakingKeeper)(nil).Delegation), ctx, addr, valAddr) -} - // BondDenom mocks base method. func (m *MockStakingKeeper) BondDenom(ctx types.Context) string { m.ctrl.T.Helper() @@ -74,6 +60,20 @@ func (mr *MockStakingKeeperMockRecorder) BondDenom(ctx interface{}) *gomock.Call return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BondDenom", reflect.TypeOf((*MockStakingKeeper)(nil).BondDenom), ctx) } +// Delegation mocks base method. +func (m *MockStakingKeeper) Delegation(ctx types.Context, addr types.AccAddress, valAddr types.ValAddress) types4.DelegationI { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delegation", ctx, addr, valAddr) + ret0, _ := ret[0].(types4.DelegationI) + return ret0 +} + +// Delegation indicates an expected call of Delegation. +func (mr *MockStakingKeeperMockRecorder) Delegation(ctx, addr, valAddr interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delegation", reflect.TypeOf((*MockStakingKeeper)(nil).Delegation), ctx, addr, valAddr) +} + // GetLastTotalPower mocks base method. func (m *MockStakingKeeper) GetLastTotalPower(ctx types.Context) types.Int { m.ctrl.T.Helper() From 6914ee7504f30f135c912edc32e6da90a5437d92 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Tue, 9 May 2023 12:35:56 -0700 Subject: [PATCH 06/11] gosec --- tests/integration/distribution.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/integration/distribution.go b/tests/integration/distribution.go index 7c4d6e987d..7fdd8ec7f3 100644 --- a/tests/integration/distribution.go +++ b/tests/integration/distribution.go @@ -98,7 +98,8 @@ func (s *CCVTestSuite) TestRewardsDistribution() { senderCoins := providerBankKeeper.GetAllBalances(s.providerCtx(), delAddr) // Send the coins to the governance module just to have a place to send them - providerBankKeeper.SendCoinsFromAccountToModule(s.providerCtx(), delAddr, govtypes.ModuleName, senderCoins) + err = providerBankKeeper.SendCoinsFromAccountToModule(s.providerCtx(), delAddr, govtypes.ModuleName, senderCoins) + s.Require().NoError(err) // Attempt to register the consumer reward denom, but fail because the account has no coins err = s.providerApp.GetProviderKeeper().RegisterConsumerRewardDenom(s.providerCtx(), rewardCoins[ibcCoinIndex].Denom, delAddr) @@ -112,7 +113,8 @@ func (s *CCVTestSuite) TestRewardsDistribution() { // Successfully register the consumer reward denom this time // Send the coins back to the delAddr - providerBankKeeper.SendCoinsFromModuleToAccount(s.providerCtx(), govtypes.ModuleName, delAddr, senderCoins) + err = providerBankKeeper.SendCoinsFromModuleToAccount(s.providerCtx(), govtypes.ModuleName, delAddr, senderCoins) + s.Require().NoError(err) // log the sender's coins senderCoins1 := providerBankKeeper.GetAllBalances(s.providerCtx(), delAddr) From a43c0d361cb9801b8c8e2734d38d2b857f0203d6 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Wed, 10 May 2023 10:56:11 -0700 Subject: [PATCH 07/11] restore param, remove tech debt from tests --- testutil/keeper/unit_test_helpers.go | 3 +-- x/ccv/provider/keeper/genesis_test.go | 2 -- x/ccv/provider/keeper/params.go | 15 ++++++--------- x/ccv/provider/keeper/params_test.go | 5 +---- x/ccv/provider/keeper/proposal_test.go | 20 ++++++++------------ x/ccv/provider/module_test.go | 4 +--- x/ccv/provider/proposal_handler_test.go | 10 +++------- 7 files changed, 20 insertions(+), 39 deletions(-) diff --git a/testutil/keeper/unit_test_helpers.go b/testutil/keeper/unit_test_helpers.go index ca9b8cb655..23c39ec128 100644 --- a/testutil/keeper/unit_test_helpers.go +++ b/testutil/keeper/unit_test_helpers.go @@ -216,9 +216,8 @@ func SetupForStoppingConsumerChain(t *testing.T, ctx sdk.Context, "chainID", clienttypes.NewHeight(4, 5)) expectations = append(expectations, GetMocksForSetConsumerChain(ctx, &mocks, "chainID")...) expectations = append(expectations, GetMocksForStopConsumerChain(ctx, &mocks)...) - expectations = append(expectations, mocks.MockStakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake").AnyTimes()) - gomock.InAnyOrder(expectations) + gomock.InOrder(expectations...) prop := GetTestConsumerAdditionProp() err := providerKeeper.CreateConsumerClient(ctx, prop) diff --git a/x/ccv/provider/keeper/genesis_test.go b/x/ccv/provider/keeper/genesis_test.go index ff4ffd94b4..20f69aac2c 100644 --- a/x/ccv/provider/keeper/genesis_test.go +++ b/x/ccv/provider/keeper/genesis_test.go @@ -109,8 +109,6 @@ func TestInitAndExportGenesis(t *testing.T) { ).Return(nil, true).Times(1), mocks.MockStakingKeeper.EXPECT().GetLastTotalPower( ctx).Return(sdk.NewInt(100)).Times(1), // Return total voting power as 100 - mocks.MockStakingKeeper.EXPECT().BondDenom( - ctx).Return("stake").AnyTimes(), // Return bond denom as "stake" ) // init provider chain diff --git a/x/ccv/provider/keeper/params.go b/x/ccv/provider/keeper/params.go index 849d582187..d4cb5a85ab 100644 --- a/x/ccv/provider/keeper/params.go +++ b/x/ccv/provider/keeper/params.go @@ -78,15 +78,12 @@ func (k Keeper) GetMaxThrottledPackets(ctx sdk.Context) int64 { } func (k Keeper) GetConsumerRewardDenomRegistrationFee(ctx sdk.Context) sdk.Coin { - // var c sdk.Coin - // k.paramSpace.Get(ctx, types.KeyConsumerRewardDenomRegistrationFee, &c) - // return c - - // The above commented code is what we should use, however due to difficulties doing - // migrations in coordinated upgrades, we will hardcode the value for now. - // A future scheduled upgrade will change this to the above code and run migrations to add the param. - // This will allow us to change the fee by governance, but for now it is set at 10 Atoms. - return sdk.NewCoin(k.stakingKeeper.BondDenom(ctx), sdk.NewInt(10000000)) + // Due to difficulties doing migrations in coordinated upgrades, this param is hardcoded to 10 ATOM in v1.1.0-multiden. + // The below code is the proper way to store the param. A future scheduled upgrade will + // need to run migrations to add the param. This will allow us to change the fee by governance. + var c sdk.Coin + k.paramSpace.Get(ctx, types.KeyConsumerRewardDenomRegistrationFee, &c) + return c } // GetParams returns the paramset for the provider module diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go index ea93a53a24..d4b83c1cd0 100644 --- a/x/ccv/provider/keeper/params_test.go +++ b/x/ccv/provider/keeper/params_test.go @@ -10,7 +10,6 @@ import ( ibctmtypes "github.com/cosmos/ibc-go/v4/modules/light-clients/07-tendermint/types" testkeeper "github.com/cosmos/interchain-security/testutil/keeper" providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" - "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" ) @@ -18,9 +17,7 @@ import ( func TestParams(t *testing.T) { // Construct an in-mem keeper with registered key table keeperParams := testkeeper.NewInMemKeeperParams(t) - providerKeeper, ctx, ctrl, mocks := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) - gomock.InAnyOrder(mocks.MockStakingKeeper.EXPECT().BondDenom( - ctx).Return("stake").AnyTimes()) + providerKeeper, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, keeperParams) defer ctrl.Finish() defaultParams := providertypes.DefaultParams() diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index 0a599b0a89..95d0b57ee5 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -104,9 +104,8 @@ func TestHandleConsumerAdditionProposal(t *testing.T) { if tc.expAppendProp { // Mock calls are only asserted if we expect a client to be created. - gomock.InAnyOrder( - append(testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, tc.prop.ChainId, clienttypes.NewHeight(2, 3)), - mocks.MockStakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake").AnyTimes()), + gomock.InOrder( + testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, tc.prop.ChainId, clienttypes.NewHeight(2, 3))..., ) } @@ -148,10 +147,9 @@ func TestCreateConsumerClient(t *testing.T) { description: "No state mutation, new client should be created", setup: func(providerKeeper *providerkeeper.Keeper, ctx sdk.Context, mocks *testkeeper.MockedKeepers) { // Valid client creation is asserted with mock expectations here - gomock.InAnyOrder(append( - testkeeper.GetMocksForCreateConsumerClient(ctx, mocks, "chainID", clienttypes.NewHeight(4, 5)), - mocks.MockStakingKeeper.EXPECT().BondDenom(ctx).Return("stake").AnyTimes(), - )) + gomock.InOrder( + testkeeper.GetMocksForCreateConsumerClient(ctx, mocks, "chainID", clienttypes.NewHeight(4, 5))..., + ) }, expClientCreated: true, }, @@ -923,11 +921,9 @@ func TestBeginBlockInit(t *testing.T) { } // Expect client creation for only for the 1st and second proposals (spawn time already passed and valid) - gomock.InAnyOrder( - append(append(testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain1", clienttypes.NewHeight(3, 4)), - testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain2", clienttypes.NewHeight(3, 4))...), - mocks.MockStakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake").AnyTimes(), - ), + gomock.InOrder( + append(testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain1", clienttypes.NewHeight(3, 4)), + testkeeper.GetMocksForCreateConsumerClient(ctx, &mocks, "chain2", clienttypes.NewHeight(3, 4))...)..., ) for _, prop := range pendingProps { diff --git a/x/ccv/provider/module_test.go b/x/ccv/provider/module_test.go index 4d4fe0e8d3..28a4b26b5d 100644 --- a/x/ccv/provider/module_test.go +++ b/x/ccv/provider/module_test.go @@ -122,8 +122,6 @@ func TestInitGenesis(t *testing.T) { &capabilitytypes.Capability{}, tc.isBound, // Capability is returned successfully if port capability is already bound to this module. ), - mocks.MockStakingKeeper.EXPECT().BondDenom( - ctx).Return("stake").AnyTimes(), } // If port capability is not already bound, port will be bound and capability claimed. @@ -146,7 +144,7 @@ func TestInitGenesis(t *testing.T) { ) } - gomock.InAnyOrder(orderedCalls) + gomock.InOrder(orderedCalls...) // // Execute method, then assert expected results diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 9639d4b94d..570598034c 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -95,20 +95,16 @@ func TestProviderProposalHandler(t *testing.T) { // Mock expectations depending on expected outcome switch { case tc.expValidConsumerAddition: - gomock.InAnyOrder(append(testkeeper.GetMocksForCreateConsumerClient( + gomock.InOrder(testkeeper.GetMocksForCreateConsumerClient( ctx, &mocks, "chainID", clienttypes.NewHeight(2, 3), - ), mocks.MockStakingKeeper.EXPECT().BondDenom( - gomock.Any()).Return("stake").AnyTimes())) + )...) case tc.expValidConsumerRemoval: testkeeper.SetupForStoppingConsumerChain(t, ctx, &providerKeeper, mocks) case tc.expValidEquivocation: providerKeeper.SetSlashLog(ctx, providertypes.NewProviderConsAddress(equivocation.GetConsensusAddress())) - gomock.InAnyOrder([]*gomock.Call{ - mocks.MockEvidenceKeeper.EXPECT().HandleEquivocationEvidence(ctx, equivocation), - mocks.MockStakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("stake").AnyTimes(), - }) + mocks.MockEvidenceKeeper.EXPECT().HandleEquivocationEvidence(ctx, equivocation) } // Execution From a4bc96e2cc45d4e1ed96fe88810a2a7650c09ebf Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Fri, 12 May 2023 10:16:55 -0700 Subject: [PATCH 08/11] ibc denom as const --- tests/e2e/steps_democracy.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/steps_democracy.go b/tests/e2e/steps_democracy.go index d123c37248..9f5915f71d 100644 --- a/tests/e2e/steps_democracy.go +++ b/tests/e2e/steps_democracy.go @@ -1,5 +1,7 @@ package main +const consumerRewardDenom = "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9" + func stepsDemocracy(consumerName string) []Step { return []Step{ { @@ -133,12 +135,12 @@ func stepsDemocracy(consumerName string) []Step { action: registerConsumerRewardDenomAction{ chain: chainID("provi"), from: validatorID("bob"), - denom: "ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9", + denom: consumerRewardDenom, }, state: State{ chainID("provi"): ChainState{ // Check that the denom is registered on provider chain - RegisteredConsumerRewardDenoms: &[]string{"ibc/3C3D7B3BE4ECC85A0E5B52A3AEC3B7DFC2AA9CA47C37821E57020D6807043BE9"}, + RegisteredConsumerRewardDenoms: &[]string{consumerRewardDenom}, ValBalances: &map[validatorID]uint{ // make sure that bob's account was debited validatorID("bob"): 9490000000, From f710f215ee74a261140ec9fe119bf3cb5c2cadfd Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Fri, 12 May 2023 12:12:38 -0700 Subject: [PATCH 09/11] add check for consumer reward denom already registered --- x/ccv/consumer/types/errors.go | 3 +- x/ccv/provider/keeper/distribution.go | 16 ++++++++ x/ccv/provider/keeper/distribution_test.go | 48 ++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 x/ccv/provider/keeper/distribution_test.go diff --git a/x/ccv/consumer/types/errors.go b/x/ccv/consumer/types/errors.go index 486281139e..45d1afaceb 100644 --- a/x/ccv/consumer/types/errors.go +++ b/x/ccv/consumer/types/errors.go @@ -6,5 +6,6 @@ import ( // Consumer sentinel errors var ( - ErrNoProposerChannelId = sdkerrors.Register(ModuleName, 1, "no established CCV channel") + ErrNoProposerChannelId = sdkerrors.Register(ModuleName, 1, "no established CCV channel") + ErrConsumerRewardDenomAlreadyRegistered = sdkerrors.Register(ModuleName, 2, "consumer reward denom already registered") ) diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index 80e59280c7..a14b3cab5d 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -2,6 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + consumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types" "github.com/cosmos/interchain-security/x/ccv/provider/types" ) @@ -14,6 +15,12 @@ func (k Keeper) EndBlockRD(ctx sdk.Context) { } func (k Keeper) RegisterConsumerRewardDenom(ctx sdk.Context, denom string, sender sdk.AccAddress) error { + + // Check if the denom is already registered + if k.ConsumerRewardDenomExists(ctx, denom) { + return consumertypes.ErrConsumerRewardDenomAlreadyRegistered + } + // Send the consumer reward denom registration fee to the community pool err := k.distributionKeeper.FundCommunityPool(ctx, sdk.NewCoins(k.GetConsumerRewardDenomRegistrationFee(ctx)), sender) if err != nil { @@ -37,6 +44,15 @@ func (k Keeper) SetConsumerRewardDenom( store.Set(types.ConsumerRewardDenomsKey(denom), []byte{}) } +func (k Keeper) ConsumerRewardDenomExists( + ctx sdk.Context, + denom string, +) bool { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ConsumerRewardDenomsKey(denom)) + return bz != nil +} + func (k Keeper) GetAllConsumerRewardDenoms(ctx sdk.Context) (consumerRewardDenoms []string) { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, []byte{types.ConsumerRewardDenomsBytePrefix}) diff --git a/x/ccv/provider/keeper/distribution_test.go b/x/ccv/provider/keeper/distribution_test.go new file mode 100644 index 0000000000..35de597245 --- /dev/null +++ b/x/ccv/provider/keeper/distribution_test.go @@ -0,0 +1,48 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + testutil "github.com/cosmos/interchain-security/testutil/keeper" + consumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types" + "github.com/cosmos/interchain-security/x/ccv/provider/types" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" +) + +// TestRegisterConsumerRewardDenom tests the RegisterConsumerRewardDenom method. +func TestRegisterConsumerRewardDenom(t *testing.T) { + // Setup + providerKeeper, ctx, ctrl, mocks := testutil.GetProviderKeeperAndCtx(t, testutil.NewInMemKeeperParams(t)) + defer ctrl.Finish() + defaultParams := types.DefaultParams() + providerKeeper.SetParams(ctx, defaultParams) + accAddr := sdk.AccAddress([]byte("addr1")) + gomock.InOrder( + mocks.MockDistributionKeeper.EXPECT().FundCommunityPool(ctx, + sdk.NewCoins(defaultParams.ConsumerRewardDenomRegistrationFee), accAddr).Return(nil).Times(2), + ) + + // Register a consumer reward denom, confirm it's persisted as expected + err := providerKeeper.RegisterConsumerRewardDenom(ctx, "denom1", accAddr) + require.NoError(t, err) + require.True(t, providerKeeper.ConsumerRewardDenomExists(ctx, "denom1")) + allDenoms := providerKeeper.GetAllConsumerRewardDenoms(ctx) + require.Len(t, allDenoms, 1) + require.Equal(t, "denom1", allDenoms[0]) + + // Register another consumer reward denom, confirm both denoms are persisted as expected + err = providerKeeper.RegisterConsumerRewardDenom(ctx, "denom2", accAddr) + require.NoError(t, err) + require.True(t, providerKeeper.ConsumerRewardDenomExists(ctx, "denom2")) + allDenoms = providerKeeper.GetAllConsumerRewardDenoms(ctx) + require.Len(t, allDenoms, 2) + require.Equal(t, "denom1", allDenoms[0]) + require.Equal(t, "denom2", allDenoms[1]) + + // Try to register first consumer reward denom again, confirm it fails + err = providerKeeper.RegisterConsumerRewardDenom(ctx, "denom1", accAddr) + require.Error(t, err) + require.Equal(t, consumertypes.ErrConsumerRewardDenomAlreadyRegistered, err) +} From 1264a318f983023397ffbc5def027ec09bc7dec7 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Fri, 12 May 2023 12:16:23 -0700 Subject: [PATCH 10/11] lint --- x/ccv/provider/keeper/distribution.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index a14b3cab5d..75c0cf3d28 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -15,7 +15,6 @@ func (k Keeper) EndBlockRD(ctx sdk.Context) { } func (k Keeper) RegisterConsumerRewardDenom(ctx sdk.Context, denom string, sender sdk.AccAddress) error { - // Check if the denom is already registered if k.ConsumerRewardDenomExists(ctx, denom) { return consumertypes.ErrConsumerRewardDenomAlreadyRegistered From df1fcbd9994652edcfff8a1c2408cc2fbc910a26 Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Mon, 15 May 2023 14:51:02 -0700 Subject: [PATCH 11/11] remove unneeded expect --- x/ccv/provider/keeper/proposal_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index 95d0b57ee5..c1c98648dc 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -989,9 +989,8 @@ func TestBeginBlockCCR(t *testing.T) { // Only first two consumer chains should be stopped expectations = append(expectations, testkeeper.GetMocksForStopConsumerChain(ctx, &mocks)...) expectations = append(expectations, testkeeper.GetMocksForStopConsumerChain(ctx, &mocks)...) - expectations = append(expectations, mocks.MockStakingKeeper.EXPECT().BondDenom(ctx).Return("stake").AnyTimes()) - gomock.InAnyOrder(expectations) + gomock.InOrder(expectations...) // // Remaining setup