Skip to content

Commit

Permalink
docs: update authz to include StakeAuthorization (cosmos#10821)
Browse files Browse the repository at this point in the history
Added StakeAuthorization & moved GenericAuthorization to the top.

Co-authored-by: Marko <[email protected]>
  • Loading branch information
nooomski and tac0turtle authored Dec 21, 2021
1 parent 3cbc38d commit b67c4b3
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions x/authz/spec/01_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ Authorization is an interface that must be implemented by a concrete authorizati

The Cosmos SDK `x/authz` module comes with following authorization types:

### GenericAuthorization

`GenericAuthorization` implements the `Authorization` interface that gives unrestricted permission to execute the provided Msg on behalf of granter's account.

+++ https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-beta1/proto/cosmos/authz/v1beta1/authz.proto#L14-L19

+++ https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-beta1/x/authz/generic_authorization.go#L18-L31

- `msg` stores Msg type URL.

### SendAuthorization

`SendAuthorization` implements the `Authorization` interface for the `cosmos.bank.v1beta1.MsgSend` Msg. It takes a `SpendLimit` that specifies the maximum amount of tokens the grantee can spend. The `SpendLimit` is updated as the tokens are spent.
Expand All @@ -30,15 +40,13 @@ The Cosmos SDK `x/authz` module comes with following authorization types:

- `spend_limit` keeps track of how many coins are left in the authorization.

### GenericAuthorization

`GenericAuthorization` implements the `Authorization` interface that gives unrestricted permission to execute the provided Msg on behalf of granter's account.
### StakeAuthorization

+++ https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-beta1/proto/cosmos/authz/v1beta1/authz.proto#L14-L19
`StakeAuthorization` implements the `Authorization` interface for messages in the [staking module](https://docs.cosmos.network/v0.44/modules/staking/). It takes an `AuthorizationType` to specify whether you want to authorise delegating, undelegating or redelegating (i.e. these have to be authorised seperately). It also takes a `MaxTokens` that keeps track of a limit to the amount of tokens that can be delegated/undelegated/redelegated. If left empty, the amount is unlimited. Additionally, this Msg takes an `AllowList` and a `DenyList`, which allows you to select which validators you allow grantees to stake with.

+++ https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-beta1/x/authz/generic_authorization.go#L18-L31
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-beta1/proto/cosmos/staking/v1beta1/authz.proto#L11-L31

- `msg` stores Msg type URL.
+++ https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-beta1/x/staking/types/authz.go#L18-L38

## Gas

Expand Down

0 comments on commit b67c4b3

Please sign in to comment.