-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat!: make grant expiration optional #11060
Conversation
932bb6d
to
ecc83c1
Compare
ecc83c1
to
5201088
Compare
Codecov Report
@@ Coverage Diff @@
## master #11060 +/- ##
==========================================
+ Coverage 65.86% 65.89% +0.03%
==========================================
Files 675 675
Lines 69773 69789 +16
==========================================
+ Hits 45955 45988 +33
+ Misses 21118 21100 -18
- Partials 2700 2701 +1
|
@@ -173,10 +173,22 @@ Examples: | |||
cmd.Flags().String(FlagSpendLimit, "", "SpendLimit for Send Authorization, an array of Coins allowed spend") | |||
cmd.Flags().StringSlice(FlagAllowedValidators, []string{}, "Allowed validators addresses separated by ,") | |||
cmd.Flags().StringSlice(FlagDenyValidators, []string{}, "Deny validators addresses separated by ,") | |||
cmd.Flags().Int64(FlagExpiration, time.Now().AddDate(1, 0, 0).Unix(), "The Unix timestamp. Default is one year.") | |||
cmd.Flags().Int64(FlagExpiration, 0, "Expire time as Unix timestamp. Set zero (0) for no expiry. Default is 0.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the default here to zero = no expiration time.
Maybe we would like to explicitly require the value? In that case:
- 0 would be not allowed
- -1 = no expire date
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 0 == no expiration time makes the most sense.
Alternatively we can do:
- 0 == no expiry
- default is -1
- all negative values are not allowed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively we can do: 0 == no expiry; default is -1
If we want to make the CLI param required, the I prefer -1 as no expire, this is because 0 would mean "default", and we don't want default (from the user perspective).
all negative values are not allowed
Now, all values < blocktime().unix()
are not allowed , except zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was thinking:
cmd.Flags().Int64(FlagExpiration, 0, "Expire time as Unix timestamp. Set zero (0) for no expiry. Default is 0.") | |
cmd.Flags().Int64(FlagExpiration, -1, "Expire time as Unix timestamp. Set zero (0) for no expiry.") |
But tbh -1 = no expire date sounds good to me too, if there's a help message.
79649a3
to
2c4025b
Compare
return simtypes.NoOpMsg(authz.ModuleName, TypeMsgGrant, "past time"), nil, nil | ||
var expiration *time.Time | ||
t1 := simtypes.RandTimestamp(r) | ||
if !t1.Before(ctx.BlockTime()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bummer! calling a rand here will cause sim tests to fail :( This is because our simulation tests don't simulate much - they are almost 'pre defined': we have one grant message, one exec and one revoke. it's basically one premade scenario with lot of boilerplate.
f8284d0
to
cf7ab0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation looks good to me, pending simulations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving pending sims test fix, I suppose related to #11060 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, except sims & few nits.
Wow, there is a weird convolution, no idea why this test is failing:
|
It is also failing in master |
@robert-zaremba It's fixed on master now |
Description
Closes: #11095
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change