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 <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2024-07-18 10:34:50 +02:00 committed by GitHub
parent 197ebe1279
commit 605b6c73d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 239 additions and 54 deletions

View File

@ -53,7 +53,6 @@ linters:
- noctx - noctx
- nolintlint - nolintlint
- nosprintfhostport - nosprintfhostport
- paralleltest
- perfsprint - perfsprint
- prealloc - prealloc
- predeclared - predeclared

View File

@ -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) { 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) 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)
})
} }

View File

@ -47048,6 +47048,9 @@ paths:
tx_gas_limit: tx_gas_limit:
type: string type: string
format: uint64 format: uint64
validator_pop_reward:
type: string
format: uint64
description: >- description: >-
QueryParamsResponse is response type for the Query/Params RPC QueryParamsResponse is response type for the Query/Params RPC
method. method.
@ -76722,6 +76725,9 @@ definitions:
tx_gas_limit: tx_gas_limit:
type: string type: string
format: uint64 format: uint64
validator_pop_reward:
type: string
format: uint64
description: Params defines the parameters for the module. description: Params defines the parameters for the module.
planetmintgo.dao.QueryAllRedeemClaimResponse: planetmintgo.dao.QueryAllRedeemClaimResponse:
type: object type: object
@ -76997,6 +77003,9 @@ definitions:
tx_gas_limit: tx_gas_limit:
type: string type: string
format: uint64 format: uint64
validator_pop_reward:
type: string
format: uint64
description: QueryParamsResponse is response type for the Query/Params RPC method. description: QueryParamsResponse is response type for the Query/Params RPC method.
planetmintgo.dao.QueryRedeemClaimByLiquidTxHashResponse: planetmintgo.dao.QueryRedeemClaimByLiquidTxHashResponse:
type: object type: object

View File

@ -25,4 +25,5 @@ message Params {
int64 mqtt_response_timeout = 14; int64 mqtt_response_timeout = 14;
string claim_address = 15; string claim_address = 15;
uint64 tx_gas_limit = 16; uint64 tx_gas_limit = 16;
uint64 validator_pop_reward = 17;
} }

View File

