From 157c29825ecdc2950c1b8bd77f8eef5824f02ddf Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Tue, 7 Jun 2022 13:43:03 +0200 Subject: [PATCH 1/2] add `developmentFund` to `mint` module --- proto/mint/mint.proto | 21 +- x/mint/keeper/keeper.go | 25 +- x/mint/simulation/genesis.go | 58 ++++- x/mint/simulation/genesis_test.go | 188 +++++++++++++- x/mint/simulation/params.go | 31 ++- x/mint/simulation/params_test.go | 5 +- x/mint/types/mint.pb.go | 405 +++++++++++++++++++++++++++--- x/mint/types/params.go | 85 +++++-- 8 files changed, 732 insertions(+), 86 deletions(-) diff --git a/proto/mint/mint.proto b/proto/mint/mint.proto index ad81c0cd4..c91b8ae5a 100644 --- a/proto/mint/mint.proto +++ b/proto/mint/mint.proto @@ -17,6 +17,14 @@ message Minter { ]; } +message WeightedAddress { + string address = 1; + string weight = 2 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; +} + message DistributionProportions { // staking defines the proportion of the minted minted_denom that is to be // allocated as staking rewards. @@ -30,9 +38,15 @@ message DistributionProportions { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + // development_fund defines the proportion of the minted minted_denom that is + // to be allocated for development funding. + string development_fund = 3 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false + ]; // community_pool defines the proportion of the minted minted_denom that is // to be allocated to the community pool. - string community_pool = 3 [ + string community_pool = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; @@ -69,4 +83,9 @@ message Params { // distribution_proportions defines the proportion of the minted denom DistributionProportions distribution_proportions = 7 [ (gogoproto.nullable) = false ]; + + // address to receive developer rewards + repeated WeightedAddress development_fund_recipients = 8 [ + (gogoproto.nullable) = false + ]; } diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index fbb6a554b..3b777329e 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -140,8 +140,31 @@ func (k Keeper) DistributeMintedCoins(ctx sdk.Context, mintedCoin sdk.Coin) erro // return err // } + devFundCoin := k.GetProportions(ctx, mintedCoin, proportions.DevelopmentFund) + devFundCoins := sdk.NewCoins(devFundCoin) + if len(params.DevelopmentFundRecipients) == 0 { + // fund community pool when rewards address is empty + err = k.distrKeeper.FundCommunityPool(ctx, devFundCoins, k.accountKeeper.GetModuleAddress(types.ModuleName)) + if err != nil { + return err + } + } else { + // allocate developer rewards to developer addresses by weight + for _, w := range params.DevelopmentFundRecipients { + devFundPortionCoins := sdk.NewCoins(k.GetProportions(ctx, devFundCoin, w.Weight)) + devAddr, err := sdk.AccAddressFromBech32(w.Address) + if err != nil { + return err + } + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, devAddr, devFundPortionCoins) + if err != nil { + return err + } + } + } + // subtract from original provision to ensure no coins left over after the allocations - communityPoolCoins := sdk.NewCoins(mintedCoin).Sub(stakingRewardsCoins).Sub(incentivesCoins) + communityPoolCoins := sdk.NewCoins(mintedCoin).Sub(stakingRewardsCoins).Sub(incentivesCoins).Sub(devFundCoins) err = k.distrKeeper.FundCommunityPool(ctx, communityPoolCoins, k.accountKeeper.GetModuleAddress(types.ModuleName)) if err != nil { return err diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index 2cf9f887a..d9647dfcd 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -9,18 +9,21 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/tendermint/spn/testutil/sample" "github.com/tendermint/spn/x/mint/types" ) // Simulation parameter constants const ( - Inflation = "inflation" - InflationRateChange = "inflation_rate_change" - InflationMax = "inflation_max" - InflationMin = "inflation_min" - GoalBonded = "goal_bonded" - DistributionProportions = "distribution_proportions" + Inflation = "inflation" + InflationRateChange = "inflation_rate_change" + InflationMax = "inflation_max" + InflationMin = "inflation_min" + GoalBonded = "goal_bonded" + DistributionProportions = "distribution_proportions" + DevelopmentFundRecipients = "development_fund_recipients" ) // GenInflation randomized Inflation @@ -53,15 +56,42 @@ func GenDistributionProportions(r *rand.Rand) types.DistributionProportions { staking := r.Int63n(99) left := int64(100) - staking incentives := r.Int63n(left) - communityPool := left - incentives + left -= incentives + devs := r.Int63n(left) + communityPool := left - devs return types.DistributionProportions{ - Staking: sdk.NewDecWithPrec(staking, 2), - Incentives: sdk.NewDecWithPrec(incentives, 2), - CommunityPool: sdk.NewDecWithPrec(communityPool, 2), + Staking: sdk.NewDecWithPrec(staking, 2), + Incentives: sdk.NewDecWithPrec(incentives, 2), + DevelopmentFund: sdk.NewDecWithPrec(devs, 2), + CommunityPool: sdk.NewDecWithPrec(communityPool, 2), } } +func GenDevelopmentFundRecipients(r *rand.Rand) []types.WeightedAddress { + numAddrs := r.Intn(51) + addrs := make([]types.WeightedAddress, 0) + remainWeight := sdk.NewDec(1) + maxRandWeight := sdk.NewDecWithPrec(15, 3) + minRandWeight := sdk.NewDecWithPrec(5, 3) + for i := 0; i < numAddrs; i++ { + // each address except the last can have a max of 2% weight and a min of 0.5% + weight := simtypes.RandomDecAmount(r, maxRandWeight).Add(minRandWeight) + if i == numAddrs-1 { + // use residual weight if last address + weight = remainWeight + } else { + remainWeight = remainWeight.Sub(weight) + } + wa := types.WeightedAddress{ + Address: sample.Address(r), + Weight: weight, + } + addrs = append(addrs, wa) + } + return addrs +} + // RandomizedGenState generates a random GenesisState for mint func RandomizedGenState(simState *module.SimulationState) { // minter @@ -102,9 +132,15 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { distributionProportions = GenDistributionProportions(r) }, ) + var developmentFundRecipients []types.WeightedAddress + simState.AppParams.GetOrGenerate( + simState.Cdc, DevelopmentFundRecipients, &developmentFundRecipients, simState.Rand, + func(r *rand.Rand) { developmentFundRecipients = GenDevelopmentFundRecipients(r) }, + ) + mintDenom := sdk.DefaultBondDenom blocksPerYear := uint64(60 * 60 * 8766 / 5) - params := types.NewParams(mintDenom, inflationRateChange, inflationMax, inflationMin, goalBonded, blocksPerYear, distributionProportions) + params := types.NewParams(mintDenom, inflationRateChange, inflationMax, inflationMin, goalBonded, blocksPerYear, distributionProportions, developmentFundRecipients) mintGenesis := types.NewGenesisState(types.InitialMinter(inflation), params) diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index a28567578..073b55322 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -40,12 +40,184 @@ func TestRandomizedGenState(t *testing.T) { var mintGenesis types.GenesisState simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &mintGenesis) - dec1, _ := sdk.NewDecFromStr("0.670000000000000000") - dec2, _ := sdk.NewDecFromStr("0.200000000000000000") - dec3, _ := sdk.NewDecFromStr("0.070000000000000000") - dec4, _ := sdk.NewDecFromStr("0.170000000000000000") - dec5, _ := sdk.NewDecFromStr("0.700000000000000000") - dec6, _ := sdk.NewDecFromStr("0.130000000000000000") + dec1 := sdk.MustNewDecFromStr("0.670000000000000000") + dec2 := sdk.MustNewDecFromStr("0.200000000000000000") + dec3 := sdk.MustNewDecFromStr("0.070000000000000000") + dec4 := sdk.MustNewDecFromStr("0.170000000000000000") + dec5 := sdk.MustNewDecFromStr("0.700000000000000000") + dec6 := sdk.MustNewDecFromStr("0.060000000000000000") + dec7 := sdk.MustNewDecFromStr("0.070000000000000000") + + weightedAddresses := []types.WeightedAddress{ + { + Address: "cosmos1jtzgjtywnea9egav6cxnjj9hp6m6xavccvhptt", + Weight: sdk.MustNewDecFromStr("0.007579683278078640"), + }, + { + Address: "cosmos1mkn7jj5ncvek4axtydnma37nsvweshkren4hsf", + Weight: sdk.MustNewDecFromStr("0.019381361604886090"), + }, + { + Address: "cosmos19a3q9ggrldtz4x562ku5dhs8ymw94sjjlapn37", + Weight: sdk.MustNewDecFromStr("0.008444926999667921"), + }, + { + Address: "cosmos1vzhn3wun33c3x82jvfkhjn0h9a337hjpqa4h00", + Weight: sdk.MustNewDecFromStr("0.014739408511639647"), + }, + { + Address: "cosmos19mut32skaqlfw30h0g9v6eafrvxwffu6xuccl4", + Weight: sdk.MustNewDecFromStr("0.019907312473387958"), + }, + { + Address: "cosmos1gq6efy5wtny5ga2j2pkdjuphn00eks7ullnkzd", + Weight: sdk.MustNewDecFromStr("0.014719612329779282"), + }, + { + Address: "cosmos1e52yky7qxek43w3wmcwnfev3qggwexg9d0894s", + Weight: sdk.MustNewDecFromStr("0.006553769588010266"), + }, + { + Address: "cosmos1fdz2l502a6s25ess2n0f799kc6qp48m20mc0hw", + Weight: sdk.MustNewDecFromStr("0.010760510739067874"), + }, + { + Address: "cosmos1q6vqfavjmy78u2ymp4lcv67ht0709ygtcqpt5h", + Weight: sdk.MustNewDecFromStr("0.013805657006441215"), + }, + { + Address: "cosmos1ca6dwkygsg97u7uckdu409pztfmtrfa6dx4tsu", + Weight: sdk.MustNewDecFromStr("0.020000000000000000"), + }, + { + Address: "cosmos138esrz5a32jhz9xnekhyz578zwg8dhjsv5djwh", + Weight: sdk.MustNewDecFromStr("0.006332758317578577"), + }, + { + Address: "cosmos1u8lz5wywvz0eg4405n4xczukklaz3upc9hxsna", + Weight: sdk.MustNewDecFromStr("0.016769438463264262"), + }, + { + Address: "cosmos1sguazn8q2ree4qhjwp3qgkfte36g36vtfztmq8", + Weight: sdk.MustNewDecFromStr("0.016486912293645013"), + }, + { + Address: "cosmos1jd8at3lh5sy4yvp2v5nmm36zqk9yh4r3wx4qvc", + Weight: sdk.MustNewDecFromStr("0.011221333052202303"), + }, + { + Address: "cosmos1syp379pdar2s3pfsjajnefjlq00czu309s5z2m", + Weight: sdk.MustNewDecFromStr("0.012547375725019854"), + }, + { + Address: "cosmos1e9vepggfm55sn8tu89uuxezfyg4ksp247vgcpw", + Weight: sdk.MustNewDecFromStr("0.005133490373095672"), + }, + { + Address: "cosmos1hd4v0atfwsyzjp7mss5chve0v0t4ukykh294cu", + Weight: sdk.MustNewDecFromStr("0.016310930079144450"), + }, + { + Address: "cosmos1mc8ngmxdr57hwaztw3fdwl807jcvr9s7wafl9h", + Weight: sdk.MustNewDecFromStr("0.005157396468835283"), + }, + { + Address: "cosmos147jfpxlrg3t3ju4fftceaaln5rqx2qqws7fujc", + Weight: sdk.MustNewDecFromStr("0.015186634308558717"), + }, + { + Address: "cosmos1l0y4wvqdr8smgr5y7hqt68ucgs6wtelvaxrsfa", + Weight: sdk.MustNewDecFromStr("0.015320081367030857"), + }, + { + Address: "cosmos1y5r6sh5pzdtkl7dh47gla3ahc29gz6um3pd409", + Weight: sdk.MustNewDecFromStr("0.008073123323036443"), + }, + { + Address: "cosmos1xx5lqm5e443rt8f5xqmkp6nkdjte3v3udgwhh6", + Weight: sdk.MustNewDecFromStr("0.020000000000000000"), + }, + { + Address: "cosmos18cmclgv68src3r37r85czymf8ukswxvg397ts9", + Weight: sdk.MustNewDecFromStr("0.013407917009802894"), + }, + { + Address: "cosmos1shpwvemq89zc5v8fxl3hpycucpys0f4xn26g6s", + Weight: sdk.MustNewDecFromStr("0.019716827416745468"), + }, + { + Address: "cosmos1943hl84hqstxmw6la5t24zdl5swyga5zufsk7u", + Weight: sdk.MustNewDecFromStr("0.019430003500044880"), + }, + { + Address: "cosmos14k4mpq5aqp3yrh2e7trpqppu6epzpudd0lvm8h", + Weight: sdk.MustNewDecFromStr("0.006513945114240174"), + }, + { + Address: "cosmos1l57qnrftjt3gryahhp6aaftngvdm3hxhc2d3zn", + Weight: sdk.MustNewDecFromStr("0.007391845925113882"), + }, + { + Address: "cosmos1m55gmlka3s5pcpalhh67lvxd544gnq9hcy9cmq", + Weight: sdk.MustNewDecFromStr("0.005000000000000000"), + }, + { + Address: "cosmos1xq3d3wt9q4td4r8smz55dhve8e5yfdaqvu5wp9", + Weight: sdk.MustNewDecFromStr("0.005905927546855497"), + }, + { + Address: "cosmos1hpvpldg2g0vcytjxfvs6pz95ztvctyue0rscf7", + Weight: sdk.MustNewDecFromStr("0.005000000000000000"), + }, + { + Address: "cosmos1vxxq87euk5jc4nd5wdj6ytf2txaqnuw5r5fwav", + Weight: sdk.MustNewDecFromStr("0.015577734590737776"), + }, + { + Address: "cosmos1803q2f46gr0wwzp0hu9sfeh6ranuhfrd7wtazm", + Weight: sdk.MustNewDecFromStr("0.016337747402005633"), + }, + { + Address: "cosmos1faggm2cfh5mzjjzcf9c5l2v47appddtp7ft80c", + Weight: sdk.MustNewDecFromStr("0.017649303914072022"), + }, + { + Address: "cosmos1y23cgd4x9mg7rwpsyaze05kcclzy288kp9lvjx", + Weight: sdk.MustNewDecFromStr("0.020000000000000000"), + }, + { + Address: "cosmos1389c6yvaw93zs3xfdgk8f7zcza25laq0h7hyym", + Weight: sdk.MustNewDecFromStr("0.017412338589465314"), + }, + { + Address: "cosmos1lpjthgnf5g0gq2k3pp3l9g6s40zva7t7q4y70r", + Weight: sdk.MustNewDecFromStr("0.018301886260426990"), + }, + { + Address: "cosmos139fkuuseq8j538m80p87nrxzvp3upc34pfhwu3", + Weight: sdk.MustNewDecFromStr("0.013784608707994140"), + }, + { + Address: "cosmos1wzxy3xcy24jsvxkyjtpy4zsvjf9pw25rcjecps", + Weight: sdk.MustNewDecFromStr("0.007006063945540094"), + }, + { + Address: "cosmos1egm90aq80hys9tvy7m8yr24c9tvxzrrkz0fzt2", + Weight: sdk.MustNewDecFromStr("0.005000000000000000"), + }, + { + Address: "cosmos1v32ux4smhrvmf6dpfs3u3wmuvwn5aqegrmvj9h", + Weight: sdk.MustNewDecFromStr("0.005000000000000000"), + }, + { + Address: "cosmos1kkp5tjyx3m3sk64pr95stnv08a53384yjmc3da", + Weight: sdk.MustNewDecFromStr("0.012540257524846348"), + }, + { + Address: "cosmos1x4yx5q09shge3p60rtyulgrv6cgl57pyss66d0", + Weight: sdk.MustNewDecFromStr("0.484591876249738564"), + }, + } require.Equal(t, uint64(6311520), mintGenesis.Params.BlocksPerYear) require.Equal(t, dec1, mintGenesis.Params.GoalBonded) @@ -54,12 +226,14 @@ func TestRandomizedGenState(t *testing.T) { require.Equal(t, "stake", mintGenesis.Params.MintDenom) require.Equal(t, dec4, mintGenesis.Params.DistributionProportions.Staking) require.Equal(t, dec5, mintGenesis.Params.DistributionProportions.Incentives) - require.Equal(t, dec6, mintGenesis.Params.DistributionProportions.CommunityPool) + require.Equal(t, dec6, mintGenesis.Params.DistributionProportions.DevelopmentFund) + require.Equal(t, dec7, mintGenesis.Params.DistributionProportions.CommunityPool) require.Equal(t, "0stake", mintGenesis.Minter.BlockProvision(mintGenesis.Params).String()) require.Equal(t, "0.170000000000000000", mintGenesis.Minter.NextAnnualProvisions(mintGenesis.Params, sdk.OneInt()).String()) require.Equal(t, "0.169999926644441493", mintGenesis.Minter.NextInflationRate(mintGenesis.Params, sdk.OneDec()).String()) require.Equal(t, "0.170000000000000000", mintGenesis.Minter.Inflation.String()) require.Equal(t, "0.000000000000000000", mintGenesis.Minter.AnnualProvisions.String()) + require.Equal(t, weightedAddresses, mintGenesis.Params.DevelopmentFundRecipients) } // TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState. diff --git a/x/mint/simulation/params.go b/x/mint/simulation/params.go index 717a1fb80..f919c8800 100644 --- a/x/mint/simulation/params.go +++ b/x/mint/simulation/params.go @@ -5,19 +5,21 @@ package simulation import ( "fmt" "math/rand" + "strings" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/tendermint/spn/x/mint/types" ) const ( - keyInflationRateChange = "InflationRateChange" - keyInflationMax = "InflationMax" - keyInflationMin = "InflationMin" - keyGoalBonded = "GoalBonded" - keyDistributionProportions = "DistributionProportions" + keyInflationRateChange = "InflationRateChange" + keyInflationMax = "InflationMax" + keyInflationMin = "InflationMin" + keyGoalBonded = "GoalBonded" + keyDistributionProportions = "DistributionProportions" + keyDevelopmentFundRecipients = "DevelopmentFundRecipients" ) // ParamChanges defines the parameters that can be modified by param change proposals @@ -47,8 +49,19 @@ func ParamChanges(r *rand.Rand) []simtypes.ParamChange { simulation.NewSimParamChange(types.ModuleName, keyDistributionProportions, func(r *rand.Rand) string { proportions := GenDistributionProportions(r) - return fmt.Sprintf("{\"staking\":\"%s\",\"incentives\":\"%s\",\"community_pool\":\"%s\"}", - proportions.Staking.String(), proportions.Incentives.String(), proportions.CommunityPool.String()) + return fmt.Sprintf("{\"staking\":\"%s\",\"incentives\":\"%s\",\"development_fund\":\"%s\",\"community_pool\":\"%s\"}", + proportions.Staking.String(), proportions.Incentives.String(), proportions.DevelopmentFund.String(), proportions.CommunityPool.String()) + }, + ), + simulation.NewSimParamChange(types.ModuleName, keyDevelopmentFundRecipients, + func(r *rand.Rand) string { + weightedAddrs := GenDevelopmentFundRecipients(r) + weightedAddrsStr := make([]string, 0) + for _, wa := range weightedAddrs { + s := fmt.Sprintf("{\"address\":\"%s\",\"weight\":\"%s\"}", wa.Address, wa.Weight.String()) + weightedAddrsStr = append(weightedAddrsStr, s) + } + return fmt.Sprintf("[%s]", strings.Join(weightedAddrsStr, ",")) }, ), } diff --git a/x/mint/simulation/params_test.go b/x/mint/simulation/params_test.go index ce75ad000..0ea87baf0 100644 --- a/x/mint/simulation/params_test.go +++ b/x/mint/simulation/params_test.go @@ -23,11 +23,12 @@ func TestParamChangest(t *testing.T) { {"mint/InflationMax", "InflationMax", "\"0.200000000000000000\"", "mint"}, {"mint/InflationMin", "InflationMin", "\"0.070000000000000000\"", "mint"}, {"mint/GoalBonded", "GoalBonded", "\"0.670000000000000000\"", "mint"}, - {"mint/DistributionProportions", "DistributionProportions", "{\"staking\":\"0.250000000000000000\",\"incentives\":\"0.210000000000000000\",\"community_pool\":\"0.540000000000000000\"}", "mint"}, + {"mint/DistributionProportions", "DistributionProportions", "{\"staking\":\"0.250000000000000000\",\"incentives\":\"0.210000000000000000\",\"development_fund\":\"0.350000000000000000\",\"community_pool\":\"0.190000000000000000\"}", "mint"}, + {"mint/DevelopmentFundRecipients", "DevelopmentFundRecipients", "[{\"address\":\"cosmos1qqkd0nt0jnkc76qvc9fderhr8lptmx56hs6t9s\",\"weight\":\"0.009966872261695090\"},{\"address\":\"cosmos1ygg6mlfr6g8dypnxgjlpdhk5z45659xue0udth\",\"weight\":\"0.005000000000000000\"},{\"address\":\"cosmos1vgtwfm6xge308aep829gnmk5jm4vj5t5rrq0ln\",\"weight\":\"0.020000000000000000\"},{\"address\":\"cosmos1jtzgjtywnea9egav6cxnjj9hp6m6xavccvhptt\",\"weight\":\"0.007579683278078640\"},{\"address\":\"cosmos1mkn7jj5ncvek4axtydnma37nsvweshkren4hsf\",\"weight\":\"0.019381361604886090\"},{\"address\":\"cosmos19a3q9ggrldtz4x562ku5dhs8ymw94sjjlapn37\",\"weight\":\"0.008444926999667921\"},{\"address\":\"cosmos1vzhn3wun33c3x82jvfkhjn0h9a337hjpqa4h00\",\"weight\":\"0.014739408511639647\"},{\"address\":\"cosmos19mut32skaqlfw30h0g9v6eafrvxwffu6xuccl4\",\"weight\":\"0.019907312473387958\"},{\"address\":\"cosmos1gq6efy5wtny5ga2j2pkdjuphn00eks7ullnkzd\",\"weight\":\"0.014719612329779282\"},{\"address\":\"cosmos1e52yky7qxek43w3wmcwnfev3qggwexg9d0894s\",\"weight\":\"0.006553769588010266\"},{\"address\":\"cosmos1fdz2l502a6s25ess2n0f799kc6qp48m20mc0hw\",\"weight\":\"0.010760510739067874\"},{\"address\":\"cosmos1q6vqfavjmy78u2ymp4lcv67ht0709ygtcqpt5h\",\"weight\":\"0.013805657006441215\"},{\"address\":\"cosmos1ca6dwkygsg97u7uckdu409pztfmtrfa6dx4tsu\",\"weight\":\"0.020000000000000000\"},{\"address\":\"cosmos138esrz5a32jhz9xnekhyz578zwg8dhjsv5djwh\",\"weight\":\"0.006332758317578577\"},{\"address\":\"cosmos1u8lz5wywvz0eg4405n4xczukklaz3upc9hxsna\",\"weight\":\"0.016769438463264262\"},{\"address\":\"cosmos1sguazn8q2ree4qhjwp3qgkfte36g36vtfztmq8\",\"weight\":\"0.016486912293645013\"},{\"address\":\"cosmos1jd8at3lh5sy4yvp2v5nmm36zqk9yh4r3wx4qvc\",\"weight\":\"0.011221333052202303\"},{\"address\":\"cosmos1syp379pdar2s3pfsjajnefjlq00czu309s5z2m\",\"weight\":\"0.012547375725019854\"},{\"address\":\"cosmos1e9vepggfm55sn8tu89uuxezfyg4ksp247vgcpw\",\"weight\":\"0.005133490373095672\"},{\"address\":\"cosmos1hd4v0atfwsyzjp7mss5chve0v0t4ukykh294cu\",\"weight\":\"0.016310930079144450\"},{\"address\":\"cosmos1mc8ngmxdr57hwaztw3fdwl807jcvr9s7wafl9h\",\"weight\":\"0.005157396468835283\"},{\"address\":\"cosmos147jfpxlrg3t3ju4fftceaaln5rqx2qqws7fujc\",\"weight\":\"0.015186634308558717\"},{\"address\":\"cosmos1l0y4wvqdr8smgr5y7hqt68ucgs6wtelvaxrsfa\",\"weight\":\"0.015320081367030857\"},{\"address\":\"cosmos1y5r6sh5pzdtkl7dh47gla3ahc29gz6um3pd409\",\"weight\":\"0.008073123323036443\"},{\"address\":\"cosmos1xx5lqm5e443rt8f5xqmkp6nkdjte3v3udgwhh6\",\"weight\":\"0.020000000000000000\"},{\"address\":\"cosmos18cmclgv68src3r37r85czymf8ukswxvg397ts9\",\"weight\":\"0.013407917009802894\"},{\"address\":\"cosmos1shpwvemq89zc5v8fxl3hpycucpys0f4xn26g6s\",\"weight\":\"0.019716827416745468\"},{\"address\":\"cosmos1943hl84hqstxmw6la5t24zdl5swyga5zufsk7u\",\"weight\":\"0.019430003500044880\"},{\"address\":\"cosmos14k4mpq5aqp3yrh2e7trpqppu6epzpudd0lvm8h\",\"weight\":\"0.006513945114240174\"},{\"address\":\"cosmos1l57qnrftjt3gryahhp6aaftngvdm3hxhc2d3zn\",\"weight\":\"0.007391845925113882\"},{\"address\":\"cosmos1m55gmlka3s5pcpalhh67lvxd544gnq9hcy9cmq\",\"weight\":\"0.005000000000000000\"},{\"address\":\"cosmos1xq3d3wt9q4td4r8smz55dhve8e5yfdaqvu5wp9\",\"weight\":\"0.005905927546855497\"},{\"address\":\"cosmos1hpvpldg2g0vcytjxfvs6pz95ztvctyue0rscf7\",\"weight\":\"0.005000000000000000\"},{\"address\":\"cosmos1vxxq87euk5jc4nd5wdj6ytf2txaqnuw5r5fwav\",\"weight\":\"0.015577734590737776\"},{\"address\":\"cosmos1803q2f46gr0wwzp0hu9sfeh6ranuhfrd7wtazm\",\"weight\":\"0.016337747402005633\"},{\"address\":\"cosmos1faggm2cfh5mzjjzcf9c5l2v47appddtp7ft80c\",\"weight\":\"0.017649303914072022\"},{\"address\":\"cosmos1y23cgd4x9mg7rwpsyaze05kcclzy288kp9lvjx\",\"weight\":\"0.020000000000000000\"},{\"address\":\"cosmos1389c6yvaw93zs3xfdgk8f7zcza25laq0h7hyym\",\"weight\":\"0.017412338589465314\"},{\"address\":\"cosmos1lpjthgnf5g0gq2k3pp3l9g6s40zva7t7q4y70r\",\"weight\":\"0.018301886260426990\"},{\"address\":\"cosmos139fkuuseq8j538m80p87nrxzvp3upc34pfhwu3\",\"weight\":\"0.013784608707994140\"},{\"address\":\"cosmos1wzxy3xcy24jsvxkyjtpy4zsvjf9pw25rcjecps\",\"weight\":\"0.007006063945540094\"},{\"address\":\"cosmos1egm90aq80hys9tvy7m8yr24c9tvxzrrkz0fzt2\",\"weight\":\"0.005000000000000000\"},{\"address\":\"cosmos1v32ux4smhrvmf6dpfs3u3wmuvwn5aqegrmvj9h\",\"weight\":\"0.005000000000000000\"},{\"address\":\"cosmos1kkp5tjyx3m3sk64pr95stnv08a53384yjmc3da\",\"weight\":\"0.012540257524846348\"},{\"address\":\"cosmos1x4yx5q09shge3p60rtyulgrv6cgl57pyss66d0\",\"weight\":\"0.005469628158639969\"},{\"address\":\"cosmos1s8ms2aza37fnet260ehy7nvw6dw4hsegpk9d45\",\"weight\":\"0.010804000690218799\"},{\"address\":\"cosmos19xfhazc6l7jfzfzdz7ed8mxuqa046lgl2d7c8p\",\"weight\":\"0.010784393959249722\"},{\"address\":\"cosmos1zhne8apjk0axgfzx9udtd7fej3c63dc8nddssv\",\"weight\":\"0.007509725733503326\"},{\"address\":\"cosmos155g77umtus4fpgas0rtvq5xvcg839qwpgnv8kd\",\"weight\":\"0.415057255446431658\"}]", "mint"}, } paramChanges := simulation.ParamChanges(r) - require.Len(t, paramChanges, 5) + require.Len(t, paramChanges, 6) for i, p := range paramChanges { require.Equal(t, expected[i].composedKey, p.ComposedKey()) diff --git a/x/mint/types/mint.pb.go b/x/mint/types/mint.pb.go index f81b5a192..dbfdb8094 100644 --- a/x/mint/types/mint.pb.go +++ b/x/mint/types/mint.pb.go @@ -65,6 +65,51 @@ func (m *Minter) XXX_DiscardUnknown() { var xxx_messageInfo_Minter proto.InternalMessageInfo +type WeightedAddress struct { + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` +} + +func (m *WeightedAddress) Reset() { *m = WeightedAddress{} } +func (m *WeightedAddress) String() string { return proto.CompactTextString(m) } +func (*WeightedAddress) ProtoMessage() {} +func (*WeightedAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_e1b9fbb701b2a577, []int{1} +} +func (m *WeightedAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WeightedAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WeightedAddress.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 *WeightedAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_WeightedAddress.Merge(m, src) +} +func (m *WeightedAddress) XXX_Size() int { + return m.Size() +} +func (m *WeightedAddress) XXX_DiscardUnknown() { + xxx_messageInfo_WeightedAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_WeightedAddress proto.InternalMessageInfo + +func (m *WeightedAddress) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + type DistributionProportions struct { // staking defines the proportion of the minted minted_denom that is to be // allocated as staking rewards. @@ -72,16 +117,19 @@ type DistributionProportions struct { // incentives defines the proportion of the minted minted_denom that is // to be allocated as incentives. Incentives github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=incentives,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"incentives"` + // development_fund defines the proportion of the minted minted_denom that is + // to be allocated for development funding. + DevelopmentFund github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=development_fund,json=developmentFund,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"development_fund"` // community_pool defines the proportion of the minted minted_denom that is // to be allocated to the community pool. - CommunityPool github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=community_pool,json=communityPool,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"community_pool"` + CommunityPool github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=community_pool,json=communityPool,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"community_pool"` } func (m *DistributionProportions) Reset() { *m = DistributionProportions{} } func (m *DistributionProportions) String() string { return proto.CompactTextString(m) } func (*DistributionProportions) ProtoMessage() {} func (*DistributionProportions) Descriptor() ([]byte, []int) { - return fileDescriptor_e1b9fbb701b2a577, []int{1} + return fileDescriptor_e1b9fbb701b2a577, []int{2} } func (m *DistributionProportions) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -126,12 +174,14 @@ type Params struct { BlocksPerYear uint64 `protobuf:"varint,6,opt,name=blocks_per_year,json=blocksPerYear,proto3" json:"blocks_per_year,omitempty"` // distribution_proportions defines the proportion of the minted denom DistributionProportions DistributionProportions `protobuf:"bytes,7,opt,name=distribution_proportions,json=distributionProportions,proto3" json:"distribution_proportions"` + // address to receive developer rewards + DevelopmentFundRecipients []WeightedAddress `protobuf:"bytes,8,rep,name=development_fund_recipients,json=developmentFundRecipients,proto3" json:"development_fund_recipients"` } func (m *Params) Reset() { *m = Params{} } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_e1b9fbb701b2a577, []int{2} + return fileDescriptor_e1b9fbb701b2a577, []int{3} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -181,8 +231,16 @@ func (m *Params) GetDistributionProportions() DistributionProportions { return DistributionProportions{} } +func (m *Params) GetDevelopmentFundRecipients() []WeightedAddress { + if m != nil { + return m.DevelopmentFundRecipients + } + return nil +} + func init() { proto.RegisterType((*Minter)(nil), "tendermint.spn.mint.Minter") + proto.RegisterType((*WeightedAddress)(nil), "tendermint.spn.mint.WeightedAddress") proto.RegisterType((*DistributionProportions)(nil), "tendermint.spn.mint.DistributionProportions") proto.RegisterType((*Params)(nil), "tendermint.spn.mint.Params") } @@ -190,38 +248,44 @@ func init() { func init() { proto.RegisterFile("mint/mint.proto", fileDescriptor_e1b9fbb701b2a577) } var fileDescriptor_e1b9fbb701b2a577 = []byte{ - // 482 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x3f, 0x6f, 0xd3, 0x40, - 0x18, 0xc6, 0xe3, 0x62, 0x52, 0xe5, 0x4a, 0x28, 0x5c, 0x41, 0xb5, 0x90, 0x70, 0xa2, 0x0c, 0x55, - 0x06, 0xb0, 0x25, 0xd8, 0x98, 0x50, 0xc8, 0xc0, 0x40, 0xc1, 0x32, 0x62, 0x00, 0x06, 0xeb, 0x6c, - 0x1f, 0xee, 0x29, 0xf6, 0xfb, 0x5a, 0x77, 0x97, 0x2a, 0xf9, 0x0a, 0x4c, 0x8c, 0x8c, 0x48, 0x7c, - 0x04, 0xbe, 0x44, 0xc7, 0x8e, 0x88, 0xa1, 0x42, 0xc9, 0x17, 0x41, 0x67, 0x53, 0x27, 0x42, 0x65, - 0x71, 0x17, 0xfb, 0xd5, 0x73, 0xf6, 0xef, 0xbd, 0x47, 0xef, 0x1f, 0xb2, 0x5f, 0x08, 0xd0, 0xbe, - 0x79, 0x78, 0xa5, 0x44, 0x8d, 0xf4, 0x40, 0x73, 0x48, 0xb9, 0xac, 0x14, 0x55, 0x82, 0x67, 0x82, - 0x07, 0xf7, 0x32, 0xcc, 0xb0, 0x3a, 0xf7, 0x4d, 0x54, 0x7f, 0x3a, 0xfa, 0x61, 0x91, 0xee, 0xb1, - 0x00, 0xcd, 0x25, 0x7d, 0x45, 0x7a, 0x02, 0x3e, 0xe5, 0x4c, 0x0b, 0x04, 0xc7, 0x1a, 0x5a, 0xe3, - 0xde, 0xc4, 0x3b, 0xbb, 0x18, 0x74, 0x7e, 0x5d, 0x0c, 0x8e, 0x32, 0xa1, 0x4f, 0xe6, 0xb1, 0x97, - 0x60, 0xe1, 0x27, 0xa8, 0x0a, 0x54, 0x7f, 0x5f, 0x8f, 0x55, 0x3a, 0xf3, 0xf5, 0xb2, 0xe4, 0xca, - 0x9b, 0xf2, 0x24, 0xdc, 0x00, 0xe8, 0x47, 0x72, 0x97, 0x01, 0xcc, 0x59, 0x1e, 0x95, 0x12, 0x4f, - 0x85, 0x12, 0x08, 0xca, 0xd9, 0x69, 0x45, 0xbd, 0x53, 0x83, 0x82, 0x86, 0x33, 0xfa, 0xbc, 0x43, - 0x0e, 0xa7, 0x42, 0x69, 0x29, 0xe2, 0xb9, 0xc9, 0x16, 0x48, 0x2c, 0x51, 0x9a, 0x48, 0xd1, 0x97, - 0x64, 0x57, 0x69, 0x36, 0x13, 0x90, 0xb5, 0x34, 0x71, 0xf9, 0x3b, 0x7d, 0x4d, 0x88, 0x80, 0x84, - 0x83, 0x16, 0xa7, 0xbc, 0xed, 0xdd, 0xb7, 0x08, 0xf4, 0x1d, 0xb9, 0x9d, 0x60, 0x51, 0xcc, 0x41, - 0xe8, 0x65, 0x54, 0x22, 0xe6, 0xce, 0x8d, 0x56, 0xcc, 0x7e, 0x43, 0x09, 0x10, 0xf3, 0xd1, 0x77, - 0x9b, 0x74, 0x03, 0x26, 0x59, 0xa1, 0xe8, 0x43, 0x42, 0x4c, 0xad, 0xa3, 0x94, 0x03, 0x16, 0xb5, - 0xfd, 0xb0, 0x67, 0x94, 0xa9, 0x11, 0x68, 0x4c, 0xee, 0x37, 0x05, 0x8a, 0x24, 0xd3, 0x3c, 0x4a, - 0x4e, 0x18, 0x64, 0xbc, 0xa5, 0xb7, 0x83, 0x06, 0x16, 0x32, 0xcd, 0x5f, 0x54, 0x28, 0xfa, 0x96, - 0xf4, 0x37, 0x39, 0x0a, 0xb6, 0x68, 0xe9, 0xf1, 0x56, 0x03, 0x39, 0x66, 0x8b, 0x7f, 0xa0, 0x02, - 0x1c, 0xfb, 0xba, 0x50, 0x01, 0xf4, 0x0d, 0xd9, 0xcb, 0x90, 0xe5, 0x51, 0x8c, 0x90, 0xf2, 0xd4, - 0xb9, 0xd9, 0xae, 0xbe, 0x06, 0x31, 0xa9, 0x08, 0xf4, 0x88, 0xec, 0xc7, 0x39, 0x26, 0x33, 0x15, - 0x95, 0x5c, 0x46, 0x4b, 0xce, 0xa4, 0xd3, 0x1d, 0x5a, 0x63, 0x3b, 0xec, 0xd7, 0x72, 0xc0, 0xe5, - 0x7b, 0xce, 0x24, 0x2d, 0x88, 0x93, 0x6e, 0x35, 0xaf, 0x19, 0x90, 0xcb, 0xee, 0x75, 0x76, 0x87, - 0xd6, 0x78, 0xef, 0xc9, 0x23, 0xef, 0x8a, 0x09, 0xf6, 0xfe, 0xd3, 0xf1, 0x13, 0xdb, 0xdc, 0x39, - 0x3c, 0x4c, 0xaf, 0x3e, 0x7e, 0x66, 0x7f, 0xfd, 0x36, 0xe8, 0x4c, 0x9e, 0x9f, 0xad, 0x5c, 0xeb, - 0x7c, 0xe5, 0x5a, 0xbf, 0x57, 0xae, 0xf5, 0x65, 0xed, 0x76, 0xce, 0xd7, 0x6e, 0xe7, 0xe7, 0xda, - 0xed, 0x7c, 0xd8, 0xb6, 0xba, 0x49, 0xeb, 0xab, 0x12, 0xfc, 0x45, 0xb5, 0x55, 0x6a, 0xbb, 0x71, - 0xb7, 0xda, 0x18, 0x4f, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x3f, 0xba, 0x9e, 0x6f, 0x04, - 0x00, 0x00, + // 579 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, + 0x10, 0xc7, 0xe3, 0x36, 0x4d, 0xbf, 0x6e, 0xbf, 0x92, 0xb2, 0x05, 0xd5, 0x80, 0x70, 0xa3, 0x08, + 0x55, 0x39, 0x80, 0x2d, 0x95, 0x1b, 0x27, 0x08, 0x55, 0xc5, 0x81, 0x42, 0x64, 0x84, 0x50, 0xe1, + 0x60, 0xad, 0xbd, 0x53, 0x67, 0x89, 0xbd, 0x6b, 0xed, 0xae, 0x43, 0xf2, 0x14, 0x70, 0xe4, 0xc8, + 0x3b, 0xf0, 0x12, 0x3d, 0xf6, 0x88, 0x38, 0x54, 0x28, 0x11, 0xef, 0x81, 0x6c, 0x27, 0x4e, 0x14, + 0xb5, 0x17, 0x5f, 0xec, 0xf1, 0x78, 0xf7, 0x37, 0xeb, 0xbf, 0xe7, 0x3f, 0xa8, 0x19, 0x33, 0xae, + 0x9d, 0xec, 0x62, 0x27, 0x52, 0x68, 0x81, 0xf7, 0x34, 0x70, 0x0a, 0x32, 0xcf, 0xa8, 0x84, 0xdb, + 0x59, 0x70, 0xff, 0x4e, 0x28, 0x42, 0x91, 0xbf, 0x77, 0xb2, 0xa8, 0x58, 0xda, 0xfe, 0x69, 0xa0, + 0xc6, 0x29, 0xe3, 0x1a, 0x24, 0x7e, 0x8d, 0xb6, 0x18, 0x3f, 0x8f, 0x88, 0x66, 0x82, 0x9b, 0x46, + 0xcb, 0xe8, 0x6c, 0x75, 0xed, 0x8b, 0xab, 0x83, 0xda, 0xef, 0xab, 0x83, 0xc3, 0x90, 0xe9, 0x7e, + 0xea, 0xdb, 0x81, 0x88, 0x9d, 0x40, 0xa8, 0x58, 0xa8, 0xd9, 0xed, 0x89, 0xa2, 0x03, 0x47, 0x8f, + 0x13, 0x50, 0xf6, 0x31, 0x04, 0xee, 0x02, 0x80, 0x3f, 0xa1, 0xdb, 0x84, 0xf3, 0x94, 0x44, 0x5e, + 0x22, 0xc5, 0x90, 0x29, 0x26, 0xb8, 0x32, 0xd7, 0x2a, 0x51, 0x77, 0x0b, 0x50, 0xaf, 0xe4, 0xb4, + 0x15, 0x6a, 0x7e, 0x00, 0x16, 0xf6, 0x35, 0xd0, 0x17, 0x94, 0x4a, 0x50, 0x0a, 0x9b, 0x68, 0x93, + 0x14, 0x61, 0x71, 0x76, 0x77, 0xfe, 0x88, 0x4f, 0x50, 0xe3, 0x4b, 0xbe, 0xb8, 0x62, 0xf9, 0xd9, + 0xee, 0xf6, 0xdf, 0x35, 0xb4, 0x7f, 0xcc, 0x94, 0x96, 0xcc, 0x4f, 0xb3, 0x4f, 0xec, 0x49, 0x91, + 0x08, 0x99, 0x45, 0x0a, 0xbf, 0x42, 0x9b, 0x4a, 0x93, 0x01, 0xe3, 0x61, 0x45, 0xe5, 0xe6, 0xdb, + 0xf1, 0x1b, 0x84, 0x18, 0x0f, 0x80, 0x6b, 0x36, 0x84, 0xaa, 0x82, 0x2d, 0x11, 0xf0, 0x19, 0xda, + 0xa5, 0x30, 0x84, 0x48, 0x24, 0x31, 0x70, 0xed, 0x9d, 0xa7, 0x9c, 0x9a, 0xeb, 0x95, 0xa8, 0xcd, + 0x25, 0xce, 0x49, 0xca, 0x29, 0x7e, 0x8f, 0x6e, 0x05, 0x22, 0x8e, 0x53, 0xce, 0xf4, 0xd8, 0x4b, + 0x84, 0x88, 0xcc, 0x7a, 0x25, 0xf0, 0x4e, 0x49, 0xe9, 0x09, 0x11, 0xb5, 0xbf, 0x6e, 0xa0, 0x46, + 0x8f, 0x48, 0x12, 0x2b, 0xfc, 0x10, 0xa1, 0xac, 0x77, 0x3d, 0x0a, 0x5c, 0xc4, 0xb3, 0xff, 0xba, + 0x95, 0x65, 0x8e, 0xb3, 0x04, 0xf6, 0xd1, 0xdd, 0xb2, 0xe1, 0x3c, 0x49, 0x34, 0x78, 0x41, 0x9f, + 0xf0, 0x10, 0x2a, 0xca, 0xb6, 0x57, 0xc2, 0x5c, 0xa2, 0xe1, 0x65, 0x8e, 0xc2, 0xef, 0xd0, 0xce, + 0xa2, 0x46, 0x4c, 0x46, 0x15, 0xc5, 0xfb, 0xbf, 0x84, 0x9c, 0x92, 0xd1, 0x0a, 0x94, 0xf1, 0x8a, + 0xc2, 0x2d, 0x41, 0x19, 0xc7, 0x6f, 0xd1, 0x76, 0x28, 0x48, 0xe4, 0xf9, 0x82, 0x53, 0xa0, 0xe6, + 0x46, 0xb5, 0xd6, 0xc9, 0x10, 0xdd, 0x9c, 0x80, 0x0f, 0x51, 0xd3, 0x8f, 0x44, 0x30, 0x50, 0x5e, + 0x02, 0xd2, 0x1b, 0x03, 0x91, 0x66, 0xa3, 0x65, 0x74, 0xea, 0xee, 0x4e, 0x91, 0xee, 0x81, 0x3c, + 0x03, 0x22, 0x71, 0x8c, 0x4c, 0xba, 0xe4, 0x8b, 0xcc, 0xf0, 0x73, 0x63, 0x98, 0x9b, 0x2d, 0xa3, + 0xb3, 0x7d, 0xf4, 0xd8, 0xbe, 0x66, 0x22, 0xd9, 0x37, 0x98, 0xa9, 0x5b, 0xcf, 0xce, 0xec, 0xee, + 0xd3, 0x1b, 0xbc, 0xf6, 0x19, 0x3d, 0x58, 0xed, 0x68, 0x4f, 0x42, 0xc0, 0x12, 0x06, 0x5c, 0x2b, + 0xf3, 0xbf, 0xd6, 0x7a, 0x67, 0xfb, 0xe8, 0xd1, 0xb5, 0x15, 0x57, 0x86, 0xc6, 0xac, 0xd2, 0xbd, + 0x95, 0xc6, 0x76, 0x4b, 0xd8, 0xb3, 0xfa, 0xf7, 0x1f, 0x07, 0xb5, 0xee, 0xf3, 0x8b, 0x89, 0x65, + 0x5c, 0x4e, 0x2c, 0xe3, 0xcf, 0xc4, 0x32, 0xbe, 0x4d, 0xad, 0xda, 0xe5, 0xd4, 0xaa, 0xfd, 0x9a, + 0x5a, 0xb5, 0x8f, 0xcb, 0xb2, 0x2e, 0x0a, 0x3a, 0x2a, 0xe1, 0xce, 0x28, 0x9f, 0xc8, 0x85, 0xb4, + 0x7e, 0x23, 0x9f, 0xb6, 0x4f, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x09, 0x8b, 0xed, 0xab, + 0x05, 0x00, 0x00, } func (m *Minter) Marshal() (dAtA []byte, err error) { @@ -267,6 +331,46 @@ func (m *Minter) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *WeightedAddress) 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 *WeightedAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WeightedAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Weight.Size() + i -= size + if _, err := m.Weight.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintMint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintMint(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *DistributionProportions) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -296,6 +400,16 @@ func (m *DistributionProportions) MarshalToSizedBuffer(dAtA []byte) (int, error) i = encodeVarintMint(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x22 + { + size := m.DevelopmentFund.Size() + i -= size + if _, err := m.DevelopmentFund.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintMint(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x1a { size := m.Incentives.Size() @@ -340,6 +454,20 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.DevelopmentFundRecipients) > 0 { + for iNdEx := len(m.DevelopmentFundRecipients) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DevelopmentFundRecipients[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } { size, err := m.DistributionProportions.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -429,6 +557,21 @@ func (m *Minter) Size() (n int) { return n } +func (m *WeightedAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovMint(uint64(l)) + } + l = m.Weight.Size() + n += 1 + l + sovMint(uint64(l)) + return n +} + func (m *DistributionProportions) Size() (n int) { if m == nil { return 0 @@ -439,6 +582,8 @@ func (m *DistributionProportions) Size() (n int) { n += 1 + l + sovMint(uint64(l)) l = m.Incentives.Size() n += 1 + l + sovMint(uint64(l)) + l = m.DevelopmentFund.Size() + n += 1 + l + sovMint(uint64(l)) l = m.CommunityPool.Size() n += 1 + l + sovMint(uint64(l)) return n @@ -467,6 +612,12 @@ func (m *Params) Size() (n int) { } l = m.DistributionProportions.Size() n += 1 + l + sovMint(uint64(l)) + if len(m.DevelopmentFundRecipients) > 0 { + for _, e := range m.DevelopmentFundRecipients { + l = e.Size() + n += 1 + l + sovMint(uint64(l)) + } + } return n } @@ -594,6 +745,122 @@ func (m *Minter) Unmarshal(dAtA []byte) error { } return nil } +func (m *WeightedAddress) 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 ErrIntOverflowMint + } + 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: WeightedAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WeightedAddress: 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 stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMint + } + 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 ErrInvalidLengthMint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMint + } + 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 ErrInvalidLengthMint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Weight.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMint(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMint + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *DistributionProportions) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -692,6 +959,40 @@ func (m *DistributionProportions) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DevelopmentFund", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMint + } + 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 ErrInvalidLengthMint + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DevelopmentFund.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field CommunityPool", wireType) } @@ -995,6 +1296,40 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DevelopmentFundRecipients", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMint + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DevelopmentFundRecipients = append(m.DevelopmentFundRecipients, WeightedAddress{}) + if err := m.DevelopmentFundRecipients[len(m.DevelopmentFundRecipients)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMint(dAtA[iNdEx:]) diff --git a/x/mint/types/params.go b/x/mint/types/params.go index baa52c820..394c208d7 100644 --- a/x/mint/types/params.go +++ b/x/mint/types/params.go @@ -13,13 +13,14 @@ import ( // Parameter store keys var ( - KeyMintDenom = []byte("MintDenom") - KeyInflationRateChange = []byte("InflationRateChange") - KeyInflationMax = []byte("InflationMax") - KeyInflationMin = []byte("InflationMin") - KeyGoalBonded = []byte("GoalBonded") - KeyBlocksPerYear = []byte("BlocksPerYear") - KeyDistributionProportions = []byte("DistributionProportions") + KeyMintDenom = []byte("MintDenom") + KeyInflationRateChange = []byte("InflationRateChange") + KeyInflationMax = []byte("InflationMax") + KeyInflationMin = []byte("InflationMin") + KeyGoalBonded = []byte("GoalBonded") + KeyBlocksPerYear = []byte("BlocksPerYear") + KeyDistributionProportions = []byte("DistributionProportions") + KeyDevelopmentFundRecipients = []byte("DevelopmentFundRecipients") ) // ParamTable for minting module. @@ -35,15 +36,17 @@ func NewParams( goalBonded sdk.Dec, blocksPerYear uint64, proportions DistributionProportions, + devAddrs []WeightedAddress, ) Params { return Params{ - MintDenom: mintDenom, - InflationRateChange: inflationRateChange, - InflationMax: inflationMax, - InflationMin: inflationMin, - GoalBonded: goalBonded, - BlocksPerYear: blocksPerYear, - DistributionProportions: proportions, + MintDenom: mintDenom, + InflationRateChange: inflationRateChange, + InflationMax: inflationMax, + InflationMin: inflationMin, + GoalBonded: goalBonded, + BlocksPerYear: blocksPerYear, + DistributionProportions: proportions, + DevelopmentFundRecipients: devAddrs, } } @@ -55,12 +58,14 @@ func DefaultParams() Params { InflationMax: sdk.NewDecWithPrec(20, 2), InflationMin: sdk.NewDecWithPrec(7, 2), GoalBonded: sdk.NewDecWithPrec(67, 2), - BlocksPerYear: uint64(60 * 60 * 8766 / 5), // assuming 5 second block times + BlocksPerYear: uint64(60 * 60 * 8766 / 5), // assuming 5 seconds block times DistributionProportions: DistributionProportions{ - Staking: sdk.NewDecWithPrec(4, 1), // 0.4 - Incentives: sdk.NewDecWithPrec(4, 1), // 0.4 - CommunityPool: sdk.NewDecWithPrec(2, 1), // 0.2 + Staking: sdk.NewDecWithPrec(3, 1), // 0.3 + Incentives: sdk.NewDecWithPrec(4, 1), // 0.4 + DevelopmentFund: sdk.NewDecWithPrec(2, 1), // 0.2 + CommunityPool: sdk.NewDecWithPrec(1, 1), // 0.1 }, + DevelopmentFundRecipients: []WeightedAddress{}, } } @@ -90,7 +95,10 @@ func (p Params) Validate() error { p.InflationMax, p.InflationMin, ) } - return validateDistributionProportions(p.DistributionProportions) + if err := validateDistributionProportions(p.DistributionProportions); err != nil { + return err + } + return validateWeightedAddresses(p.DevelopmentFundRecipients) } // String implements the Stringer interface. @@ -109,6 +117,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyGoalBonded, &p.GoalBonded, validateGoalBonded), paramtypes.NewParamSetPair(KeyBlocksPerYear, &p.BlocksPerYear, validateBlocksPerYear), paramtypes.NewParamSetPair(KeyDistributionProportions, &p.DistributionProportions, validateDistributionProportions), + paramtypes.NewParamSetPair(KeyDevelopmentFundRecipients, &p.DevelopmentFundRecipients, validateWeightedAddresses), } } @@ -219,11 +228,15 @@ func validateDistributionProportions(i interface{}) error { return errors.New("pool incentives distribution ratio should not be negative") } + if v.DevelopmentFund.IsNegative() { + return errors.New("development fund distribution ratio should not be negative") + } + if v.CommunityPool.IsNegative() { return errors.New("community pool distribution ratio should not be negative") } - totalProportions := v.Staking.Add(v.Incentives).Add(v.CommunityPool) + totalProportions := v.Staking.Add(v.Incentives).Add(v.DevelopmentFund).Add(v.CommunityPool) if !totalProportions.Equal(sdk.NewDec(1)) { return errors.New("total distributions ratio should be 1") @@ -231,3 +244,35 @@ func validateDistributionProportions(i interface{}) error { return nil } + +func validateWeightedAddresses(i interface{}) error { + v, ok := i.([]WeightedAddress) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if len(v) == 0 { + return nil + } + + weightSum := sdk.NewDec(0) + for i, w := range v { + _, err := sdk.AccAddressFromBech32(w.Address) + if err != nil { + return fmt.Errorf("invalid address at index %d", i) + } + if !w.Weight.IsPositive() { + return fmt.Errorf("non-positive weight at index %d", i) + } + if w.Weight.GT(sdk.NewDec(1)) { + return fmt.Errorf("more than 1 weight at index %d", i) + } + weightSum = weightSum.Add(w.Weight) + } + + if !weightSum.Equal(sdk.NewDec(1)) { + return fmt.Errorf("invalid weight sum: %s", weightSum.String()) + } + + return nil +} From c33780f4abdad02d2cbb017096ace171dfa23546 Mon Sep 17 00:00:00 2001 From: Giuseppe Natale <12249307+giunatale@users.noreply.github.com> Date: Thu, 16 Jun 2022 20:26:47 +0200 Subject: [PATCH 2/2] address feedback --- config.yml | 16 ++++++++++++---- x/mint/keeper/keeper.go | 10 +++++++--- x/mint/simulation/genesis.go | 12 +++++++----- x/mint/simulation/genesis_test.go | 16 +++++++++------- x/mint/simulation/params.go | 15 ++++++++++++--- 5 files changed, 47 insertions(+), 22 deletions(-) diff --git a/config.yml b/config.yml index 14ccd3a61..834a0ba35 100644 --- a/config.yml +++ b/config.yml @@ -62,9 +62,17 @@ genesis: params: mint_denom: "uspn" distribution_proportions: - staking: "0.400000000000000000" + staking: "0.300000000000000000" incentives: "0.400000000000000000" - community_pool: "0.200000000000000000" + development_fund: "0.200000000000000000" + community_pool: "0.100000000000000000" + development_fund_recipients: + - address: "spn1ezptsm3npn54qx9vvpah4nymre59ykr9exx2ul" # alice + weight: "0.400000000000000000" + - address: "spn1aqn8ynvr3jmq67879qulzrwhchq5dtrvtx0nhe" # bob + weight: "0.300000000000000000" + - address: "spn1pkdk6m2nh77nlaep84cylmkhjder3arey7rll5" # carol + weight: "0.300000000000000000" launch: params: revertDelay: "5" @@ -73,8 +81,8 @@ genesis: fundraising: params: auction_creation_fee: - - "amount": "100" - "denom": "uspn" + - amount: "100" + denom: "uspn" monitoringp: params: lastBlockHeight: "1" diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index 3b777329e..6ce2a2e81 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -4,6 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + spnerrors "github.com/tendermint/spn/pkg/errors" "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/spn/x/mint/types" @@ -144,8 +145,11 @@ func (k Keeper) DistributeMintedCoins(ctx sdk.Context, mintedCoin sdk.Coin) erro devFundCoins := sdk.NewCoins(devFundCoin) if len(params.DevelopmentFundRecipients) == 0 { // fund community pool when rewards address is empty - err = k.distrKeeper.FundCommunityPool(ctx, devFundCoins, k.accountKeeper.GetModuleAddress(types.ModuleName)) - if err != nil { + if err = k.distrKeeper.FundCommunityPool( + ctx, + devFundCoins, + k.accountKeeper.GetModuleAddress(types.ModuleName), + ); err != nil { return err } } else { @@ -154,7 +158,7 @@ func (k Keeper) DistributeMintedCoins(ctx sdk.Context, mintedCoin sdk.Coin) erro devFundPortionCoins := sdk.NewCoins(k.GetProportions(ctx, devFundCoin, w.Weight)) devAddr, err := sdk.AccAddressFromBech32(w.Address) if err != nil { - return err + return spnerrors.Critical(err.Error()) } err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, devAddr, devFundPortionCoins) if err != nil { diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index d9647dfcd..75f076cf8 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -69,11 +69,13 @@ func GenDistributionProportions(r *rand.Rand) types.DistributionProportions { } func GenDevelopmentFundRecipients(r *rand.Rand) []types.WeightedAddress { - numAddrs := r.Intn(51) - addrs := make([]types.WeightedAddress, 0) - remainWeight := sdk.NewDec(1) - maxRandWeight := sdk.NewDecWithPrec(15, 3) - minRandWeight := sdk.NewDecWithPrec(5, 3) + var ( + addrs = make([]types.WeightedAddress, 0) + numAddrs = r.Intn(51) + remainWeight = sdk.NewDec(1) + maxRandWeight = sdk.NewDecWithPrec(15, 3) + minRandWeight = sdk.NewDecWithPrec(5, 3) + ) for i := 0; i < numAddrs; i++ { // each address except the last can have a max of 2% weight and a min of 0.5% weight := simtypes.RandomDecAmount(r, maxRandWeight).Add(minRandWeight) diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index 073b55322..8d2696273 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -40,13 +40,15 @@ func TestRandomizedGenState(t *testing.T) { var mintGenesis types.GenesisState simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &mintGenesis) - dec1 := sdk.MustNewDecFromStr("0.670000000000000000") - dec2 := sdk.MustNewDecFromStr("0.200000000000000000") - dec3 := sdk.MustNewDecFromStr("0.070000000000000000") - dec4 := sdk.MustNewDecFromStr("0.170000000000000000") - dec5 := sdk.MustNewDecFromStr("0.700000000000000000") - dec6 := sdk.MustNewDecFromStr("0.060000000000000000") - dec7 := sdk.MustNewDecFromStr("0.070000000000000000") + var ( + dec1 = sdk.MustNewDecFromStr("0.670000000000000000") + dec2 = sdk.MustNewDecFromStr("0.200000000000000000") + dec3 = sdk.MustNewDecFromStr("0.070000000000000000") + dec4 = sdk.MustNewDecFromStr("0.170000000000000000") + dec5 = sdk.MustNewDecFromStr("0.700000000000000000") + dec6 = sdk.MustNewDecFromStr("0.060000000000000000") + dec7 = sdk.MustNewDecFromStr("0.070000000000000000") + ) weightedAddresses := []types.WeightedAddress{ { diff --git a/x/mint/simulation/params.go b/x/mint/simulation/params.go index f919c8800..125a3941b 100644 --- a/x/mint/simulation/params.go +++ b/x/mint/simulation/params.go @@ -49,8 +49,13 @@ func ParamChanges(r *rand.Rand) []simtypes.ParamChange { simulation.NewSimParamChange(types.ModuleName, keyDistributionProportions, func(r *rand.Rand) string { proportions := GenDistributionProportions(r) - return fmt.Sprintf("{\"staking\":\"%s\",\"incentives\":\"%s\",\"development_fund\":\"%s\",\"community_pool\":\"%s\"}", - proportions.Staking.String(), proportions.Incentives.String(), proportions.DevelopmentFund.String(), proportions.CommunityPool.String()) + return fmt.Sprintf( + `{"staking":"%s","incentives":"%s","development_fund":"%s","community_pool":"%s"}`, + proportions.Staking.String(), + proportions.Incentives.String(), + proportions.DevelopmentFund.String(), + proportions.CommunityPool.String(), + ) }, ), simulation.NewSimParamChange(types.ModuleName, keyDevelopmentFundRecipients, @@ -58,7 +63,11 @@ func ParamChanges(r *rand.Rand) []simtypes.ParamChange { weightedAddrs := GenDevelopmentFundRecipients(r) weightedAddrsStr := make([]string, 0) for _, wa := range weightedAddrs { - s := fmt.Sprintf("{\"address\":\"%s\",\"weight\":\"%s\"}", wa.Address, wa.Weight.String()) + s := fmt.Sprintf( + `{"address":"%s","weight":"%s"}`, + wa.Address, + wa.Weight.String(), + ) weightedAddrsStr = append(weightedAddrsStr, s) } return fmt.Sprintf("[%s]", strings.Join(weightedAddrsStr, ","))