From efb97d8c95ae0529585295d0aa67d84dca4c6a9d Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 22 Jun 2022 23:24:01 -0400 Subject: [PATCH 01/26] chore: mint module docs and clean up --- go.mod | 2 +- proto/osmosis/mint/v1beta1/genesis.proto | 6 +- proto/osmosis/mint/v1beta1/mint.proto | 43 +++-- proto/osmosis/mint/v1beta1/query.proto | 6 +- x/gamm/pool-models/balancer/tx.pb.go | 54 +++---- x/mint/keeper/hooks.go | 2 +- x/mint/keeper/keeper.go | 3 +- x/mint/types/events.go | 10 +- x/mint/types/expected_keepers.go | 1 - x/mint/types/export_test.go | 6 + x/mint/types/genesis.go | 2 +- x/mint/types/genesis.pb.go | 6 +- x/mint/types/hooks.go | 7 +- x/mint/types/keys.go | 16 +- x/mint/types/mint.pb.go | 43 +++-- x/mint/types/minter.go | 18 ++- x/mint/types/minter_test.go | 52 +++++- x/mint/types/params.go | 11 +- x/mint/types/query.pb.go | 8 +- x/pool-incentives/keeper/hooks.go | 2 + x/superfluid/types/query.pb.go | 198 +++++++++++------------ 21 files changed, 301 insertions(+), 195 deletions(-) create mode 100644 x/mint/types/export_test.go diff --git a/go.mod b/go.mod index b6a836e495e..7ff37b8b053 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/CosmWasm/wasmd v0.24.0 github.com/cosmos/cosmos-proto v1.0.0-alpha7 - github.com/cosmos/cosmos-sdk v0.45.4 + github.com/cosmos/cosmos-sdk v0.45.5 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/iavl v0.17.3 github.com/cosmos/ibc-go/v3 v3.0.0 diff --git a/proto/osmosis/mint/v1beta1/genesis.proto b/proto/osmosis/mint/v1beta1/genesis.proto index 3a9112b639a..bc0094b6b32 100644 --- a/proto/osmosis/mint/v1beta1/genesis.proto +++ b/proto/osmosis/mint/v1beta1/genesis.proto @@ -8,13 +8,13 @@ option go_package = "github.com/osmosis-labs/osmosis/v7/x/mint/types"; // GenesisState defines the mint module's genesis state. message GenesisState { - // minter is a space for holding current rewards information. + // Minter is an abstraction for holding current rewards information. Minter minter = 1 [ (gogoproto.nullable) = false ]; - // params defines all the paramaters of the module. + // Params defines all the paramaters of the mint module. Params params = 2 [ (gogoproto.nullable) = false ]; - // current halven period start epoch + // HalvenStartedEpoch current halven period start epoch int64 halven_started_epoch = 3 [ (gogoproto.moretags) = "yaml:\"halven_started_epoch\"" ]; } diff --git a/proto/osmosis/mint/v1beta1/mint.proto b/proto/osmosis/mint/v1beta1/mint.proto index 95490b849a5..92fba5913d9 100644 --- a/proto/osmosis/mint/v1beta1/mint.proto +++ b/proto/osmosis/mint/v1beta1/mint.proto @@ -10,7 +10,7 @@ import "google/protobuf/duration.proto"; // Minter represents the minting state. message Minter { - // current epoch provisions + // EpochProvisions represent rewards for the current epoch. string epoch_provisions = 1 [ (gogoproto.moretags) = "yaml:\"epoch_provisions\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -18,6 +18,9 @@ message Minter { ]; } +// WeightedAddress represents an address with a weight assigned to it. +// The weight is used to determine the proportion of the total minted +// tokens to be minted to the address. message WeightedAddress { string address = 1 [ (gogoproto.moretags) = "yaml:\"address\"" ]; string weight = 2 [ @@ -27,29 +30,32 @@ message WeightedAddress { ]; } +// DistributionProportions defines the distribution proportions of the minted +// denom. In other words, defines which stakeholders will receive the minted +// denoms and how much. message DistributionProportions { - // staking defines the proportion of the minted minted_denom that is to be + // Staking defines the proportion of the minted MintedDenom that is to be // allocated as staking rewards. string staking = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.moretags) = "yaml:\"staking\"", (gogoproto.nullable) = false ]; - // pool_incentives defines the proportion of the minted minted_denom that is + // PoolImcentives defines the proportion of the minted MintedDenom that is // to be allocated as pool incentives. string pool_incentives = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.moretags) = "yaml:\"pool_incentives\"", (gogoproto.nullable) = false ]; - // developer_rewards defines the proportion of the minted minted_denom that is + // DeveloperRewards defines the proportion of the minted MintedDenom that is // to be allocated to developer rewards address. string developer_rewards = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.moretags) = "yaml:\"developer_rewards\"", (gogoproto.nullable) = false ]; - // community_pool defines the proportion of the minted minted_denom that is + // CommunityPool defines the proportion of the minted MintedDenom that is // to be allocated to the community pool. string community_pool = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -58,39 +64,48 @@ message DistributionProportions { ]; } -// Params holds parameters for the mint module. +// Params holds parameters for the x/mint module. message Params { option (gogoproto.goproto_stringer) = false; - // type of coin to mint + // MintDenom the denom of the coin to mint. string mint_denom = 1; - // epoch provisions from the first epoch + // GenesisEpochProvisions epoch provisions from the first epoch. string genesis_epoch_provisions = 2 [ (gogoproto.moretags) = "yaml:\"genesis_epoch_provisions\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // mint epoch identifier + // EpochIdentifier mint epoch identifier e.g. (day, week). string epoch_identifier = 3 [ (gogoproto.moretags) = "yaml:\"epoch_identifier\"" ]; - // number of epochs take to reduce rewards + // ReductionPeriodInEpochs the number of epochs it takes + // to reduce the rewards. int64 reduction_period_in_epochs = 4 [ (gogoproto.moretags) = "yaml:\"reduction_period_in_epochs\"" ]; - // reduction multiplier to execute on each period + // ReductionFactor is the reduction multiplier to execute + // at the end of each period set by ReductionPeriodInEpochs. string reduction_factor = 5 [ (gogoproto.moretags) = "yaml:\"reduction_factor\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // distribution_proportions defines the proportion of the minted denom + // DistributionProportions defines the distribution proportions of the minted + // denom. In other words, defines which stakeholders will receive the minted + // denoms and how much. DistributionProportions distribution_proportions = 6 [ (gogoproto.nullable) = false ]; - // address to receive developer rewards + // WeightedDeveloperRewardsReceivers the address to receive developer rewards + // with weights assignedt to each address. The final amount that each address + // receives is: + // EpochProvisions * DistributionProportions.DeveloperRewards * Address's + // Weight. repeated WeightedAddress weighted_developer_rewards_receivers = 7 [ (gogoproto.moretags) = "yaml:\"developer_rewards_receiver\"", (gogoproto.nullable) = false ]; - // start epoch to distribute minting rewards + // MintingRewardsDistributionStartEpoch start epoch to distribute minting + // rewards int64 minting_rewards_distribution_start_epoch = 8 [ (gogoproto.moretags) = "yaml:\"minting_rewards_distribution_start_epoch\"" ]; diff --git a/proto/osmosis/mint/v1beta1/query.proto b/proto/osmosis/mint/v1beta1/query.proto index 83c55a5e0ad..a327c75b266 100644 --- a/proto/osmosis/mint/v1beta1/query.proto +++ b/proto/osmosis/mint/v1beta1/query.proto @@ -14,7 +14,7 @@ service Query { option (google.api.http).get = "/osmosis/mint/v1beta1/params"; } - // EpochProvisions current minting epoch provisions value. + // EpochProvisions returns the current minting epoch provisions value. rpc EpochProvisions(QueryEpochProvisionsRequest) returns (QueryEpochProvisionsResponse) { option (google.api.http).get = "/osmosis/mint/v1beta1/epoch_provisions"; @@ -26,7 +26,7 @@ message QueryParamsRequest {} // QueryParamsResponse is the response type for the Query/Params RPC method. message QueryParamsResponse { - // params defines the parameters of the module. + // Params defines the parameters of the module. Params params = 1 [ (gogoproto.nullable) = false ]; } @@ -37,7 +37,7 @@ message QueryEpochProvisionsRequest {} // QueryEpochProvisionsResponse is the response type for the // Query/EpochProvisions RPC method. message QueryEpochProvisionsResponse { - // epoch_provisions is the current minting per epoch provisions value. + // EpochProvisions is the current minting per epoch provisions value. bytes epoch_provisions = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false diff --git a/x/gamm/pool-models/balancer/tx.pb.go b/x/gamm/pool-models/balancer/tx.pb.go index 8389c66d7c3..b10cb4e3eed 100644 --- a/x/gamm/pool-models/balancer/tx.pb.go +++ b/x/gamm/pool-models/balancer/tx.pb.go @@ -151,34 +151,34 @@ func init() { } var fileDescriptor_0647ee155de97433 = []byte{ - // 425 bytes of a gzipped FileDescriptorProto + // 427 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0xc1, 0x8a, 0xd4, 0x30, - 0x18, 0xc7, 0x27, 0x3b, 0x43, 0xc5, 0x2c, 0x1e, 0x0c, 0xab, 0x94, 0x11, 0xdb, 0x52, 0x2f, 0xf5, - 0x30, 0x09, 0x3b, 0x0a, 0x82, 0x07, 0xc5, 0xba, 0xb2, 0xec, 0x61, 0x61, 0xec, 0x69, 0xf1, 0xb2, - 0xa4, 0xdb, 0x58, 0x07, 0xda, 0xa6, 0x24, 0x99, 0x61, 0x7c, 0x0b, 0x9f, 0xc0, 0xa3, 0x8f, 0xe0, - 0x33, 0xec, 0x71, 0x8f, 0x9e, 0x8a, 0x74, 0xde, 0x60, 0x9e, 0x40, 0x92, 0xb4, 0x32, 0x42, 0x17, - 0x05, 0x6f, 0xe9, 0x97, 0xdf, 0xff, 0xff, 0xff, 0xbe, 0xf4, 0x83, 0x33, 0x2e, 0x4b, 0x2e, 0x97, - 0x92, 0xe4, 0xb4, 0x2c, 0x49, 0xcd, 0x79, 0x31, 0x2b, 0x79, 0xc6, 0x0a, 0x49, 0x52, 0x5a, 0xd0, - 0xea, 0x8a, 0x09, 0xa2, 0x36, 0x44, 0x6d, 0x70, 0x2d, 0xb8, 0xe2, 0x28, 0xea, 0x70, 0xac, 0x71, - 0xac, 0x71, 0x4b, 0xe3, 0x9e, 0xc6, 0xeb, 0xe3, 0x94, 0x29, 0x7a, 0x3c, 0x3d, 0xca, 0x79, 0xce, - 0x8d, 0x88, 0xe8, 0x93, 0xd5, 0x4f, 0x9f, 0xff, 0x3d, 0xae, 0x3f, 0x2c, 0x38, 0x2f, 0xac, 0x2a, - 0xfc, 0x7e, 0x00, 0x1f, 0x9c, 0xcb, 0xfc, 0xad, 0x60, 0x54, 0xb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, 0x26, 0x6b, 0x5e, 0x49, 0x86, 0x1e, 0xc1, 0x5b, 0x46, 0xb3, 0xcc, 0xcc, + 0x13, 0x4e, 0x62, 0xd8, 0x36, 0xbe, 0xa3, 0x91, 0xd3, 0xe3, 0xc4, 0xd1, 0x57, 0xa7, 0xd9, 0xe2, + 0x1b, 0x80, 0xe3, 0x33, 0x99, 0xa3, 0xaf, 0x00, 0xa2, 0x81, 0xbf, 0xf0, 0x12, 0xff, 0xeb, 0x5a, + 0xe0, 0xc1, 0x66, 0x66, 0x27, 0xff, 0x29, 0xe8, 0xa7, 0x89, 0xdf, 0x5d, 0xb5, 0x1e, 0xb8, 0x6e, + 0x3d, 0xf0, 0xb3, 0xf5, 0xc0, 0x97, 0xad, 0x37, 0xba, 0xde, 0x7a, 0xa3, 0x1f, 0x5b, 0x6f, 0xf4, + 0xe1, 0x45, 0xbe, 0x54, 0x9f, 0x56, 0x29, 0xbe, 0xe4, 0x25, 0xe9, 0x8a, 0xcd, 0x0b, 0x9a, 0xca, + 0xfe, 0x83, 0xac, 0x9f, 0x91, 0xcd, 0xfe, 0xb5, 0x4c, 0x1d, 0xb3, 0x8a, 0x4f, 0x7e, 0x05, 0x00, + 0x00, 0xff, 0xff, 0x56, 0x65, 0x86, 0x28, 0x31, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/mint/keeper/hooks.go b/x/mint/keeper/hooks.go index bce090cbafe..f55404640f1 100644 --- a/x/mint/keeper/hooks.go +++ b/x/mint/keeper/hooks.go @@ -59,7 +59,7 @@ func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumb ctx.EventManager().EmitEvent( sdk.NewEvent( - types.EventTypeMint, + types.ModuleName, sdk.NewAttribute(types.AttributeEpochNumber, fmt.Sprintf("%d", epochNumber)), sdk.NewAttribute(types.AttributeKeyEpochProvisions, minter.EpochProvisions.String()), sdk.NewAttribute(sdk.AttributeKeyAmount, mintedCoin.Amount.String()), diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index dcb08f27c96..448a6ebb1dd 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -1,9 +1,10 @@ package keeper import ( + "github.com/tendermint/tendermint/libs/log" + "github.com/osmosis-labs/osmosis/v7/x/mint/types" poolincentivestypes "github.com/osmosis-labs/osmosis/v7/x/pool-incentives/types" - "github.com/tendermint/tendermint/libs/log" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/mint/types/events.go b/x/mint/types/events.go index 6ad8f851868..4f1ca5464b6 100644 --- a/x/mint/types/events.go +++ b/x/mint/types/events.go @@ -1,9 +1,11 @@ package types -// Minting module event types. +// Minting module event constants. const ( - EventTypeMint = ModuleName - + // AttributeKeyEpochProvisions is the string representation of the + // epoch provisions event attribute. AttributeKeyEpochProvisions = "epoch_provisions" - AttributeEpochNumber = "epoch_number" + // AttributeEpochNumber is the string representation of the + // epoch number event attribute. + AttributeEpochNumber = "epoch_number" ) diff --git a/x/mint/types/expected_keepers.go b/x/mint/types/expected_keepers.go index b23f5e53040..29f1c7d3a78 100644 --- a/x/mint/types/expected_keepers.go +++ b/x/mint/types/expected_keepers.go @@ -12,7 +12,6 @@ type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress HasAccount(ctx sdk.Context, addr sdk.AccAddress) bool - // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, types.ModuleAccountI) GetModuleAccount(ctx sdk.Context, moduleName string) types.ModuleAccountI } diff --git a/x/mint/types/export_test.go b/x/mint/types/export_test.go new file mode 100644 index 00000000000..103197e146c --- /dev/null +++ b/x/mint/types/export_test.go @@ -0,0 +1,6 @@ +package types + +var ( + ErrNilEpochProvisions = errNilEpochProvisions + ErrNegativeEpochProvisions = errNegativeEpochProvisions +) diff --git a/x/mint/types/genesis.go b/x/mint/types/genesis.go index eae6321d589..bfe7e40645f 100644 --- a/x/mint/types/genesis.go +++ b/x/mint/types/genesis.go @@ -25,5 +25,5 @@ func ValidateGenesis(data GenesisState) error { return err } - return ValidateMinter(data.Minter) + return data.Minter.Validate() } diff --git a/x/mint/types/genesis.pb.go b/x/mint/types/genesis.pb.go index 7aca546b4bc..b6008ec5dd6 100644 --- a/x/mint/types/genesis.pb.go +++ b/x/mint/types/genesis.pb.go @@ -25,11 +25,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the mint module's genesis state. type GenesisState struct { - // minter is a space for holding current rewards information. + // Minter is an abstraction for holding current rewards information. Minter Minter `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter"` - // params defines all the paramaters of the module. + // Params defines all the paramaters of the mint module. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` - // current halven period start epoch + // HalvenStartedEpoch current halven period start epoch HalvenStartedEpoch int64 `protobuf:"varint,3,opt,name=halven_started_epoch,json=halvenStartedEpoch,proto3" json:"halven_started_epoch,omitempty" yaml:"halven_started_epoch"` } diff --git a/x/mint/types/hooks.go b/x/mint/types/hooks.go index ff2b3c3d4d1..26b0e8fad2f 100644 --- a/x/mint/types/hooks.go +++ b/x/mint/types/hooks.go @@ -4,19 +4,24 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +// MintHooks defines an interface for mint module's hooks. type MintHooks interface { AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) } var _ MintHooks = MultiMintHooks{} -// combine multiple mint hooks, all hook functions are run in array sequence. +// MultiMintHooks is a container for mint hooks. +// All hooks are run in sequence. type MultiMintHooks []MintHooks +// NewMultiMintHooks returns new MultiMintHooks given hooks. func NewMultiMintHooks(hooks ...MintHooks) MultiMintHooks { return hooks } +// AfterDistributeMintedCoin is a hook that runs after minter mints and distributes coins +// at the beginning of each epoch. func (h MultiMintHooks) AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) { for i := range h { h[i].AfterDistributeMintedCoin(ctx, mintedCoin) diff --git a/x/mint/types/keys.go b/x/mint/types/keys.go index 6812a631889..b6dc41a6480 100644 --- a/x/mint/types/keys.go +++ b/x/mint/types/keys.go @@ -1,15 +1,17 @@ package types -// MinterKey is the key to use for the keeper store. +// MinterKey is the key to use for the keeper store at which +// the Minter and its EpochProvisions are stored. var MinterKey = []byte{0x00} -// LastHalvenEpochKey is the key to use for the keeper store. +// LastHalvenEpochKey is the key to use for the keeper store +// for storing the last epoch at which halvening occurred. var LastHalvenEpochKey = []byte{0x03} const ( - // module name. + // ModuleName is the module name. ModuleName = "mint" - // module acct name for developer vesting. + // DeveloperVestingModuleAcctName is the module acct name for developer vesting. DeveloperVestingModuleAcctName = "developer_vesting_unvested" // StoreKey is the default store key for mint. @@ -18,7 +20,9 @@ const ( // QuerierRoute is the querier route for the minting store. QuerierRoute = StoreKey - // Query endpoints supported by the minting querier. - QueryParameters = "parameters" + // QueryParameters is an endpoint path for querying mint parameters. + QueryParameters = "parameters" + + // QueryEpochProvisions is an endpoint path for querying mint epoch provisions. QueryEpochProvisions = "epoch_provisions" ) diff --git a/x/mint/types/mint.pb.go b/x/mint/types/mint.pb.go index e3bae5c43db..e74ad61a2f7 100644 --- a/x/mint/types/mint.pb.go +++ b/x/mint/types/mint.pb.go @@ -28,7 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Minter represents the minting state. type Minter struct { - // current epoch provisions + // EpochProvisions represent rewards for the current epoch. EpochProvisions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=epoch_provisions,json=epochProvisions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"epoch_provisions" yaml:"epoch_provisions"` } @@ -65,6 +65,9 @@ func (m *Minter) XXX_DiscardUnknown() { var xxx_messageInfo_Minter proto.InternalMessageInfo +// WeightedAddress represents an address with a weight assigned to it. +// The weight is used to determine the proportion of the total minted +// tokens to be minted to the address. type WeightedAddress struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty" yaml:"address"` 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" yaml:"weight"` @@ -110,17 +113,20 @@ func (m *WeightedAddress) GetAddress() string { return "" } +// DistributionProportions defines the distribution proportions of the minted +// denom. In other words, defines which stakeholders will receive the minted +// denoms and how much. type DistributionProportions struct { - // staking defines the proportion of the minted minted_denom that is to be + // Staking defines the proportion of the minted MintedDenom that is to be // allocated as staking rewards. Staking github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=staking,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"staking" yaml:"staking"` - // pool_incentives defines the proportion of the minted minted_denom that is + // PoolImcentives defines the proportion of the minted MintedDenom that is // to be allocated as pool incentives. PoolIncentives github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=pool_incentives,json=poolIncentives,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"pool_incentives" yaml:"pool_incentives"` - // developer_rewards defines the proportion of the minted minted_denom that is + // DeveloperRewards defines the proportion of the minted MintedDenom that is // to be allocated to developer rewards address. DeveloperRewards github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=developer_rewards,json=developerRewards,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"developer_rewards" yaml:"developer_rewards"` - // community_pool defines the proportion of the minted minted_denom that is + // CommunityPool defines the proportion of the minted MintedDenom that is // to be allocated to the 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" yaml:"community_pool"` } @@ -158,23 +164,32 @@ func (m *DistributionProportions) XXX_DiscardUnknown() { var xxx_messageInfo_DistributionProportions proto.InternalMessageInfo -// Params holds parameters for the mint module. +// Params holds parameters for the x/mint module. type Params struct { - // type of coin to mint + // MintDenom the denom of the coin to mint. MintDenom string `protobuf:"bytes,1,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` - // epoch provisions from the first epoch + // GenesisEpochProvisions epoch provisions from the first epoch. GenesisEpochProvisions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=genesis_epoch_provisions,json=genesisEpochProvisions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"genesis_epoch_provisions" yaml:"genesis_epoch_provisions"` - // mint epoch identifier + // EpochIdentifier mint epoch identifier e.g. (day, week). EpochIdentifier string `protobuf:"bytes,3,opt,name=epoch_identifier,json=epochIdentifier,proto3" json:"epoch_identifier,omitempty" yaml:"epoch_identifier"` - // number of epochs take to reduce rewards + // ReductionPeriodInEpochs the number of epochs it takes + // to reduce the rewards. ReductionPeriodInEpochs int64 `protobuf:"varint,4,opt,name=reduction_period_in_epochs,json=reductionPeriodInEpochs,proto3" json:"reduction_period_in_epochs,omitempty" yaml:"reduction_period_in_epochs"` - // reduction multiplier to execute on each period + // ReductionFactor is the reduction multiplier to execute + // at the end of each period set by ReductionPeriodInEpochs. ReductionFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=reduction_factor,json=reductionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reduction_factor" yaml:"reduction_factor"` - // distribution_proportions defines the proportion of the minted denom + // DistributionProportions defines the distribution proportions of the minted + // denom. In other words, defines which stakeholders will receive the minted + // denoms and how much. DistributionProportions DistributionProportions `protobuf:"bytes,6,opt,name=distribution_proportions,json=distributionProportions,proto3" json:"distribution_proportions"` - // address to receive developer rewards + // WeightedDeveloperRewardsReceivers the address to receive developer rewards + // with weights assignedt to each address. The final amount that each address + // receives is: + // EpochProvisions * DistributionProportions.DeveloperRewards * Address's + // Weight. WeightedDeveloperRewardsReceivers []WeightedAddress `protobuf:"bytes,7,rep,name=weighted_developer_rewards_receivers,json=weightedDeveloperRewardsReceivers,proto3" json:"weighted_developer_rewards_receivers" yaml:"developer_rewards_receiver"` - // start epoch to distribute minting rewards + // MintingRewardsDistributionStartEpoch start epoch to distribute minting + // rewards MintingRewardsDistributionStartEpoch int64 `protobuf:"varint,8,opt,name=minting_rewards_distribution_start_epoch,json=mintingRewardsDistributionStartEpoch,proto3" json:"minting_rewards_distribution_start_epoch,omitempty" yaml:"minting_rewards_distribution_start_epoch"` } diff --git a/x/mint/types/minter.go b/x/mint/types/minter.go index e9ba2b5d5f3..c4037c71aaa 100644 --- a/x/mint/types/minter.go +++ b/x/mint/types/minter.go @@ -1,9 +1,16 @@ package types import ( + "errors" + sdk "github.com/cosmos/cosmos-sdk/types" ) +var ( + errNilEpochProvisions = errors.New("epoch provisions was nil in genesis") + errNegativeEpochProvisions = errors.New("epoch provisions should be non-negative") +) + // NewMinter returns a new Minter object with the given epoch // provisions values. func NewMinter(epochProvisions sdk.Dec) Minter { @@ -22,8 +29,15 @@ func DefaultInitialMinter() Minter { return InitialMinter() } -// validate minter. -func ValidateMinter(minter Minter) error { +// Validate validates minter. Returns nil on success, error otherewise. +func (m Minter) Validate() error { + if m.EpochProvisions.IsNil() { + return errNilEpochProvisions + } + + if m.EpochProvisions.IsNegative() { + return errNegativeEpochProvisions + } return nil } diff --git a/x/mint/types/minter_test.go b/x/mint/types/minter_test.go index 1865228a274..e86dda30650 100644 --- a/x/mint/types/minter_test.go +++ b/x/mint/types/minter_test.go @@ -1,10 +1,13 @@ -package types +package types_test import ( "math/rand" "testing" + "github.com/osmosis-labs/osmosis/v7/x/mint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" ) // Benchmarking :) @@ -15,8 +18,8 @@ import ( // BenchmarkEpochProvision-4 3000000 429 ns/op func BenchmarkEpochProvision(b *testing.B) { b.ReportAllocs() - minter := InitialMinter() - params := DefaultParams() + minter := types.InitialMinter() + params := types.DefaultParams() s1 := rand.NewSource(100) r1 := rand.New(s1) @@ -32,11 +35,50 @@ func BenchmarkEpochProvision(b *testing.B) { // BenchmarkNextEpochProvisions-4 5000000 251 ns/op func BenchmarkNextEpochProvisions(b *testing.B) { b.ReportAllocs() - minter := InitialMinter() - params := DefaultParams() + minter := types.InitialMinter() + params := types.DefaultParams() // run the NextEpochProvisions function b.N times for n := 0; n < b.N; n++ { minter.NextEpochProvisions(params) } } + +func TestValidate(t *testing.T) { + + testcases := []struct { + name string + minter types.Minter + expected error + }{ + { + "valid - success", + types.InitialMinter(), + nil, + }, + { + "negative -errir", + types.Minter{ + EpochProvisions: sdk.NewDec(-1), + }, + types.ErrNegativeEpochProvisions, + }, + { + "nil -error", + types.Minter{}, + types.ErrNilEpochProvisions, + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + actual := tc.minter.Validate() + if tc.expected != nil { + require.Error(t, actual) + require.Equal(t, actual, tc.expected) + } else { + require.NoError(t, actual) + } + }) + } +} diff --git a/x/mint/types/params.go b/x/mint/types/params.go index 31f6d964685..19dc168260b 100644 --- a/x/mint/types/params.go +++ b/x/mint/types/params.go @@ -5,9 +5,10 @@ import ( "fmt" "strings" - epochtypes "github.com/osmosis-labs/osmosis/v7/x/epochs/types" yaml "gopkg.in/yaml.v2" + epochtypes "github.com/osmosis-labs/osmosis/v7/x/epochs/types" + sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) @@ -29,6 +30,7 @@ func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } +// NewParams returns new mint module parameters initialized to the given values. func NewParams( mintDenom string, genesisEpochProvisions sdk.Dec, epochIdentifier string, ReductionFactor sdk.Dec, reductionPeriodInEpochs int64, distrProportions DistributionProportions, @@ -46,7 +48,7 @@ func NewParams( } } -// default minting module parameters. +// DefaultParams returns the default minting module parameters. func DefaultParams() Params { return Params{ MintDenom: sdk.DefaultBondDenom, @@ -65,7 +67,8 @@ func DefaultParams() Params { } } -// validate params. +// Validate validates mint module parameters. Returns nil if valid, +// error otherwise func (p Params) Validate() error { if err := validateMintDenom(p.MintDenom); err != nil { return err @@ -192,8 +195,6 @@ func validateDistributionProportions(i interface{}) error { return errors.New("developer rewards distribution ratio should not be negative") } - // TODO: Maybe we should allow this :joy:, lets you burn osmo from community pool - // for new chains if v.CommunityPool.IsNegative() { return errors.New("community pool distribution ratio should not be negative") } diff --git a/x/mint/types/query.pb.go b/x/mint/types/query.pb.go index a7c1a564082..07ae98df383 100644 --- a/x/mint/types/query.pb.go +++ b/x/mint/types/query.pb.go @@ -69,7 +69,7 @@ var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryParamsResponse is the response type for the Query/Params RPC method. type QueryParamsResponse struct { - // params defines the parameters of the module. + // Params defines the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -154,7 +154,7 @@ var xxx_messageInfo_QueryEpochProvisionsRequest proto.InternalMessageInfo // QueryEpochProvisionsResponse is the response type for the // Query/EpochProvisions RPC method. type QueryEpochProvisionsResponse struct { - // epoch_provisions is the current minting per epoch provisions value. + // EpochProvisions is the current minting per epoch provisions value. EpochProvisions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=epoch_provisions,json=epochProvisions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"epoch_provisions"` } @@ -243,7 +243,7 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Params returns the total set of minting parameters. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // EpochProvisions current minting epoch provisions value. + // EpochProvisions returns the current minting epoch provisions value. EpochProvisions(ctx context.Context, in *QueryEpochProvisionsRequest, opts ...grpc.CallOption) (*QueryEpochProvisionsResponse, error) } @@ -277,7 +277,7 @@ func (c *queryClient) EpochProvisions(ctx context.Context, in *QueryEpochProvisi type QueryServer interface { // Params returns the total set of minting parameters. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // EpochProvisions current minting epoch provisions value. + // EpochProvisions returns the current minting epoch provisions value. EpochProvisions(context.Context, *QueryEpochProvisionsRequest) (*QueryEpochProvisionsResponse, error) } diff --git a/x/pool-incentives/keeper/hooks.go b/x/pool-incentives/keeper/hooks.go index 4fe21bf1979..af099cbc535 100644 --- a/x/pool-incentives/keeper/hooks.go +++ b/x/pool-incentives/keeper/hooks.go @@ -4,6 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" gammtypes "github.com/osmosis-labs/osmosis/v7/x/gamm/types" + minttypes "github.com/osmosis-labs/osmosis/v7/x/mint/types" ) type Hooks struct { @@ -11,6 +12,7 @@ type Hooks struct { } var _ gammtypes.GammHooks = Hooks{} +var _ minttypes.MintHooks = Hooks{} // Create new pool incentives hooks. func (k Keeper) Hooks() Hooks { return Hooks{k} } diff --git a/x/superfluid/types/query.pb.go b/x/superfluid/types/query.pb.go index 40a7985f794..27cd1d36102 100644 --- a/x/superfluid/types/query.pb.go +++ b/x/superfluid/types/query.pb.go @@ -1267,105 +1267,105 @@ func init() { func init() { proto.RegisterFile("osmosis/superfluid/query.proto", fileDescriptor_e3d9448e4ed3943f) } var fileDescriptor_e3d9448e4ed3943f = []byte{ - // 1554 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcf, 0x6f, 0x14, 0x55, - 0x1c, 0xef, 0x6b, 0xa1, 0x85, 0x2f, 0x09, 0x94, 0x07, 0xca, 0x32, 0xc0, 0x16, 0xa6, 0xd0, 0xae, - 0x05, 0x66, 0xa4, 0x58, 0xa8, 0x28, 0x84, 0x2d, 0x05, 0x6c, 0x52, 0x2c, 0x2e, 0xb4, 0x24, 0xfe, - 0xc8, 0x64, 0x76, 0xe7, 0xb1, 0x4c, 0x3a, 0x3b, 0xb3, 0xdd, 0x37, 0x53, 0xd9, 0x10, 0x62, 0xc4,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x5c, - 0x22, 0x19, 0x93, 0x49, 0x2e, 0x2e, 0xd0, 0x9a, 0x73, 0x3e, 0x14, 0x8a, 0x6b, 0xae, 0x38, 0x0d, - 0xa3, 0x94, 0x73, 0x52, 0xe8, 0xf2, 0x5d, 0x04, 0x07, 0x22, 0x7c, 0x73, 0xb6, 0x4b, 0x1a, 0x35, - 0x62, 0x98, 0x7a, 0xa3, 0x59, 0xac, 0x54, 0x1c, 0xcf, 0x76, 0xe7, 0xec, 0xeb, 0x4e, 0x32, 0x12, - 0xbc, 0x1b, 0x36, 0xad, 0xea, 0x96, 0xa6, 0x1b, 0x46, 0x23, 0xd7, 0xcf, 0x08, 0x43, 0xab, 0xba, - 0x55, 0x34, 0x8c, 0x86, 0x4f, 0xaa, 0xea, 0x5e, 0x95, 0x68, 0xa6, 0x91, 0x1b, 0xd8, 0x8f, 0x0a, - 0x1b, 0x4a, 0x43, 0xec, 0x7d, 0xce, 0xc0, 0x39, 0x18, 0xf2, 0x25, 0x08, 0xa5, 0xb9, 0x0d, 0x5c, - 0x48, 0xbc, 0xca, 0x37, 0x20, 0x5f, 0xb4, 0xac, 0x04, 0x1f, 0x82, 0x1c, 0xfa, 0xf5, 0x11, 0x55, - 0xb6, 0x88, 0xc7, 0x98, 0xc2, 0xdb, 0x40, 0xf1, 0xdb, 0x40, 0xe1, 0x37, 0x85, 0x68, 0x03, 0xe5, - 0xb2, 0x5e, 0x0d, 0xca, 0xb0, 0x14, 0x93, 0x94, 0x7f, 0x44, 0x30, 0x92, 0x6a, 0x4a, 0xe4, 0xe2, - 0x1a, 0x6c, 0xd2, 0xc5, 0x99, 0x28, 0x8e, 0xa9, 0xec, 0xe2, 0x48, 0x09, 0x9e, 0x28, 0x97, 0x50, - 0x19, 0xbe, 0xd8, 0x02, 0xa2, 0x9f, 0x81, 0x18, 0xef, 0x08, 0x82, 0x7b, 0xd5, 0x82, 0xe2, 0x0c, - 0x8c, 0x9e, 0x73, 0x6c, 0x9b, 0x54, 0x5c, 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, 0x6e, 0xac, 0x9e, 0x54, 0x6f, 0xc6, 0x7d, 0x61, 0xe3, 0x61, 0x79, 0x90, - 0xfd, 0xcb, 0x7d, 0xfc, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa2, 0xbf, 0x9a, 0x5a, 0x3d, 0x18, - 0x00, 0x00, + // 1555 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcd, 0x6f, 0xd4, 0x46, + 0x1b, 0xcf, 0x24, 0x90, 0xc0, 0x83, 0x04, 0xc9, 0xc0, 0xfb, 0xb2, 0x18, 0xd8, 0x80, 0x03, 0xc9, + 0x36, 0x80, 0x5d, 0x42, 0x03, 0x29, 0x2d, 0x88, 0x0d, 0x01, 0x1a, 0x29, 0x34, 0x74, 0x21, 0x41, + 0xea, 0x87, 0x2c, 0xef, 0x7a, 0x58, 0xac, 0x78, 0xed, 0xcd, 0x8e, 0x9d, 0xb2, 0x42, 0xa8, 0x12, + 0x55, 0xa5, 0xa2, 0x1e, 0x5a, 0x89, 0x7f, 0xa0, 0x57, 0x7a, 0xa8, 0x7a, 0xeb, 0xa5, 0x97, 0xaa, + 0x17, 0xa4, 0xaa, 0x12, 0x52, 0x2f, 0x55, 0x0f, 0x50, 0x41, 0xaf, 0xbd, 0xf4, 0xd8, 0x5e, 0x2a, + 0xcf, 0x8c, 0x3f, 0x36, 0x6b, 0x7b, 0x77, 0x53, 0x0a, 0xa7, 0xb5, 0xe7, 0xf9, 0xfc, 0x3d, 0x1f, + 0xe3, 0xe7, 0x59, 0xc8, 0x3b, 0xb4, 0xe6, 0x50, 0x93, 0xaa, 0xd4, 0xab, 0x93, 0xc6, 0x0d, 0xcb, + 0x33, 0x0d, 0x75, 0xd5, 0x23, 0x8d, 0xa6, 0x52, 0x6f, 0x38, 0xae, 0x83, 0xb1, 0xa0, 0x2b, 0x11, + 0x5d, 0xda, 0x55, 0x75,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89, 0xbf, 0xc8, 0xef, 0xc1, 0x48, + 0x8c, 0x53, 0x18, 0xbe, 0x08, 0xa0, 0xfb, 0x87, 0x9a, 0xdb, 0xac, 0x13, 0xc6, 0xbf, 0x7d, 0x6a, + 0x22, 0xc9, 0xf8, 0xd5, 0xf0, 0x31, 0x52, 0xb2, 0x55, 0x0f, 0x1e, 0x65, 0x0c, 0xc3, 0x45, 0xcb, + 0x62, 0xa4, 0x10, 0xeb, 0x32, 0x8c, 0xc4, 0xce, 0x84, 0xc1, 0x22, 0x0c, 0x32, 0x29, 0x1f, 0xe9, + 0x40, 0x61, 0xdb, 0xd4, 0x58, 0x17, 0xc6, 0x02, 0xc8, 0x5c, 0x50, 0x56, 0xe0, 0xff, 0xec, 0xf8, + 0xb2, 0x67, 0xb9, 0x66, 0xdd, 0x32, 0x49, 0x23, 0x1b, 0xf8, 0x67, 0x08, 0x76, 0xb7, 0x09, 0x08, + 0x77, 0xea, 0x20, 0xf9, 0xf6, 0x35, 0xb2, 0xea, 0x99, 0x6b, 0xba, 0x45, 0x6c, 0x57, 0xab, 0x85, + 0x5c, 0x22, 0x19, 0x53, 0x49, 0x2e, 0x2e, 0xd2, 0x9a, 0x73, 0x21, 0x14, 0x8a, 0x6b, 0xae, 0x38, + 0x0d, 0xa3, 0x94, 0x73, 0x52, 0xe8, 0xf2, 0x3d, 0x04, 0x07, 0x23, 0x7c, 0xf3, 0xb6, 0x4b, 0x1a, + 0x35, 0x62, 0x98, 0x7a, 0xa3, 0x59, 0xac, 0x54, 0x1c, 0xcf, 0x76, 0xe7, 0xed, 0x1b, 0x4e, 0x32, + 0x12, 0xbc, 0x07, 0xb6, 0xac, 0xe9, 0x96, 0xa6, 0x1b, 0x46, 0x23, 0xd7, 0xcf, 0x08, 0x43, 0x6b, + 0xba, 0x55, 0x34, 0x8c, 0x86, 0x4f, 0xaa, 0xea, 0x5e, 0x95, 0x68, 0xa6, 0x91, 0x1b, 0x38, 0x80, + 0x0a, 0x9b, 0x4a,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x1e, 0xa9, 0xf8, 0x2f, 0x34, 0x88, 0x68, 0x5c, 0x66, 0xd1, 0xb8, 0x84, 0x2f, + 0xf4, 0x5e, 0x03, 0x7e, 0x2c, 0xa2, 0x81, 0x8b, 0xff, 0x13, 0xf6, 0x75, 0x3f, 0x1c, 0xef, 0x79, + 0x80, 0xc2, 0x0b, 0x49, 0x38, 0x36, 0x3a, 0x07, 0x4a, 0x97, 0x9f, 0x93, 0x36, 0x11, 0xa1, 0xf7, + 0x59, 0x84, 0x96, 0xf1, 0xb5, 0xac, 0x08, 0x11, 0xa1, 0x5e, 0xcb, 0xba, 0x10, 0x12, 0x02, 0x36, + 0xbb, 0xf8, 0xf0, 0x69, 0x1e, 0x3d, 0x7a, 0x9a, 0x47, 0xbf, 0x3d, 0xcd, 0xa3, 0x2f, 0x9e, 0xe5, + 0xfb, 0x1e, 0x3d, 0xcb, 0xf7, 0xfd, 0xf2, 0x2c, 0xdf, 0xf7, 0xee, 0x74, 0x6c, 0x16, 0x14, 0x96, + 0x8f, 0x59, 0x7a, 0x99, 0x86, 0x6e, 0xac, 0x9d, 0x52, 0x6f, 0xc5, 0x7d, 0x61, 0xe3, 0x61, 0x79, + 0x90, 0xfd, 0xcd, 0x7d, 0xe2, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x21, 0x0e, 0xbf, 0x3e, + 0x18, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 531fd0d38c3a89cd788ab72e29e10ecee793cdc5 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 22 Jun 2022 23:48:14 -0400 Subject: [PATCH 02/26] rename LasteHalvenEpoch to LastReductionEpoch --- docs/core/proto-docs.md | 2 +- proto/osmosis/mint/v1beta1/genesis.proto | 7 ++-- x/mint/{spec => }/README.md | 21 +++++------ x/mint/keeper/genesis.go | 6 ++-- x/mint/keeper/genesis_test.go | 2 +- x/mint/keeper/hooks.go | 10 +++--- x/mint/keeper/hooks_test.go | 33 ++++++++--------- x/mint/keeper/keeper.go | 12 +++---- x/mint/types/genesis.go | 14 ++++---- x/mint/types/genesis.pb.go | 45 ++++++++++++------------ x/mint/types/keys.go | 6 ++-- 11 files changed, 79 insertions(+), 79 deletions(-) rename x/mint/{spec => }/README.md (96%) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 0d4c1ce7850..7940bc1b90e 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -2624,7 +2624,7 @@ GenesisState defines the mint module's genesis state. | ----- | ---- | ----- | ----------- | | `minter` | [Minter](#osmosis.mint.v1beta1.Minter) | | minter is a space for holding current rewards information. | | `params` | [Params](#osmosis.mint.v1beta1.Params) | | params defines all the paramaters of the module. | -| `halven_started_epoch` | [int64](#int64) | | current halven period start epoch | +| `reduction_started_epoch` | [int64](#int64) | | current reduction period start epoch | diff --git a/proto/osmosis/mint/v1beta1/genesis.proto b/proto/osmosis/mint/v1beta1/genesis.proto index bc0094b6b32..4d26589e8d2 100644 --- a/proto/osmosis/mint/v1beta1/genesis.proto +++ b/proto/osmosis/mint/v1beta1/genesis.proto @@ -14,7 +14,8 @@ message GenesisState { // Params defines all the paramaters of the mint module. Params params = 2 [ (gogoproto.nullable) = false ]; - // HalvenStartedEpoch current halven period start epoch - int64 halven_started_epoch = 3 - [ (gogoproto.moretags) = "yaml:\"halven_started_epoch\"" ]; + // ReductionStartedEpoch the first epoch in which the reduction of mint + // begins. + int64 reduction_started_epoch = 3 + [ (gogoproto.moretags) = "yaml:\"reduction_started_epoch\"" ]; } diff --git a/x/mint/spec/README.md b/x/mint/README.md similarity index 96% rename from x/mint/spec/README.md rename to x/mint/README.md index c4b30dca5c1..f9e443aea52 100644 --- a/x/mint/spec/README.md +++ b/x/mint/README.md @@ -1,11 +1,13 @@ # Mint -The ```mint``` module is responsible for creating tokens in a flexible way to reward -validators, incentivize providing pool liquidity, provide funds for Osmosis governance, and pay developers to maintain and improve Osmosis. +The `mint` module is responsible for creating tokens in a flexible way to reward +validators, incentivize providing pool liquidity, provide funds for Osmosis governance, +and pay developers to maintain and improve Osmosis. -The module is also responsible for reducing the token creation and distribution by a set amount and a set period of time until it reaches its maximum supply (see ```reduction_factor``` and ```reduction_period_in_epochs```) +The module is also responsible for reducing the token creation and distribution by a set period +until it reaches its maximum supply (see `reduction_factor` and `reduction_period_in_epochs`) -Module uses time basis epochs supported by ```epochs``` module. +The module uses time basis epochs supported by the `epochs` module. ## Contents @@ -28,7 +30,7 @@ tokens within a chain. The design taken within Osmosis is to year is 52 epochs. The next period's rewards are 2/3 of the prior period's rewards) -### Reductioning factor +### Reduction factor This is a generalization over the Bitcoin style halvenings. Every year, the amount of rewards issued per week will reduce by a governance @@ -72,16 +74,11 @@ type Params struct { } ``` -### LastHalvenEpoch +### LastReductionEpoch -Last halven epoch stores the epoch number when the last reduction of +Last reduction epoch stores the epoch number when the last reduction of coin mint amount per epoch has happened. -**TODO:** - -- Update the name to LastReductionEpoch as the reduction amount could - be set by governance. - ## Begin-Epoch Minting parameters are recalculated and inflation paid at the beginning diff --git a/x/mint/keeper/genesis.go b/x/mint/keeper/genesis.go index db27bf7d21a..b794a64c0fc 100644 --- a/x/mint/keeper/genesis.go +++ b/x/mint/keeper/genesis.go @@ -19,13 +19,13 @@ func (k Keeper) InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.Ba bk.AddSupplyOffset(ctx, data.Params.MintDenom, sdk.NewInt(225_000_000_000_000).Neg()) } - k.SetLastHalvenEpochNum(ctx, data.HalvenStartedEpoch) + k.SetLastReductionEpochNum(ctx, data.ReductionStartedEpoch) } // ExportGenesis returns a GenesisState for a given context and keeper. func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { minter := k.GetMinter(ctx) params := k.GetParams(ctx) - lastHalvenEpoch := k.GetLastHalvenEpochNum(ctx) - return types.NewGenesisState(minter, params, lastHalvenEpoch) + lastReductionEpoch := k.GetLastReductionEpochNum(ctx) + return types.NewGenesisState(minter, params, lastReductionEpoch) } diff --git a/x/mint/keeper/genesis_test.go b/x/mint/keeper/genesis_test.go index 17d1e4a95a7..44b79563e11 100644 --- a/x/mint/keeper/genesis_test.go +++ b/x/mint/keeper/genesis_test.go @@ -25,5 +25,5 @@ func TestMintInitGenesis(t *testing.T) { expectedVestingCoins, ok := sdk.NewIntFromString("225000000000000") require.True(t, ok) require.Equal(t, expectedVestingCoins, initialVestingCoins.Amount) - require.Equal(t, int64(0), app.MintKeeper.GetLastHalvenEpochNum(ctx)) + require.Equal(t, int64(0), app.MintKeeper.GetLastReductionEpochNum(ctx)) } diff --git a/x/mint/keeper/hooks.go b/x/mint/keeper/hooks.go index f55404640f1..3cef94b8269 100644 --- a/x/mint/keeper/hooks.go +++ b/x/mint/keeper/hooks.go @@ -21,20 +21,20 @@ func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumb if epochNumber < params.MintingRewardsDistributionStartEpoch { return } else if epochNumber == params.MintingRewardsDistributionStartEpoch { - k.SetLastHalvenEpochNum(ctx, epochNumber) + k.SetLastReductionEpochNum(ctx, epochNumber) } // fetch stored minter & params minter := k.GetMinter(ctx) params := k.GetParams(ctx) // Check if we have hit an epoch where we update the inflation parameter. - // Since epochs only update based on BFT time data, it is safe to store the "halvening period time" + // Since epochs only update based on BFT time data, it is safe to store the "reducing period time" // in terms of the number of epochs that have transpired. - if epochNumber >= k.GetParams(ctx).ReductionPeriodInEpochs+k.GetLastHalvenEpochNum(ctx) { - // Halven the reward per halven period + if epochNumber >= k.GetParams(ctx).ReductionPeriodInEpochs+k.GetLastReductionEpochNum(ctx) { + // Reduce the reward per reduction period minter.EpochProvisions = minter.NextEpochProvisions(params) k.SetMinter(ctx, minter) - k.SetLastHalvenEpochNum(ctx, epochNumber) + k.SetLastReductionEpochNum(ctx, epochNumber) } // mint coins, update supply diff --git a/x/mint/keeper/hooks_test.go b/x/mint/keeper/hooks_test.go index 91f75affda6..74571d0bafa 100644 --- a/x/mint/keeper/hooks_test.go +++ b/x/mint/keeper/hooks_test.go @@ -4,13 +4,14 @@ import ( "testing" "time" - osmoapp "github.com/osmosis-labs/osmosis/v7/app" - lockuptypes "github.com/osmosis-labs/osmosis/v7/x/lockup/types" - "github.com/osmosis-labs/osmosis/v7/x/mint/types" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + osmoapp "github.com/osmosis-labs/osmosis/v7/app" + lockuptypes "github.com/osmosis-labs/osmosis/v7/x/lockup/types" + "github.com/osmosis-labs/osmosis/v7/x/mint/types" + "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -42,9 +43,9 @@ func TestEndOfEpochMintedCoinDistribution(t *testing.T) { ctx, sdk.NewCoin("stake", sdk.NewInt(156*500000*2))) height := int64(1) - lastHalvenPeriod := app.MintKeeper.GetLastHalvenEpochNum(ctx) + lastReductionPeriod := app.MintKeeper.GetLastReductionEpochNum(ctx) // correct rewards - for ; height < lastHalvenPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { + for ; height < lastReductionPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { devRewardsModuleAcc := app.AccountKeeper.GetModuleAccount(ctx, types.DeveloperVestingModuleAcctName) devRewardsModuleOrigin := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress()) feePoolOrigin := app.DistrKeeper.GetFeePool(ctx) @@ -81,10 +82,10 @@ func TestEndOfEpochMintedCoinDistribution(t *testing.T) { app.EpochsKeeper.BeforeEpochStart(futureCtx, params.DistrEpochIdentifier, height) app.EpochsKeeper.AfterEpochEnd(futureCtx, params.DistrEpochIdentifier, height) - lastHalvenPeriod = app.MintKeeper.GetLastHalvenEpochNum(ctx) - require.Equal(t, lastHalvenPeriod, app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs) + lastReductionPeriod = app.MintKeeper.GetLastReductionEpochNum(ctx) + require.Equal(t, lastReductionPeriod, app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs) - for ; height < lastHalvenPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { + for ; height < lastReductionPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { devRewardsModuleAcc := app.AccountKeeper.GetModuleAccount(ctx, types.DeveloperVestingModuleAcctName) devRewardsModuleOrigin := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress()) feePoolOrigin := app.DistrKeeper.GetFeePool(ctx) @@ -125,9 +126,9 @@ func TestMintedCoinDistributionWhenDevRewardsAddressEmpty(t *testing.T) { ctx, sdk.NewCoin("stake", sdk.NewInt(156*500000*2))) height := int64(1) - lastHalvenPeriod := app.MintKeeper.GetLastHalvenEpochNum(ctx) + lastReductionPeriod := app.MintKeeper.GetLastReductionEpochNum(ctx) // correct rewards - for ; height < lastHalvenPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { + for ; height < lastReductionPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { devRewardsModuleAcc := app.AccountKeeper.GetModuleAccount(ctx, types.DeveloperVestingModuleAcctName) devRewardsModuleOrigin := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress()) feePoolOrigin := app.DistrKeeper.GetFeePool(ctx) @@ -152,10 +153,10 @@ func TestMintedCoinDistributionWhenDevRewardsAddressEmpty(t *testing.T) { app.EpochsKeeper.BeforeEpochStart(futureCtx, params.DistrEpochIdentifier, height) app.EpochsKeeper.AfterEpochEnd(futureCtx, params.DistrEpochIdentifier, height) - lastHalvenPeriod = app.MintKeeper.GetLastHalvenEpochNum(ctx) - require.Equal(t, lastHalvenPeriod, app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs) + lastReductionPeriod = app.MintKeeper.GetLastReductionEpochNum(ctx) + require.Equal(t, lastReductionPeriod, app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs) - for ; height < lastHalvenPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { + for ; height < lastReductionPeriod+app.MintKeeper.GetParams(ctx).ReductionPeriodInEpochs; height++ { devRewardsModuleAcc := app.AccountKeeper.GetModuleAccount(ctx, types.DeveloperVestingModuleAcctName) devRewardsModuleOrigin := app.BankKeeper.GetAllBalances(ctx, devRewardsModuleAcc.GetAddress()) feePoolOrigin := app.DistrKeeper.GetFeePool(ctx) @@ -214,9 +215,9 @@ func TestEndOfEpochNoDistributionWhenIsNotYetStartTime(t *testing.T) { require.NotEqual(t, sdk.DecCoins{}, app.DistrKeeper.GetFeePool(ctx).CommunityPool, "Tokens to community pool at start distribution epoch") - // halven period should be set to mintParams.MintingRewardsDistributionStartEpoch - lastHalvenPeriod := app.MintKeeper.GetLastHalvenEpochNum(ctx) - require.Equal(t, lastHalvenPeriod, mintParams.MintingRewardsDistributionStartEpoch) + // reduction period should be set to mintParams.MintingRewardsDistributionStartEpoch + lastReductionPeriod := app.MintKeeper.GetLastReductionEpochNum(ctx) + require.Equal(t, lastReductionPeriod, mintParams.MintingRewardsDistributionStartEpoch) } func setupGaugeForLPIncentives(t *testing.T, app *osmoapp.OsmosisApp, ctx sdk.Context) { diff --git a/x/mint/keeper/keeper.go b/x/mint/keeper/keeper.go index 448a6ebb1dd..3ae53908c10 100644 --- a/x/mint/keeper/keeper.go +++ b/x/mint/keeper/keeper.go @@ -93,10 +93,10 @@ func (k *Keeper) SetHooks(h types.MintHooks) *Keeper { return k } -// GetLastHalvenEpochNum returns last halven epoch number. -func (k Keeper) GetLastHalvenEpochNum(ctx sdk.Context) int64 { +// GetLastReductionEpochNum returns last reduction epoch number. +func (k Keeper) GetLastReductionEpochNum(ctx sdk.Context) int64 { store := ctx.KVStore(k.storeKey) - b := store.Get(types.LastHalvenEpochKey) + b := store.Get(types.LastReductionEpochKey) if b == nil { return 0 } @@ -104,10 +104,10 @@ func (k Keeper) GetLastHalvenEpochNum(ctx sdk.Context) int64 { return int64(sdk.BigEndianToUint64(b)) } -// SetLastHalvenEpochNum set last halven epoch number. -func (k Keeper) SetLastHalvenEpochNum(ctx sdk.Context, epochNum int64) { +// SetLastReductionEpochNum set last reduction epoch number. +func (k Keeper) SetLastReductionEpochNum(ctx sdk.Context, epochNum int64) { store := ctx.KVStore(k.storeKey) - store.Set(types.LastHalvenEpochKey, sdk.Uint64ToBigEndian(uint64(epochNum))) + store.Set(types.LastReductionEpochKey, sdk.Uint64ToBigEndian(uint64(epochNum))) } // get the minter. diff --git a/x/mint/types/genesis.go b/x/mint/types/genesis.go index bfe7e40645f..17756127b7e 100644 --- a/x/mint/types/genesis.go +++ b/x/mint/types/genesis.go @@ -1,20 +1,20 @@ package types // NewGenesisState creates a new GenesisState object. -func NewGenesisState(minter Minter, params Params, halvenStartedEpoch int64) *GenesisState { +func NewGenesisState(minter Minter, params Params, reductionStartedEpoch int64) *GenesisState { return &GenesisState{ - Minter: minter, - Params: params, - HalvenStartedEpoch: halvenStartedEpoch, + Minter: minter, + Params: params, + ReductionStartedEpoch: reductionStartedEpoch, } } // DefaultGenesisState creates a default GenesisState object. func DefaultGenesisState() *GenesisState { return &GenesisState{ - Minter: DefaultInitialMinter(), - Params: DefaultParams(), - HalvenStartedEpoch: 0, + Minter: DefaultInitialMinter(), + Params: DefaultParams(), + ReductionStartedEpoch: 0, } } diff --git a/x/mint/types/genesis.pb.go b/x/mint/types/genesis.pb.go index b6008ec5dd6..6d296b8bd83 100644 --- a/x/mint/types/genesis.pb.go +++ b/x/mint/types/genesis.pb.go @@ -29,8 +29,9 @@ type GenesisState struct { Minter Minter `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter"` // Params defines all the paramaters of the mint module. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` - // HalvenStartedEpoch current halven period start epoch - HalvenStartedEpoch int64 `protobuf:"varint,3,opt,name=halven_started_epoch,json=halvenStartedEpoch,proto3" json:"halven_started_epoch,omitempty" yaml:"halven_started_epoch"` + // ReductionStartedEpoch the first epoch in which the reduction of mint + // begins. + ReductionStartedEpoch int64 `protobuf:"varint,3,opt,name=reduction_started_epoch,json=reductionStartedEpoch,proto3" json:"reduction_started_epoch,omitempty" yaml:"reduction_started_epoch"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -80,9 +81,9 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetHalvenStartedEpoch() int64 { +func (m *GenesisState) GetReductionStartedEpoch() int64 { if m != nil { - return m.HalvenStartedEpoch + return m.ReductionStartedEpoch } return 0 } @@ -96,25 +97,25 @@ func init() { } var fileDescriptor_12e6a5511ad3feeb = []byte{ - // 279 bytes of a gzipped FileDescriptorProto + // 282 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xca, 0x2f, 0xce, 0xcd, 0x2f, 0xce, 0x2c, 0xd6, 0xcf, 0xcd, 0xcc, 0x2b, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x81, 0xaa, 0xd1, 0x03, 0xa9, 0xd1, 0x83, 0xaa, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0x2b, - 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0xa5, 0xe4, 0xb1, 0x9a, 0x07, 0xd6, 0x08, 0x56, 0xa0, 0x74, 0x93, + 0xd0, 0x07, 0xb1, 0x20, 0x6a, 0xa5, 0xe4, 0xb1, 0x9a, 0x07, 0xd6, 0x08, 0x56, 0xa0, 0xf4, 0x88, 0x91, 0x8b, 0xc7, 0x1d, 0x62, 0x7c, 0x70, 0x49, 0x62, 0x49, 0xaa, 0x90, 0x15, 0x17, 0x1b, 0x48, 0x3a, 0xb5, 0x48, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x46, 0x0f, 0x9b, 0x75, 0x7a, 0xbe, 0x60, 0x35, 0x4e, 0x2c, 0x27, 0xee, 0xc9, 0x33, 0x04, 0x41, 0x75, 0x80, 0xf4, 0x16, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x4b, 0x30, 0xe1, 0xd3, 0x1b, 0x00, 0x56, 0x03, 0xd3, 0x0b, 0xd1, 0x21, 0x14, - 0xc8, 0x25, 0x92, 0x91, 0x98, 0x53, 0x96, 0x9a, 0x17, 0x5f, 0x5c, 0x92, 0x58, 0x54, 0x92, 0x9a, - 0x12, 0x9f, 0x5a, 0x90, 0x9f, 0x9c, 0x21, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0xec, 0x24, 0xff, 0xe9, - 0x9e, 0xbc, 0x74, 0x65, 0x62, 0x6e, 0x8e, 0x95, 0x12, 0x36, 0x55, 0x4a, 0x41, 0x42, 0x10, 0xe1, - 0x60, 0x88, 0xa8, 0x2b, 0x48, 0xd0, 0xc9, 0xf3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, - 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, - 0x18, 0xa2, 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xa1, 0x4e, - 0xd4, 0xcd, 0x49, 0x4c, 0x2a, 0x86, 0x71, 0xf4, 0xcb, 0xcc, 0xf5, 0x2b, 0x20, 0x61, 0x56, 0x52, - 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x2d, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf7, - 0x5d, 0xab, 0xdd, 0xa0, 0x01, 0x00, 0x00, + 0xc5, 0x25, 0x5e, 0x94, 0x9a, 0x52, 0x9a, 0x5c, 0x92, 0x99, 0x9f, 0x17, 0x5f, 0x5c, 0x92, 0x58, + 0x54, 0x92, 0x9a, 0x12, 0x9f, 0x5a, 0x90, 0x9f, 0x9c, 0x21, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0xec, + 0xa4, 0xf4, 0xe9, 0x9e, 0xbc, 0x5c, 0x65, 0x62, 0x6e, 0x8e, 0x95, 0x12, 0x0e, 0x85, 0x4a, 0x41, + 0xa2, 0x70, 0x99, 0x60, 0x88, 0x84, 0x2b, 0x48, 0xdc, 0xc9, 0xf3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, + 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, + 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, + 0xf5, 0xa1, 0x6e, 0xd5, 0xcd, 0x49, 0x4c, 0x2a, 0x86, 0x71, 0xf4, 0xcb, 0xcc, 0xf5, 0x2b, 0x20, + 0x81, 0x57, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x36, 0x63, 0x40, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xa2, 0xcc, 0xdf, 0xaf, 0xa9, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -137,8 +138,8 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.HalvenStartedEpoch != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.HalvenStartedEpoch)) + if m.ReductionStartedEpoch != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.ReductionStartedEpoch)) i-- dAtA[i] = 0x18 } @@ -186,8 +187,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if m.HalvenStartedEpoch != 0 { - n += 1 + sovGenesis(uint64(m.HalvenStartedEpoch)) + if m.ReductionStartedEpoch != 0 { + n += 1 + sovGenesis(uint64(m.ReductionStartedEpoch)) } return n } @@ -295,9 +296,9 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HalvenStartedEpoch", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ReductionStartedEpoch", wireType) } - m.HalvenStartedEpoch = 0 + m.ReductionStartedEpoch = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -307,7 +308,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.HalvenStartedEpoch |= int64(b&0x7F) << shift + m.ReductionStartedEpoch |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/mint/types/keys.go b/x/mint/types/keys.go index b6dc41a6480..f2c40c0871d 100644 --- a/x/mint/types/keys.go +++ b/x/mint/types/keys.go @@ -4,9 +4,9 @@ package types // the Minter and its EpochProvisions are stored. var MinterKey = []byte{0x00} -// LastHalvenEpochKey is the key to use for the keeper store -// for storing the last epoch at which halvening occurred. -var LastHalvenEpochKey = []byte{0x03} +// LastReductionEpochKey is the key to use for the keeper store +// for storing the last epoch at which reduction occurred. +var LastReductionEpochKey = []byte{0x03} const ( // ModuleName is the module name. From bbe1b5c451083116f4e59113691c218c42fd1322 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 23 Jun 2022 00:11:32 -0400 Subject: [PATCH 03/26] lint --- x/mint/types/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/mint/types/hooks.go b/x/mint/types/hooks.go index 26b0e8fad2f..217b7818da9 100644 --- a/x/mint/types/hooks.go +++ b/x/mint/types/hooks.go @@ -20,7 +20,7 @@ func NewMultiMintHooks(hooks ...MintHooks) MultiMintHooks { return hooks } -// AfterDistributeMintedCoin is a hook that runs after minter mints and distributes coins +// AfterDistributeMintedCoin is a hook that runs after minter mints and distributes coins // at the beginning of each epoch. func (h MultiMintHooks) AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) { for i := range h { From cbb683e8395655042b4421355cd54a8c96bfa507 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 24 Jun 2022 15:25:00 -0400 Subject: [PATCH 04/26] revert proto comments --- proto/osmosis/mint/v1beta1/genesis.proto | 6 +++--- proto/osmosis/mint/v1beta1/mint.proto | 25 ++++++++++++------------ proto/osmosis/mint/v1beta1/query.proto | 4 ++-- x/mint/types/genesis.pb.go | 6 +++--- x/mint/types/mint.pb.go | 25 ++++++++++++------------ x/mint/types/query.pb.go | 4 ++-- 6 files changed, 34 insertions(+), 36 deletions(-) diff --git a/proto/osmosis/mint/v1beta1/genesis.proto b/proto/osmosis/mint/v1beta1/genesis.proto index 4d26589e8d2..38b8dfd5874 100644 --- a/proto/osmosis/mint/v1beta1/genesis.proto +++ b/proto/osmosis/mint/v1beta1/genesis.proto @@ -8,13 +8,13 @@ option go_package = "github.com/osmosis-labs/osmosis/v7/x/mint/types"; // GenesisState defines the mint module's genesis state. message GenesisState { - // Minter is an abstraction for holding current rewards information. + // minter is an abstraction for holding current rewards information. Minter minter = 1 [ (gogoproto.nullable) = false ]; - // Params defines all the paramaters of the mint module. + // params defines all the paramaters of the mint module. Params params = 2 [ (gogoproto.nullable) = false ]; - // ReductionStartedEpoch the first epoch in which the reduction of mint + // reduction_started_epoch the first epoch in which the reduction of mint // begins. int64 reduction_started_epoch = 3 [ (gogoproto.moretags) = "yaml:\"reduction_started_epoch\"" ]; diff --git a/proto/osmosis/mint/v1beta1/mint.proto b/proto/osmosis/mint/v1beta1/mint.proto index 92fba5913d9..667b4ef3a61 100644 --- a/proto/osmosis/mint/v1beta1/mint.proto +++ b/proto/osmosis/mint/v1beta1/mint.proto @@ -10,7 +10,7 @@ import "google/protobuf/duration.proto"; // Minter represents the minting state. message Minter { - // EpochProvisions represent rewards for the current epoch. + // epoch_provisions represent rewards for the current epoch. string epoch_provisions = 1 [ (gogoproto.moretags) = "yaml:\"epoch_provisions\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -68,43 +68,42 @@ message DistributionProportions { message Params { option (gogoproto.goproto_stringer) = false; - // MintDenom the denom of the coin to mint. + // mint_denom the denom of the coin to mint. string mint_denom = 1; - // GenesisEpochProvisions epoch provisions from the first epoch. + // genesis_epoch_provisions epoch provisions from the first epoch. string genesis_epoch_provisions = 2 [ (gogoproto.moretags) = "yaml:\"genesis_epoch_provisions\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // EpochIdentifier mint epoch identifier e.g. (day, week). + // epoch_identifier mint epoch identifier e.g. (day, week). string epoch_identifier = 3 [ (gogoproto.moretags) = "yaml:\"epoch_identifier\"" ]; - // ReductionPeriodInEpochs the number of epochs it takes + // reduction_period_in_epochs the number of epochs it takes // to reduce the rewards. int64 reduction_period_in_epochs = 4 [ (gogoproto.moretags) = "yaml:\"reduction_period_in_epochs\"" ]; - // ReductionFactor is the reduction multiplier to execute + // reduction_factor is the reduction multiplier to execute // at the end of each period set by ReductionPeriodInEpochs. string reduction_factor = 5 [ (gogoproto.moretags) = "yaml:\"reduction_factor\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; - // DistributionProportions defines the distribution proportions of the minted + // distribution_proportions defines the distribution proportions of the minted // denom. In other words, defines which stakeholders will receive the minted // denoms and how much. DistributionProportions distribution_proportions = 6 [ (gogoproto.nullable) = false ]; - // WeightedDeveloperRewardsReceivers the address to receive developer rewards - // with weights assignedt to each address. The final amount that each address - // receives is: - // EpochProvisions * DistributionProportions.DeveloperRewards * Address's - // Weight. + // weighted_developer_rewards_receivers the address to receive developer + // rewards with weights assignedt to each address. The final amount that each + // address receives is: epoch_provisions * + // distribution_proportions.developer_rewards * Address's Weight. repeated WeightedAddress weighted_developer_rewards_receivers = 7 [ (gogoproto.moretags) = "yaml:\"developer_rewards_receiver\"", (gogoproto.nullable) = false ]; - // MintingRewardsDistributionStartEpoch start epoch to distribute minting + // minting_rewards_distribution_start_epoch start epoch to distribute minting // rewards int64 minting_rewards_distribution_start_epoch = 8 [ (gogoproto.moretags) = diff --git a/proto/osmosis/mint/v1beta1/query.proto b/proto/osmosis/mint/v1beta1/query.proto index a327c75b266..90bbdfb252d 100644 --- a/proto/osmosis/mint/v1beta1/query.proto +++ b/proto/osmosis/mint/v1beta1/query.proto @@ -26,7 +26,7 @@ message QueryParamsRequest {} // QueryParamsResponse is the response type for the Query/Params RPC method. message QueryParamsResponse { - // Params defines the parameters of the module. + // params defines the parameters of the module. Params params = 1 [ (gogoproto.nullable) = false ]; } @@ -37,7 +37,7 @@ message QueryEpochProvisionsRequest {} // QueryEpochProvisionsResponse is the response type for the // Query/EpochProvisions RPC method. message QueryEpochProvisionsResponse { - // EpochProvisions is the current minting per epoch provisions value. + // epoch_provisions is the current minting per epoch provisions value. bytes epoch_provisions = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false diff --git a/x/mint/types/genesis.pb.go b/x/mint/types/genesis.pb.go index 6d296b8bd83..efd1542c836 100644 --- a/x/mint/types/genesis.pb.go +++ b/x/mint/types/genesis.pb.go @@ -25,11 +25,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the mint module's genesis state. type GenesisState struct { - // Minter is an abstraction for holding current rewards information. + // minter is an abstraction for holding current rewards information. Minter Minter `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter"` - // Params defines all the paramaters of the mint module. + // params defines all the paramaters of the mint module. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` - // ReductionStartedEpoch the first epoch in which the reduction of mint + // reduction_started_epoch the first epoch in which the reduction of mint // begins. ReductionStartedEpoch int64 `protobuf:"varint,3,opt,name=reduction_started_epoch,json=reductionStartedEpoch,proto3" json:"reduction_started_epoch,omitempty" yaml:"reduction_started_epoch"` } diff --git a/x/mint/types/mint.pb.go b/x/mint/types/mint.pb.go index e74ad61a2f7..63932980ead 100644 --- a/x/mint/types/mint.pb.go +++ b/x/mint/types/mint.pb.go @@ -28,7 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Minter represents the minting state. type Minter struct { - // EpochProvisions represent rewards for the current epoch. + // epoch_provisions represent rewards for the current epoch. EpochProvisions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=epoch_provisions,json=epochProvisions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"epoch_provisions" yaml:"epoch_provisions"` } @@ -166,29 +166,28 @@ var xxx_messageInfo_DistributionProportions proto.InternalMessageInfo // Params holds parameters for the x/mint module. type Params struct { - // MintDenom the denom of the coin to mint. + // mint_denom the denom of the coin to mint. MintDenom string `protobuf:"bytes,1,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` - // GenesisEpochProvisions epoch provisions from the first epoch. + // genesis_epoch_provisions epoch provisions from the first epoch. GenesisEpochProvisions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=genesis_epoch_provisions,json=genesisEpochProvisions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"genesis_epoch_provisions" yaml:"genesis_epoch_provisions"` - // EpochIdentifier mint epoch identifier e.g. (day, week). + // epoch_identifier mint epoch identifier e.g. (day, week). EpochIdentifier string `protobuf:"bytes,3,opt,name=epoch_identifier,json=epochIdentifier,proto3" json:"epoch_identifier,omitempty" yaml:"epoch_identifier"` - // ReductionPeriodInEpochs the number of epochs it takes + // reduction_period_in_epochs the number of epochs it takes // to reduce the rewards. ReductionPeriodInEpochs int64 `protobuf:"varint,4,opt,name=reduction_period_in_epochs,json=reductionPeriodInEpochs,proto3" json:"reduction_period_in_epochs,omitempty" yaml:"reduction_period_in_epochs"` - // ReductionFactor is the reduction multiplier to execute + // reduction_factor is the reduction multiplier to execute // at the end of each period set by ReductionPeriodInEpochs. ReductionFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=reduction_factor,json=reductionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reduction_factor" yaml:"reduction_factor"` - // DistributionProportions defines the distribution proportions of the minted + // distribution_proportions defines the distribution proportions of the minted // denom. In other words, defines which stakeholders will receive the minted // denoms and how much. DistributionProportions DistributionProportions `protobuf:"bytes,6,opt,name=distribution_proportions,json=distributionProportions,proto3" json:"distribution_proportions"` - // WeightedDeveloperRewardsReceivers the address to receive developer rewards - // with weights assignedt to each address. The final amount that each address - // receives is: - // EpochProvisions * DistributionProportions.DeveloperRewards * Address's - // Weight. + // weighted_developer_rewards_receivers the address to receive developer + // rewards with weights assignedt to each address. The final amount that each + // address receives is: epoch_provisions * + // distribution_proportions.developer_rewards * Address's Weight. WeightedDeveloperRewardsReceivers []WeightedAddress `protobuf:"bytes,7,rep,name=weighted_developer_rewards_receivers,json=weightedDeveloperRewardsReceivers,proto3" json:"weighted_developer_rewards_receivers" yaml:"developer_rewards_receiver"` - // MintingRewardsDistributionStartEpoch start epoch to distribute minting + // minting_rewards_distribution_start_epoch start epoch to distribute minting // rewards MintingRewardsDistributionStartEpoch int64 `protobuf:"varint,8,opt,name=minting_rewards_distribution_start_epoch,json=mintingRewardsDistributionStartEpoch,proto3" json:"minting_rewards_distribution_start_epoch,omitempty" yaml:"minting_rewards_distribution_start_epoch"` } diff --git a/x/mint/types/query.pb.go b/x/mint/types/query.pb.go index 07ae98df383..d394f9f53d7 100644 --- a/x/mint/types/query.pb.go +++ b/x/mint/types/query.pb.go @@ -69,7 +69,7 @@ var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo // QueryParamsResponse is the response type for the Query/Params RPC method. type QueryParamsResponse struct { - // Params defines the parameters of the module. + // params defines the parameters of the module. Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -154,7 +154,7 @@ var xxx_messageInfo_QueryEpochProvisionsRequest proto.InternalMessageInfo // QueryEpochProvisionsResponse is the response type for the // Query/EpochProvisions RPC method. type QueryEpochProvisionsResponse struct { - // EpochProvisions is the current minting per epoch provisions value. + // epoch_provisions is the current minting per epoch provisions value. EpochProvisions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=epoch_provisions,json=epochProvisions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"epoch_provisions"` } From 9d0f3cc37af89cc422193759a4ae71dc5f6f4ede Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 24 Jun 2022 15:40:34 -0400 Subject: [PATCH 05/26] spec --- x/mint/README.md | 79 ++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 49 deletions(-) diff --git a/x/mint/README.md b/x/mint/README.md index f9e443aea52..bc9933cd9b9 100644 --- a/x/mint/README.md +++ b/x/mint/README.md @@ -25,19 +25,19 @@ The `x/mint` module is designed to handle the regular printing of new tokens within a chain. The design taken within Osmosis is to - Mint new tokens once per epoch (default one week) -- To have a "Reductioning factor" every period, which reduces the - amount of rewards per epoch. (default: period is 3 years, where a +- To have a "Reductioning factor" every period, which reduces the number of + rewards per epoch. (default: period is 3 years, where a year is 52 epochs. The next period's rewards are 2/3 of the prior period's rewards) ### Reduction factor -This is a generalization over the Bitcoin style halvenings. Every year, -the amount of rewards issued per week will reduce by a governance -specified factor, instead of a fixed `1/2`. So +This is a generalization over the Bitcoin-style halvenings. Every year, the number + of rewards issued per week will reduce by a governance-specified +factor, instead of a fixed `1/2`. So `RewardsPerEpochNextPeriod = ReductionFactor * CurrentRewardsPerEpoch)`. When `ReductionFactor = 1/2`, the Bitcoin halvenings are recreated. We -default to having a reduction factor of `2/3`, and thus reduce rewards +default to having a reduction factor of `2/3` and thus reduce rewards at the end of every year by `33%`. The implication of this is that the total supply is finite, according to @@ -49,7 +49,7 @@ the following formula: ### Minter -The minter is a space for holding current rewards information. +The [`Minter`](https://github.com/osmosis-labs/osmosis/blob/cbb683e8395655042b4421355cd54a8c96bfa507/x/mint/types/mint.pb.go#L30) is an abstraction for holding current rewards information. ```go type Minter struct { @@ -59,7 +59,7 @@ type Minter struct { ### Params -Minting params are held in the global params store. +Minting [`Params`](https://github.com/osmosis-labs/osmosis/blob/cbb683e8395655042b4421355cd54a8c96bfa507/x/mint/types/mint.pb.go#L168) are held in the global params store. ```go type Params struct { @@ -68,9 +68,9 @@ type Params struct { EpochIdentifier string // identifier of epoch ReductionPeriodInEpochs int64 // number of epochs between reward reductions ReductionFactor sdk.Dec // reduction multiplier to execute on each period - DistributionProportions DistributionProportions // distribution_proportions defines the proportion of the minted denom - WeightedDeveloperRewardsReceivers []WeightedAddress // address to receive developer rewards - MintingRewardsDistributionStartEpoch int64 // start epoch to distribute minting rewards + DistributionProportions DistributionProportions // distribution_proportions defines the proportion of the minted denom + WeightedDeveloperRewardsReceivers []WeightedAddress // address to receive developer rewards + MintingRewardsDistributionStartEpoch int64 // start epoch to distribute minting rewards } ``` @@ -81,38 +81,24 @@ coin mint amount per epoch has happened. ## Begin-Epoch -Minting parameters are recalculated and inflation paid at the beginning -of each epoch. An epoch is signalled by x/epochs +Minting parameters are recalculated and inflation is paid at the beginning +of each epoch. An epoch is signaled by x/epochs ### NextEpochProvisions The target epoch provision is recalculated on each reduction period -(default 3 years). At the time of reduction, the current provision is -multiplied by reduction factor (default `2/3`), to calculate the +(default 3 years). At the time of the reduction, the current provision is +multiplied by the reduction factor (default `2/3`), to calculate the provisions for the next epoch. Consequently, the rewards of the next -period will be lowered by `1 - reduction factor`. - -``` go -func (m Minter) NextEpochProvisions(params Params) sdk.Dec { - return m.EpochProvisions.Mul(params.ReductionFactor) -} -``` +period will be lowered by a `1` - reduction factor. ### EpochProvision Calculate the provisions generated for each epoch based on current epoch provisions. The provisions are then minted by the `mint` module's `ModuleMinterAccount`. These rewards are transferred to a -`FeeCollector`, which handles distributing the rewards per the chains -needs. (See TODO.md for details) This fee collector is specified as the -`auth` module's `FeeCollector` `ModuleAccount`. - -``` go -func (m Minter) EpochProvision(params Params) sdk.Coin { - provisionAmt := m.EpochProvisions.QuoInt(sdk.NewInt(int64(params.EpochsPerYear))) - return sdk.NewCoin(params.MintDenom, provisionAmt.TruncateInt()) -} -``` +`FeeCollector`, which handles distributing the rewards per the chain's needs. +This fee collector is specified as the `auth` module's `FeeCollector` `ModuleAccount`. ## Network Parameters @@ -136,10 +122,10 @@ The minting module contains the following parameters: Below are all the network parameters for the ```mint``` module: - **```mint_denom```** - Token type being minted -- **```genesis_epoch_provisions```** - Amount of tokens generated at epoch to the distribution categories (see distribution_proportions) +- **```genesis_epoch_provisions```** - Amount of tokens generated at the epoch to the distribution categories (see distribution_proportions) - **```epoch_identifier```** - Type of epoch that triggers token issuance (day, week, etc.) - **```reduction_period_in_epochs```** - How many epochs must occur before implementing the reduction factor -- **```reduction_factor```** - What the total token issuance factor will reduce by after reduction period passes (if set to 66.66%, token issuance will reduce by 1/3) +- **```reduction_factor```** - What the total token issuance factor will reduce by after the reduction period passes (if set to 66.66%, token issuance will reduce by 1/3) - **```distribution_proportions```** - Categories in which the specified proportion of newly released tokens are distributed to - **```staking```** - Proportion of minted funds to incentivize staking OSMO - **```pool_incentives```** - Proportion of minted funds to incentivize pools on Osmosis @@ -151,21 +137,16 @@ Below are all the network parameters for the ```mint``` module: **Notes** 1. `mint_denom` defines denom for minting token - uosmo -2. `genesis_epoch_provisions` provides minting tokens per epoch at - genesis. -3. `epoch_identifier` defines the epoch identifier to be used for mint - module e.g. "weekly" -4. `reduction_period_in_epochs` defines the number of epochs to pass to - reduce mint amount -5. `reduction_factor` defines the reduction factor of tokens at every - `reduction_period_in_epochs` -6. `distribution_proportions` defines distribution rules for minted - tokens, when developer rewards address is empty, it distribute - tokens to community pool. -7. `weighted_developer_rewards_receivers` provides the addresses that - receives developer rewards by weight -8. `minting_rewards_distribution_start_epoch` defines the start epoch - of minting to make sure minting start after initial pools are set +2. `genesis_epoch_provisions` provides minting tokens per epoch at genesis. +3. `epoch_identifier` defines the epoch identifier to be used for the mint module e.g. "weekly" +4. `reduction_period_in_epochs` defines the number of epochs to pass to reduce the mint amount +5. `reduction_factor` defines the reduction factor of tokens at every `reduction_period_in_epochs` +6. `distribution_proportions` defines distribution rules for minted tokens, when the developer + rewards address is empty, it distributes tokens to the community pool. +7. `weighted_developer_rewards_receivers` provides the addresses that receive developer + rewards by weight +8. `minting_rewards_distribution_start_epoch` defines the start epoch of minting to make sure + minting start after initial pools are set ## Events From 5a06bf1af4d4a421e4890935e36ab4d11d69609c Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 24 Jun 2022 15:48:05 -0400 Subject: [PATCH 06/26] try removing simulation --- Makefile | 1 - x/mint/module.go | 37 +--------------- x/mint/simulation/decoder.go | 27 ----------- x/mint/simulation/decoder_test.go | 48 -------------------- x/mint/simulation/genesis.go | 50 --------------------- x/mint/simulation/genesis_test.go | 74 ------------------------------- 6 files changed, 2 insertions(+), 235 deletions(-) delete mode 100644 x/mint/simulation/decoder.go delete mode 100644 x/mint/simulation/decoder_test.go delete mode 100644 x/mint/simulation/genesis.go delete mode 100644 x/mint/simulation/genesis_test.go diff --git a/Makefile b/Makefile index 36f7705f530..d34435691b4 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,5 @@ #!/usr/bin/make -f -PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation') VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//') COMMIT := $(shell git log -1 --format='%H') LEDGER_ENABLED ?= true diff --git a/x/mint/module.go b/x/mint/module.go index 8cb8d6c2f1f..397e104de0e 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "math/rand" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -16,19 +15,16 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/osmosis-labs/osmosis/v7/x/mint/client/cli" "github.com/osmosis-labs/osmosis/v7/x/mint/client/rest" "github.com/osmosis-labs/osmosis/v7/x/mint/keeper" - "github.com/osmosis-labs/osmosis/v7/x/mint/simulation" "github.com/osmosis-labs/osmosis/v7/x/mint/types" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModule{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} ) // AppModuleBasic defines the basic application module used by the mint module. @@ -162,34 +158,5 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato return []abci.ValidatorUpdate{} } -// ___________________________________________________________________________ - -// AppModuleSimulation functions - -// GenerateGenesisState creates a randomized GenState of the mint module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// ProposalContents doesn't return any content functions for governance proposals. -func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// RandomizedParams creates randomized mint param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a decoder for mint module's types. -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { - sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) -} - -// WeightedOperations doesn't return any mint module operation. -func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { - return nil -} - // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return 1 } diff --git a/x/mint/simulation/decoder.go b/x/mint/simulation/decoder.go deleted file mode 100644 index 33a752a5dc9..00000000000 --- a/x/mint/simulation/decoder.go +++ /dev/null @@ -1,27 +0,0 @@ -package simulation - -import ( - "bytes" - "fmt" - - "github.com/osmosis-labs/osmosis/v7/x/mint/types" - - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/types/kv" -) - -// NewDecodeStore returns a decoder function closure that umarshals the KVPair's -// Value to the corresponding mint type. -func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { - return func(kvA, kvB kv.Pair) string { - switch { - case bytes.Equal(kvA.Key, types.MinterKey): - var minterA, minterB types.Minter - cdc.MustUnmarshal(kvA.Value, &minterA) - cdc.MustUnmarshal(kvB.Value, &minterB) - return fmt.Sprintf("%v\n%v", minterA, minterB) - default: - panic(fmt.Sprintf("invalid mint key %X", kvA.Key)) - } - } -} diff --git a/x/mint/simulation/decoder_test.go b/x/mint/simulation/decoder_test.go deleted file mode 100644 index 23e5adfde66..00000000000 --- a/x/mint/simulation/decoder_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package simulation_test - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" - - simapp "github.com/osmosis-labs/osmosis/v7/app" - "github.com/osmosis-labs/osmosis/v7/x/mint/simulation" - "github.com/osmosis-labs/osmosis/v7/x/mint/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/kv" -) - -func TestDecodeStore(t *testing.T) { - cdc, _ := simapp.MakeCodecs() - dec := simulation.NewDecodeStore(cdc) - - minter := types.NewMinter(sdk.NewDec(15)) - - kvPairs := kv.Pairs{ - Pairs: []kv.Pair{ - {Key: types.MinterKey, Value: cdc.MustMarshal(&minter)}, - {Key: []byte{0x99}, Value: []byte{0x99}}, - }, - } - tests := []struct { - name string - expectedLog string - }{ - {"Minter", fmt.Sprintf("%v\n%v", minter, minter)}, - {"other", ""}, - } - - for i, tt := range tests { - i, tt := i, tt - t.Run(tt.name, func(t *testing.T) { - switch i { - case len(tests) - 1: - require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name) - default: - require.Equal(t, tt.expectedLog, dec(kvPairs.Pairs[i], kvPairs.Pairs[i]), tt.name) - } - }) - } -} diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go deleted file mode 100644 index 1aa8a68b278..00000000000 --- a/x/mint/simulation/genesis.go +++ /dev/null @@ -1,50 +0,0 @@ -package simulation - -// DONTCOVER - -import ( - "encoding/json" - "fmt" - - "github.com/osmosis-labs/osmosis/v7/x/mint/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" -) - -// RandomizedGenState generates a random GenesisState for mint. -func RandomizedGenState(simState *module.SimulationState) { - // minter - - // var maxRewardPerEpoch sdk.Dec - // simState.AppParams.GetOrGenerate( - // simState.Cdc, MaxRewardPerEpoch, &maxRewardPerEpoch, simState.Rand, - // func(r *rand.Rand) { maxRewardPerEpoch = GenMaxRewardPerEpoch(r) }, - // ) - - // var minRewardPerEpoch sdk.Dec - // simState.AppParams.GetOrGenerate( - // simState.Cdc, MinRewardPerEpoch, &minRewardPerEpoch, simState.Rand, - // func(r *rand.Rand) { minRewardPerEpoch = GenMinRewardPerEpoch(r) }, - // ) - // Leaving as sample code - - mintDenom := sdk.DefaultBondDenom - epochProvisions := sdk.NewDec(500000) // TODO: Randomize this - params := types.NewParams(mintDenom, epochProvisions, "week", sdk.NewDecWithPrec(5, 1), 156, types.DistributionProportions{ - Staking: sdk.NewDecWithPrec(4, 1), // 0.4 - PoolIncentives: sdk.NewDecWithPrec(3, 1), // 0.3 - DeveloperRewards: sdk.NewDecWithPrec(2, 1), // 0.2 - CommunityPool: sdk.NewDecWithPrec(1, 1), // 0.1 - }, []types.WeightedAddress{}, 0) - - mintGenesis := types.NewGenesisState(types.InitialMinter(), params, 0) - - bz, err := json.MarshalIndent(&mintGenesis, "", " ") - if err != nil { - panic(err) - } - // TODO: Do some randomization later - fmt.Printf("Selected deterministically generated minting parameters:\n%s\n", bz) - simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(mintGenesis) -} diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go deleted file mode 100644 index 913bd8bfe00..00000000000 --- a/x/mint/simulation/genesis_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package simulation_test - -import ( - "encoding/json" - "math/rand" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/osmosis-labs/osmosis/v7/x/mint/simulation" - "github.com/osmosis-labs/osmosis/v7/x/mint/types" - - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// TestRandomizedGenState tests the normal scenario of applying RandomizedGenState. -// Abonormal scenarios are not tested here. -func TestRandomizedGenState(t *testing.T) { - interfaceRegistry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - - s := rand.NewSource(1) - r := rand.New(s) - - simState := module.SimulationState{ - AppParams: make(simtypes.AppParams), - Cdc: cdc, - Rand: r, - NumBonded: 3, - Accounts: simtypes.RandomAccounts(r, 3), - InitialStake: 1000, - GenState: make(map[string]json.RawMessage), - } - - simulation.RandomizedGenState(&simState) - - var mintGenesis types.GenesisState - simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &mintGenesis) - - require.Equal(t, "stake", mintGenesis.Params.MintDenom) - require.Equal(t, "0stake", mintGenesis.Minter.EpochProvision(mintGenesis.Params).String()) - require.Equal(t, "0.000000000000000000", mintGenesis.Minter.NextEpochProvisions(mintGenesis.Params).String()) - require.Equal(t, "0.000000000000000000", mintGenesis.Minter.EpochProvisions.String()) -} - -// TestRandomizedGenState tests abnormal scenarios of applying RandomizedGenState. -func TestRandomizedGenState1(t *testing.T) { - interfaceRegistry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(interfaceRegistry) - - s := rand.NewSource(1) - r := rand.New(s) - // all these tests will panic - tests := []struct { - simState module.SimulationState - panicMsg string - }{ - { // panic => reason: incomplete initialization of the simState - module.SimulationState{}, "invalid memory address or nil pointer dereference"}, - { // panic => reason: incomplete initialization of the simState - module.SimulationState{ - AppParams: make(simtypes.AppParams), - Cdc: cdc, - Rand: r, - }, "assignment to entry in nil map"}, - } - - for _, tt := range tests { - require.Panicsf(t, func() { simulation.RandomizedGenState(&tt.simState) }, tt.panicMsg) - } -} From 0560eb31101d02ddc06d319b042f516665291776 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 24 Jun 2022 16:51:15 -0400 Subject: [PATCH 07/26] client module changes --- x/mint/client/cli/cli_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/mint/client/cli/cli_test.go b/x/mint/client/cli/cli_test.go index c9c2061806f..f4e926ddd81 100644 --- a/x/mint/client/cli/cli_test.go +++ b/x/mint/client/cli/cli_test.go @@ -1,5 +1,4 @@ //go:build norace -// +build norace package cli_test From eafd55c5c9bc946dec3b1ab59c6d5027c803b0c8 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 24 Jun 2022 16:52:29 -0400 Subject: [PATCH 08/26] client/rest --- x/mint/client/rest/grpc_query_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/mint/client/rest/grpc_query_test.go b/x/mint/client/rest/grpc_query_test.go index e1334390367..b7aa537000a 100644 --- a/x/mint/client/rest/grpc_query_test.go +++ b/x/mint/client/rest/grpc_query_test.go @@ -1,5 +1,4 @@ //go:build norace -// +build norace package rest_test From f217da4132d53d957b12588605942162be3b6f21 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 24 Jun 2022 18:57:26 -0400 Subject: [PATCH 09/26] more proto fixes --- proto/osmosis/mint/v1beta1/mint.proto | 10 +++++----- x/mint/types/mint.pb.go | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/proto/osmosis/mint/v1beta1/mint.proto b/proto/osmosis/mint/v1beta1/mint.proto index 667b4ef3a61..eee03e941ba 100644 --- a/proto/osmosis/mint/v1beta1/mint.proto +++ b/proto/osmosis/mint/v1beta1/mint.proto @@ -34,28 +34,28 @@ message WeightedAddress { // denom. In other words, defines which stakeholders will receive the minted // denoms and how much. message DistributionProportions { - // Staking defines the proportion of the minted MintedDenom that is to be + // staking defines the proportion of the minted mint_denom that is to be // allocated as staking rewards. string staking = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.moretags) = "yaml:\"staking\"", (gogoproto.nullable) = false ]; - // PoolImcentives defines the proportion of the minted MintedDenom that is + // pool_incentives defines the proportion of the minted mint_denom that is // to be allocated as pool incentives. string pool_incentives = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.moretags) = "yaml:\"pool_incentives\"", (gogoproto.nullable) = false ]; - // DeveloperRewards defines the proportion of the minted MintedDenom that is + // developer_rewards defines the proportion of the minted mint_denom that is // to be allocated to developer rewards address. string developer_rewards = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.moretags) = "yaml:\"developer_rewards\"", (gogoproto.nullable) = false ]; - // CommunityPool defines the proportion of the minted MintedDenom that is + // community_pool defines the proportion of the minted mint_denom that is // to be allocated to the community pool. string community_pool = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", @@ -84,7 +84,7 @@ message Params { int64 reduction_period_in_epochs = 4 [ (gogoproto.moretags) = "yaml:\"reduction_period_in_epochs\"" ]; // reduction_factor is the reduction multiplier to execute - // at the end of each period set by ReductionPeriodInEpochs. + // at the end of each period set by reduction_period_in_epochs. string reduction_factor = 5 [ (gogoproto.moretags) = "yaml:\"reduction_factor\"", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", diff --git a/x/mint/types/mint.pb.go b/x/mint/types/mint.pb.go index 63932980ead..2753332b152 100644 --- a/x/mint/types/mint.pb.go +++ b/x/mint/types/mint.pb.go @@ -117,16 +117,16 @@ func (m *WeightedAddress) GetAddress() string { // denom. In other words, defines which stakeholders will receive the minted // denoms and how much. type DistributionProportions struct { - // Staking defines the proportion of the minted MintedDenom that is to be + // staking defines the proportion of the minted mint_denom that is to be // allocated as staking rewards. Staking github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=staking,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"staking" yaml:"staking"` - // PoolImcentives defines the proportion of the minted MintedDenom that is + // pool_incentives defines the proportion of the minted mint_denom that is // to be allocated as pool incentives. PoolIncentives github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=pool_incentives,json=poolIncentives,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"pool_incentives" yaml:"pool_incentives"` - // DeveloperRewards defines the proportion of the minted MintedDenom that is + // developer_rewards defines the proportion of the minted mint_denom that is // to be allocated to developer rewards address. DeveloperRewards github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=developer_rewards,json=developerRewards,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"developer_rewards" yaml:"developer_rewards"` - // CommunityPool defines the proportion of the minted MintedDenom that is + // community_pool defines the proportion of the minted mint_denom that is // to be allocated to the 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" yaml:"community_pool"` } @@ -176,7 +176,7 @@ type Params struct { // to reduce the rewards. ReductionPeriodInEpochs int64 `protobuf:"varint,4,opt,name=reduction_period_in_epochs,json=reductionPeriodInEpochs,proto3" json:"reduction_period_in_epochs,omitempty" yaml:"reduction_period_in_epochs"` // reduction_factor is the reduction multiplier to execute - // at the end of each period set by ReductionPeriodInEpochs. + // at the end of each period set by reduction_period_in_epochs. ReductionFactor github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=reduction_factor,json=reductionFactor,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reduction_factor" yaml:"reduction_factor"` // distribution_proportions defines the distribution proportions of the minted // denom. In other words, defines which stakeholders will receive the minted From 88c0fc428039e36ce7843e5daa00c6f4343a44c0 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 24 Jun 2022 18:58:57 -0400 Subject: [PATCH 10/26] avoid listing minting params in spec --- x/mint/README.md | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/x/mint/README.md b/x/mint/README.md index bc9933cd9b9..2ba6a0bdd66 100644 --- a/x/mint/README.md +++ b/x/mint/README.md @@ -61,19 +61,6 @@ type Minter struct { Minting [`Params`](https://github.com/osmosis-labs/osmosis/blob/cbb683e8395655042b4421355cd54a8c96bfa507/x/mint/types/mint.pb.go#L168) are held in the global params store. -```go -type Params struct { - MintDenom string // type of coin to mint - GenesisEpochProvisions sdk.Dec // initial epoch provisions at genesis - EpochIdentifier string // identifier of epoch - ReductionPeriodInEpochs int64 // number of epochs between reward reductions - ReductionFactor sdk.Dec // reduction multiplier to execute on each period - DistributionProportions DistributionProportions // distribution_proportions defines the proportion of the minted denom - WeightedDeveloperRewardsReceivers []WeightedAddress // address to receive developer rewards - MintingRewardsDistributionStartEpoch int64 // start epoch to distribute minting rewards -} -``` - ### LastReductionEpoch Last reduction epoch stores the epoch number when the last reduction of From 3d922c84ce51dae32d336f15f67af984214bebf4 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 25 Jun 2022 08:07:06 -0700 Subject: [PATCH 11/26] Update proto/osmosis/mint/v1beta1/mint.proto Co-authored-by: Dev Ojha --- proto/osmosis/mint/v1beta1/mint.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/osmosis/mint/v1beta1/mint.proto b/proto/osmosis/mint/v1beta1/mint.proto index eee03e941ba..894f853a8fa 100644 --- a/proto/osmosis/mint/v1beta1/mint.proto +++ b/proto/osmosis/mint/v1beta1/mint.proto @@ -68,7 +68,7 @@ message DistributionProportions { message Params { option (gogoproto.goproto_stringer) = false; - // mint_denom the denom of the coin to mint. + // mint_denom is the denom of the coin to mint. string mint_denom = 1; // genesis_epoch_provisions epoch provisions from the first epoch. string genesis_epoch_provisions = 2 [ From 649e20eda41e1612e46ca91f065682eff0595e14 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 25 Jun 2022 11:13:09 -0400 Subject: [PATCH 12/26] update comment in hooks.go --- x/mint/keeper/hooks.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x/mint/keeper/hooks.go b/x/mint/keeper/hooks.go index 3cef94b8269..9c3e520e7fd 100644 --- a/x/mint/keeper/hooks.go +++ b/x/mint/keeper/hooks.go @@ -28,8 +28,10 @@ func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, epochNumb params := k.GetParams(ctx) // Check if we have hit an epoch where we update the inflation parameter. - // Since epochs only update based on BFT time data, it is safe to store the "reducing period time" - // in terms of the number of epochs that have transpired. + // We measure time between reductions in number of epochs. + // This avoids issues with measuring in block numbers, as epochs have fixed intervals, with very + // low variance at the relevant sizes. As a result, it is safe to store the epoch number + // of the last reduction to be later retrieved for comparison. if epochNumber >= k.GetParams(ctx).ReductionPeriodInEpochs+k.GetLastReductionEpochNum(ctx) { // Reduce the reward per reduction period minter.EpochProvisions = minter.NextEpochProvisions(params) From 21fc1c8df13c89dc4dc110b6db171c0c68e03d77 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 25 Jun 2022 11:39:15 -0400 Subject: [PATCH 13/26] Revert "try removing simulation" w/o Makefile change This reverts commit 5a06bf1af4d4a421e4890935e36ab4d11d69609c. --- x/mint/module.go | 37 +++++++++++++++- x/mint/simulation/decoder.go | 27 +++++++++++ x/mint/simulation/decoder_test.go | 48 ++++++++++++++++++++ x/mint/simulation/genesis.go | 50 +++++++++++++++++++++ x/mint/simulation/genesis_test.go | 74 +++++++++++++++++++++++++++++++ 5 files changed, 234 insertions(+), 2 deletions(-) create mode 100644 x/mint/simulation/decoder.go create mode 100644 x/mint/simulation/decoder_test.go create mode 100644 x/mint/simulation/genesis.go create mode 100644 x/mint/simulation/genesis_test.go diff --git a/x/mint/module.go b/x/mint/module.go index 397e104de0e..54a123ec844 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "math/rand" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -15,16 +16,19 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/osmosis-labs/osmosis/v7/x/mint/client/cli" "github.com/osmosis-labs/osmosis/v7/x/mint/client/rest" "github.com/osmosis-labs/osmosis/v7/x/mint/keeper" + "github.com/osmosis-labs/osmosis/v7/x/mint/simulation" "github.com/osmosis-labs/osmosis/v7/x/mint/types" ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleSimulation = AppModule{} ) // AppModuleBasic defines the basic application module used by the mint module. @@ -160,3 +164,32 @@ func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.Validato // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return 1 } + +// ___________________________________________________________________________ + +// AppModuleSimulation functions + +// GenerateGenesisState creates a randomized GenState of the mint module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + simulation.RandomizedGenState(simState) +} + +// ProposalContents doesn't return any content functions for governance proposals. +func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { + return nil +} + +// RandomizedParams creates randomized mint param changes for the simulator. +func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { + return nil +} + +// RegisterStoreDecoder registers a decoder for mint module's types. +func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { + sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) +} + +// WeightedOperations doesn't return any mint module operation. +func (AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { + return nil +} diff --git a/x/mint/simulation/decoder.go b/x/mint/simulation/decoder.go new file mode 100644 index 00000000000..33a752a5dc9 --- /dev/null +++ b/x/mint/simulation/decoder.go @@ -0,0 +1,27 @@ +package simulation + +import ( + "bytes" + "fmt" + + "github.com/osmosis-labs/osmosis/v7/x/mint/types" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/types/kv" +) + +// NewDecodeStore returns a decoder function closure that umarshals the KVPair's +// Value to the corresponding mint type. +func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { + return func(kvA, kvB kv.Pair) string { + switch { + case bytes.Equal(kvA.Key, types.MinterKey): + var minterA, minterB types.Minter + cdc.MustUnmarshal(kvA.Value, &minterA) + cdc.MustUnmarshal(kvB.Value, &minterB) + return fmt.Sprintf("%v\n%v", minterA, minterB) + default: + panic(fmt.Sprintf("invalid mint key %X", kvA.Key)) + } + } +} diff --git a/x/mint/simulation/decoder_test.go b/x/mint/simulation/decoder_test.go new file mode 100644 index 00000000000..23e5adfde66 --- /dev/null +++ b/x/mint/simulation/decoder_test.go @@ -0,0 +1,48 @@ +package simulation_test + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" + + simapp "github.com/osmosis-labs/osmosis/v7/app" + "github.com/osmosis-labs/osmosis/v7/x/mint/simulation" + "github.com/osmosis-labs/osmosis/v7/x/mint/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/kv" +) + +func TestDecodeStore(t *testing.T) { + cdc, _ := simapp.MakeCodecs() + dec := simulation.NewDecodeStore(cdc) + + minter := types.NewMinter(sdk.NewDec(15)) + + kvPairs := kv.Pairs{ + Pairs: []kv.Pair{ + {Key: types.MinterKey, Value: cdc.MustMarshal(&minter)}, + {Key: []byte{0x99}, Value: []byte{0x99}}, + }, + } + tests := []struct { + name string + expectedLog string + }{ + {"Minter", fmt.Sprintf("%v\n%v", minter, minter)}, + {"other", ""}, + } + + for i, tt := range tests { + i, tt := i, tt + t.Run(tt.name, func(t *testing.T) { + switch i { + case len(tests) - 1: + require.Panics(t, func() { dec(kvPairs.Pairs[i], kvPairs.Pairs[i]) }, tt.name) + default: + require.Equal(t, tt.expectedLog, dec(kvPairs.Pairs[i], kvPairs.Pairs[i]), tt.name) + } + }) + } +} diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go new file mode 100644 index 00000000000..1aa8a68b278 --- /dev/null +++ b/x/mint/simulation/genesis.go @@ -0,0 +1,50 @@ +package simulation + +// DONTCOVER + +import ( + "encoding/json" + "fmt" + + "github.com/osmosis-labs/osmosis/v7/x/mint/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" +) + +// RandomizedGenState generates a random GenesisState for mint. +func RandomizedGenState(simState *module.SimulationState) { + // minter + + // var maxRewardPerEpoch sdk.Dec + // simState.AppParams.GetOrGenerate( + // simState.Cdc, MaxRewardPerEpoch, &maxRewardPerEpoch, simState.Rand, + // func(r *rand.Rand) { maxRewardPerEpoch = GenMaxRewardPerEpoch(r) }, + // ) + + // var minRewardPerEpoch sdk.Dec + // simState.AppParams.GetOrGenerate( + // simState.Cdc, MinRewardPerEpoch, &minRewardPerEpoch, simState.Rand, + // func(r *rand.Rand) { minRewardPerEpoch = GenMinRewardPerEpoch(r) }, + // ) + // Leaving as sample code + + mintDenom := sdk.DefaultBondDenom + epochProvisions := sdk.NewDec(500000) // TODO: Randomize this + params := types.NewParams(mintDenom, epochProvisions, "week", sdk.NewDecWithPrec(5, 1), 156, types.DistributionProportions{ + Staking: sdk.NewDecWithPrec(4, 1), // 0.4 + PoolIncentives: sdk.NewDecWithPrec(3, 1), // 0.3 + DeveloperRewards: sdk.NewDecWithPrec(2, 1), // 0.2 + CommunityPool: sdk.NewDecWithPrec(1, 1), // 0.1 + }, []types.WeightedAddress{}, 0) + + mintGenesis := types.NewGenesisState(types.InitialMinter(), params, 0) + + bz, err := json.MarshalIndent(&mintGenesis, "", " ") + if err != nil { + panic(err) + } + // TODO: Do some randomization later + fmt.Printf("Selected deterministically generated minting parameters:\n%s\n", bz) + simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(mintGenesis) +} diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go new file mode 100644 index 00000000000..87fa4bfbbc2 --- /dev/null +++ b/x/mint/simulation/genesis_test.go @@ -0,0 +1,74 @@ +package simulation_test + +import ( + "encoding/json" + "math/rand" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/osmosis-labs/osmosis/v7/x/mint/simulation" + "github.com/osmosis-labs/osmosis/v7/x/mint/types" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +// TestRandomizedGenState tests the normal scenario of applying RandomizedGenState. +// Abnormal scenarios are not tested here. +func TestRandomizedGenState(t *testing.T) { + interfaceRegistry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(interfaceRegistry) + + s := rand.NewSource(1) + r := rand.New(s) + + simState := module.SimulationState{ + AppParams: make(simtypes.AppParams), + Cdc: cdc, + Rand: r, + NumBonded: 3, + Accounts: simtypes.RandomAccounts(r, 3), + InitialStake: 1000, + GenState: make(map[string]json.RawMessage), + } + + simulation.RandomizedGenState(&simState) + + var mintGenesis types.GenesisState + simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &mintGenesis) + + require.Equal(t, "stake", mintGenesis.Params.MintDenom) + require.Equal(t, "0stake", mintGenesis.Minter.EpochProvision(mintGenesis.Params).String()) + require.Equal(t, "0.000000000000000000", mintGenesis.Minter.NextEpochProvisions(mintGenesis.Params).String()) + require.Equal(t, "0.000000000000000000", mintGenesis.Minter.EpochProvisions.String()) +} + +// TestRandomizedGenState_Invalid tests abnormal scenarios of applying RandomizedGenState. +func TestRandomizedGenState_Invalid(t *testing.T) { + interfaceRegistry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(interfaceRegistry) + + s := rand.NewSource(1) + r := rand.New(s) + // all these tests will panic + tests := []struct { + simState module.SimulationState + panicMsg string + }{ + { // panic => reason: incomplete initialization of the simState + module.SimulationState{}, "invalid memory address or nil pointer dereference"}, + { // panic => reason: incomplete initialization of the simState + module.SimulationState{ + AppParams: make(simtypes.AppParams), + Cdc: cdc, + Rand: r, + }, "assignment to entry in nil map"}, + } + + for _, tt := range tests { + require.Panicsf(t, func() { simulation.RandomizedGenState(&tt.simState) }, tt.panicMsg) + } +} From 5001b8489ed6bbcb82956f3b0841a8be50d0e179 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 25 Jun 2022 16:02:50 -0400 Subject: [PATCH 14/26] randomize mint gen state simulation --- x/mint/simulation/genesis.go | 191 ++++++++++++++++++++++++++---- x/mint/simulation/genesis_test.go | 99 +++++++++++++++- 2 files changed, 263 insertions(+), 27 deletions(-) diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index 1aa8a68b278..6194ad4f1d7 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -5,6 +5,7 @@ package simulation import ( "encoding/json" "fmt" + "math/rand" "github.com/osmosis-labs/osmosis/v7/x/mint/types" @@ -12,39 +13,185 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" ) +// Simulation parameter constants. +const ( + epochProvisionsKey = "epoch_provisions" + epochIdentifierKey = "epoch_identifier" + reductionFactorKey = "reduction_factor" + reductionPeriodInEpochsKey = "reduction_period_in_epochs" + stakingDistributionProportionKey = "staking_distribution_proportion" + poolIncentivesDistributionProportionKey = "pool_incentives_distribution_proportion" + developerRewardsDistributionProportionKey = "developer_rewards_distribution_proportion" + communityPoolDistributionProportionKey = "community_pool_distribution_proportion" + weightedDevRewardReceiversKey = "weighted_dev_reward_receivers" + mintingRewardsDistributionStartEpochKey = "minting_rewards_distribution_start_epoch" + reductionStartedEpochKey = "reduction_started_epoch" + + maxInt64 = int(^uint(0) >> 1) +) + +var ( + epochIdentifierOptions = []string{"day", "week"} +) + // RandomizedGenState generates a random GenesisState for mint. func RandomizedGenState(simState *module.SimulationState) { - // minter + var epochProvisions sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, epochProvisionsKey, &epochProvisions, simState.Rand, + func(r *rand.Rand) { epochProvisions = genEpochProvisions(r) }, + ) + + var epochIdentifier string + simState.AppParams.GetOrGenerate( + simState.Cdc, epochIdentifierKey, &epochIdentifier, simState.Rand, + func(r *rand.Rand) { epochIdentifier = genEpochIdentifier(r) }, + ) + + var reductionFactor sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, reductionFactorKey, &reductionFactor, simState.Rand, + func(r *rand.Rand) { reductionFactor = genReductionFactor(r) }, + ) + + var reductionPeriodInEpochs int64 + simState.AppParams.GetOrGenerate( + simState.Cdc, reductionPeriodInEpochsKey, &reductionPeriodInEpochs, simState.Rand, + func(r *rand.Rand) { reductionPeriodInEpochs = genReductionPeriodInEpochs(r) }, + ) + + randomDisitributionProportions := genProportionsAddingUpToOne(simState.Rand, 4) + + var stakingDistributionProportion sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, stakingDistributionProportionKey, &stakingDistributionProportion, simState.Rand, + func(r *rand.Rand) { stakingDistributionProportion = randomDisitributionProportions[0] }, + ) - // var maxRewardPerEpoch sdk.Dec - // simState.AppParams.GetOrGenerate( - // simState.Cdc, MaxRewardPerEpoch, &maxRewardPerEpoch, simState.Rand, - // func(r *rand.Rand) { maxRewardPerEpoch = GenMaxRewardPerEpoch(r) }, - // ) + var poolIncentivesDistributionProportion sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, poolIncentivesDistributionProportionKey, &poolIncentivesDistributionProportion, simState.Rand, + func(r *rand.Rand) { poolIncentivesDistributionProportion = randomDisitributionProportions[1] }, + ) - // var minRewardPerEpoch sdk.Dec - // simState.AppParams.GetOrGenerate( - // simState.Cdc, MinRewardPerEpoch, &minRewardPerEpoch, simState.Rand, - // func(r *rand.Rand) { minRewardPerEpoch = GenMinRewardPerEpoch(r) }, - // ) - // Leaving as sample code + var developerRewardsDistributionProportion sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, developerRewardsDistributionProportionKey, &developerRewardsDistributionProportion, simState.Rand, + func(r *rand.Rand) { developerRewardsDistributionProportion = randomDisitributionProportions[2] }, + ) + + var communityPoolDistributionProportion sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, communityPoolDistributionProportionKey, &communityPoolDistributionProportion, simState.Rand, + func(r *rand.Rand) { communityPoolDistributionProportion = randomDisitributionProportions[3] }, + ) + + var weightedDevRewardReceivers []types.WeightedAddress + simState.AppParams.GetOrGenerate( + simState.Cdc, weightedDevRewardReceiversKey, &weightedDevRewardReceivers, simState.Rand, + func(r *rand.Rand) { + addressCount := r.Intn(5) + randomDevRewardProportions := genProportionsAddingUpToOne(simState.Rand, addressCount) + + for i := 0; i < addressCount; i++ { + weightedDevRewardReceivers = append(weightedDevRewardReceivers, types.WeightedAddress{ + Address: fmt.Sprintf("address_%d", i), + Weight: randomDevRewardProportions[i], + }) + } + }, + ) + + var mintintRewardsDistributionStartEpoch int64 + simState.AppParams.GetOrGenerate( + simState.Cdc, mintingRewardsDistributionStartEpochKey, &mintintRewardsDistributionStartEpoch, simState.Rand, + func(r *rand.Rand) { mintintRewardsDistributionStartEpoch = genMintintRewardsDistributionStartEpoch(r) }, + ) + + var reductionStartedEpoch int64 + simState.AppParams.GetOrGenerate( + simState.Cdc, reductionStartedEpochKey, &reductionStartedEpoch, simState.Rand, + func(r *rand.Rand) { reductionStartedEpoch = genReductionStartedEpoch(r) }, + ) mintDenom := sdk.DefaultBondDenom - epochProvisions := sdk.NewDec(500000) // TODO: Randomize this - params := types.NewParams(mintDenom, epochProvisions, "week", sdk.NewDecWithPrec(5, 1), 156, types.DistributionProportions{ - Staking: sdk.NewDecWithPrec(4, 1), // 0.4 - PoolIncentives: sdk.NewDecWithPrec(3, 1), // 0.3 - DeveloperRewards: sdk.NewDecWithPrec(2, 1), // 0.2 - CommunityPool: sdk.NewDecWithPrec(1, 1), // 0.1 - }, []types.WeightedAddress{}, 0) + params := types.NewParams( + mintDenom, + epochProvisions, + epochIdentifier, + reductionFactor, + reductionPeriodInEpochs, + types.DistributionProportions{ + Staking: stakingDistributionProportion, + PoolIncentives: poolIncentivesDistributionProportion, + DeveloperRewards: developerRewardsDistributionProportion, + CommunityPool: communityPoolDistributionProportion, + }, + weightedDevRewardReceivers, + mintintRewardsDistributionStartEpoch) - mintGenesis := types.NewGenesisState(types.InitialMinter(), params, 0) + minter := types.NewMinter(epochProvisions) + + mintGenesis := types.NewGenesisState(minter, params, reductionStartedEpoch) bz, err := json.MarshalIndent(&mintGenesis, "", " ") if err != nil { panic(err) } - // TODO: Do some randomization later - fmt.Printf("Selected deterministically generated minting parameters:\n%s\n", bz) + fmt.Printf("Selected pseudo-randomly generated minting parameters:\n%s\n", bz) simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(mintGenesis) } + +func genEpochProvisions(r *rand.Rand) sdk.Dec { + return sdk.NewDec(int64(r.Intn(maxInt64))) +} + +func genEpochIdentifier(r *rand.Rand) string { + return epochIdentifierOptions[rand.Intn(len(epochIdentifierOptions))] +} + +func genReductionFactor(r *rand.Rand) sdk.Dec { + return sdk.NewDecWithPrec(int64(r.Intn(10)), 1) +} + +func genReductionPeriodInEpochs(r *rand.Rand) int64 { + return int64(r.Intn(maxInt64)) +} + +func genStakingDistributionProportion(r *rand.Rand) sdk.Dec { + return sdk.NewDecWithPrec(int64(r.Intn(5)), 1) +} + +func genPoolIncentivesDistributionProportion(r *rand.Rand, limitRatio sdk.Dec) sdk.Dec { + return sdk.NewDecWithPrec(int64(r.Intn(int(limitRatio.MulInt64(10).TruncateInt64()))), 1) +} + +func genDeveloperRewardsDistributionProportion(r *rand.Rand, limitRatio sdk.Dec) sdk.Dec { + return sdk.NewDecWithPrec(int64(r.Intn(int(limitRatio.MulInt64(10).TruncateInt64()))), 1) +} + +// genProportionsAddingUpToOne reurns a slice with numberOfProportions that add up to 1. +func genProportionsAddingUpToOne(r *rand.Rand, numberOfProportions int) []sdk.Dec { + proportions := make([]sdk.Dec, numberOfProportions) + + // We start by estimating the first proportion with a limit of 1. + // Then, subtract the first proportion from 1 to esimate + // the remaining ratio to be used as upper bound for next randomization. + // Next, repeat the randomization process for the remaining proportions. + remainingRatio := sdk.OneDec() + for i := 0; i < numberOfProportions-1; i++ { + nextProportion := sdk.NewDecWithPrec(int64(r.Intn(int(remainingRatio.MulInt64(10).TruncateInt64()))), 1) + proportions[i] = nextProportion + remainingRatio = remainingRatio.Sub(nextProportion) + } + proportions[numberOfProportions-1] = remainingRatio + return proportions +} + +func genMintintRewardsDistributionStartEpoch(r *rand.Rand) int64 { + return int64(r.Intn(maxInt64)) +} + +func genReductionStartedEpoch(r *rand.Rand) int64 { + return int64(r.Intn(maxInt64)) +} diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index 87fa4bfbbc2..a276c30e7f2 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -2,6 +2,7 @@ package simulation_test import ( "encoding/json" + "fmt" "math/rand" "testing" @@ -12,6 +13,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) @@ -22,7 +24,7 @@ func TestRandomizedGenState(t *testing.T) { interfaceRegistry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(interfaceRegistry) - s := rand.NewSource(1) + s := rand.NewSource(5) r := rand.New(s) simState := module.SimulationState{ @@ -40,10 +42,97 @@ func TestRandomizedGenState(t *testing.T) { var mintGenesis types.GenesisState simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &mintGenesis) - require.Equal(t, "stake", mintGenesis.Params.MintDenom) - require.Equal(t, "0stake", mintGenesis.Minter.EpochProvision(mintGenesis.Params).String()) - require.Equal(t, "0.000000000000000000", mintGenesis.Minter.NextEpochProvisions(mintGenesis.Params).String()) - require.Equal(t, "0.000000000000000000", mintGenesis.Minter.EpochProvisions.String()) + const ( + expectedEpochProvisionsStr = "7913048388940673156" + expectedEpochIdentifier = "week" + expectedReductionFactorStr = "0.6" + expectedReductionPeriodInEpochs = int64(9171281239991390334) + + expectedStakingDistributionProportion = "0.8" + expectedPoolIncentivesDistributionProportion = "0" + expectedDeveloperRewardsDistributionProportion = "0.1" + expectedCommunityPoolDistributionProportion = "0.1" + + expectedMintintRewardsDistributionStartEpoch = int64(3800660657951843153) + + expectedReductionStartedEpoch = int64(1187669907065521396) + + expectedNextEpochProvisionsStr = "3956524194470336578" + expectedDenom = sdk.DefaultBondDenom + ) + + var expectedWeightedAddresses []types.WeightedAddress = []types.WeightedAddress{ + { + Address: "address_0", + Weight: sdk.NewDecWithPrec(4, 1), + }, + { + Address: "address_1", + Weight: sdk.NewDecWithPrec(0, 1), + }, + { + Address: "address_2", + Weight: sdk.NewDecWithPrec(2, 1), + }, + { + Address: "address_3", + Weight: sdk.NewDecWithPrec(4, 1), + }, + } + + // Epoch provisions from Minter. + epochProvisionsDec, err := sdk.NewDecFromStr(expectedEpochProvisionsStr) + require.NoError(t, err) + require.Equal(t, epochProvisionsDec, mintGenesis.Minter.EpochProvisions) + + // Epoch identifier. + require.Equal(t, expectedEpochIdentifier, mintGenesis.Params.EpochIdentifier) + + // Reduction factor. + reductionFactorDec, err := sdk.NewDecFromStr(expectedReductionFactorStr) + require.NoError(t, err) + require.Equal(t, reductionFactorDec, mintGenesis.Params.ReductionFactor) + + // Reduction perion in epochs. + require.Equal(t, expectedReductionPeriodInEpochs, mintGenesis.Params.ReductionPeriodInEpochs) + + // Staking rewards distribution proportion. + stakingDistributionProportionDec, err := sdk.NewDecFromStr(expectedStakingDistributionProportion) + require.NoError(t, err) + require.Equal(t, stakingDistributionProportionDec, mintGenesis.Params.DistributionProportions.Staking) + + // Pool incentives distribution proportion. + poolIncentivesDistributionProportionDec, err := sdk.NewDecFromStr(expectedPoolIncentivesDistributionProportion) + require.NoError(t, err) + require.Equal(t, poolIncentivesDistributionProportionDec, mintGenesis.Params.DistributionProportions.PoolIncentives) + + // Developer rewards distribution proportion. + developerRewardsDistributionProportionDec, err := sdk.NewDecFromStr(expectedDeveloperRewardsDistributionProportion) + require.NoError(t, err) + require.Equal(t, developerRewardsDistributionProportionDec, mintGenesis.Params.DistributionProportions.DeveloperRewards) + + // Community pool distribution proportion. + communityPoolDistributionProportionDec, err := sdk.NewDecFromStr(expectedCommunityPoolDistributionProportion) + require.NoError(t, err) + require.Equal(t, communityPoolDistributionProportionDec, mintGenesis.Params.DistributionProportions.CommunityPool) + + // Weighted developer rewards receivers. + require.Equal(t, expectedWeightedAddresses, mintGenesis.Params.WeightedDeveloperRewardsReceivers) + + // Minting rewards distribution start epoch + require.Equal(t, expectedMintintRewardsDistributionStartEpoch, mintGenesis.Params.MintingRewardsDistributionStartEpoch) + + // Reduction started epoch. + require.Equal(t, expectedReductionStartedEpoch, mintGenesis.ReductionStartedEpoch) + + // Next epoch provisions. + nextEpochProvisionsDec := epochProvisionsDec.Mul(reductionFactorDec) + require.NoError(t, err) + require.Equal(t, nextEpochProvisionsDec, mintGenesis.Minter.NextEpochProvisions(mintGenesis.Params)) + + // Denom and Epoch provisions from Params. + require.Equal(t, expectedDenom, mintGenesis.Params.MintDenom) + require.Equal(t, fmt.Sprintf("%s%s", expectedEpochProvisionsStr, expectedDenom), mintGenesis.Minter.EpochProvision(mintGenesis.Params).String()) } // TestRandomizedGenState_Invalid tests abnormal scenarios of applying RandomizedGenState. From 8363a7eabec4a5d98eb2cd9de5573ff191fbd3dd Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 25 Jun 2022 17:33:40 -0400 Subject: [PATCH 15/26] fix full sim tests --- x/mint/simulation/genesis.go | 97 +++++++++++++------------------ x/mint/simulation/genesis_test.go | 28 ++++----- 2 files changed, 56 insertions(+), 69 deletions(-) diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index 6194ad4f1d7..bce40b54ccf 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -15,23 +15,26 @@ import ( // Simulation parameter constants. const ( - epochProvisionsKey = "epoch_provisions" - epochIdentifierKey = "epoch_identifier" - reductionFactorKey = "reduction_factor" - reductionPeriodInEpochsKey = "reduction_period_in_epochs" + epochProvisionsKey = "genesis_epoch_provisions" + epochIdentifierKey = "epoch_identifier" + reductionFactorKey = "reduction_factor" + reductionPeriodInEpochsKey = "reduction_period_in_epochs" + + distributionProportionsKey = "distribution_proportions" + stakingDistributionProportionKey = "staking_distribution_proportion" poolIncentivesDistributionProportionKey = "pool_incentives_distribution_proportion" developerRewardsDistributionProportionKey = "developer_rewards_distribution_proportion" communityPoolDistributionProportionKey = "community_pool_distribution_proportion" - weightedDevRewardReceiversKey = "weighted_dev_reward_receivers" + weightedDevRewardReceiversKey = "weighted_developer_rewards_receivers" mintingRewardsDistributionStartEpochKey = "minting_rewards_distribution_start_epoch" - reductionStartedEpochKey = "reduction_started_epoch" maxInt64 = int(^uint(0) >> 1) ) var ( - epochIdentifierOptions = []string{"day", "week"} + epochIdentifierOptions = []string{"day", "week"} + possibleBech32AddrLengths = []uint8{20, 32} ) // RandomizedGenState generates a random GenesisState for mint. @@ -60,30 +63,16 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { reductionPeriodInEpochs = genReductionPeriodInEpochs(r) }, ) - randomDisitributionProportions := genProportionsAddingUpToOne(simState.Rand, 4) - - var stakingDistributionProportion sdk.Dec + var distributionProportions types.DistributionProportions simState.AppParams.GetOrGenerate( - simState.Cdc, stakingDistributionProportionKey, &stakingDistributionProportion, simState.Rand, - func(r *rand.Rand) { stakingDistributionProportion = randomDisitributionProportions[0] }, - ) - - var poolIncentivesDistributionProportion sdk.Dec - simState.AppParams.GetOrGenerate( - simState.Cdc, poolIncentivesDistributionProportionKey, &poolIncentivesDistributionProportion, simState.Rand, - func(r *rand.Rand) { poolIncentivesDistributionProportion = randomDisitributionProportions[1] }, - ) - - var developerRewardsDistributionProportion sdk.Dec - simState.AppParams.GetOrGenerate( - simState.Cdc, developerRewardsDistributionProportionKey, &developerRewardsDistributionProportion, simState.Rand, - func(r *rand.Rand) { developerRewardsDistributionProportion = randomDisitributionProportions[2] }, - ) - - var communityPoolDistributionProportion sdk.Dec - simState.AppParams.GetOrGenerate( - simState.Cdc, communityPoolDistributionProportionKey, &communityPoolDistributionProportion, simState.Rand, - func(r *rand.Rand) { communityPoolDistributionProportion = randomDisitributionProportions[3] }, + simState.Cdc, distributionProportionsKey, &distributionProportions, simState.Rand, + func(r *rand.Rand) { + randomDisitributionProportions := genProportionsAddingUpToOne(simState.Rand, 4) + distributionProportions.Staking = randomDisitributionProportions[0] + distributionProportions.PoolIncentives = randomDisitributionProportions[1] + distributionProportions.DeveloperRewards = randomDisitributionProportions[2] + distributionProportions.CommunityPool = randomDisitributionProportions[3] + }, ) var weightedDevRewardReceivers []types.WeightedAddress @@ -94,8 +83,17 @@ func RandomizedGenState(simState *module.SimulationState) { randomDevRewardProportions := genProportionsAddingUpToOne(simState.Rand, addressCount) for i := 0; i < addressCount; i++ { + addressLength := possibleBech32AddrLengths[r.Intn(len(possibleBech32AddrLengths))] + addressRandBytes, err := randBytes(r, int(addressLength)) + if err != nil { + panic(err) + } + address, err := sdk.Bech32ifyAddressBytes("osmo", addressRandBytes) + if err != nil { + panic(err) + } weightedDevRewardReceivers = append(weightedDevRewardReceivers, types.WeightedAddress{ - Address: fmt.Sprintf("address_%d", i), + Address: address, Weight: randomDevRewardProportions[i], }) } @@ -108,11 +106,7 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { mintintRewardsDistributionStartEpoch = genMintintRewardsDistributionStartEpoch(r) }, ) - var reductionStartedEpoch int64 - simState.AppParams.GetOrGenerate( - simState.Cdc, reductionStartedEpochKey, &reductionStartedEpoch, simState.Rand, - func(r *rand.Rand) { reductionStartedEpoch = genReductionStartedEpoch(r) }, - ) + reductionStartedEpoch := genReductionStartedEpoch(simState.Rand) mintDenom := sdk.DefaultBondDenom params := types.NewParams( @@ -121,12 +115,7 @@ func RandomizedGenState(simState *module.SimulationState) { epochIdentifier, reductionFactor, reductionPeriodInEpochs, - types.DistributionProportions{ - Staking: stakingDistributionProportion, - PoolIncentives: poolIncentivesDistributionProportion, - DeveloperRewards: developerRewardsDistributionProportion, - CommunityPool: communityPoolDistributionProportion, - }, + distributionProportions, weightedDevRewardReceivers, mintintRewardsDistributionStartEpoch) @@ -158,18 +147,6 @@ func genReductionPeriodInEpochs(r *rand.Rand) int64 { return int64(r.Intn(maxInt64)) } -func genStakingDistributionProportion(r *rand.Rand) sdk.Dec { - return sdk.NewDecWithPrec(int64(r.Intn(5)), 1) -} - -func genPoolIncentivesDistributionProportion(r *rand.Rand, limitRatio sdk.Dec) sdk.Dec { - return sdk.NewDecWithPrec(int64(r.Intn(int(limitRatio.MulInt64(10).TruncateInt64()))), 1) -} - -func genDeveloperRewardsDistributionProportion(r *rand.Rand, limitRatio sdk.Dec) sdk.Dec { - return sdk.NewDecWithPrec(int64(r.Intn(int(limitRatio.MulInt64(10).TruncateInt64()))), 1) -} - // genProportionsAddingUpToOne reurns a slice with numberOfProportions that add up to 1. func genProportionsAddingUpToOne(r *rand.Rand, numberOfProportions int) []sdk.Dec { proportions := make([]sdk.Dec, numberOfProportions) @@ -180,7 +157,8 @@ func genProportionsAddingUpToOne(r *rand.Rand, numberOfProportions int) []sdk.De // Next, repeat the randomization process for the remaining proportions. remainingRatio := sdk.OneDec() for i := 0; i < numberOfProportions-1; i++ { - nextProportion := sdk.NewDecWithPrec(int64(r.Intn(int(remainingRatio.MulInt64(10).TruncateInt64()))), 1) + // We add 0.01 to make sure that zero is never returned because a proportion of 0 is deemed invalid. + nextProportion := sdk.MustNewDecFromStr("0.01").Add(sdk.NewDecWithPrec(int64(r.Intn(int(remainingRatio.MulInt64(9).TruncateInt64()))), 1)) proportions[i] = nextProportion remainingRatio = remainingRatio.Sub(nextProportion) } @@ -195,3 +173,12 @@ func genMintintRewardsDistributionStartEpoch(r *rand.Rand) int64 { func genReductionStartedEpoch(r *rand.Rand) int64 { return int64(r.Intn(maxInt64)) } + +func randBytes(r *rand.Rand, length int) ([]byte, error) { + result := make([]byte, length) + n, err := r.Read(result) + if n != length { + return nil, fmt.Errorf("did not read enough bytes, read: %d, expected: %d", n, length) + } + return result, err +} diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index a276c30e7f2..fcc4ac5a56f 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -48,14 +48,14 @@ func TestRandomizedGenState(t *testing.T) { expectedReductionFactorStr = "0.6" expectedReductionPeriodInEpochs = int64(9171281239991390334) - expectedStakingDistributionProportion = "0.8" - expectedPoolIncentivesDistributionProportion = "0" - expectedDeveloperRewardsDistributionProportion = "0.1" - expectedCommunityPoolDistributionProportion = "0.1" + expectedStakingDistributionProportion = "0.51" + expectedPoolIncentivesDistributionProportion = "0.01" + expectedDeveloperRewardsDistributionProportion = "0.31" + expectedCommunityPoolDistributionProportion = "0.17" - expectedMintintRewardsDistributionStartEpoch = int64(3800660657951843153) + expectedMintintRewardsDistributionStartEpoch = int64(8326275384461735988) - expectedReductionStartedEpoch = int64(1187669907065521396) + expectedReductionStartedEpoch = int64(8272964973000937025) expectedNextEpochProvisionsStr = "3956524194470336578" expectedDenom = sdk.DefaultBondDenom @@ -63,20 +63,20 @@ func TestRandomizedGenState(t *testing.T) { var expectedWeightedAddresses []types.WeightedAddress = []types.WeightedAddress{ { - Address: "address_0", - Weight: sdk.NewDecWithPrec(4, 1), + Address: "osmo10h0yjph5cs87jlrn0d7g7u4dmftufg57mute7qhn6zla86ha3ems0yhsdm", + Weight: sdk.NewDecWithPrec(21, 2), }, { - Address: "address_1", - Weight: sdk.NewDecWithPrec(0, 1), + Address: "osmo1fcjs4czqdfcm8vpx0835kvxgh30hx8s4p8fk53", + Weight: sdk.NewDecWithPrec(21, 2), }, { - Address: "address_2", - Weight: sdk.NewDecWithPrec(2, 1), + Address: "osmo1npjxgta2789ju4v063ewwuyv6wpz84x8gscg7hx4l9xlxwr0pgdqzzez3k", + Weight: sdk.NewDecWithPrec(31, 2), }, { - Address: "address_3", - Weight: sdk.NewDecWithPrec(4, 1), + Address: "osmo15y8quyqq24d2xlkm6lekg5x3uqxcvf362jlq4yuayy6c4y3e9nysq8gmgg", + Weight: sdk.NewDecWithPrec(27, 2), }, } From e6db733bd1fce67c8cdb7f3daac9c656dbc9dc57 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 25 Jun 2022 17:48:59 -0400 Subject: [PATCH 16/26] fix TestAppStateDeterminism --- x/mint/simulation/genesis.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index bce40b54ccf..649fc818687 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -79,7 +79,7 @@ func RandomizedGenState(simState *module.SimulationState) { simState.AppParams.GetOrGenerate( simState.Cdc, weightedDevRewardReceiversKey, &weightedDevRewardReceivers, simState.Rand, func(r *rand.Rand) { - addressCount := r.Intn(5) + addressCount := max(1, r.Intn(5)) randomDevRewardProportions := genProportionsAddingUpToOne(simState.Rand, addressCount) for i := 0; i < addressCount; i++ { @@ -149,6 +149,10 @@ func genReductionPeriodInEpochs(r *rand.Rand) int64 { // genProportionsAddingUpToOne reurns a slice with numberOfProportions that add up to 1. func genProportionsAddingUpToOne(r *rand.Rand, numberOfProportions int) []sdk.Dec { + if numberOfProportions < 0 { + panic("numberOfProportions must be greater than or equal to 1") + } + proportions := make([]sdk.Dec, numberOfProportions) // We start by estimating the first proportion with a limit of 1. @@ -182,3 +186,10 @@ func randBytes(r *rand.Rand, length int) ([]byte, error) { } return result, err } + +func max(a, b int) int { + if a > b { + return a + } + return b +} From d05e2f697c689b444997c2ba6b26b035128c7b90 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 25 Jun 2022 18:35:46 -0400 Subject: [PATCH 17/26] fix TestAppStateDeterminism --- x/mint/simulation/genesis.go | 64 ++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index 649fc818687..b79eed191ca 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -66,38 +66,13 @@ func RandomizedGenState(simState *module.SimulationState) { var distributionProportions types.DistributionProportions simState.AppParams.GetOrGenerate( simState.Cdc, distributionProportionsKey, &distributionProportions, simState.Rand, - func(r *rand.Rand) { - randomDisitributionProportions := genProportionsAddingUpToOne(simState.Rand, 4) - distributionProportions.Staking = randomDisitributionProportions[0] - distributionProportions.PoolIncentives = randomDisitributionProportions[1] - distributionProportions.DeveloperRewards = randomDisitributionProportions[2] - distributionProportions.CommunityPool = randomDisitributionProportions[3] - }, + func(r *rand.Rand) { distributionProportions = genDistributionProportions(r) }, ) var weightedDevRewardReceivers []types.WeightedAddress simState.AppParams.GetOrGenerate( simState.Cdc, weightedDevRewardReceiversKey, &weightedDevRewardReceivers, simState.Rand, - func(r *rand.Rand) { - addressCount := max(1, r.Intn(5)) - randomDevRewardProportions := genProportionsAddingUpToOne(simState.Rand, addressCount) - - for i := 0; i < addressCount; i++ { - addressLength := possibleBech32AddrLengths[r.Intn(len(possibleBech32AddrLengths))] - addressRandBytes, err := randBytes(r, int(addressLength)) - if err != nil { - panic(err) - } - address, err := sdk.Bech32ifyAddressBytes("osmo", addressRandBytes) - if err != nil { - panic(err) - } - weightedDevRewardReceivers = append(weightedDevRewardReceivers, types.WeightedAddress{ - Address: address, - Weight: randomDevRewardProportions[i], - }) - } - }, + func(r *rand.Rand) { weightedDevRewardReceivers = genWeightedDevRewardReceivers(simState.Rand) }, ) var mintintRewardsDistributionStartEpoch int64 @@ -136,7 +111,7 @@ func genEpochProvisions(r *rand.Rand) sdk.Dec { } func genEpochIdentifier(r *rand.Rand) string { - return epochIdentifierOptions[rand.Intn(len(epochIdentifierOptions))] + return "day" } func genReductionFactor(r *rand.Rand) sdk.Dec { @@ -170,6 +145,39 @@ func genProportionsAddingUpToOne(r *rand.Rand, numberOfProportions int) []sdk.De return proportions } +func genDistributionProportions(r *rand.Rand) types.DistributionProportions { + distributionProportions := types.DistributionProportions{} + randomDisitributionProportions := genProportionsAddingUpToOne(r, 4) + distributionProportions.Staking = randomDisitributionProportions[0] + distributionProportions.PoolIncentives = randomDisitributionProportions[1] + distributionProportions.DeveloperRewards = randomDisitributionProportions[2] + distributionProportions.CommunityPool = randomDisitributionProportions[3] + return distributionProportions +} + +func genWeightedDevRewardReceivers(r *rand.Rand) []types.WeightedAddress { + var weightedDevRewardReceivers []types.WeightedAddress + addressCount := max(1, r.Intn(5)) + randomDevRewardProportions := genProportionsAddingUpToOne(r, addressCount) + + for i := 0; i < addressCount; i++ { + addressLength := possibleBech32AddrLengths[r.Intn(len(possibleBech32AddrLengths))] + addressRandBytes, err := randBytes(r, int(addressLength)) + if err != nil { + panic(err) + } + address, err := sdk.Bech32ifyAddressBytes("osmo", addressRandBytes) + if err != nil { + panic(err) + } + weightedDevRewardReceivers = append(weightedDevRewardReceivers, types.WeightedAddress{ + Address: address, + Weight: randomDevRewardProportions[i], + }) + } + return weightedDevRewardReceivers +} + func genMintintRewardsDistributionStartEpoch(r *rand.Rand) int64 { return int64(r.Intn(maxInt64)) } From a667c99b31d37d3c1682a8aa706f1b0fb8fce5a4 Mon Sep 17 00:00:00 2001 From: Roman Date: Sat, 25 Jun 2022 18:43:03 -0400 Subject: [PATCH 18/26] change expected epochIdentifier to day --- x/mint/simulation/genesis_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index fcc4ac5a56f..bc4a1c13678 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -44,7 +44,7 @@ func TestRandomizedGenState(t *testing.T) { const ( expectedEpochProvisionsStr = "7913048388940673156" - expectedEpochIdentifier = "week" + expectedEpochIdentifier = "day" expectedReductionFactorStr = "0.6" expectedReductionPeriodInEpochs = int64(9171281239991390334) From 87fd6d36e1ef100bce31ca7213e9364fbc73200e Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 29 Jun 2022 15:53:52 -0400 Subject: [PATCH 19/26] address Dev's comments to hardcode certain parameters --- x/mint/simulation/export_test.go | 10 ++ x/mint/simulation/genesis.go | 147 +++++++++++++++--------------- x/mint/simulation/genesis_test.go | 54 ++--------- 3 files changed, 88 insertions(+), 123 deletions(-) create mode 100644 x/mint/simulation/export_test.go diff --git a/x/mint/simulation/export_test.go b/x/mint/simulation/export_test.go new file mode 100644 index 00000000000..4e7719ebdaf --- /dev/null +++ b/x/mint/simulation/export_test.go @@ -0,0 +1,10 @@ +package simulation + +const ( + ExpectedEpochIdentifier = epochIdentifier +) + +var ( + ExpectedDistributionProportions = distributionProportions + ExpectedDevRewardReceivers = weightedDevRewardReceivers +) diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index b79eed191ca..47cbe136b39 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -29,12 +29,83 @@ const ( weightedDevRewardReceiversKey = "weighted_developer_rewards_receivers" mintingRewardsDistributionStartEpochKey = "minting_rewards_distribution_start_epoch" - maxInt64 = int(^uint(0) >> 1) + epochIdentifier = "day" + maxInt64 = int(^uint(0) >> 1) ) var ( epochIdentifierOptions = []string{"day", "week"} possibleBech32AddrLengths = []uint8{20, 32} + + // Taken from: // https://github.com/osmosis-labs/networks/raw/main/osmosis-1/genesis.json + distributionProportions = types.DistributionProportions{ + Staking: sdk.NewDecWithPrec(25, 2), + PoolIncentives: sdk.NewDecWithPrec(45, 2), + DeveloperRewards: sdk.NewDecWithPrec(25, 2), + CommunityPool: sdk.NewDecWithPrec(05, 2), + } + weightedDevRewardReceivers = []types.WeightedAddress{ + { + Address: "osmo14kjcwdwcqsujkdt8n5qwpd8x8ty2rys5rjrdjj", + Weight: sdk.NewDecWithPrec(2887, 4), + }, + { + Address: "osmo1gw445ta0aqn26suz2rg3tkqfpxnq2hs224d7gq", + Weight: sdk.NewDecWithPrec(229, 3), + }, + { + Address: "osmo13lt0hzc6u3htsk7z5rs6vuurmgg4hh2ecgxqkf", + Weight: sdk.NewDecWithPrec(1625, 4), + }, + { + Address: "osmo1kvc3he93ygc0us3ycslwlv2gdqry4ta73vk9hu", + Weight: sdk.NewDecWithPrec(109, 3), + }, + { + Address: "osmo19qgldlsk7hdv3ddtwwpvzff30pxqe9phq9evxf", + Weight: sdk.NewDecWithPrec(995, 3).Quo(sdk.NewDec(10)), // 0.0995 + }, + { + Address: "osmo19fs55cx4594een7qr8tglrjtt5h9jrxg458htd", + Weight: sdk.NewDecWithPrec(6, 1).Quo(sdk.NewDec(10)), // 0.06 + }, + { + Address: "osmo1ssp6px3fs3kwreles3ft6c07mfvj89a544yj9k", + Weight: sdk.NewDecWithPrec(15, 2).Quo(sdk.NewDec(10)), // 0.015 + }, + { + Address: "osmo1c5yu8498yzqte9cmfv5zcgtl07lhpjrj0skqdx", + Weight: sdk.NewDecWithPrec(1, 1).Quo(sdk.NewDec(10)), // 0.01 + }, + { + Address: "osmo1yhj3r9t9vw7qgeg22cehfzj7enwgklw5k5v7lj", + Weight: sdk.NewDecWithPrec(75, 2).Quo(sdk.NewDec(100)), // 0.0075 + }, + { + Address: "osmo18nzmtyn5vy5y45dmcdnta8askldyvehx66lqgm", + Weight: sdk.NewDecWithPrec(7, 1).Quo(sdk.NewDec(100)), // 0.007 + }, + { + Address: "osmo1z2x9z58cg96ujvhvu6ga07yv9edq2mvkxpgwmc", + Weight: sdk.NewDecWithPrec(5, 1).Quo(sdk.NewDec(100)), // 0.005 + }, + { + Address: "osmo1tvf3373skua8e6480eyy38avv8mw3hnt8jcxg9", + Weight: sdk.NewDecWithPrec(25, 2).Quo(sdk.NewDec(100)), // 0.0025 + }, + { + Address: "osmo1zs0txy03pv5crj2rvty8wemd3zhrka2ne8u05n", + Weight: sdk.NewDecWithPrec(25, 2).Quo(sdk.NewDec(100)), // 0.0025 + }, + { + Address: "osmo1djgf9p53n7m5a55hcn6gg0cm5mue4r5g3fadee", + Weight: sdk.NewDecWithPrec(1, 1).Quo(sdk.NewDec(100)), // 0.001 + }, + { + Address: "osmo1488zldkrn8xcjh3z40v2mexq7d088qkna8ceze", + Weight: sdk.NewDecWithPrec(8, 1).Quo(sdk.NewDec(1000)), // 0.0008 + }, + } ) // RandomizedGenState generates a random GenesisState for mint. @@ -45,12 +116,6 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { epochProvisions = genEpochProvisions(r) }, ) - var epochIdentifier string - simState.AppParams.GetOrGenerate( - simState.Cdc, epochIdentifierKey, &epochIdentifier, simState.Rand, - func(r *rand.Rand) { epochIdentifier = genEpochIdentifier(r) }, - ) - var reductionFactor sdk.Dec simState.AppParams.GetOrGenerate( simState.Cdc, reductionFactorKey, &reductionFactor, simState.Rand, @@ -63,18 +128,6 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { reductionPeriodInEpochs = genReductionPeriodInEpochs(r) }, ) - var distributionProportions types.DistributionProportions - simState.AppParams.GetOrGenerate( - simState.Cdc, distributionProportionsKey, &distributionProportions, simState.Rand, - func(r *rand.Rand) { distributionProportions = genDistributionProportions(r) }, - ) - - var weightedDevRewardReceivers []types.WeightedAddress - simState.AppParams.GetOrGenerate( - simState.Cdc, weightedDevRewardReceiversKey, &weightedDevRewardReceivers, simState.Rand, - func(r *rand.Rand) { weightedDevRewardReceivers = genWeightedDevRewardReceivers(simState.Rand) }, - ) - var mintintRewardsDistributionStartEpoch int64 simState.AppParams.GetOrGenerate( simState.Cdc, mintingRewardsDistributionStartEpochKey, &mintintRewardsDistributionStartEpoch, simState.Rand, @@ -122,62 +175,6 @@ func genReductionPeriodInEpochs(r *rand.Rand) int64 { return int64(r.Intn(maxInt64)) } -// genProportionsAddingUpToOne reurns a slice with numberOfProportions that add up to 1. -func genProportionsAddingUpToOne(r *rand.Rand, numberOfProportions int) []sdk.Dec { - if numberOfProportions < 0 { - panic("numberOfProportions must be greater than or equal to 1") - } - - proportions := make([]sdk.Dec, numberOfProportions) - - // We start by estimating the first proportion with a limit of 1. - // Then, subtract the first proportion from 1 to esimate - // the remaining ratio to be used as upper bound for next randomization. - // Next, repeat the randomization process for the remaining proportions. - remainingRatio := sdk.OneDec() - for i := 0; i < numberOfProportions-1; i++ { - // We add 0.01 to make sure that zero is never returned because a proportion of 0 is deemed invalid. - nextProportion := sdk.MustNewDecFromStr("0.01").Add(sdk.NewDecWithPrec(int64(r.Intn(int(remainingRatio.MulInt64(9).TruncateInt64()))), 1)) - proportions[i] = nextProportion - remainingRatio = remainingRatio.Sub(nextProportion) - } - proportions[numberOfProportions-1] = remainingRatio - return proportions -} - -func genDistributionProportions(r *rand.Rand) types.DistributionProportions { - distributionProportions := types.DistributionProportions{} - randomDisitributionProportions := genProportionsAddingUpToOne(r, 4) - distributionProportions.Staking = randomDisitributionProportions[0] - distributionProportions.PoolIncentives = randomDisitributionProportions[1] - distributionProportions.DeveloperRewards = randomDisitributionProportions[2] - distributionProportions.CommunityPool = randomDisitributionProportions[3] - return distributionProportions -} - -func genWeightedDevRewardReceivers(r *rand.Rand) []types.WeightedAddress { - var weightedDevRewardReceivers []types.WeightedAddress - addressCount := max(1, r.Intn(5)) - randomDevRewardProportions := genProportionsAddingUpToOne(r, addressCount) - - for i := 0; i < addressCount; i++ { - addressLength := possibleBech32AddrLengths[r.Intn(len(possibleBech32AddrLengths))] - addressRandBytes, err := randBytes(r, int(addressLength)) - if err != nil { - panic(err) - } - address, err := sdk.Bech32ifyAddressBytes("osmo", addressRandBytes) - if err != nil { - panic(err) - } - weightedDevRewardReceivers = append(weightedDevRewardReceivers, types.WeightedAddress{ - Address: address, - Weight: randomDevRewardProportions[i], - }) - } - return weightedDevRewardReceivers -} - func genMintintRewardsDistributionStartEpoch(r *rand.Rand) int64 { return int64(r.Intn(maxInt64)) } diff --git a/x/mint/simulation/genesis_test.go b/x/mint/simulation/genesis_test.go index bc4a1c13678..130760e45c8 100644 --- a/x/mint/simulation/genesis_test.go +++ b/x/mint/simulation/genesis_test.go @@ -44,49 +44,24 @@ func TestRandomizedGenState(t *testing.T) { const ( expectedEpochProvisionsStr = "7913048388940673156" - expectedEpochIdentifier = "day" expectedReductionFactorStr = "0.6" expectedReductionPeriodInEpochs = int64(9171281239991390334) - expectedStakingDistributionProportion = "0.51" - expectedPoolIncentivesDistributionProportion = "0.01" - expectedDeveloperRewardsDistributionProportion = "0.31" - expectedCommunityPoolDistributionProportion = "0.17" + expectedMintintRewardsDistributionStartEpoch = int64(14997548954463330) - expectedMintintRewardsDistributionStartEpoch = int64(8326275384461735988) - - expectedReductionStartedEpoch = int64(8272964973000937025) + expectedReductionStartedEpoch = int64(6009281777831789783) expectedNextEpochProvisionsStr = "3956524194470336578" expectedDenom = sdk.DefaultBondDenom ) - var expectedWeightedAddresses []types.WeightedAddress = []types.WeightedAddress{ - { - Address: "osmo10h0yjph5cs87jlrn0d7g7u4dmftufg57mute7qhn6zla86ha3ems0yhsdm", - Weight: sdk.NewDecWithPrec(21, 2), - }, - { - Address: "osmo1fcjs4czqdfcm8vpx0835kvxgh30hx8s4p8fk53", - Weight: sdk.NewDecWithPrec(21, 2), - }, - { - Address: "osmo1npjxgta2789ju4v063ewwuyv6wpz84x8gscg7hx4l9xlxwr0pgdqzzez3k", - Weight: sdk.NewDecWithPrec(31, 2), - }, - { - Address: "osmo15y8quyqq24d2xlkm6lekg5x3uqxcvf362jlq4yuayy6c4y3e9nysq8gmgg", - Weight: sdk.NewDecWithPrec(27, 2), - }, - } - // Epoch provisions from Minter. epochProvisionsDec, err := sdk.NewDecFromStr(expectedEpochProvisionsStr) require.NoError(t, err) require.Equal(t, epochProvisionsDec, mintGenesis.Minter.EpochProvisions) // Epoch identifier. - require.Equal(t, expectedEpochIdentifier, mintGenesis.Params.EpochIdentifier) + require.Equal(t, simulation.ExpectedEpochIdentifier, mintGenesis.Params.EpochIdentifier) // Reduction factor. reductionFactorDec, err := sdk.NewDecFromStr(expectedReductionFactorStr) @@ -96,28 +71,11 @@ func TestRandomizedGenState(t *testing.T) { // Reduction perion in epochs. require.Equal(t, expectedReductionPeriodInEpochs, mintGenesis.Params.ReductionPeriodInEpochs) - // Staking rewards distribution proportion. - stakingDistributionProportionDec, err := sdk.NewDecFromStr(expectedStakingDistributionProportion) - require.NoError(t, err) - require.Equal(t, stakingDistributionProportionDec, mintGenesis.Params.DistributionProportions.Staking) - - // Pool incentives distribution proportion. - poolIncentivesDistributionProportionDec, err := sdk.NewDecFromStr(expectedPoolIncentivesDistributionProportion) - require.NoError(t, err) - require.Equal(t, poolIncentivesDistributionProportionDec, mintGenesis.Params.DistributionProportions.PoolIncentives) - - // Developer rewards distribution proportion. - developerRewardsDistributionProportionDec, err := sdk.NewDecFromStr(expectedDeveloperRewardsDistributionProportion) - require.NoError(t, err) - require.Equal(t, developerRewardsDistributionProportionDec, mintGenesis.Params.DistributionProportions.DeveloperRewards) - - // Community pool distribution proportion. - communityPoolDistributionProportionDec, err := sdk.NewDecFromStr(expectedCommunityPoolDistributionProportion) - require.NoError(t, err) - require.Equal(t, communityPoolDistributionProportionDec, mintGenesis.Params.DistributionProportions.CommunityPool) + // Distribution proportions. + require.Equal(t, simulation.ExpectedDistributionProportions, mintGenesis.Params.DistributionProportions) // Weighted developer rewards receivers. - require.Equal(t, expectedWeightedAddresses, mintGenesis.Params.WeightedDeveloperRewardsReceivers) + require.Equal(t, simulation.ExpectedDevRewardReceivers, mintGenesis.Params.WeightedDeveloperRewardsReceivers) // Minting rewards distribution start epoch require.Equal(t, expectedMintintRewardsDistributionStartEpoch, mintGenesis.Params.MintingRewardsDistributionStartEpoch) From a785de13eebcfd91b6807458fbcf8ffaff105bb5 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 29 Jun 2022 12:54:15 -0700 Subject: [PATCH 20/26] Update x/mint/types/minter_test.go Co-authored-by: Dev Ojha --- x/mint/types/minter_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/mint/types/minter_test.go b/x/mint/types/minter_test.go index e86dda30650..cb841155a9f 100644 --- a/x/mint/types/minter_test.go +++ b/x/mint/types/minter_test.go @@ -44,7 +44,7 @@ func BenchmarkNextEpochProvisions(b *testing.B) { } } -func TestValidate(t *testing.T) { +func TestMinterValidate(t *testing.T) { testcases := []struct { name string From edaa64d96404be2b993cf83bf5e85a52d4c76969 Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 29 Jun 2022 17:04:39 -0400 Subject: [PATCH 21/26] remove unused variable --- x/mint/simulation/genesis.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index 47cbe136b39..57611c7d2b4 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -34,7 +34,6 @@ const ( ) var ( - epochIdentifierOptions = []string{"day", "week"} possibleBech32AddrLengths = []uint8{20, 32} // Taken from: // https://github.com/osmosis-labs/networks/raw/main/osmosis-1/genesis.json From adc46b070dedea03fbafe6d30952fe6ad030f0b6 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 30 Jun 2022 07:06:35 -0700 Subject: [PATCH 22/26] Update proto/osmosis/mint/v1beta1/genesis.proto Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com> --- proto/osmosis/mint/v1beta1/genesis.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/osmosis/mint/v1beta1/genesis.proto b/proto/osmosis/mint/v1beta1/genesis.proto index 38b8dfd5874..80ebfa46bc7 100644 --- a/proto/osmosis/mint/v1beta1/genesis.proto +++ b/proto/osmosis/mint/v1beta1/genesis.proto @@ -14,7 +14,7 @@ message GenesisState { // params defines all the paramaters of the mint module. Params params = 2 [ (gogoproto.nullable) = false ]; - // reduction_started_epoch the first epoch in which the reduction of mint + // reduction_started_epoch is the first epoch in which the reduction of mint // begins. int64 reduction_started_epoch = 3 [ (gogoproto.moretags) = "yaml:\"reduction_started_epoch\"" ]; From 828951b2faa1fa705d4190481cceb59fb6031150 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 30 Jun 2022 07:06:50 -0700 Subject: [PATCH 23/26] Update proto/osmosis/mint/v1beta1/mint.proto Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com> --- proto/osmosis/mint/v1beta1/mint.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/osmosis/mint/v1beta1/mint.proto b/proto/osmosis/mint/v1beta1/mint.proto index 894f853a8fa..ebbca045887 100644 --- a/proto/osmosis/mint/v1beta1/mint.proto +++ b/proto/osmosis/mint/v1beta1/mint.proto @@ -95,7 +95,7 @@ message Params { // denoms and how much. DistributionProportions distribution_proportions = 6 [ (gogoproto.nullable) = false ]; - // weighted_developer_rewards_receivers the address to receive developer + // weighted_developer_rewards_receivers is the address to receive developer // rewards with weights assignedt to each address. The final amount that each // address receives is: epoch_provisions * // distribution_proportions.developer_rewards * Address's Weight. From 8c873a3fc64534bfc69a696da22ebf32c3940bc2 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 30 Jun 2022 07:07:11 -0700 Subject: [PATCH 24/26] Update x/mint/types/hooks.go Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com> --- x/mint/types/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/mint/types/hooks.go b/x/mint/types/hooks.go index 217b7818da9..1cffa07ccd4 100644 --- a/x/mint/types/hooks.go +++ b/x/mint/types/hooks.go @@ -20,7 +20,7 @@ func NewMultiMintHooks(hooks ...MintHooks) MultiMintHooks { return hooks } -// AfterDistributeMintedCoin is a hook that runs after minter mints and distributes coins +// AfterDistributeMintedCoin is a hook that runs after minter mints and distributes coins // at the beginning of each epoch. func (h MultiMintHooks) AfterDistributeMintedCoin(ctx sdk.Context, mintedCoin sdk.Coin) { for i := range h { From 536c279961e77c99f0974139d86c86cb6c9dbde8 Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 30 Jun 2022 10:11:10 -0400 Subject: [PATCH 25/26] make prot-all --- go.mod | 2 +- proto/osmosis/superfluid/query.proto | 19 ++- x/mint/types/genesis.pb.go | 2 +- x/mint/types/mint.pb.go | 4 +- x/superfluid/types/query.pb.go | 206 ++++++++++++++------------- 5 files changed, 120 insertions(+), 113 deletions(-) diff --git a/go.mod b/go.mod index 192e7445dee..c2c941e6294 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/CosmWasm/wasmd v0.24.0 github.com/cosmos/cosmos-proto v1.0.0-alpha7 - github.com/cosmos/cosmos-sdk v0.45.5 + github.com/cosmos/cosmos-sdk v0.45.6 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/iavl v0.17.3 github.com/cosmos/ibc-go/v3 v3.0.0 diff --git a/proto/osmosis/superfluid/query.proto b/proto/osmosis/superfluid/query.proto index 65c18b34b05..aac8702d5b4 100644 --- a/proto/osmosis/superfluid/query.proto +++ b/proto/osmosis/superfluid/query.proto @@ -114,10 +114,12 @@ service Query { // "/osmosis/superfluid/v1beta1/superfluid_unbondings_by_validator_denom"; // } -// Returns the specified delegations for a specific delegator - rpc TotalDelegationByDelegator (QueryTotalDelegationByDelegatorRequest) returns (QueryTotalDelegationByDelegatorResponse) { - option (google.api.http).get = "/osmosis/superfluid/v1beta1/" - "total_delegation_by_delegator/{delegator_address}"; + // Returns the specified delegations for a specific delegator + rpc TotalDelegationByDelegator(QueryTotalDelegationByDelegatorRequest) + returns (QueryTotalDelegationByDelegatorResponse) { + option (google.api.http).get = + "/osmosis/superfluid/v1beta1/" + "total_delegation_by_delegator/{delegator_address}"; } } @@ -265,17 +267,14 @@ message EstimateSuperfluidDelegatedAmountByValidatorDenomResponse { // ]; // } -message QueryTotalDelegationByDelegatorRequest { - string delegator_address = 1; -} +message QueryTotalDelegationByDelegatorRequest { string delegator_address = 1; } message QueryTotalDelegationByDelegatorResponse { repeated SuperfluidDelegationRecord superfluid_delegation_records = 1 [ (gogoproto.nullable) = false ]; - repeated cosmos.staking.v1beta1.DelegationResponse delegation_response = 2 [ - (gogoproto.nullable) = false - ]; + repeated cosmos.staking.v1beta1.DelegationResponse delegation_response = 2 + [ (gogoproto.nullable) = false ]; repeated cosmos.base.v1beta1.Coin total_delegated_coins = 3 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" diff --git a/x/mint/types/genesis.pb.go b/x/mint/types/genesis.pb.go index efd1542c836..f93c2d59a1d 100644 --- a/x/mint/types/genesis.pb.go +++ b/x/mint/types/genesis.pb.go @@ -29,7 +29,7 @@ type GenesisState struct { Minter Minter `protobuf:"bytes,1,opt,name=minter,proto3" json:"minter"` // params defines all the paramaters of the mint module. Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` - // reduction_started_epoch the first epoch in which the reduction of mint + // reduction_started_epoch is the first epoch in which the reduction of mint // begins. ReductionStartedEpoch int64 `protobuf:"varint,3,opt,name=reduction_started_epoch,json=reductionStartedEpoch,proto3" json:"reduction_started_epoch,omitempty" yaml:"reduction_started_epoch"` } diff --git a/x/mint/types/mint.pb.go b/x/mint/types/mint.pb.go index 2753332b152..954fdc0fc56 100644 --- a/x/mint/types/mint.pb.go +++ b/x/mint/types/mint.pb.go @@ -166,7 +166,7 @@ var xxx_messageInfo_DistributionProportions proto.InternalMessageInfo // Params holds parameters for the x/mint module. type Params struct { - // mint_denom the denom of the coin to mint. + // mint_denom is the denom of the coin to mint. MintDenom string `protobuf:"bytes,1,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` // genesis_epoch_provisions epoch provisions from the first epoch. GenesisEpochProvisions github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=genesis_epoch_provisions,json=genesisEpochProvisions,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"genesis_epoch_provisions" yaml:"genesis_epoch_provisions"` @@ -182,7 +182,7 @@ type Params struct { // denom. In other words, defines which stakeholders will receive the minted // denoms and how much. DistributionProportions DistributionProportions `protobuf:"bytes,6,opt,name=distribution_proportions,json=distributionProportions,proto3" json:"distribution_proportions"` - // weighted_developer_rewards_receivers the address to receive developer + // weighted_developer_rewards_receivers is the address to receive developer // rewards with weights assignedt to each address. The final amount that each // address receives is: epoch_provisions * // distribution_proportions.developer_rewards * Address's Weight. diff --git a/x/superfluid/types/query.pb.go b/x/superfluid/types/query.pb.go index 9c911b9637e..db7120f64d1 100644 --- a/x/superfluid/types/query.pb.go +++ b/x/superfluid/types/query.pb.go @@ -1386,105 +1386,111 @@ func init() { func init() { proto.RegisterFile("osmosis/superfluid/query.proto", fileDescriptor_e3d9448e4ed3943f) } var fileDescriptor_e3d9448e4ed3943f = []byte{ - // 1555 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0xcd, 0x6f, 0xd4, 0x46, - 0x1b, 0xcf, 0x24, 0x90, 0xc0, 0x83, 0x04, 0xc9, 0xc0, 0xfb, 0xb2, 0x18, 0xd8, 0x80, 0x03, 0xc9, - 0x36, 0x80, 0x5d, 0x42, 0x03, 0x29, 0x2d, 0x88, 0x0d, 0x01, 0x1a, 0x29, 0x34, 0x74, 0x21, 0x41, - 0xea, 0x87, 0x2c, 0xef, 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0x77, 0xea, 0x20, 0xf9, 0xf6, 0x35, 0xb2, 0xea, 0x99, 0x6b, 0xba, 0x45, 0x6c, 0x57, 0xab, 0x85, - 0x5c, 0x22, 0x19, 0x53, 0x49, 0x2e, 0x2e, 0xd2, 0x9a, 0x73, 0x21, 0x14, 0x8a, 0x6b, 0xae, 0x38, - 0x0d, 0xa3, 0x94, 0x73, 0x52, 0xe8, 0xf2, 0x3d, 0x04, 0x07, 0x23, 0x7c, 0xf3, 0xb6, 0x4b, 0x1a, - 0x35, 0x62, 0x98, 0x7a, 0xa3, 0x59, 0xac, 0x54, 0x1c, 0xcf, 0x76, 0xe7, 0xed, 0x1b, 0x4e, 0x32, - 0x12, 0xbc, 0x07, 0xb6, 0xac, 0xe9, 0x96, 0xa6, 0x1b, 0x46, 0x23, 0xd7, 0xcf, 0x08, 0x43, 0x6b, - 0xba, 0x55, 0x34, 0x8c, 0x86, 0x4f, 0xaa, 0xea, 0x5e, 0x95, 0x68, 0xa6, 0x91, 0x1b, 0x38, 0x80, - 0x0a, 0x9b, 0x4a, 0x43, 0xec, 0x7d, 0xde, 0xc0, 0x39, 0x18, 0xf2, 0x25, 0x08, 0xa5, 0xb9, 0x4d, - 0x5c, 0x48, 0xbc, 0xca, 0x37, 0x21, 0x5f, 0xb4, 0xac, 0x04, 0x1f, 0x82, 0x1c, 0xfa, 0xf5, 0x11, - 0x55, 0xb6, 0x88, 0xc7, 0xb8, 0xc2, 0xdb, 0x40, 0xf1, 0xdb, 0x40, 0xe1, 0x37, 0x85, 0x68, 0x03, - 0xe5, 0x8a, 0x5e, 0x0d, 0xca, 0xb0, 0x14, 0x93, 0x94, 0x7f, 0x40, 0x30, 0x9a, 0x6a, 0x4a, 0xe4, - 0xe2, 0x3a, 0x6c, 0xd1, 0xc5, 0x99, 0x28, 0x8e, 0xe9, 0xec, 0xe2, 0x48, 0x09, 0x9e, 0x28, 0x97, - 0x50, 0x19, 0xbe, 0xd4, 0x02, 0xa2, 0x9f, 0x81, 0x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, 0xdf, 0xf7, 0xee, 0x74, 0x6c, 0x16, 0x14, 0x96, - 0x8f, 0x59, 0x7a, 0x99, 0x86, 0x6e, 0xac, 0x9d, 0x52, 0x6f, 0xc5, 0x7d, 0x61, 0xe3, 0x61, 0x79, - 0x90, 0xfd, 0xcd, 0x7d, 0xe2, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x21, 0x0e, 0xbf, 0x3e, - 0x18, 0x00, 0x00, + // 1660 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x59, 0x4b, 0x6c, 0xd4, 0xc6, + 0x1b, 0xcf, 0x24, 0x21, 0x81, 0x0f, 0x09, 0x92, 0x01, 0xfe, 0x09, 0x06, 0x36, 0xe0, 0x84, 0x24, + 0xff, 0x00, 0x76, 0x09, 0x0d, 0xa4, 0x50, 0x10, 0x1b, 0x02, 0x34, 0x52, 0xd2, 0xd0, 0x25, 0x09, + 0x52, 0x1f, 0xb2, 0x9c, 0xf5, 0xb0, 0x58, 0xf1, 0xda, 0x9b, 0x1d, 0x6f, 0xca, 0x0a, 0xa1, 0x4a, + 0x54, 0x95, 0x8a, 0x7a, 0x68, 0x25, 0x4e, 0x3d, 0xb5, 0x57, 0x7a, 0xe8, 0xb5, 0x97, 0x5e, 0xaa, + 0x5e, 0x90, 0xaa, 0x4a, 0x48, 0xbd, 0x54, 0x3d, 0x40, 0x05, 0x3d, 0xb6, 0x97, 0x1e, 0xdb, 0x4b, + 0xe5, 0x99, 0xf1, 0x63, 0xb3, 0x7e, 0x6c, 0x02, 0x85, 0x9e, 0xb2, 0xf6, 0xf7, 0xfc, 0x7d, 0xaf, + 0x99, 0xcf, 0x81, 0x9c, 0x43, 0xcb, 0x0e, 0x35, 0xa9, 0x4a, 0x6b, 0x15, 0x52, 0xbd, 0x6e, 0xd5, + 0x4c, 0x43, 0x5d, 0xad, 0x91, 0x6a, 0x5d, 0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 0x6b, 0xba, 0xa5, 0xe9, 0x86, 0x51, 0xed, 0x6f, 0x67, 0x84, 0xee, 0x35, + 0xdd, 0xca, 0x1b, 0x46, 0xd5, 0x23, 0x95, 0xf4, 0x5a, 0x89, 0x68, 0xa6, 0xd1, 0xdf, 0x71, 0x10, + 0x8d, 0x76, 0x16, 0xba, 0xd9, 0xf3, 0x8c, 0x81, 0xfb, 0xa1, 0xdb, 0x93, 0x20, 0x94, 0xf6, 0x77, + 0x72, 0x21, 0xf1, 0x28, 0xdf, 0x80, 0x5c, 0xde, 0xb2, 0x62, 0x7c, 0xf0, 0x73, 0xe8, 0xd5, 0x47, + 0x58, 0xff, 0x22, 0x1e, 0xc3, 0x0a, 0x6f, 0x00, 0xc5, 0x6b, 0x16, 0x85, 0xcf, 0x13, 0xd1, 0x03, + 0xca, 0x15, 0xbd, 0xe4, 0x97, 0x61, 0x21, 0x22, 0x29, 0x7f, 0x8f, 0x60, 0x20, 0xd1, 0x94, 0xc8, + 0xc5, 0x35, 0xd8, 0xaa, 0x8b, 0x77, 0xa2, 0x38, 0x26, 0xd2, 0x8b, 0x23, 0x21, 0x78, 0xa2, 0x5c, + 0x02, 0x65, 0xf8, 0x72, 0x03, 0x88, 0x76, 0x06, 0x62, 0x24, 0x13, 0x04, 0xf7, 0xaa, 0x01, 0xc5, + 0x39, 0x18, 0xbc, 0xe0, 0xd8, 0x36, 0x29, 0xba, 0x24, 0xce, 0xb8, 0x1f, 0xb4, 0x3e, 0xe8, 0xf6, + 0x46, 0x8b, 0x97, 0x0a, 0xc4, 0x52, 0xd1, 0xe5, 0x3d, 0xce, 0x18, 0xf2, 0xfb, 0x30, 0x94, 0x2e, + 0x2f, 0x22, 0x31, 0x0f, 0xdd, 0xc2, 0x79, 0x11, 0xf2, 0xcd, 0x05, 0xa2, 0xe0, 0x6b, 0x91, 0x07, + 0xe1, 0xd0, 0x82, 0xe3, 0xea, 0x56, 0x28, 0x32, 0x4d, 0x2c, 0x52, 0xe2, 0x43,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, 0x76, 0xc7, 0xd4, 0xfc, 0x83, 0x27, 0x39, 0xf4, 0xf0, + 0x49, 0x0e, 0xfd, 0xfa, 0x24, 0x87, 0x3e, 0x7b, 0x9a, 0x6b, 0x7b, 0xf8, 0x34, 0xd7, 0xf6, 0xf3, + 0xd3, 0x5c, 0xdb, 0xdb, 0x13, 0x91, 0x1b, 0xb0, 0x30, 0x79, 0xcc, 0xd2, 0x97, 0x69, 0x60, 0x7f, + 0xed, 0x94, 0x7a, 0x33, 0xea, 0x04, 0xbb, 0x14, 0x2f, 0x77, 0xb1, 0x7f, 0x24, 0x9d, 0xf8, 0x27, + 0x00, 0x00, 0xff, 0xff, 0x6f, 0xaa, 0xd8, 0x36, 0xc6, 0x1b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1527,6 +1533,7 @@ type QueryClient interface { // This is labeled an estimate, because the way it calculates the amount can // lead rounding errors from the true delegated amount EstimateSuperfluidDelegatedAmountByValidatorDenom(ctx context.Context, in *EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, opts ...grpc.CallOption) (*EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, error) + // Returns the specified delegations for a specific delegator TotalDelegationByDelegator(ctx context.Context, in *QueryTotalDelegationByDelegatorRequest, opts ...grpc.CallOption) (*QueryTotalDelegationByDelegatorResponse, error) } @@ -1685,6 +1692,7 @@ type QueryServer interface { // This is labeled an estimate, because the way it calculates the amount can // lead rounding errors from the true delegated amount EstimateSuperfluidDelegatedAmountByValidatorDenom(context.Context, *EstimateSuperfluidDelegatedAmountByValidatorDenomRequest) (*EstimateSuperfluidDelegatedAmountByValidatorDenomResponse, error) + // Returns the specified delegations for a specific delegator TotalDelegationByDelegator(context.Context, *QueryTotalDelegationByDelegatorRequest) (*QueryTotalDelegationByDelegatorResponse, error) } From ff383fc1f640bd1c2f902ce147659b23b751285c Mon Sep 17 00:00:00 2001 From: Roman Date: Thu, 30 Jun 2022 10:17:45 -0400 Subject: [PATCH 26/26] remove unused --- x/mint/simulation/genesis.go | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/x/mint/simulation/genesis.go b/x/mint/simulation/genesis.go index 57611c7d2b4..f11118c7943 100644 --- a/x/mint/simulation/genesis.go +++ b/x/mint/simulation/genesis.go @@ -20,8 +20,6 @@ const ( reductionFactorKey = "reduction_factor" reductionPeriodInEpochsKey = "reduction_period_in_epochs" - distributionProportionsKey = "distribution_proportions" - stakingDistributionProportionKey = "staking_distribution_proportion" poolIncentivesDistributionProportionKey = "pool_incentives_distribution_proportion" developerRewardsDistributionProportionKey = "developer_rewards_distribution_proportion" @@ -34,8 +32,6 @@ const ( ) var ( - possibleBech32AddrLengths = []uint8{20, 32} - // Taken from: // https://github.com/osmosis-labs/networks/raw/main/osmosis-1/genesis.json distributionProportions = types.DistributionProportions{ Staking: sdk.NewDecWithPrec(25, 2), @@ -162,10 +158,6 @@ func genEpochProvisions(r *rand.Rand) sdk.Dec { return sdk.NewDec(int64(r.Intn(maxInt64))) } -func genEpochIdentifier(r *rand.Rand) string { - return "day" -} - func genReductionFactor(r *rand.Rand) sdk.Dec { return sdk.NewDecWithPrec(int64(r.Intn(10)), 1) } @@ -181,19 +173,3 @@ func genMintintRewardsDistributionStartEpoch(r *rand.Rand) int64 { func genReductionStartedEpoch(r *rand.Rand) int64 { return int64(r.Intn(maxInt64)) } - -func randBytes(r *rand.Rand, length int) ([]byte, error) { - result := make([]byte, length) - n, err := r.Read(result) - if n != length { - return nil, fmt.Errorf("did not read enough bytes, read: %d, expected: %d", n, length) - } - return result, err -} - -func max(a, b int) int { - if a > b { - return a - } - return b -}