Concepts

Cosmos-SDK Authz module Concepts

A grant is an allowance to execute a Msg by the grantee on behalf of the granter. Authorization is an interface that must be implemented by a concrete authorization logic to validate and execute grants. Authorizations are extensible and can be defined for any Msg service method even outside of the module where the Msg method is defined. See the SendAuthorization example in the next section for more details.

Note: The authz module is different from the auth module that is responsible for specifying the base transaction and account types.

Gas

In order to prevent DoS attacks, granting StakeAuthorizations with x/authz incurs gas. StakeAuthorization allows you to authorize another account to delegate, undelegate, or redelegate to validators. The authorizer can define a list of validators they allow or deny delegations to. The Cosmos SDK iterates over these lists and charges 10 gas for each validator in both of the lists.

Since the state maintains a list for granter, and grantee pair with the same expiration, we are iterating over the list to remove the grant (in case of any revoke of particular msgType) from the list and we are charging 20 gas per iteration.

Last updated