cosmos-sdk/x/crisis
Aleksandr Bezobchuk a0682b14f4
chore: collapse module spec and readme (#13143)
* updates

* add auth and separate vesting

* authz

* capability

* crisis

* epoching

* nft

* mint

* params

* upgrade

* fix website build

* finish other modules

* fix `pre.sh` and update modules title

* add docs

* display vesting in docs

* add page splitting for missing modules

* updates

* improve `pre.sh`

Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
2022-09-05 12:26:40 +00:00
..
client/cli use require instead of assert in cli test (#13132) 2022-09-02 02:18:02 -04:00
exported feat: remove x/params dependency in x/crisis (#12491) 2022-07-12 06:15:50 +00:00
keeper feat: deprecate x/params usage in x/bank (#12630) 2022-07-20 18:58:15 -04:00
migrations/v2 chore: fix migration paths (#12579) 2022-07-14 10:32:06 -04:00
testutil refactor: use mocks for x/crisis keeper tests (#12558) 2022-07-13 16:32:11 +00:00
types chore: fix linting issues exposed by fixing golangci-lint (#12895) 2022-08-11 22:00:24 +02:00
abci.go Merge PR #6761: telemetry: use UTC() in wrappers 2020-07-17 15:33:50 -04:00
module.go chore: remove legacy appmodule boiler plate (#12725) 2022-07-28 13:18:14 +02:00
README.md chore: collapse module spec and readme (#13143) 2022-09-05 12:26:40 +00:00

x/crisis

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

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.

simd tx crisis --help

invariant-broken

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

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

Example:

simd tx crisis invariant-broken bank total-supply --from=[keyname or address]