From 605b6c73d6a9706ca42648e353a1c7faa41e8084 Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger <64837895+LaurentMontBlanc@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:34:50 +0200 Subject: [PATCH] 415 add validator pop reward amount to chain params (#420) * feat: add validator pop reward as chain param * feat: add store for challenge initiator reward amount indexed by height * feat: add validator PoP reward calculation between distributions * fix: remove paralleltest lint rule due to data race --------- Signed-off-by: Lorenz Herzberger --- .golangci.yaml | 1 - app/app.go | 3 + docs/static/openapi.yml | 9 ++ proto/planetmintgo/dao/params.proto | 1 + tests/e2e/dao/pop/selection_suite.go | 2 +- x/dao/keeper/challenge.go | 16 +++ x/dao/keeper/distribution.go | 24 +++- x/dao/keeper/migrations.go | 5 + .../keeper/msg_server_distribution_result.go | 9 ++ x/dao/keeper/msg_server_init_pop.go | 3 + x/dao/keeper/msg_server_report_pop_result.go | 18 +++ x/dao/keeper/msg_server_test.go | 49 ++++++--- x/dao/keeper/params.go | 4 + x/dao/migrations/v3/params.go | 31 ++++++ x/dao/module.go | 5 +- x/dao/types/errors.go | 1 + x/dao/types/keys.go | 2 + x/dao/types/params.go | 7 +- x/dao/types/params.pb.go | 103 ++++++++++++------ 19 files changed, 239 insertions(+), 54 deletions(-) create mode 100644 x/dao/migrations/v3/params.go diff --git a/.golangci.yaml b/.golangci.yaml index 37898f4..0a27a21 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -53,7 +53,6 @@ linters: - noctx - nolintlint - nosprintfhostport - - paralleltest - perfsprint - prealloc - predeclared diff --git a/app/app.go b/app/app.go index 2315181..b26ecbe 100644 --- a/app/app.go +++ b/app/app.go @@ -999,4 +999,7 @@ func (app *App) setupUpgradeHandlers() { app.UpgradeKeeper.SetUpgradeHandler("v0.10.0", func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { return app.mm.RunMigrations(ctx, app.configurator, fromVM) }) + app.UpgradeKeeper.SetUpgradeHandler("v0.10.5", func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return app.mm.RunMigrations(ctx, app.configurator, fromVM) + }) } diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 88419cc..94ce6b2 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -47048,6 +47048,9 @@ paths: tx_gas_limit: type: string format: uint64 + validator_pop_reward: + type: string + format: uint64 description: >- QueryParamsResponse is response type for the Query/Params RPC method. @@ -76722,6 +76725,9 @@ definitions: tx_gas_limit: type: string format: uint64 + validator_pop_reward: + type: string + format: uint64 description: Params defines the parameters for the module. planetmintgo.dao.QueryAllRedeemClaimResponse: type: object @@ -76997,6 +77003,9 @@ definitions: tx_gas_limit: type: string format: uint64 + validator_pop_reward: + type: string + format: uint64 description: QueryParamsResponse is response type for the Query/Params RPC method. planetmintgo.dao.QueryRedeemClaimByLiquidTxHashResponse: type: object diff --git a/proto/planetmintgo/dao/params.proto b/proto/planetmintgo/dao/params.proto index 4aa40ed..b80f881 100644 --- a/proto/planetmintgo/dao/params.proto +++ b/proto/planetmintgo/dao/params.proto @@ -25,4 +25,5 @@ message Params { int64 mqtt_response_timeout = 14; string claim_address = 15; uint64 tx_gas_limit = 16; + uint64 validator_pop_reward = 17; } diff --git a/tests/e2e/dao/pop/selection_suite.go b/tests/e2e/dao/pop/selection_suite.go index 0b001fb..86129db 100644 --- a/tests/e2e/dao/pop/selection_suite.go +++ b/tests/e2e/dao/pop/selection_suite.go @@ -196,7 +196,7 @@ func (s *SelectionE2ETestSuite) VerifyTokens(token string) { }) s.Require().NoError(err) assert.Contains(s.T(), out.String(), token) - assert.Equal(s.T(), "amount: \"17979452050\"\ndenom: "+token+"\n", out.String()) // Total supply 2 * 7990867578 (total supply) + 1 * 1997716894 (challenger) = 17979452050 + assert.Equal(s.T(), "amount: \"18279452050\"\ndenom: "+token+"\n", out.String()) // Total supply 2 * 7990867578 (total supply) + 1 * 1997716894 (challenger) + 3 * 100000000 (validator) = 17979452050 out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{ machines[0].address, diff --git a/x/dao/keeper/challenge.go b/x/dao/keeper/challenge.go index 39ea3a9..37f8832 100644 --- a/x/dao/keeper/challenge.go +++ b/x/dao/keeper/challenge.go @@ -69,3 +69,19 @@ func (k Keeper) GetChallenges(ctx sdk.Context) (challenges []types.Challenge, er } return } + +func (k Keeper) storeChallangeInitiatorReward(ctx sdk.Context, height int64, amount uint64) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PoPInitiatorReward)) + appendValue := util.SerializeUint64(amount) + store.Set(util.SerializeInt64(height), appendValue) +} + +func (k Keeper) getChallengeInitiatorReward(ctx sdk.Context, height int64) (amount uint64, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.PoPInitiatorReward)) + amountBytes := store.Get(util.SerializeInt64(height)) + if amountBytes == nil { + return 0, false + } + amount = util.DeserializeUint64(amountBytes) + return amount, true +} diff --git a/x/dao/keeper/distribution.go b/x/dao/keeper/distribution.go index b21ac79..d483186 100644 --- a/x/dao/keeper/distribution.go +++ b/x/dao/keeper/distribution.go @@ -48,15 +48,35 @@ func (k Keeper) ComputeDistribution(ctx sdk.Context, lastReissuance int64, block distribution.StrategicAddr = k.GetParams(ctx).DistributionAddressStrategic distribution.PopAddr = k.GetParams(ctx).DistributionAddressPop - distribution.DaoAmount = util.UintValueToRDDLTokenString(uint64(float64(amount) * types.PercentageDao)) + // PoP rewards subtracted from DaoAmount and added to PoPAmount for later distribution + validatorPoPRewards, err := k.accumulateValidatorPoPRewardsForDistribution(ctx, lastReissuance, blockHeight) + if err != nil { + util.GetAppLogger().Error(ctx, "error calculating Validator PoP rewards from height %v to %v", lastReissuance, blockHeight) + } + + distribution.DaoAmount = util.UintValueToRDDLTokenString(uint64(float64(amount)*types.PercentageDao) - validatorPoPRewards) distribution.EarlyInvAmount = util.UintValueToRDDLTokenString(uint64(float64(amount) * types.PercentageEarlyInvestor)) distribution.InvestorAmount = util.UintValueToRDDLTokenString(uint64(float64(amount) * types.PercentageInvestor)) distribution.StrategicAmount = util.UintValueToRDDLTokenString(uint64(float64(amount) * types.PercentageStrategic)) - distribution.PopAmount = util.UintValueToRDDLTokenString(uint64(float64(amount) * types.PercentagePop)) + distribution.PopAmount = util.UintValueToRDDLTokenString(uint64(float64(amount)*types.PercentagePop) + validatorPoPRewards) return distribution } +func (k Keeper) accumulateValidatorPoPRewardsForDistribution(ctx sdk.Context, firstPop int64, lastPop int64) (amount uint64, err error) { + challenges, err := k.GetChallengeRange(ctx, firstPop, lastPop) + if err != nil { + return 0, err + } + for _, challenge := range challenges { + reward, found := k.getChallengeInitiatorReward(ctx, challenge.GetHeight()) + if found { + amount += reward + } + } + return amount, nil +} + func getUint64FromTxString(ctx sdk.Context, tx string) (amount uint64, err error) { subStrings := strings.Split(tx, " ") if len(subStrings) < 3 { diff --git a/x/dao/keeper/migrations.go b/x/dao/keeper/migrations.go index bb4862e..73948b7 100644 --- a/x/dao/keeper/migrations.go +++ b/x/dao/keeper/migrations.go @@ -3,6 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" v2 "github.com/planetmint/planetmint-go/x/dao/migrations/v2" + v3 "github.com/planetmint/planetmint-go/x/dao/migrations/v3" ) // Migrator is a struct for handling in-place store migrations. @@ -19,3 +20,7 @@ func NewMigrator(keeper Keeper) Migrator { func (m Migrator) Migrate1to2(ctx sdk.Context) error { return v2.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) } + +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return v3.MigrateParams(ctx, m.keeper.storeKey, m.keeper.cdc) +} diff --git a/x/dao/keeper/msg_server_distribution_result.go b/x/dao/keeper/msg_server_distribution_result.go index e4734f8..e82e392 100644 --- a/x/dao/keeper/msg_server_distribution_result.go +++ b/x/dao/keeper/msg_server_distribution_result.go @@ -56,6 +56,15 @@ func (k msgServer) resolveStagedClaims(ctx sdk.Context, start int64, end int64) if challenge.GetSuccess() { popParticipants[challenge.Challengee] += challengeeAmt } + initiatorAddr, err := sdk.AccAddressFromHexUnsafe(challenge.Initiator) + if err != nil { + util.GetAppLogger().Error(ctx, "error converting initiator address") + } + validatorPopReward, found := k.getChallengeInitiatorReward(ctx, challenge.GetHeight()) + if !found { + util.GetAppLogger().Error(ctx, "No PoP initiator reward found for height %v", challenge.GetHeight()) + } + popParticipants[initiatorAddr.String()] += validatorPopReward } // second data structure because map iteration order is not guaranteed in GO diff --git a/x/dao/keeper/msg_server_init_pop.go b/x/dao/keeper/msg_server_init_pop.go index 870c33c..228402f 100644 --- a/x/dao/keeper/msg_server_init_pop.go +++ b/x/dao/keeper/msg_server_init_pop.go @@ -24,6 +24,9 @@ func (k msgServer) InitPop(goCtx context.Context, msg *types.MsgInitPop) (*types k.StoreChallenge(ctx, challenge) + amount := k.GetValidatorPoPReward(ctx) + k.storeChallangeInitiatorReward(ctx, msg.GetHeight(), amount) + validatorIdentity, err := util.GetValidatorCometBFTIdentity(ctx, k.RootDir) if err != nil { util.GetAppLogger().Error(ctx, initPopTag+errormsg.CouldNotGetValidatorIdentity+": "+err.Error()) diff --git a/x/dao/keeper/msg_server_report_pop_result.go b/x/dao/keeper/msg_server_report_pop_result.go index 5813cc3..4f28b70 100644 --- a/x/dao/keeper/msg_server_report_pop_result.go +++ b/x/dao/keeper/msg_server_report_pop_result.go @@ -44,6 +44,12 @@ func (k msgServer) ReportPopResult(goCtx context.Context, msg *types.MsgReportPo return nil, err } + _, err = sdk.AccAddressFromHexUnsafe(msg.Challenge.GetInitiator()) + if err != nil { + util.GetAppLogger().Error(ctx, "error converting initiator address") + return nil, errorsmod.Wrap(types.ErrInvalidPoPInitiator, "PoP initiator not hex encoded") + } + // update valid PoP Result reports err = k.updateChallenge(ctx, msg) if err != nil { @@ -74,6 +80,12 @@ func (k msgServer) issuePoPRewards(ctx sdk.Context, challenge types.Challenge) ( stagedCRDDL = stagedCRDDL.AddAmount(sdk.NewIntFromUint64(challengerAmt)) } + validatorPoPreward, found := k.getChallengeInitiatorReward(ctx, challenge.GetHeight()) + if !found { + util.GetAppLogger().Error(ctx, "No PoP initiator reward found for height %v", challenge.GetHeight()) + } + stagedCRDDL = stagedCRDDL.AddAmount(sdk.NewIntFromUint64(validatorPoPreward)) + err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(stagedCRDDL)) if err != nil { return @@ -90,6 +102,12 @@ func (k msgServer) handlePoP(ctx sdk.Context, challenge types.Challenge) (err er return } + initiatorAddr, _ := sdk.AccAddressFromHexUnsafe(challenge.Initiator) + err = k.sendRewards(ctx, initiatorAddr.String(), k.GetValidatorPoPReward(ctx)) + if err != nil { + return + } + if !challenge.GetSuccess() { return } diff --git a/x/dao/keeper/msg_server_test.go b/x/dao/keeper/msg_server_test.go index e9ecdca..2122a32 100644 --- a/x/dao/keeper/msg_server_test.go +++ b/x/dao/keeper/msg_server_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "context" + "encoding/hex" "fmt" "testing" @@ -28,8 +29,8 @@ func TestMsgServer(t *testing.T) { } func TestMsgServerReportPoPResult(t *testing.T) { - t.Parallel() initiator := sample.Secp256k1AccAddress() + initiatorHex := hex.EncodeToString(initiator.Bytes()) challenger := sample.Secp256k1AccAddress() challengee := sample.Secp256k1AccAddress() errInvalidPopData := "Invalid pop data" @@ -44,7 +45,7 @@ func TestMsgServerReportPoPResult(t *testing.T) { types.MsgReportPopResult{ Creator: challenger.String(), Challenge: &types.Challenge{ - Initiator: initiator.String(), + Initiator: initiatorHex, Challenger: challenger.String(), Challengee: challengee.String(), Height: 1, @@ -59,7 +60,7 @@ func TestMsgServerReportPoPResult(t *testing.T) { types.MsgReportPopResult{ Creator: challenger.String(), Challenge: &types.Challenge{ - Initiator: initiator.String(), + Initiator: initiatorHex, Challenger: challenger.String(), Challengee: challengee.String(), Height: 2, @@ -87,7 +88,7 @@ func TestMsgServerReportPoPResult(t *testing.T) { types.MsgReportPopResult{ Creator: challenger.String(), Challenge: &types.Challenge{ - Initiator: initiator.String(), + Initiator: initiatorHex, Challenger: challenger.String(), Challengee: challengee.String(), Height: 4, @@ -102,7 +103,7 @@ func TestMsgServerReportPoPResult(t *testing.T) { types.MsgReportPopResult{ Creator: challenger.String(), Challenge: &types.Challenge{ - Initiator: initiator.String(), + Initiator: initiatorHex, Challenger: challenger.String(), Challengee: challengee.String(), Height: 5, @@ -117,7 +118,7 @@ func TestMsgServerReportPoPResult(t *testing.T) { types.MsgReportPopResult{ Creator: challenger.String(), Challenge: &types.Challenge{ - Initiator: initiator.String(), + Initiator: initiatorHex, Challenger: challenger.String(), Challengee: challengee.String(), Height: 6, @@ -128,7 +129,7 @@ func TestMsgServerReportPoPResult(t *testing.T) { "PoP report data does not match challenge: invalid challenge", }, { - "Non-Existing PoP", + "Initiator not hex encoded", types.MsgReportPopResult{ Creator: challenger.String(), Challenge: &types.Challenge{ @@ -140,6 +141,21 @@ func TestMsgServerReportPoPResult(t *testing.T) { Finished: true, }, }, + "PoP initiator not hex encoded: invalid PoP initiator", + }, + { + "Non-Existing PoP", + types.MsgReportPopResult{ + Creator: challenger.String(), + Challenge: &types.Challenge{ + Initiator: initiatorHex, + Challenger: challenger.String(), + Challengee: challengee.String(), + Height: 8, + Success: true, + Finished: true, + }, + }, "no challenge found for PoP report: invalid challenge", }, } @@ -147,7 +163,7 @@ func TestMsgServerReportPoPResult(t *testing.T) { msgServer, ctx, k := setupMsgServer(t) sdkCtx := sdk.UnwrapSDKContext(ctx) // set up the challenges, do not store the last challenge (special test case) - for i := 0; i < 6; i++ { + for i := 0; i < len(testCases)-1; i++ { msg := testCases[i].msg challenge := msg.GetChallenge() k.StoreChallenge(sdkCtx, *challenge) @@ -155,16 +171,19 @@ func TestMsgServerReportPoPResult(t *testing.T) { // adjust challenge 4 to satisfy the test case testCases[3].msg.Challenge.Challengee = testCases[3].msg.Challenge.Challenger testCases[4].msg.Challenge.Challenger = testCases[4].msg.Challenge.Challengee - testCases[5].msg.Challenge.Initiator = testCases[5].msg.Challenge.Challenger + testCases[5].msg.Challenge.Initiator = hex.EncodeToString(challenger.Bytes()) for _, tc := range testCases { - res, err := msgServer.ReportPopResult(ctx, &tc.msg) + tc := tc + t.Run(tc.name, func(t *testing.T) { + res, err := msgServer.ReportPopResult(ctx, &tc.msg) - if tc.errMsg != "" { - assert.EqualError(t, err, tc.errMsg) - } else { - assert.Equal(t, &types.MsgReportPopResultResponse{}, res) - } + if tc.errMsg != "" { + assert.EqualError(t, err, tc.errMsg) + } else { + assert.Equal(t, &types.MsgReportPopResultResponse{}, res) + } + }) } } func TestMsgServerMintToken(t *testing.T) { diff --git a/x/dao/keeper/params.go b/x/dao/keeper/params.go index 53d154f..7f8f418 100644 --- a/x/dao/keeper/params.go +++ b/x/dao/keeper/params.go @@ -42,3 +42,7 @@ func (k Keeper) GetTxGasLimit(ctx sdk.Context) (txGasLimit uint64) { func (k Keeper) GetClaimAddress(ctx sdk.Context) (claimAddress string) { return k.GetParams(ctx).ClaimAddress } + +func (k Keeper) GetValidatorPoPReward(ctx sdk.Context) (validatorPoPReward uint64) { + return k.GetParams(ctx).ValidatorPopReward +} diff --git a/x/dao/migrations/v3/params.go b/x/dao/migrations/v3/params.go new file mode 100644 index 0000000..2379a7a --- /dev/null +++ b/x/dao/migrations/v3/params.go @@ -0,0 +1,31 @@ +package v3 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/planetmint/planetmint-go/util" + "github.com/planetmint/planetmint-go/x/dao/types" +) + +func MigrateParams(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { + store := ctx.KVStore(storeKey) + paramBytes := store.Get(types.KeyPrefix(types.ParamsKey)) + + var params types.Params + err := cdc.Unmarshal(paramBytes, ¶ms) + if err != nil { + return err + } + + params.ValidatorPopReward = util.RDDLToken2Uint(1) + + bz, err := cdc.Marshal(¶ms) + if err != nil { + return err + } + + store.Set(types.KeyPrefix(types.ParamsKey), bz) + + return nil +} diff --git a/x/dao/module.go b/x/dao/module.go index 842f58e..a2278d6 100644 --- a/x/dao/module.go +++ b/x/dao/module.go @@ -122,6 +122,9 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate1to2); err != nil { panic(fmt.Errorf("failed to register migration of %s to v2: %w", types.ModuleName, err)) } + if err := cfg.RegisterMigration(types.ModuleName, 3, m.Migrate2to3); err != nil { + panic(fmt.Errorf("failed to register migration of %s to v3: %w", types.ModuleName, err)) + } } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) @@ -145,7 +148,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 4 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { diff --git a/x/dao/types/errors.go b/x/dao/types/errors.go index 576c169..eeaa2c9 100644 --- a/x/dao/types/errors.go +++ b/x/dao/types/errors.go @@ -29,4 +29,5 @@ var ( ErrConvertClaims = errorsmod.Register(ModuleName, 20, "convert claim failed") ErrInvalidClaimAddress = errorsmod.Register(ModuleName, 21, "invalid claim address") ErrInvalidPopReporter = errorsmod.Register(ModuleName, 22, "invalid PoP reporter") + ErrInvalidPoPInitiator = errorsmod.Register(ModuleName, 23, "invalid PoP initiator") ) diff --git a/x/dao/types/keys.go b/x/dao/types/keys.go index 9c2e4c0..dd7facc 100644 --- a/x/dao/types/keys.go +++ b/x/dao/types/keys.go @@ -25,6 +25,8 @@ const ( PoPDistributionKey = "Dao/PoPDistribution" + PoPInitiatorReward = "Dao/PoPInitiatorReward" + ParamsKey = "Dao/Params" ) diff --git a/x/dao/types/params.go b/x/dao/types/params.go index 398c72b..ea2e8f4 100644 --- a/x/dao/types/params.go +++ b/x/dao/types/params.go @@ -17,7 +17,7 @@ func NewParams(mintAddress string, tokenDenom string, stagedDenom string, claimDenom string, reissuanceAsset string, reissuanceEpochs int64, popEpochs int64, distributionOffset int64, distributionAddressEarlyInv string, distributionAddressInvestor string, distributionAddressStrategic string, distributionAddressDao string, distributionAddressPop string, - mqttResponseTimeout int64, claimAddress string, txGasLimit uint64) Params { + mqttResponseTimeout int64, claimAddress string, txGasLimit uint64, validatorPoPReward uint64) Params { return Params{ MintAddress: mintAddress, TokenDenom: tokenDenom, @@ -42,6 +42,7 @@ func NewParams(mintAddress string, tokenDenom string, stagedDenom string, MqttResponseTimeout: mqttResponseTimeout, ClaimAddress: claimAddress, TxGasLimit: txGasLimit, + ValidatorPopReward: validatorPoPReward, } } @@ -63,7 +64,9 @@ func DefaultParams() Params { "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD", 2000, "plmnt1m5apfematgm7uueazhk482026ert95x2l2dx78", - 200000) + 200000, + 100000000, + ) } // ParamSetPairs get the params.ParamSet diff --git a/x/dao/types/params.pb.go b/x/dao/types/params.pb.go index 9667132..3a1238c 100644 --- a/x/dao/types/params.pb.go +++ b/x/dao/types/params.pb.go @@ -41,6 +41,7 @@ type Params struct { MqttResponseTimeout int64 `protobuf:"varint,14,opt,name=mqtt_response_timeout,json=mqttResponseTimeout,proto3" json:"mqtt_response_timeout,omitempty"` ClaimAddress string `protobuf:"bytes,15,opt,name=claim_address,json=claimAddress,proto3" json:"claim_address,omitempty"` TxGasLimit uint64 `protobuf:"varint,16,opt,name=tx_gas_limit,json=txGasLimit,proto3" json:"tx_gas_limit,omitempty"` + ValidatorPopReward uint64 `protobuf:"varint,17,opt,name=validator_pop_reward,json=validatorPopReward,proto3" json:"validator_pop_reward,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -187,6 +188,13 @@ func (m *Params) GetTxGasLimit() uint64 { return 0 } +func (m *Params) GetValidatorPopReward() uint64 { + if m != nil { + return m.ValidatorPopReward + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "planetmintgo.dao.Params") } @@ -194,38 +202,40 @@ func init() { func init() { proto.RegisterFile("planetmintgo/dao/params.proto", fileDescriptor_a58575036b3ad531) } var fileDescriptor_a58575036b3ad531 = []byte{ - // 493 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xb1, 0x6f, 0x13, 0x31, - 0x14, 0xc6, 0x73, 0x34, 0x0d, 0xc4, 0x49, 0x69, 0x70, 0x01, 0x59, 0x40, 0x2e, 0x01, 0x96, 0x20, - 0x44, 0x4e, 0x82, 0x05, 0xb1, 0xb5, 0xa4, 0x42, 0x91, 0x90, 0xa8, 0x02, 0x13, 0x8b, 0xe5, 0xdc, - 0xb9, 0x57, 0x8b, 0x9c, 0x9f, 0x39, 0xbf, 0x44, 0xe9, 0x7f, 0xc1, 0xc8, 0xc8, 0x9f, 0xc3, 0xd8, - 0x91, 0x11, 0x25, 0xff, 0x06, 0x03, 0xb2, 0xef, 0xa2, 0x5e, 0xa5, 0x64, 0xb3, 0xbe, 0xef, 0xf7, - 0x7d, 0xb6, 0xac, 0xf7, 0x48, 0xd7, 0xcc, 0x84, 0x96, 0x98, 0x29, 0x8d, 0x29, 0x44, 0x89, 0x80, - 0xc8, 0x88, 0x5c, 0x64, 0x76, 0x68, 0x72, 0x40, 0xa0, 0x9d, 0xaa, 0x3d, 0x4c, 0x04, 0x3c, 0xba, - 0x9f, 0x42, 0x0a, 0xde, 0x8c, 0xdc, 0xa9, 0xe0, 0x9e, 0xfd, 0xdb, 0x27, 0x8d, 0x33, 0x1f,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x03, 0x00, 0x00, + // 521 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xc1, 0x6e, 0x13, 0x3d, + 0x14, 0x85, 0x33, 0x7f, 0xf3, 0x07, 0xe2, 0xa4, 0x34, 0x75, 0x0b, 0xb2, 0x80, 0x4c, 0x02, 0x6c, + 0x82, 0x10, 0x19, 0x04, 0x1b, 0xc4, 0xae, 0x25, 0x15, 0x8a, 0x84, 0x44, 0x14, 0x58, 0xb1, 0xb1, + 0x9c, 0x8c, 0x3b, 0xb5, 0xc8, 0xcc, 0x35, 0xf6, 0x4d, 0x48, 0xdf, 0x82, 0x25, 0x4b, 0x9e, 0x80, + 0xe7, 0x60, 0xd9, 0x25, 0x4b, 0x94, 0xbc, 0x08, 0xb2, 0x67, 0x42, 0x07, 0x29, 0xd9, 0x59, 0xe7, + 0x7c, 0xe7, 0xd8, 0xb2, 0xee, 0x25, 0x6d, 0x3d, 0x13, 0x99, 0xc4, 0x54, 0x65, 0x98, 0x40, 0x14, + 0x0b, 0x88, 0xb4, 0x30, 0x22, 0xb5, 0x7d, 0x6d, 0x00, 0x81, 0xb6, 0xca, 0x76, 0x3f, 0x16, 0x70, + 0xf7, 0x38, 0x81, 0x04, 0xbc, 0x19, 0xb9, 0x53, 0xce, 0x3d, 0xfc, 0x51, 0x23, 0xb5, 0x91, 0x0f, + 0xd2, 0x07, 0xa4, 0xe9, 0x70, 0x2e, 0xe2, 0xd8, 0x48, 0x6b, 0x59, 0xd0, 0x0d, 0x7a, 0xf5, 0x71, + 0xc3, 0x69, 0x27, 0xb9, 0x44, 0x3b, 0xa4, 0x81, 0xf0, 0x49, 0x66, 0x3c, 0x96, 0x19, 0xa4, 0xec, + 0x3f, 0x4f, 0x10, 0x2f, 0x0d, 0x9c, 0xe2, 0x3a, 0x2c, 0x8a, 0x44, 0xc6, 0x05, 0xb1, 0x97, 0x77, + 0xe4, 0x5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fd, 0x8c, 0xc8, 0x8d, 0xb4, 0x1a, 0x32, 0x2b, + 0x39, 0xaa, 0x54, 0xc2, 0x1c, 0xd9, 0x2d, 0xff, 0xeb, 0x47, 0xce, 0x1c, 0x17, 0xde, 0x87, 0xdc, + 0xa2, 0x8f, 0xc8, 0x7e, 0x3e, 0x3f, 0x9b, 0x39, 0x3d, 0xf0, 0x57, 0x34, 0xbd, 0xb8, 0x19, 0xd4, + 0x2e, 0x69, 0xe2, 0x92, 0x27, 0xc2, 0xf2, 0x99, 0x4a, 0x15, 0xb2, 0x56, 0x37, 0xe8, 0x55, 0xc7, + 0x04, 0x97, 0x6f, 0x84, 0x7d, 0xeb, 0x14, 0xfa, 0x8c, 0x1c, 0x2f, 0xc4, 0x4c, 0xc5, 0x02, 0xc1, + 0xb8, 0x97, 0x72, 0x23, 0xbf, 0x08, 0x13, 0xb3, 0x43, 0x4f, 0xd2, 0xbf, 0xde, 0x08, 0xf4, 0xd8, + 0x3b, 0xaf, 0xaa, 0xdf, 0xbe, 0x77, 0x2a, 0xa7, 0xc3, 0x9f, 0xab, 0x30, 0xb8, 0x5a, 0x85, 0xc1, + 0xef, 0x55, 0x18, 0x7c, 0x5d, 0x87, 0x95, 0xab, 0x75, 0x58, 0xf9, 0xb5, 0x0e, 0x2b, 0x1f, 0xa3, + 0x44, 0xe1, 0xc5, 0x7c, 0xd2, 0x9f, 0x42, 0x1a, 0x5d, 0x6f, 0x5f, 0xe9, 0xf8, 0x34, 0x81, 0x68, + 0xe9, 0x57, 0x15, 0x2f, 0xb5, 0xb4, 0x93, 0x9a, 0x5f, 0xc1, 0x17, 0x7f, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x67, 0x5d, 0xde, 0x8f, 0xcb, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -248,6 +258,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ValidatorPopReward != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ValidatorPopReward)) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x88 + } if m.TxGasLimit != 0 { i = encodeVarintParams(dAtA, i, uint64(m.TxGasLimit)) i-- @@ -431,6 +448,9 @@ func (m *Params) Size() (n int) { if m.TxGasLimit != 0 { n += 2 + sovParams(uint64(m.TxGasLimit)) } + if m.ValidatorPopReward != 0 { + n += 2 + sovParams(uint64(m.ValidatorPopReward)) + } return n } @@ -916,6 +936,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 17: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorPopReward", wireType) + } + m.ValidatorPopReward = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValidatorPopReward |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:])