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

fix: Incorrect error message when periodlimit is not set on a feegrant tx #10050

Merged
merged 22 commits into from
Sep 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c7c07db
improved error message for period limit on fee grant
fkneeland-figure Sep 1, 2021
3880d41
added changelog entry
fkneeland-figure Sep 1, 2021
0286f16
added newline
fkneeland-figure Sep 1, 2021
a8bfb73
Merge branch 'master' into improve_feegrant_error_message
fkneeland-figure Sep 2, 2021
bf679c9
cr fixes
fkneeland-figure Sep 7, 2021
88d16d1
Merge branch 'master' of github.com:cosmos/cosmos-sdk into improve_fe…
fkneeland-figure Sep 7, 2021
28442b4
Merge branch 'improve_feegrant_error_message' of github.com:fkneeland…
fkneeland-figure Sep 7, 2021
26a004d
Update CHANGELOG.md
aleem1314 Sep 8, 2021
e3a087a
Merge branch 'master' into improve_feegrant_error_message
aleem1314 Sep 8, 2021
1adfc3f
updated changelog
fkneeland-figure Sep 8, 2021
4d81433
Merge branch 'master' of github.com:cosmos/cosmos-sdk into improve_fe…
fkneeland-figure Sep 8, 2021
e79e0a5
Merge branch 'improve_feegrant_error_message' of github.com:fkneeland…
fkneeland-figure Sep 8, 2021
9114030
Update x/feegrant/client/cli/tx.go
alexanderbez Sep 9, 2021
115e67f
Update CHANGELOG.md
alexanderbez Sep 9, 2021
d2c4c15
cr fixes
fkneeland-figure Sep 9, 2021
6dd75b4
Merge branch 'improve_feegrant_error_message' of github.com:fkneeland…
fkneeland-figure Sep 9, 2021
60bf318
Merge branch 'master' of github.com:cosmos/cosmos-sdk into improve_fe…
fkneeland-figure Sep 9, 2021
5d868d1
Merge branch 'master' into improve_feegrant_error_message
alexanderbez Sep 9, 2021
aa67555
Merge branch 'master' into improve_feegrant_error_message
fkneeland-figure Sep 9, 2021
4906809
Merge branch 'master' into improve_feegrant_error_message
amaury1093 Sep 14, 2021
8c9d6cf
Merge branch 'master' into improve_feegrant_error_message
alexanderbez Sep 14, 2021
6d2b81e
Merge branch 'master' into improve_feegrant_error_message
fkneeland-figure Sep 14, 2021
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
+ [\#9980](https://github.com/cosmos/cosmos-sdk/pull/9980) Returning the error when the invalid argument is passed to bank query total supply cli.
+ [\#10061](https://github.com/cosmos/cosmos-sdk/pull/10061) Ensure that `LegacyAminoPubKey` struct correctly unmarshals from JSON
* (server) [#10016](https://github.com/cosmos/cosmos-sdk/issues/10016) Fix marshaling of index-events into server config file.
* (x/feegrant) [\#10049](https://github.com/cosmos/cosmos-sdk/issues/10049) Fixed the error message when `period` or `period-limit` flag is not set on a feegrant grant transaction.


### State Machine Breaking
Expand Down
39 changes: 21 additions & 18 deletions x/feegrant/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,25 +125,28 @@ Examples:
return err
}

if periodClock > 0 && periodLimit != nil {
fkneeland-figure marked this conversation as resolved.
Show resolved Hide resolved
periodReset := getPeriodReset(periodClock)
if exp != "" && periodReset.Sub(expiresAtTime) > 0 {
return fmt.Errorf("period(%d) cannot reset after expiration(%v)", periodClock, exp)
}

periodic := feegrant.PeriodicAllowance{
Basic: basic,
Period: getPeriod(periodClock),
PeriodReset: getPeriodReset(periodClock),
PeriodSpendLimit: periodLimit,
PeriodCanSpend: periodLimit,
}

grant = &periodic

} else {
return fmt.Errorf("invalid number of args %d", len(args))
if periodClock <= 0 {
return fmt.Errorf("period clock was not set")
}

if periodLimit == nil {
return fmt.Errorf("period limit was not set")
}

periodReset := getPeriodReset(periodClock)
aleem1314 marked this conversation as resolved.
Show resolved Hide resolved
if exp != "" && periodReset.Sub(expiresAtTime) > 0 {
return fmt.Errorf("period (%d) cannot reset after expiration (%v)", periodClock, exp)
}

periodic := feegrant.PeriodicAllowance{
Basic: basic,
Period: getPeriod(periodClock),
PeriodReset: getPeriodReset(periodClock),
PeriodSpendLimit: periodLimit,
PeriodCanSpend: periodLimit,
}

grant = &periodic
}

allowedMsgs, err := cmd.Flags().GetStringSlice(FlagAllowedMsgs)
Expand Down