Skip to content

Commit

Permalink
docs: fix toc links (cosmos#13770)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Nov 4, 2022
1 parent d2e4154 commit d6e5bb3
Show file tree
Hide file tree
Showing 16 changed files with 622 additions and 679 deletions.
8 changes: 7 additions & 1 deletion docs/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,13 @@ html {
@apply text-6 font-bold leading-9 tracking-tight;
}
h3 {
@apply text-4 font-semibold leading-7 tracking-tight;
@apply text-4 font-semibold leading-8 tracking-tight;
}
h4 {
@apply text-3 font-semibold leading-7 tracking-tight;
}
h5 {
@apply text-3 font-semibold leading-6 tracking-wide;
}
p {
@apply leading-relaxed;
Expand Down
52 changes: 26 additions & 26 deletions x/authz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ granting arbitrary privileges from one account (the granter) to another account
* [gRPC](#grpc)
* [REST](#rest)

# Concepts
## Concepts

## Authorization and Grant
### Authorization and Grant

The `x/authz` module defines interfaces and messages grant authorizations to perform actions
on behalf of one account to other accounts. The design is defined in the [ADR 030](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-030-authz-module.md).
Expand All @@ -44,11 +44,11 @@ Authorization is an interface that must be implemented by a concrete authorizati
https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/x/authz/authorizations.go#L11-L25
```

## Built-in Authorizations
### Built-in Authorizations

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

### GenericAuthorization
#### GenericAuthorization

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

Expand All @@ -62,7 +62,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/x/authz/generic_authorization.

* `msg` stores Msg type URL.

### SendAuthorization
#### SendAuthorization

`SendAuthorization` implements the `Authorization` interface for the `cosmos.bank.v1beta1.MsgSend` Msg. It takes a (positive) `SpendLimit` that specifies the maximum amount of tokens the grantee can spend. The `SpendLimit` is updated as the tokens are spent.

Expand All @@ -76,7 +76,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/x/bank/types/send_authorizatio

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

### StakeAuthorization
#### StakeAuthorization

`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 required `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` or a `DenyList`, which allows you to select which validators you allow or deny grantees to stake with.

Expand All @@ -88,15 +88,15 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/proto/cosmos/staking/v1beta1/a
https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/x/staking/types/authz.go#L15-L35
```

## Gas
### Gas

In order to prevent DoS attacks, granting `StakeAuthorization`s 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 charge 10 gas for each validator in both of the lists.

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

# State
## State

## Grant
### Grant

Grants are identified by combining granter address (the address bytes of the granter), grantee address (the address bytes of the grantee) and Authorization type (its type URL). Hence we only allow one grant for the (granter, grantee, Authorization) triple.

Expand All @@ -108,7 +108,7 @@ The grant object encapsulates an `Authorization` type and an expiration timestam
https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/proto/cosmos/authz/v1beta1/authz.proto#L22-L30
```

## GrantQueue
### GrantQueue

We are maintaining a queue for authz pruning. Whenever a grant is created, an item will be added to `GrantQueue` with a key of expiration, granter, grantee.

Expand All @@ -122,11 +122,11 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/x/authz/keeper/keys.go#L78-L93

The `GrantQueueItem` object contains the list of type urls between granter and grantee that expire at the time indicated in the key.

# Messages
## Messages

In this section we describe the processing of messages for the authz module.

## MsgGrant
### MsgGrant

An authorization grant is created using the `MsgGrant` message.
If there is already a grant for the `(granter, grantee, Authorization)` triple, then the new grant overwrites the previous one. To update or extend an existing grant, a new grant with the same `(granter, grantee, Authorization)` triple should be created.
Expand All @@ -142,7 +142,7 @@ The message handling should fail if:
* provided `Grant.Authorization` is not implemented.
* `Authorization.MsgTypeURL()` is not defined in the router (there is no defined handler in the app router to handle that Msg types).

## MsgRevoke
### MsgRevoke

A grant can be removed with the `MsgRevoke` message.

Expand All @@ -157,7 +157,7 @@ The message handling should fail if:

NOTE: The `MsgExec` message removes a grant if the grant has expired.

## MsgExec
### MsgExec

When a grantee wants to execute a transaction on behalf of a granter, they must send `MsgExec`.

Expand All @@ -171,25 +171,25 @@ The message handling should fail if:
* grantee doesn't have permission to run the transaction.
* if granted authorization is expired.

# Events
## Events

The authz module emits proto events defined in [the Protobuf reference](https://buf.build/cosmos/cosmos-sdk/docs/main/cosmos.authz.v1beta1#cosmos.authz.v1beta1.EventGrant).

# Client
## Client

## CLI
### CLI

A user can query and interact with the `authz` module using the CLI.

### Query
#### Query

The `query` commands allow users to query `authz` state.

```bash
simd query authz --help
```

#### grants
##### grants

The `grants` command allows users to query grants for a granter-grantee pair. If the message type URL is set, it selects grants only for that message type.

Expand All @@ -216,15 +216,15 @@ grants:
pagination: null
```

### Transactions
#### Transactions

The `tx` commands allow users to interact with the `authz` module.

```bash
simd tx authz --help
```

#### exec
##### exec

The `exec` command allows a grantee to execute a transaction on behalf of granter.

Expand All @@ -238,7 +238,7 @@ Example:
simd tx authz exec tx.json --from=cosmos1..
```

#### grant
##### grant

The `grant` command allows a granter to grant an authorization to a grantee.

Expand All @@ -252,7 +252,7 @@ Example:
simd tx authz grant cosmos1.. send --spend-limit=100stake --from=cosmos1..
```

#### revoke
##### revoke

The `revoke` command allows a granter to revoke an authorization from a grantee.

Expand All @@ -266,11 +266,11 @@ Example:
simd tx authz revoke cosmos1.. /cosmos.bank.v1beta1.MsgSend --from=cosmos1..
```

## gRPC
### gRPC

A user can query the `authz` module using gRPC endpoints.

### Grants
#### Grants

The `Grants` endpoint allows users to query grants for a granter-grantee pair. If the message type URL is set, it selects grants only for that message type.

Expand Down Expand Up @@ -308,7 +308,7 @@ Example Output:
}
```

## REST
### REST

A user can query the `authz` module using REST endpoints.

Expand Down
12 changes: 6 additions & 6 deletions x/capability/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ func NewApp(...) *App {
* [In persisted KV store](#in-persisted-kv-store)
* [In-memory KV store](#in-memory-kv-store)

# Concepts
## Concepts

## Capabilities
### Capabilities

Capabilities are multi-owner. A scoped keeper can create a capability via `NewCapability`
which creates a new unique, unforgeable object-capability reference. The newly
Expand All @@ -104,14 +104,14 @@ with which the calling module previously associated it.
claimed by name. The module is not allowed to retrieve capabilities which it does
not own.

## Stores
### Stores

* MemStore
* KeyStore

# State
## State

## In persisted KV store
### In persisted KV store

1. Global unique capability index
2. Capability owners
Expand All @@ -121,7 +121,7 @@ Indexes:
* Unique index: `[]byte("index") -> []byte(currentGlobalIndex)`
* Capability Index: `[]byte("capability_index") | []byte(index) -> ProtocolBuffer(CapabilityOwners)`

## In-memory KV store
### In-memory KV store

1. Initialized flag
2. Mapping between the module and capability tuple and the capability name
Expand Down
24 changes: 12 additions & 12 deletions x/crisis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ application initialization process.
* [Client](#client)
* [CLI](#cli)

# State
## State

## ConstantFee
### ConstantFee

Due to the anticipated large gas cost requirement to verify an invariant (and
potential to exceed the maximum allowable block gas limit) a constant fee is
Expand All @@ -34,12 +34,12 @@ it can be updated with governance or the address with authority.

* Params: `mint/params -> legacy_amino(sdk.Coin)`

# Messages
## Messages

In this section we describe the processing of the crisis messages and the
corresponding updates to the state.

## MsgVerifyInvariant
### MsgVerifyInvariant

Blockchain invariants can be checked using the `MsgVerifyInvariant` message.

Expand All @@ -58,13 +58,13 @@ never deducted as the transaction is never committed to a block (equivalent to
being refunded). However, if the invariant is not broken, the constant fee will
not be refunded.

# Events
## Events

The crisis module emits the following events:

## Handlers
### Handlers

### MsgVerifyInvariance
#### MsgVerifyInvariance

| Type | Attribute Key | Attribute Value |
|-----------|---------------|------------------|
Expand All @@ -73,29 +73,29 @@ The crisis module emits the following events:
| message | action | verify_invariant |
| message | sender | {senderAddress} |

# Parameters
## Parameters

The crisis module contains the following parameters:

| Key | Type | Example |
|-------------|---------------|-----------------------------------|
| ConstantFee | object (coin) | {"denom":"uatom","amount":"1000"} |

# Client
## Client

## CLI
### CLI

A user can query and interact with the `crisis` module using the CLI.

### Transactions
#### Transactions

The `tx` commands allow users to interact with the `crisis` module.

```bash
simd tx crisis --help
```

#### invariant-broken
##### invariant-broken

The `invariant-broken` command submits proof when an invariant was broken to halt the chain

Expand Down
Loading

0 comments on commit d6e5bb3

Please sign in to comment.