Skip to content
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

chore: collapse module spec and readme #13143

Merged
merged 20 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
crisis
  • Loading branch information
tac0turtle committed Sep 4, 2022
commit 50c208e7e508f78aa0eaf4a23bf29e47dc23bcda
108 changes: 106 additions & 2 deletions x/crisis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,110 @@
order: 0
-->

# Crisis
# `crisis`

* [Crisis](spec/README.md) - Halting the blockchain under certain circumstances (e.g. if an invariant is broken).
## Overview

The crisis module halts the blockchain under the circumstance that a blockchain
invariant is broken. Invariants can be registered with the application during the
application initialization process.

## Contents

*[State](#state)
* [ConstantFee](#constantfee)
*[Messages](#messages)
* [MsgVerifyInvariant](#msgverifyinvariant)
*[Events](#events)
* [Handlers](#handlers)
*[Parameters](#params)
*[Client](#client)*
* [CLI](#cli)

# State

## 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
used instead of the standard gas consumption method. The constant fee is
intended to be larger than the anticipated gas cost of running the invariant
with the standard gas consumption method.

The ConstantFee param is stored in the module params state with the prefix of `0x01`,
it can be updated with governance or the address with authority.

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

# Messages

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

## MsgVerifyInvariant

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

+++ https://github.com/cosmos/cosmos-sdk/blob/v0.46.0/proto/cosmos/crisis/v1beta1/tx.proto#L16-L26

This message is expected to fail if:

* the sender does not have enough coins for the constant fee
* the invariant route is not registered

This message checks the invariant provided, and if the invariant is broken it
panics, halting the blockchain. If the invariant is broken, the constant fee is
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

The crisis module emits the following events:

## Handlers

### MsgVerifyInvariance

| Type | Attribute Key | Attribute Value |
|-----------|---------------|------------------|
| invariant | route | {invariantRoute} |
| message | module | crisis |
| message | action | verify_invariant |
| message | sender | {senderAddress} |

# Parameters

The crisis module contains the following parameters:

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

# Client

## CLI

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

### Transactions

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

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

#### invariant-broken

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

```bash
simd tx crisis invariant-broken [module-name] [invariant-route] [flags]
```

Example:

```bash
simd tx crisis invariant-broken bank total-supply --from=[keyname or address]
```
18 changes: 0 additions & 18 deletions x/crisis/spec/01_state.md

This file was deleted.

25 changes: 0 additions & 25 deletions x/crisis/spec/02_messages.md

This file was deleted.

18 changes: 0 additions & 18 deletions x/crisis/spec/03_events.md

This file was deleted.

11 changes: 0 additions & 11 deletions x/crisis/spec/04_params.md

This file was deleted.

31 changes: 0 additions & 31 deletions x/crisis/spec/05_client.md

This file was deleted.

26 changes: 0 additions & 26 deletions x/crisis/spec/README.md

This file was deleted.