@ -196,7 +196,7 @@ func (s *SelectionE2ETestSuite) VerifyTokens(token string) {
}) })
s.Require().NoError(err) s.Require().NoError(err)
assert.Contains(s.T(), out.String(), token) 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{ out, err = clitestutil.ExecTestCLICmd(val.ClientCtx, bank.GetBalancesCmd(), []string{
machines[0].address, machines[0].address,

View File

@ -69,3 +69,19 @@ func (k Keeper) GetChallenges(ctx sdk.Context) (challenges []types.Challenge, er
} }
return 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
}

View File

@ -48,15 +48,35 @@ func (k Keeper) ComputeDistribution(ctx sdk.Context, lastReissuance int64, block
distribution.StrategicAddr = k.GetParams(ctx).DistributionAddressStrategic distribution.StrategicAddr = k.GetParams(ctx).DistributionAddressStrategic
distribution.PopAddr = k.GetParams(ctx).DistributionAddressPop 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.EarlyInvAmount = util.UintValueToRDDLTokenString(uint64(float64(amount) * types.PercentageEarlyInvestor))
distribution.InvestorAmount = util.UintValueToRDDLTokenString(uint64(float64(amount) * types.PercentageInvestor)) distribution.InvestorAmount = util.UintValueToRDDLTokenString(uint64(float64(amount) * types.PercentageInvestor))
distribution.StrategicAmount = util.UintValueToRDDLTokenString(uint64(float64(amount) * types.PercentageStrategic)) 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 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) { func getUint64FromTxString(ctx sdk.Context, tx string) (amount uint64, err error) {
subStrings := strings.Split(tx, " ") subStrings := strings.Split(tx, " ")
if len(subStrings) < 3 { if len(subStrings) < 3 {

View File

@ -3,6 +3,7 @@ package keeper
import ( import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
v2 "github.com/planetmint/planetmint-go/x/dao/migrations/v2" 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. // 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 { func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return v2.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) 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)
}

View File

@ -56,6 +56,15 @@ func (k msgServer) resolveStagedClaims(ctx sdk.Context, start int64, end int64)
if challenge.GetSuccess() { if challenge.GetSuccess() {
popParticipants[challenge.Challengee] += challengeeAmt 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 // second data structure because map iteration order is not guaranteed in GO

View File

@ -24,6 +24,9 @@ func (k msgServer) InitPop(goCtx context.Context, msg *types.MsgInitPop) (*types
k.StoreChallenge(ctx, challenge) k.StoreChallenge(ctx, challenge)
amount := k.GetValidatorPoPReward(ctx)
k.storeChallangeInitiatorReward(ctx, msg.GetHeight(), amount)
validatorIdentity, err := util.GetValidatorCometBFTIdentity(ctx, k.RootDir) validatorIdentity, err := util.GetValidatorCometBFTIdentity(ctx, k.RootDir)
if err != nil { if err != nil {
util.GetAppLogger().Error(ctx, initPopTag+errormsg.CouldNotGetValidatorIdentity+": "+err.Error()) util.GetAppLogger().Error(ctx, initPopTag+errormsg.CouldNotGetValidatorIdentity+": "+err.Error())

View File

@ -44,6 +44,12 @@ func (k msgServer) ReportPopResult(goCtx context.Context, msg *types.MsgReportPo
return nil, err 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 // update valid PoP Result reports
err = k.updateChallenge(ctx, msg) err = k.updateChallenge(ctx, msg)
if err != nil { if err != nil {
@ -74,6 +80,12 @@ func (k msgServer) issuePoPRewards(ctx sdk.Context, challenge types.Challenge) (
stagedCRDDL = stagedCRDDL.AddAmount(sdk.NewIntFromUint64(challengerAmt)) 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)) err = k.bankKeeper.MintCoins(ctx, types.ModuleName, sdk.NewCoins(stagedCRDDL))
if err != nil { if err != nil {
return return
@ -90,6 +102,12 @@ func (k msgServer) handlePoP(ctx sdk.Context, challenge types.Challenge) (err er
return return
} }
initiatorAddr, _ := sdk.AccAddressFromHexUnsafe(challenge.Initiator)
err = k.sendRewards(ctx, initiatorAddr.String(), k.GetValidatorPoPReward(ctx))
if err != nil {
return
}
if !challenge.GetSuccess() { if !challenge.GetSuccess() {
return return
} }

View File

@ -2,6 +2,7 @@ package keeper_test
import ( import (
"context" "context"
"encoding/hex"
"fmt" "fmt"
"testing" "testing"
@ -28,8 +29,8 @@ func TestMsgServer(t *testing.T) {
} }
func TestMsgServerReportPoPResult(t *testing.T) { func TestMsgServerReportPoPResult(t *testing.T) {
t.Parallel()
initiator := sample.Secp256k1AccAddress() initiator := sample.Secp256k1AccAddress()
initiatorHex := hex.EncodeToString(initiator.Bytes())
challenger := sample.Secp256k1AccAddress() challenger := sample.Secp256k1AccAddress()
challengee := sample.Secp256k1AccAddress() challengee := sample.Secp256k1AccAddress()
errInvalidPopData := "Invalid pop data" errInvalidPopData := "Invalid pop data"
@ -44,7 +45,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
types.MsgReportPopResult{ types.MsgReportPopResult{
Creator: challenger.String(), Creator: challenger.String(),
Challenge: &types.Challenge{ Challenge: &types.Challenge{
Initiator: initiator.String(), Initiator: initiatorHex,
Challenger: challenger.String(), Challenger: challenger.String(),
Challengee: challengee.String(), Challengee: challengee.String(),
Height: 1, Height: 1,
@ -59,7 +60,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
types.MsgReportPopResult{ types.MsgReportPopResult{
Creator: challenger.String(), Creator: challenger.String(),
Challenge: &types.Challenge{ Challenge: &types.Challenge{
Initiator: initiator.String(), Initiator: initiatorHex,
Challenger: challenger.String(), Challenger: challenger.String(),
Challengee: challengee.String(), Challengee: challengee.String(),
Height: 2, Height: 2,
@ -87,7 +88,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
types.MsgReportPopResult{ types.MsgReportPopResult{
Creator: challenger.String(), Creator: challenger.String(),
Challenge: &types.Challenge{ Challenge: &types.Challenge{
Initiator: initiator.String(), Initiator: initiatorHex,
Challenger: challenger.String(), Challenger: challenger.String(),
Challengee: challengee.String(), Challengee: challengee.String(),
Height: 4, Height: 4,
@ -102,7 +103,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
types.MsgReportPopResult{ types.MsgReportPopResult{
Creator: challenger.String(), Creator: challenger.String(),
Challenge: &types.Challenge{ Challenge: &types.Challenge{
Initiator: initiator.String(), Initiator: initiatorHex,
Challenger: challenger.String(), Challenger: challenger.String(),
Challengee: challengee.String(), Challengee: challengee.String(),
Height: 5, Height: 5,
@ -117,7 +118,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
types.MsgReportPopResult{ types.MsgReportPopResult{
Creator: challenger.String(), Creator: challenger.String(),
Challenge: &types.Challenge{ Challenge: &types.Challenge{
Initiator: initiator.String(), Initiator: initiatorHex,
Challenger: challenger.String(), Challenger: challenger.String(),
Challengee: challengee.String(), Challengee: challengee.String(),
Height: 6, Height: 6,
@ -128,7 +129,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
"PoP report data does not match challenge: invalid challenge", "PoP report data does not match challenge: invalid challenge",
}, },
{ {
"Non-Existing PoP", "Initiator not hex encoded",
types.MsgReportPopResult{ types.MsgReportPopResult{
Creator: challenger.String(), Creator: challenger.String(),
Challenge: &types.Challenge{ Challenge: &types.Challenge{
@ -140,6 +141,21 @@ func TestMsgServerReportPoPResult(t *testing.T) {
Finished: true, 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", "no challenge found for PoP report: invalid challenge",
}, },
} }
@ -147,7 +163,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
msgServer, ctx, k := setupMsgServer(t) msgServer, ctx, k := setupMsgServer(t)
sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx := sdk.UnwrapSDKContext(ctx)
// set up the challenges, do not store the last challenge (special test case) // 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 msg := testCases[i].msg
challenge := msg.GetChallenge() challenge := msg.GetChallenge()
k.StoreChallenge(sdkCtx, *challenge) k.StoreChallenge(sdkCtx, *challenge)
@ -155,16 +171,19 @@ func TestMsgServerReportPoPResult(t *testing.T) {
// adjust challenge 4 to satisfy the test case // adjust challenge 4 to satisfy the test case
testCases[3].msg.Challenge.Challengee = testCases[3].msg.Challenge.Challenger testCases[3].msg.Challenge.Challengee = testCases[3].msg.Challenge.Challenger
testCases[4].msg.Challenge.Challenger = testCases[4].msg.Challenge.Challengee 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 { 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 != "" { if tc.errMsg != "" {
assert.EqualError(t, err, tc.errMsg) assert.EqualError(t, err, tc.errMsg)
} else { } else {
assert.Equal(t, &types.MsgReportPopResultResponse{}, res) assert.Equal(t, &types.MsgReportPopResultResponse{}, res)
} }
})
} }
} }
func TestMsgServerMintToken(t *testing.T) { func TestMsgServerMintToken(t *testing.T) {

View File

@ -42,3 +42,7 @@ func (k Keeper) GetTxGasLimit(ctx sdk.Context) (txGasLimit uint64) {
func (k Keeper) GetClaimAddress(ctx sdk.Context) (claimAddress string) { func (k Keeper) GetClaimAddress(ctx sdk.Context) (claimAddress string) {
return k.GetParams(ctx).ClaimAddress return k.GetParams(ctx).ClaimAddress
} }
func (k Keeper) GetValidatorPoPReward(ctx sdk.Context) (validatorPoPReward uint64) {
return k.GetParams(ctx).ValidatorPopReward
}

View File

@ -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, &params)
if err != nil {
return err
}
params.ValidatorPopReward = util.RDDLToken2Uint(1)
bz, err := cdc.Marshal(&params)
if err != nil {
return err
}
store.Set(types.KeyPrefix(types.ParamsKey), bz)
return nil
}

View File

@ -122,6 +122,9 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate1to2); err != nil { 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)) 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) // 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 // 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 // BeginBlock contains the logic that is automatically triggered at the beginning of each block
func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {

View File

@ -29,4 +29,5 @@ var (
ErrConvertClaims = errorsmod.Register(ModuleName, 20, "convert claim failed") ErrConvertClaims = errorsmod.Register(ModuleName, 20, "convert claim failed")
ErrInvalidClaimAddress = errorsmod.Register(ModuleName, 21, "invalid claim address") ErrInvalidClaimAddress = errorsmod.Register(ModuleName, 21, "invalid claim address")
ErrInvalidPopReporter = errorsmod.Register(ModuleName, 22, "invalid PoP reporter") ErrInvalidPopReporter = errorsmod.Register(ModuleName, 22, "invalid PoP reporter")
ErrInvalidPoPInitiator = errorsmod.Register(ModuleName, 23, "invalid PoP initiator")
) )

View File

@ -25,6 +25,8 @@ const (
PoPDistributionKey = "Dao/PoPDistribution" PoPDistributionKey = "Dao/PoPDistribution"
PoPInitiatorReward = "Dao/PoPInitiatorReward"
ParamsKey = "Dao/Params" ParamsKey = "Dao/Params"
) )

View File

@ -17,7 +17,7 @@ func NewParams(mintAddress string, tokenDenom string, stagedDenom string,
claimDenom string, reissuanceAsset string, reissuanceEpochs int64, popEpochs int64, claimDenom string, reissuanceAsset string, reissuanceEpochs int64, popEpochs int64,
distributionOffset int64, distributionAddressEarlyInv string, distributionAddressInvestor string, distributionOffset int64, distributionAddressEarlyInv string, distributionAddressInvestor string,
distributionAddressStrategic string, distributionAddressDao string, distributionAddressPop 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{ return Params{
MintAddress: mintAddress, MintAddress: mintAddress,
TokenDenom: tokenDenom, TokenDenom: tokenDenom,
@ -42,6 +42,7 @@ func NewParams(mintAddress string, tokenDenom string, stagedDenom string,
MqttResponseTimeout: mqttResponseTimeout, MqttResponseTimeout: mqttResponseTimeout,
ClaimAddress: claimAddress, ClaimAddress: claimAddress,
TxGasLimit: txGasLimit, TxGasLimit: txGasLimit,
ValidatorPopReward: validatorPoPReward,
} }
} }
@ -63,7 +64,9 @@ func DefaultParams() Params {
"vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD", "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD",
2000, 2000,
"plmnt1m5apfematgm7uueazhk482026ert95x2l2dx78", "plmnt1m5apfematgm7uueazhk482026ert95x2l2dx78",
200000) 200000,
100000000,
)
} }
// ParamSetPairs get the params.ParamSet // ParamSetPairs get the params.ParamSet

View File

@ -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"` 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"` 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"` 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{} } func (m *Params) Reset() { *m = Params{} }
@ -187,6 +188,13 @@ func (m *Params) GetTxGasLimit() uint64 {
return 0 return 0
} }
func (m *Params) GetValidatorPopReward() uint64 {
if m != nil {
return m.ValidatorPopReward
}
return 0
}
func init() { func init() {
proto.RegisterType((*Params)(nil), "planetmintgo.dao.Params") proto.RegisterType((*Params)(nil), "planetmintgo.dao.Params")
} }
@ -194,38 +202,40 @@ func init() {
func init() { proto.RegisterFile("planetmintgo/dao/params.proto", fileDescriptor_a58575036b3ad531) } func init() { proto.RegisterFile("planetmintgo/dao/params.proto", fileDescriptor_a58575036b3ad531) }
var fileDescriptor_a58575036b3ad531 = []byte{ var fileDescriptor_a58575036b3ad531 = []byte{
// 493 bytes of a gzipped FileDescriptorProto // 521 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xb1, 0x6f, 0x13, 0x31, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xc1, 0x6e, 0x13, 0x3d,
0x14, 0xc6, 0x73, 0x34, 0x0d, 0xc4, 0x49, 0x69, 0x70, 0x01, 0x59, 0x40, 0x2e, 0x01, 0x96, 0x20, 0x14, 0x85, 0x33, 0x7f, 0xf3, 0x07, 0xe2, 0xa4, 0x34, 0x75, 0x0b, 0xb2, 0x80, 0x4c, 0x02, 0x6c,
0x44, 0x4e, 0x82, 0x05, 0xb1, 0xb5, 0xa4, 0x42, 0x91, 0x90, 0xa8, 0x02, 0x13, 0x8b, 0xe5, 0xdc, 0x82, 0x10, 0x19, 0x04, 0x1b, 0xc4, 0xae, 0x25, 0x15, 0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f, 0xcb, 0x03, 0x00, 0x00,
} }
func (m *Params) Marshal() (dAtA []byte, err error) { func (m *Params) Marshal() (dAtA []byte, err error) {
@ -248,6 +258,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if m.ValidatorPopReward != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.ValidatorPopReward))
i--
dAtA[i] = 0x1
i--
dAtA[i] = 0x88
}
if m.TxGasLimit != 0 { if m.TxGasLimit != 0 {
i = encodeVarintParams(dAtA, i, uint64(m.TxGasLimit)) i = encodeVarintParams(dAtA, i, uint64(m.TxGasLimit))
i-- i--
@ -431,6 +448,9 @@ func (m *Params) Size() (n int) {
if m.TxGasLimit != 0 { if m.TxGasLimit != 0 {
n += 2 + sovParams(uint64(m.TxGasLimit)) n += 2 + sovParams(uint64(m.TxGasLimit))
} }
if m.ValidatorPopReward != 0 {
n += 2 + sovParams(uint64(m.ValidatorPopReward))
}
return n return n
} }
@ -916,6 +936,25 @@ func (m *Params) Unmarshal(dAtA []byte) error {
break 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: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipParams(dAtA[iNdEx:]) skippy, err := skipParams(dAtA[iNdEx:])