Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4R: Validator Commission Model #2365

Merged
merged 32 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0836abd
Update validator commission fields
Sep 20, 2018
2d3cbcd
Remove CommissionChangeToday and update to use CommissionChangeTime
Sep 20, 2018
06aacb9
Implement commission as a first class citizen type
Sep 20, 2018
d2f60c9
Implement stringer for Comission
Sep 20, 2018
0bdbf8c
Move commission type and logic to new file
Sep 20, 2018
243ec85
Add new commission errors
Sep 20, 2018
f7e2f3b
Add commission to create validator message
Sep 20, 2018
66094d1
Implement and call UpdateValidatorCommission
Sep 20, 2018
d410639
Update godoc for UpdateValidatorCommission
Sep 20, 2018
e29414e
Add Abs to the decimal type
Sep 20, 2018
6403d19
Implement new SetValidatorCommission
Sep 20, 2018
e89b751
Update decimal short godocs
Sep 20, 2018
a0b55c6
Move set initial commission logic
Sep 20, 2018
4bc9070
Move initial commission validation to Commission type
Sep 20, 2018
cabcd3c
Update initial validator commission logic and unit tests
Sep 21, 2018
04945e4
Remove commission update time from struct and move to validator
Sep 21, 2018
6606348
Update validator create handler tests
Sep 21, 2018
a3947dc
Implement commission logic for CLI
Sep 21, 2018
8b12742
Fix make lint failure
Sep 21, 2018
d743ba8
Fix make cover failure
Sep 21, 2018
7f9f927
Update edit validator logic to handle new commission rate
Sep 21, 2018
8eb926d
Fix lint and cover
Sep 21, 2018
3aa7f5f
Update create/edit validator simulation to include commission params
Sep 21, 2018
08dc442
Update MsgEditValidator godoc
Sep 21, 2018
d22c4d9
Update pending log
Sep 21, 2018
089a279
Update staking tx docs
Sep 21, 2018
a3f0dc8
Fix CLI create validator test
Sep 21, 2018
66c25aa
Update variables names for commission strings
Sep 24, 2018
307cb15
Merge UpdateTime into Commission type
Sep 24, 2018
588a553
Update create-validator usage in docs
Sep 24, 2018
a117fcf
Update more docs with examples
Sep 24, 2018
f75029d
More doc updates
Sep 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update variables names for commission strings
  • Loading branch information
Aleksandr Bezobchuk committed Sep 24, 2018
commit 66c25aadef7ebc5d9509e3d29a9aee84b210cb33
8 changes: 4 additions & 4 deletions x/stake/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ func GetCmdCreateValidator(cdc *codec.Codec) *cobra.Command {
}

// get the initial validator commission parameters
cRate := viper.GetString(FlagCommissionRate)
cMaxRate := viper.GetString(FlagCommissionMaxRate)
cMaxChangeRate := viper.GetString(FlagCommissionMaxChangeRate)
commission, err := getCommission(cRate, cMaxRate, cMaxChangeRate)
rateStr := viper.GetString(FlagCommissionRate)
maxRateStr := viper.GetString(FlagCommissionMaxRate)
maxChangeRateStr := viper.GetString(FlagCommissionMaxChangeRate)
commission, err := getCommission(rateStr, maxRateStr, maxChangeRateStr)
if err != nil {
return err
}
Expand Down
12 changes: 5 additions & 7 deletions x/stake/client/cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"github.com/pkg/errors"
)

// nolint: gocyclo
// TODO: Make this pass gocyclo linting
func getShares(
storeName string, cdc *codec.Codec, sharesAmountStr,
sharesPercentStr string, delAddr sdk.AccAddress, valAddr sdk.ValAddress,
Expand Down Expand Up @@ -65,22 +63,22 @@ func getShares(
return
}

func getCommission(cRate, cMaxRate, cMaxChangeRate string) (commission types.Commission, err error) {
if cRate == "" || cMaxRate == "" || cMaxChangeRate == "" {
func getCommission(rateStr, maxRateStr, maxChangeRateStr string) (commission types.Commission, err error) {
if rateStr == "" || maxRateStr == "" || maxChangeRateStr == "" {
return commission, errors.Errorf("must specify all validator commission parameters")
}

rate, err := sdk.NewDecFromStr(cRate)
rate, err := sdk.NewDecFromStr(rateStr)
if err != nil {
return commission, err
}

maxRate, err := sdk.NewDecFromStr(cMaxRate)
maxRate, err := sdk.NewDecFromStr(maxRateStr)
if err != nil {
return commission, err
}

maxChangeRate, err := sdk.NewDecFromStr(cMaxChangeRate)
maxChangeRate, err := sdk.NewDecFromStr(maxChangeRateStr)
if err != nil {
return commission, err
}
Expand Down