-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
WIP: Add x/msg_authorization
module
#7370
Closed
Closed
Changes from all commits
Commits
Show all changes
89 commits
Select commit
Hold shift + click to select a range
5a34c06
WIP: Msg authorization module added
atheeshp d30572c
Merge branch 'master' of github.com:cosmos/cosmos-sdk into msg_author…
atheeshp 5087ad3
Merge branch 'master' of github.com:cosmos/cosmos-sdk into msg_auth_p…
atheeshp 3eac303
fixing errors
atheeshp beb7cc2
Merge branch 'master' of github.com:cosmos/cosmos-sdk into msg_auth_p…
atheeshp 39f1715
fixed errors
atheeshp 0f71c06
fixed module.go
atheeshp ffd988e
Merge branch 'master' of github.com:cosmos/cosmos-sdk into msg_auth_p…
atheeshp 14870e4
Add msg_tests
aleem1314 c2d6db2
fixes compile issues
atheeshp 307cc99
Merge branch 'msg_auth_proto' of https://github.com/cosmos/cosmos-sdk…
aleem1314 5362872
fix test
atheeshp 61834b6
Merge branch 'master' of github.com:cosmos/cosmos-sdk into msg_auth_p…
atheeshp 7b80c0f
fix test
atheeshp ca9062e
Merge branch 'master' into msg_authorization
atheeshp f27b8f1
Merge branch 'msg_authorization' of github.com:cosmos/cosmos-sdk into…
atheeshp 64224ea
Merge branch 'msg_auth_proto' of https://github.com/cosmos/cosmos-sdk…
aleem1314 5d9da55
Add msg types tests
aleem1314 e4b8dd5
Fix Getmsgs
aleem1314 4f2e40e
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into al…
aleem1314 3b487ad
fixed codec issue
atheeshp c0ec30e
Fix syntax issues
aleem1314 df76719
Merge branch 'master' of github.com:cosmos/cosmos-sdk into msg_auth_p…
atheeshp 8d480cd
Merge branch 'msg_auth_proto' of https://github.com/cosmos/cosmos-sdk…
aleem1314 3e985e7
Fix keeper
aleem1314 f6024d3
fixed proto issues
atheeshp 6243445
Fix keeper tests
aleem1314 2490825
Merge branch 'msg_auth_proto' of https://github.com/cosmos/cosmos-sdk…
aleem1314 2f75c50
fixed router in keeper
atheeshp 4cb8b77
Merge branch 'master' into msg_authorization
atheeshp 9745393
Merge branch 'msg_authorization' of github.com:cosmos/cosmos-sdk into…
atheeshp 24da343
Merge branch 'master' of github.com:cosmos/cosmos-sdk into msg_author…
atheeshp fbbcbac
Merge branch 'msg_authorization' of github.com:cosmos/cosmos-sdk into…
atheeshp d280dad
Merge branch 'msg_auth_proto' of github.com:cosmos/cosmos-sdk into ms…
atheeshp 63acf05
Fix query proto
aleem1314 f22d8be
Merge branch 'aleem/msg_authorization' into msg_authorization
aleem1314 6d4f640
Merge branch 'master' of github.com:cosmos/cosmos-sdk into msg_author…
atheeshp cd4dba1
Merge branch 'msg_authorization' of github.com:cosmos/cosmos-sdk into…
atheeshp 0f6266b
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 38566b6
Fix cli txs
aleem1314 b118e4c
Add grpc query client implementation
aleem1314 01ad577
Add grpc-keeper test
aleem1314 246f3f4
Add grpc query tests
aleem1314 f4a5734
Fix linting issues
aleem1314 d442400
Fix cli query
aleem1314 2bae46c
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 2b759a7
fix lint errors
aleem1314 6f6cf7e
Add Genesis state
aleem1314 35e107d
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 edf46c8
Fix query authorization
aleem1314 4bd54a6
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 9d1040d
Review changes
aleem1314 d8a2a18
Fix grant authorization handler
aleem1314 d100e49
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 9ec3f39
Add cli tests
aleem1314 ab3f14a
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 f1e434b
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 5c37e32
Add cli tests
aleem1314 8be9599
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 8b16c06
Fix genesis test
aleem1314 291ec19
Fix issues
aleem1314 d81ec6b
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 1d6aa18
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 cd72441
update module to use proto msg services
aleem1314 53462e6
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 39f876b
Add simultion tests
aleem1314 8656392
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 04f3c8a
Fix lint
aleem1314 cf097d4
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 5f95ca8
fix lint
aleem1314 721aab3
Merge branch 'msg_authorization' of github.com:cosmos/cosmos-sdk into…
atheeshp fc60444
Merge branch 'master' into msg_authorization
atheeshp f417681
WIP simulations
aleem1314 eb782c5
Merge branch 'msg_authorization' of https://github.com/cosmos/cosmos-…
aleem1314 d78a517
Merge branch 'msg_authorization' of github.com:cosmos/cosmos-sdk into…
atheeshp 8d28432
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 1c166e0
WIP simulations
aleem1314 3d43482
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 1ea7693
add msg tests
aleem1314 fc9438a
Merge branch 'master' of https://github.com/cosmos/cosmos-sdk into ms…
aleem1314 39bb25d
Fix simulation
aleem1314 f728be7
Fix errors
aleem1314 be3c14d
Merge branch 'msg_authorization' of github.com:cosmos/cosmos-sdk into…
atheeshp 5c5d126
fix genesis import export
atheeshp bbd3930
fix sim tests
atheeshp 85dfb75
fix sim
atheeshp a4a81c7
fix test
atheeshp f5bfa38
Merge branch 'master' into msg_authorization
atheeshp b2b2106
Merge branch 'master' into msg_authorization
atheeshp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
syntax = "proto3"; | ||
package cosmos.msg_authorization.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/msg_authorization/v1beta1/tx.proto"; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/msg_authorization/types"; | ||
|
||
// GenesisState defines the msg_authorization module's genesis state. | ||
message GenesisState { | ||
repeated MsgGrantAuthorization authorization = 1 [(gogoproto.nullable) = false]; | ||
} |
44 changes: 44 additions & 0 deletions
44
proto/cosmos/msg_authorization/v1beta1/msg_authorization.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
syntax = "proto3"; | ||
package cosmos.msg_authorization.v1beta1; | ||
|
||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/any.proto"; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/msg_authorization/types"; | ||
|
||
// SendAuthorization allows the grantee to spend up to spend_limit coins from | ||
// the granter's account. | ||
message SendAuthorization{ | ||
option (gogoproto.equal) = true; | ||
option (gogoproto.goproto_getters) = false; | ||
option (cosmos_proto.implements_interface) = "Authorization"; | ||
|
||
repeated cosmos.base.v1beta1.Coin spend_limit = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", | ||
(gogoproto.moretags) = "yaml:\"spend_limit\"" | ||
]; | ||
} | ||
|
||
// GenericAuthorization gives the grantee unrestricted permissions to execute | ||
// the provide method on behalf of the granter's account. | ||
message GenericAuthorization{ | ||
option (gogoproto.equal) = true; | ||
option (gogoproto.goproto_getters) = false; | ||
option (cosmos_proto.implements_interface) = "Authorization"; | ||
|
||
string method_name = 1[ | ||
(gogoproto.customname)="MessageName" | ||
]; | ||
} | ||
|
||
// TODO | ||
message AuthorizationGrant{ | ||
option (gogoproto.goproto_getters) = false; | ||
google.protobuf.Any authorization = 1 [ | ||
(cosmos_proto.accepts_interface) = "Authorization" | ||
]; | ||
int64 expiration = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
syntax = "proto3"; | ||
package cosmos.msg_authorization.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/any.proto"; | ||
import "google/api/annotations.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/msg_authorization/types"; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// Returns any `Authorization` (or `nil`), with the expiration time, granted to the grantee by the granter for the provided msg type. | ||
rpc Authorization(QueryAuthorizationRequest) returns (QueryAuthorizationResponse) { | ||
option (google.api.http).get = "/cosmos/msgauth/v1beta1/granters/{granter_addr}/grantees/{grantee_addr}/{msg_type}"; | ||
} | ||
|
||
} | ||
|
||
// QueryAuthorizationRequest is the request type for the Query/Authorization RPC method. | ||
message QueryAuthorizationRequest { | ||
option (gogoproto.equal) = false; | ||
option (gogoproto.goproto_getters) = false; | ||
|
||
string granter_addr = 1; | ||
string grantee_addr = 2; | ||
|
||
string msg_type = 3; | ||
} | ||
|
||
// QueryAuthorizationResponse is the response type for the Query/Authorization RPC method. | ||
message QueryAuthorizationResponse { | ||
// account defines the account of the corresponding address. | ||
google.protobuf.Any authorization = 1 [(cosmos_proto.accepts_interface) = "Authorization"]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
syntax = "proto3"; | ||
package cosmos.msg_authorization.v1beta1; | ||
|
||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
import "google/protobuf/any.proto"; | ||
import "cosmos/base/abci/v1beta1/abci.proto"; | ||
option go_package = "github.com/cosmos/cosmos-sdk/x/msg_authorization/types"; | ||
option (gogoproto.equal_all) = true; | ||
|
||
|
||
// Msg defines the msg_authorization Msg service. | ||
service Msg { | ||
// GrantAuthorization grants the provided authorization to the grantee on the granter's | ||
// account with the provided expiration time. | ||
rpc GrantAuthorization(MsgGrantAuthorization) returns (MsgGrantAuthorizationResponse); | ||
// ExecAuthorized attempts to execute the provided messages using | ||
// authorizations granted to the grantee. Each message should have only | ||
// one signer corresponding to the granter of the authorization. | ||
rpc ExecAuthorized(MsgExecAuthorized) returns (MsgExecAuthorizedResponse); | ||
// RevokeAuthorization revokes any authorization corresponding to the provided method name on the | ||
// granter's account that has been granted to the grantee. | ||
rpc RevokeAuthorization(MsgRevokeAuthorization) returns (MsgRevokeAuthorizationResponse); | ||
} | ||
|
||
// MsgGrantAuthorization grants the provided authorization to the grantee on the granter's | ||
// account with the provided expiration time. | ||
message MsgGrantAuthorization{ | ||
option (gogoproto.equal) = true; | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
string granter = 1; | ||
string grantee = 2; | ||
|
||
google.protobuf.Any authorization = 3 [ | ||
(cosmos_proto.accepts_interface) = "Authorization" | ||
]; | ||
google.protobuf.Timestamp expiration = 4 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.stdtime) = true | ||
]; | ||
} | ||
|
||
|
||
// MsgExecAuthorizedResponse defines the Msg/MsgExecAuthorizedResponse response type. | ||
message MsgExecAuthorizedResponse { | ||
option (gogoproto.equal) = false; | ||
|
||
cosmos.base.abci.v1beta1.Result result = 1; | ||
} | ||
|
||
// MsgExecAuthorized attempts to execute the provided messages using | ||
// authorizations granted to the grantee. Each message should have only | ||
// one signer corresponding to the granter of the authorization. | ||
message MsgExecAuthorized { | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
string grantee = 1; | ||
repeated google.protobuf.Any msgs = 2 [ | ||
(cosmos_proto.accepts_interface) = "github.com/cosmos/cosmos-sdk/types.Msg", | ||
(gogoproto.moretags) = "yaml:\"msgs\"" | ||
]; | ||
} | ||
|
||
// MsgGrantAuthorizationResponse defines the Msg/MsgGrantAuthorization response type. | ||
message MsgGrantAuthorizationResponse { } | ||
|
||
// MsgRevokeAuthorization revokes any authorization with the provided sdk.Msg type on the | ||
// granter's account with that has been granted to the grantee. | ||
message MsgRevokeAuthorization{ | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
|
||
string granter = 1; | ||
string grantee = 2; | ||
string authorization_msg_type = 3 [(gogoproto.moretags) = "yaml:\"authorization_msg_type\""]; | ||
} | ||
|
||
// MsgRevokeAuthorizationResponse defines the Msg/MsgRevokeAuthorizationResponse response type. | ||
message MsgRevokeAuthorizationResponse { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.