-
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
add MsgVote authorization #8462
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8462 +/- ##
==========================================
- Coverage 61.48% 61.46% -0.02%
==========================================
Files 630 631 +1
Lines 36398 36408 +10
==========================================
Hits 22379 22379
- Misses 11670 11679 +9
- Partials 2349 2350 +1
|
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, Just one query
if !allow { | ||
return nil, sdkerrors.Wrapf(sdkerrors.ErrInsufficientFunds, "requested amount is more than spend limit") | ||
return nil, err |
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.
Nice
@@ -20,7 +20,7 @@ type Authorization interface { | |||
|
|||
// Accept determines whether this grant permits the provided sdk.ServiceMsg to be performed, and if | |||
// so provides an upgraded authorization instance. | |||
Accept(msg sdk.ServiceMsg, block tmproto.Header) (allow bool, updated Authorization, delete bool) | |||
Accept(msg sdk.ServiceMsg, block tmproto.Header) (allow bool, updated Authorization, delete bool, err error) |
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.
👍
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.
We can just replace allow with error if this is needed
|
||
// VoteAuthorization allows the grantee to vote on a proposal on behalf of the granter's account. | ||
message VoteAuthorization { | ||
option (cosmos_proto.implements_interface) = "Authorization"; |
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.
How about authorizing for specific type of proposals? That would be more granular I believe.
ProposalType: Any
It can have one of All
, TextProposal
, SoftwareUpgradeProposal
, ParamChangeProposal
etc.
@amaurymartiny any thoughts
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 agree 👍
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 didn't get how we can achieve this, Accept
method doesn't have access to the state/keeper.
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.
Ah yes, we should find a cleaner way to handle this
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.
So we can use GenericAuthorization if there is nothing special to check here. Adding state access seems out of scope and feels like we should address with the ADR 033 approach if we do...
Co-authored-by: Anil Kumar Kammari <[email protected]>
So I think that maybe this is superfluous unfortunately. Everything we can do here without state access can be done with GenericAuthorization... So maybe we close this PR and open an issue to discuss state access in authorizations. I think it should basically be the ability to query read only state using ADR033... but there is a dependency on the ADR 033 code which hasn't been upstreamed yet. So we should address in the next release instead. |
Closing this for now, follow-up discussion : #8468 |
Description
ref: #8312
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes