From 940f53f182482ac3f1336c1691b68750d5316008 Mon Sep 17 00:00:00 2001 From: Till Ziegler Date: Tue, 26 Sep 2023 23:21:33 +0200 Subject: [PATCH] add: add straths suggestions --- proto/terra/dyncomm/v1beta1/genesis.proto | 5 +- proto/terra/dyncomm/v1beta1/query.proto | 1 + x/dyncomm/ante/ante.go | 39 +++-- x/dyncomm/genesis.go | 15 +- x/dyncomm/keeper/dyncomm.go | 83 +++++++++-- x/dyncomm/keeper/querier.go | 3 +- x/dyncomm/types/genesis.go | 12 +- x/dyncomm/types/genesis.pb.go | 173 ++++++++++++++-------- x/dyncomm/types/query.pb.go | 111 ++++++++++---- 9 files changed, 318 insertions(+), 124 deletions(-) diff --git a/proto/terra/dyncomm/v1beta1/genesis.proto b/proto/terra/dyncomm/v1beta1/genesis.proto index 4950487d4..5d96359bc 100644 --- a/proto/terra/dyncomm/v1beta1/genesis.proto +++ b/proto/terra/dyncomm/v1beta1/genesis.proto @@ -10,12 +10,13 @@ option go_package = "github.com/classic-terra/core/v2/x/dyncomm/types"; message GenesisState { // params defines all the paramaters of the module. Params params = 1 [(gogoproto.nullable) = false]; - repeated MinCommissionRate min_commission_rates = 2 [(gogoproto.nullable) = false]; + repeated ValidatorCommissionRate validator_commission_rates = 2 [(gogoproto.nullable) = false]; } // MinDynCommission defines a validator - min commission rate // pair to be enforced by the blockchain -message MinCommissionRate { +message ValidatorCommissionRate { string validator_address = 1; string min_commission_rate = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; + string target_commission_rate = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; } \ No newline at end of file diff --git a/proto/terra/dyncomm/v1beta1/query.proto b/proto/terra/dyncomm/v1beta1/query.proto index 8027c0396..77e40c495 100644 --- a/proto/terra/dyncomm/v1beta1/query.proto +++ b/proto/terra/dyncomm/v1beta1/query.proto @@ -37,4 +37,5 @@ message QueryRateRequest { // QueryRateResponse is the response type for the Query/Rate RPC method. message QueryRateResponse { string rate = 1 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; + string target = 2 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; } diff --git a/x/dyncomm/ante/ante.go b/x/dyncomm/ante/ante.go index 3698c207b..b7cd164a8 100644 --- a/x/dyncomm/ante/ante.go +++ b/x/dyncomm/ante/ante.go @@ -24,19 +24,13 @@ func NewDyncommDecorator(dk dyncommkeeper.Keeper, sk stakingkeeper.Keeper) Dynco } } -// IsMsgSubmitProposal checks whether the input msg is a MsgSubmitProposal -func IsMsgEditValidator(msg sdk.Msg) bool { - _, ok := msg.(*stakingtypes.MsgEditValidator) - return ok -} - func (dd DyncommDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { if simulate { return next(ctx, tx, simulate) } msgs := tx.GetMsgs() - err := dd.FilterMsgsAndCheckEditValidator(ctx, msgs...) + err := dd.FilterMsgsAndProcessMsgs(ctx, msgs...) if err != nil { return ctx, err @@ -46,23 +40,29 @@ func (dd DyncommDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, } -func (dd DyncommDecorator) FilterMsgsAndCheckEditValidator(ctx sdk.Context, msgs ...sdk.Msg) (err error) { +func (dd DyncommDecorator) FilterMsgsAndProcessMsgs(ctx sdk.Context, msgs ...sdk.Msg) (err error) { for _, msg := range msgs { - if !IsMsgEditValidator(msg) { + + switch msg.(type) { + case *stakingtypes.MsgEditValidator: + err = dd.ProcessEditValidator(ctx, msg) + case *stakingtypes.MsgCreateValidator: + err = dd.ProcessCreateValidator(ctx, msg) + default: continue } - err := dd.CheckEditValidator(ctx, msg) if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, err.Error()) } + } return nil } -func (dd DyncommDecorator) CheckEditValidator(ctx sdk.Context, msg sdk.Msg) (err error) { +func (dd DyncommDecorator) ProcessEditValidator(ctx sdk.Context, msg sdk.Msg) (err error) { msgEditValidator := msg.(*stakingtypes.MsgEditValidator) @@ -79,6 +79,23 @@ func (dd DyncommDecorator) CheckEditValidator(ctx sdk.Context, msg sdk.Msg) (err return fmt.Errorf("commission for %s must be at least %f", operator, dynMinRate.MustFloat64()) } + // set new target rate from intendet + dd.dyncommKeeper.SetTargetCommissionRate(ctx, msgEditValidator.ValidatorAddress, *newIntendedRate) + + return nil + +} + +func (dd DyncommDecorator) ProcessCreateValidator(ctx sdk.Context, msg sdk.Msg) (err error) { + + msgEditValidator := msg.(*stakingtypes.MsgCreateValidator) + newIntendedRate := msgEditValidator.Commission.Rate + + // we don't know yet what the validators VP + // is gonna be. So let's just set the intended + // target rate here + dd.dyncommKeeper.SetTargetCommissionRate(ctx, msgEditValidator.ValidatorAddress, newIntendedRate) + return nil } diff --git a/x/dyncomm/genesis.go b/x/dyncomm/genesis.go index 221c9bdbf..115602f45 100644 --- a/x/dyncomm/genesis.go +++ b/x/dyncomm/genesis.go @@ -5,12 +5,21 @@ import ( "github.com/classic-terra/core/v2/x/dyncomm/keeper" "github.com/classic-terra/core/v2/x/dyncomm/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // InitGenesis initializes default parameters // and the keeper's address to pubkey map func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState) { keeper.SetParams(ctx, data.Params) + + //iterate validators and set target rates + keeper.StakingKeeper.IterateValidators(ctx, func(index int64, validator stakingtypes.ValidatorI) (stop bool) { + val := validator.(stakingtypes.Validator) + keeper.SetTargetCommissionRate(ctx, val.OperatorAddress, val.Commission.Rate) + return false + }) + err := keeper.UpdateAllBondedValidatorRates(ctx) if err != nil { panic("could not initialize genesis") @@ -23,10 +32,10 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState // with InitGenesis func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) (data *types.GenesisState) { params := keeper.GetParams(ctx) - var rates []types.MinCommissionRate + var rates []types.ValidatorCommissionRate - rates = append(rates) - keeper.IterateDynCommissionRates(ctx, func(rate types.MinCommissionRate) (stop bool) { + //rates = append(rates) + keeper.IterateDynCommissionRates(ctx, func(rate types.ValidatorCommissionRate) (stop bool) { rates = append(rates, rate) return false }) diff --git a/x/dyncomm/keeper/dyncomm.go b/x/dyncomm/keeper/dyncomm.go index ae98b3046..9081a3ba9 100644 --- a/x/dyncomm/keeper/dyncomm.go +++ b/x/dyncomm/keeper/dyncomm.go @@ -46,11 +46,42 @@ func (k Keeper) CalculateDynCommission(ctx sdk.Context, validator stakingtypes.V } func (k Keeper) SetDynCommissionRate(ctx sdk.Context, validator string, rate sdk.Dec) { + + var preSetRate types.ValidatorCommissionRate store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal( - &types.MinCommissionRate{ - ValidatorAddress: validator, - MinCommissionRate: &rate, + bz := store.Get(types.GetMinCommissionRatesKey(validator)) + targetRate := sdk.ZeroDec() + + if bz != nil { + k.cdc.MustUnmarshal(bz, &preSetRate) + targetRate = *preSetRate.TargetCommissionRate + } + bz = k.cdc.MustMarshal( + &types.ValidatorCommissionRate{ + ValidatorAddress: validator, + MinCommissionRate: &rate, + TargetCommissionRate: &targetRate, + }, + ) + store.Set(types.GetMinCommissionRatesKey(validator), bz) +} + +func (k Keeper) SetTargetCommissionRate(ctx sdk.Context, validator string, rate sdk.Dec) { + + var preSetRate types.ValidatorCommissionRate + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.GetMinCommissionRatesKey(validator)) + minRate := sdk.ZeroDec() + + if bz != nil { + k.cdc.MustUnmarshal(bz, &preSetRate) + minRate = *preSetRate.MinCommissionRate + } + bz = k.cdc.MustMarshal( + &types.ValidatorCommissionRate{ + ValidatorAddress: validator, + MinCommissionRate: &minRate, + TargetCommissionRate: &rate, }, ) store.Set(types.GetMinCommissionRatesKey(validator), bz) @@ -63,19 +94,31 @@ func (k Keeper) GetDynCommissionRate(ctx sdk.Context, validator string) (rate sd return sdk.ZeroDec() } - var validatorRate types.MinCommissionRate + var validatorRate types.ValidatorCommissionRate k.cdc.MustUnmarshal(bz, &validatorRate) return *validatorRate.MinCommissionRate } +func (k Keeper) GetTargetCommissionRate(ctx sdk.Context, validator string) (rate sdk.Dec) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.GetMinCommissionRatesKey(validator)) + if bz == nil { + return sdk.ZeroDec() + } + + var validatorRate types.ValidatorCommissionRate + k.cdc.MustUnmarshal(bz, &validatorRate) + return *validatorRate.TargetCommissionRate +} + // IterateDynCommissionRates iterates over dyn commission rates in the store -func (k Keeper) IterateDynCommissionRates(ctx sdk.Context, cb func(types.MinCommissionRate) bool) { +func (k Keeper) IterateDynCommissionRates(ctx sdk.Context, cb func(types.ValidatorCommissionRate) bool) { store := ctx.KVStore(k.storeKey) it := store.Iterator(nil, nil) defer it.Close() for ; it.Valid(); it.Next() { - var entry types.MinCommissionRate + var entry types.ValidatorCommissionRate if err := entry.Unmarshal(it.Value()); err != nil { panic(err) } @@ -86,13 +129,24 @@ func (k Keeper) IterateDynCommissionRates(ctx sdk.Context, cb func(types.MinComm } } -func (k Keeper) UpdateValidatorRates(ctx sdk.Context, validator stakingtypes.Validator) { +func (k Keeper) UpdateValidatorMinRates(ctx sdk.Context, validator stakingtypes.Validator) { - newRate := k.CalculateDynCommission(ctx, validator) + var newRate sdk.Dec + minRate := k.CalculateDynCommission(ctx, validator) newMaxRate := validator.Commission.MaxRate + targetRate := k.GetTargetCommissionRate(ctx, validator.OperatorAddress) + + // assume the newRate will be the target rate ... + newRate = targetRate + + // ... but enforce min rate + if newRate.LT(minRate) { + newRate = minRate + } - if newMaxRate.LT(newRate) { - newMaxRate = newRate + // new min rate pushes max rate + if newMaxRate.LT(minRate) { + newMaxRate = minRate } newValidator := validator @@ -105,7 +159,10 @@ func (k Keeper) UpdateValidatorRates(ctx sdk.Context, validator stakingtypes.Val k.StakingKeeper.SetValidator(ctx, newValidator) k.SetDynCommissionRate(ctx, validator.OperatorAddress, newRate) - ctx.Logger().Info("dyncomm:", "val", validator.OperatorAddress, "rate", k.GetDynCommissionRate(ctx, validator.OperatorAddress)) + // Debug + minRate = k.GetDynCommissionRate(ctx, validator.OperatorAddress) + targetRate = k.GetTargetCommissionRate(ctx, validator.OperatorAddress) + ctx.Logger().Info("dyncomm:", "val", validator.OperatorAddress, "min_rate", minRate, "target_rate", targetRate) } @@ -120,7 +177,7 @@ func (k Keeper) UpdateAllBondedValidatorRates(ctx sdk.Context) (err error) { return false } - k.UpdateValidatorRates(ctx, val) + k.UpdateValidatorMinRates(ctx, val) return false diff --git a/x/dyncomm/keeper/querier.go b/x/dyncomm/keeper/querier.go index a5f4f9d85..153bd4e07 100644 --- a/x/dyncomm/keeper/querier.go +++ b/x/dyncomm/keeper/querier.go @@ -31,5 +31,6 @@ func (q querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types. func (q querier) Rate(c context.Context, req *types.QueryRateRequest) (*types.QueryRateResponse, error) { ctx := sdk.UnwrapSDKContext(c) rate := q.GetDynCommissionRate(ctx, req.ValidatorAddr) - return &types.QueryRateResponse{Rate: &rate}, nil + target := q.GetTargetCommissionRate(ctx, req.ValidatorAddr) + return &types.QueryRateResponse{Rate: &rate, Target: &target}, nil } diff --git a/x/dyncomm/types/genesis.go b/x/dyncomm/types/genesis.go index 4862d43e9..8fee6b02b 100644 --- a/x/dyncomm/types/genesis.go +++ b/x/dyncomm/types/genesis.go @@ -1,18 +1,18 @@ package types // NewGenesisState creates a new GenesisState object -func NewGenesisState(params Params, rates []MinCommissionRate) *GenesisState { +func NewGenesisState(params Params, rates []ValidatorCommissionRate) *GenesisState { return &GenesisState{ - Params: params, - MinCommissionRates: rates, + Params: params, + ValidatorCommissionRates: rates, } } // DefaultGenesisState gets raw genesis raw message for testing func DefaultGenesisState() *GenesisState { - emptySet := []MinCommissionRate{} + emptySet := []ValidatorCommissionRate{} return &GenesisState{ - Params: DefaultParams(), - MinCommissionRates: emptySet, + Params: DefaultParams(), + ValidatorCommissionRates: emptySet, } } diff --git a/x/dyncomm/types/genesis.pb.go b/x/dyncomm/types/genesis.pb.go index 29746c9a0..1f698621a 100644 --- a/x/dyncomm/types/genesis.pb.go +++ b/x/dyncomm/types/genesis.pb.go @@ -27,8 +27,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the dyncomm module's genesis state. type GenesisState struct { // params defines all the paramaters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - MinCommissionRates []MinCommissionRate `protobuf:"bytes,2,rep,name=min_commission_rates,json=minCommissionRates,proto3" json:"min_commission_rates"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + ValidatorCommissionRates []ValidatorCommissionRate `protobuf:"bytes,2,rep,name=validator_commission_rates,json=validatorCommissionRates,proto3" json:"validator_commission_rates"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -71,32 +71,33 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetMinCommissionRates() []MinCommissionRate { +func (m *GenesisState) GetValidatorCommissionRates() []ValidatorCommissionRate { if m != nil { - return m.MinCommissionRates + return m.ValidatorCommissionRates } return nil } // MinDynCommission defines a validator - min commission rate // pair to be enforced by the blockchain -type MinCommissionRate struct { - ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` - MinCommissionRate *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=min_commission_rate,json=minCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_commission_rate,omitempty"` +type ValidatorCommissionRate struct { + ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` + MinCommissionRate *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=min_commission_rate,json=minCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_commission_rate,omitempty"` + TargetCommissionRate *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=target_commission_rate,json=targetCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"target_commission_rate,omitempty"` } -func (m *MinCommissionRate) Reset() { *m = MinCommissionRate{} } -func (m *MinCommissionRate) String() string { return proto.CompactTextString(m) } -func (*MinCommissionRate) ProtoMessage() {} -func (*MinCommissionRate) Descriptor() ([]byte, []int) { +func (m *ValidatorCommissionRate) Reset() { *m = ValidatorCommissionRate{} } +func (m *ValidatorCommissionRate) String() string { return proto.CompactTextString(m) } +func (*ValidatorCommissionRate) ProtoMessage() {} +func (*ValidatorCommissionRate) Descriptor() ([]byte, []int) { return fileDescriptor_ac14a232c2479651, []int{1} } -func (m *MinCommissionRate) XXX_Unmarshal(b []byte) error { +func (m *ValidatorCommissionRate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MinCommissionRate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ValidatorCommissionRate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MinCommissionRate.Marshal(b, m, deterministic) + return xxx_messageInfo_ValidatorCommissionRate.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -106,19 +107,19 @@ func (m *MinCommissionRate) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *MinCommissionRate) XXX_Merge(src proto.Message) { - xxx_messageInfo_MinCommissionRate.Merge(m, src) +func (m *ValidatorCommissionRate) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorCommissionRate.Merge(m, src) } -func (m *MinCommissionRate) XXX_Size() int { +func (m *ValidatorCommissionRate) XXX_Size() int { return m.Size() } -func (m *MinCommissionRate) XXX_DiscardUnknown() { - xxx_messageInfo_MinCommissionRate.DiscardUnknown(m) +func (m *ValidatorCommissionRate) XXX_DiscardUnknown() { + xxx_messageInfo_ValidatorCommissionRate.DiscardUnknown(m) } -var xxx_messageInfo_MinCommissionRate proto.InternalMessageInfo +var xxx_messageInfo_ValidatorCommissionRate proto.InternalMessageInfo -func (m *MinCommissionRate) GetValidatorAddress() string { +func (m *ValidatorCommissionRate) GetValidatorAddress() string { if m != nil { return m.ValidatorAddress } @@ -127,7 +128,7 @@ func (m *MinCommissionRate) GetValidatorAddress() string { func init() { proto.RegisterType((*GenesisState)(nil), "terra.dyncomm.v1beta1.GenesisState") - proto.RegisterType((*MinCommissionRate)(nil), "terra.dyncomm.v1beta1.MinCommissionRate") + proto.RegisterType((*ValidatorCommissionRate)(nil), "terra.dyncomm.v1beta1.ValidatorCommissionRate") } func init() { @@ -135,28 +136,30 @@ func init() { } var fileDescriptor_ac14a232c2479651 = []byte{ - // 334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xcf, 0x4a, 0x02, 0x41, - 0x1c, 0xc7, 0x77, 0x2c, 0x84, 0xc6, 0x0e, 0xb9, 0x19, 0x88, 0xd0, 0x2a, 0x06, 0x21, 0x85, 0x33, - 0x69, 0xc7, 0x4e, 0x59, 0x10, 0x04, 0x41, 0x6c, 0x37, 0x2f, 0x36, 0xee, 0x0e, 0xdb, 0x90, 0xb3, - 0x23, 0xf3, 0x9b, 0x24, 0xdf, 0xa2, 0x07, 0xe8, 0x15, 0x7a, 0x0f, 0x8f, 0x1e, 0xa3, 0x83, 0x84, - 0xbe, 0x48, 0x38, 0xbb, 0x2d, 0x91, 0x7a, 0xda, 0x65, 0x7e, 0x9f, 0xef, 0x1f, 0xf8, 0xe2, 0x23, - 0xc3, 0xb5, 0x66, 0x34, 0x1c, 0xc7, 0x81, 0x92, 0x92, 0x8e, 0x5a, 0x7d, 0x6e, 0x58, 0x8b, 0x46, - 0x3c, 0xe6, 0x20, 0x80, 0x0c, 0xb5, 0x32, 0xca, 0x3d, 0xb0, 0x10, 0x49, 0x21, 0x92, 0x42, 0x95, - 0x52, 0xa4, 0x22, 0x65, 0x09, 0xba, 0xfc, 0x4b, 0xe0, 0xca, 0x06, 0xc7, 0x5f, 0xb1, 0x85, 0xea, - 0x1f, 0x08, 0xef, 0xde, 0x24, 0x19, 0x0f, 0x86, 0x19, 0xee, 0x5e, 0xe0, 0xfc, 0x90, 0x69, 0x26, - 0xa1, 0x8c, 0x6a, 0xa8, 0x51, 0x68, 0x1f, 0x92, 0xb5, 0x99, 0xe4, 0xde, 0x42, 0x9d, 0xed, 0xc9, - 0xac, 0xea, 0xf8, 0xa9, 0xc4, 0x7d, 0xc4, 0x25, 0x29, 0xe2, 0xde, 0x12, 0x14, 0x00, 0x42, 0xc5, - 0x3d, 0xcd, 0x0c, 0x87, 0x72, 0xae, 0xb6, 0xd5, 0x28, 0xb4, 0x1b, 0x1b, 0xac, 0xee, 0x44, 0x7c, - 0x95, 0x29, 0x7c, 0x66, 0x78, 0xea, 0xea, 0xca, 0xff, 0x07, 0xa8, 0xbf, 0x23, 0x5c, 0x5c, 0xe1, - 0xdd, 0x53, 0x5c, 0x1c, 0xb1, 0x81, 0x08, 0x99, 0x51, 0xba, 0xc7, 0xc2, 0x50, 0x73, 0x48, 0xfa, - 0xef, 0xf8, 0x7b, 0xd9, 0xe1, 0x32, 0x79, 0x77, 0xbb, 0x78, 0x7f, 0x4d, 0xc9, 0x72, 0x6e, 0x89, - 0x77, 0x4e, 0xbe, 0x66, 0xd5, 0xe3, 0x48, 0x98, 0xa7, 0x97, 0x3e, 0x09, 0x94, 0xa4, 0x81, 0x02, - 0xa9, 0x20, 0xfd, 0x34, 0x21, 0x7c, 0xa6, 0x66, 0x3c, 0xe4, 0x40, 0xae, 0x79, 0xe0, 0x17, 0x57, - 0xfa, 0x75, 0x6e, 0x27, 0x73, 0x0f, 0x4d, 0xe7, 0x1e, 0xfa, 0x9e, 0x7b, 0xe8, 0x6d, 0xe1, 0x39, - 0xd3, 0x85, 0xe7, 0x7c, 0x2e, 0x3c, 0xa7, 0x7b, 0xf6, 0xd7, 0x74, 0xc0, 0x00, 0x44, 0xd0, 0x4c, - 0x06, 0x0a, 0x94, 0xe6, 0x74, 0xd4, 0xa6, 0xaf, 0xd9, 0x54, 0x36, 0xa2, 0x9f, 0xb7, 0x0b, 0x9d, - 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x61, 0xef, 0xfd, 0x1a, 0x02, 0x00, 0x00, + // 358 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x41, 0x4b, 0x02, 0x41, + 0x1c, 0xc5, 0x77, 0x35, 0x84, 0xc6, 0x0e, 0xb9, 0x59, 0x2d, 0x42, 0xab, 0x18, 0x84, 0x14, 0xce, + 0xa4, 0x1d, 0x3b, 0x65, 0x41, 0xd0, 0x29, 0x36, 0xe8, 0xe0, 0xc5, 0xc6, 0xdd, 0x61, 0x1b, 0x72, + 0x76, 0x64, 0xfe, 0xd3, 0x92, 0xf7, 0x3e, 0x40, 0xdf, 0xa8, 0xab, 0x47, 0x8f, 0xd1, 0x41, 0x42, + 0xbf, 0x48, 0xb8, 0xbb, 0x5a, 0x98, 0x1e, 0x3a, 0xed, 0x32, 0xff, 0xdf, 0x7b, 0xef, 0x3f, 0xc3, + 0x43, 0x87, 0x9a, 0x29, 0x45, 0x89, 0x3f, 0x08, 0x3d, 0x29, 0x04, 0x89, 0x1a, 0x5d, 0xa6, 0x69, + 0x83, 0x04, 0x2c, 0x64, 0xc0, 0x01, 0xf7, 0x95, 0xd4, 0xd2, 0xda, 0x8d, 0x21, 0x9c, 0x42, 0x38, + 0x85, 0x4a, 0xc5, 0x40, 0x06, 0x32, 0x26, 0xc8, 0xec, 0x2f, 0x81, 0x4b, 0x6b, 0x1c, 0xe7, 0xe2, + 0x18, 0xaa, 0xbe, 0x9b, 0x68, 0xeb, 0x3a, 0xc9, 0xb8, 0xd3, 0x54, 0x33, 0xeb, 0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f, 0x02, 0x70, 0xaf, 0x9e, 0x54, 0xc3, 0x93, 0x8a, 0x91, 0xa8, 0x49, 0x5e, 0x16, + 0x25, 0x89, 0x53, 0xba, 0xb9, 0xb8, 0x1b, 0x67, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xea, 0x0a, + 0x36, 0xd6, 0x94, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -179,10 +182,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.MinCommissionRates) > 0 { - for iNdEx := len(m.MinCommissionRates) - 1; iNdEx >= 0; iNdEx-- { + if len(m.ValidatorCommissionRates) > 0 { + for iNdEx := len(m.ValidatorCommissionRates) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.MinCommissionRates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ValidatorCommissionRates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -206,7 +209,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MinCommissionRate) Marshal() (dAtA []byte, err error) { +func (m *ValidatorCommissionRate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -216,16 +219,28 @@ func (m *MinCommissionRate) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MinCommissionRate) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatorCommissionRate) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MinCommissionRate) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatorCommissionRate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if m.TargetCommissionRate != nil { + { + size := m.TargetCommissionRate.Size() + i -= size + if _, err := m.TargetCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } if m.MinCommissionRate != nil { { size := m.MinCommissionRate.Size() @@ -267,8 +282,8 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.MinCommissionRates) > 0 { - for _, e := range m.MinCommissionRates { + if len(m.ValidatorCommissionRates) > 0 { + for _, e := range m.ValidatorCommissionRates { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -276,7 +291,7 @@ func (m *GenesisState) Size() (n int) { return n } -func (m *MinCommissionRate) Size() (n int) { +func (m *ValidatorCommissionRate) Size() (n int) { if m == nil { return 0 } @@ -290,6 +305,10 @@ func (m *MinCommissionRate) Size() (n int) { l = m.MinCommissionRate.Size() n += 1 + l + sovGenesis(uint64(l)) } + if m.TargetCommissionRate != nil { + l = m.TargetCommissionRate.Size() + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -363,7 +382,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinCommissionRates", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorCommissionRates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -390,8 +409,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinCommissionRates = append(m.MinCommissionRates, MinCommissionRate{}) - if err := m.MinCommissionRates[len(m.MinCommissionRates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ValidatorCommissionRates = append(m.ValidatorCommissionRates, ValidatorCommissionRate{}) + if err := m.ValidatorCommissionRates[len(m.ValidatorCommissionRates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -416,7 +435,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } -func (m *MinCommissionRate) Unmarshal(dAtA []byte) error { +func (m *ValidatorCommissionRate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -439,10 +458,10 @@ func (m *MinCommissionRate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MinCommissionRate: wiretype end group for non-group") + return fmt.Errorf("proto: ValidatorCommissionRate: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MinCommissionRate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ValidatorCommissionRate: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -513,6 +532,42 @@ func (m *MinCommissionRate) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetCommissionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.TargetCommissionRate = &v + if err := m.TargetCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/dyncomm/types/query.pb.go b/x/dyncomm/types/query.pb.go index e71c7ad83..d73a6e0ce 100644 --- a/x/dyncomm/types/query.pb.go +++ b/x/dyncomm/types/query.pb.go @@ -161,7 +161,8 @@ func (m *QueryRateRequest) GetValidatorAddr() string { // QueryRateResponse is the response type for the Query/Rate RPC method. type QueryRateResponse struct { - Rate *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate,omitempty"` + Rate *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=rate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"rate,omitempty"` + Target *github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=target,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"target,omitempty"` } func (m *QueryRateResponse) Reset() { *m = QueryRateResponse{} } @@ -207,34 +208,34 @@ func init() { func init() { proto.RegisterFile("terra/dyncomm/v1beta1/query.proto", fileDescriptor_6284eb8921642edc) } var fileDescriptor_6284eb8921642edc = []byte{ - // 417 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0x41, 0x4b, 0xe3, 0x40, - 0x1c, 0xc5, 0x93, 0xd2, 0x2d, 0xec, 0x2c, 0xbb, 0xec, 0xce, 0x76, 0x61, 0x09, 0xdb, 0x74, 0x37, - 0x4b, 0xb5, 0x16, 0x9a, 0xb1, 0x15, 0x0f, 0x22, 0x08, 0x16, 0x4f, 0x9e, 0x34, 0xde, 0xbc, 0xc8, - 0x34, 0x19, 0x62, 0xb0, 0xc9, 0xa4, 0x33, 0xd3, 0x62, 0x11, 0x2f, 0x1e, 0x3c, 0x17, 0xfc, 0x08, - 0x7e, 0x99, 0x1e, 0x0b, 0x5e, 0xc4, 0x43, 0x91, 0xd6, 0x0f, 0x22, 0x99, 0x8c, 0xa5, 0xc5, 0x56, - 0x3d, 0x25, 0xfc, 0xf3, 0x7b, 0xef, 0xff, 0xe6, 0x4d, 0xc0, 0x3f, 0x41, 0x18, 0xc3, 0xc8, 0xeb,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, 0xf7, 0x88, 0xeb, 0x48, 0x5d, 0xfd, 0x36, 0x03, - 0x3e, 0x49, 0x57, 0x78, 0xad, 0x83, 0x5c, 0x1a, 0x19, 0xae, 0x2d, 0x39, 0xd1, 0xeb, 0x8e, 0x8c, - 0xca, 0x47, 0xd0, 0x34, 0xab, 0x55, 0xba, 0xba, 0x7b, 0xba, 0xc9, 0x14, 0x61, 0x01, 0x2d, 0xbe, - 0x93, 0xb4, 0x22, 0xd8, 0xd7, 0x41, 0x36, 0x39, 0x23, 0x5c, 0x7d, 0xcb, 0x7b, 0xa6, 0x40, 0xa3, - 0xfc, 0x3e, 0xa8, 0x22, 0x6c, 0xca, 0x08, 0x08, 0x56, 0x97, 0x44, 0x48, 0x3a, 0xe1, 0xe8, 0x62, - 0xfe, 0x3a, 0x2e, 0x1b, 0xfb, 0x83, 0xb1, 0xa9, 0x0f, 0xc7, 0xa6, 0xfe, 0x38, 0x36, 0xf5, 0xfe, - 0xc4, 0xd4, 0x86, 0x13, 0x53, 0xbb, 0x9f, 0x98, 0xda, 0xf1, 0xfa, 0x6c, 0xdb, 0x2d, 0xcc, 0x79, - 0xe0, 0x56, 0x53, 0x6b, 0x97, 0x32, 0x82, 0xba, 0x75, 0x74, 0x3e, 0x5d, 0x22, 0xbb, 0x6f, 0xe6, - 0xe4, 0x2f, 0xb7, 0xf1, 0x1c, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x98, 0xd4, 0x5d, 0x07, 0x03, 0x00, - 0x00, + // 431 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4d, 0x8b, 0xd3, 0x40, + 0x18, 0xce, 0x94, 0x1a, 0x70, 0x44, 0xd1, 0xb1, 0x42, 0x09, 0x36, 0xd5, 0x48, 0xb5, 0x16, 0x9a, + 0xb1, 0x15, 0x0f, 0x22, 0x08, 0x06, 0x4f, 0x9e, 0x34, 0x47, 0x2f, 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a8, 0x8b, 0xff, 0xae, 0x4c, 0x54, 0xfb, 0x3d, 0x53, 0xfd, 0xb7, + 0xef, 0x2f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x07, 0xfa, 0x2c, 0xae, 0x4c, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -461,6 +462,18 @@ func (m *QueryRateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Target != nil { + { + size := m.Target.Size() + i -= size + if _, err := m.Target.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } if m.Rate != nil { { size := m.Rate.Size() @@ -530,6 +543,10 @@ func (m *QueryRateResponse) Size() (n int) { l = m.Rate.Size() n += 1 + l + sovQuery(uint64(l)) } + if m.Target != nil { + l = m.Target.Size() + n += 1 + l + sovQuery(uint64(l)) + } return n } @@ -819,6 +836,42 @@ func (m *QueryRateResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var v github_com_cosmos_cosmos_sdk_types.Dec + m.Target = &v + if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:])