概述
当区块链不变量被破坏时,crisis 模块会停止区块链运行。不变量可以在应用初始化过程中注册到应用中。目录
状态
ConstantFee
由于校验不变量预计需要消耗大量 gas,并且可能超过区块允许的最大 gas 上限,因此这里使用固定费用,而不是标准的 gas 消耗方式。该固定费用的设计目标是高于使用标准 gas 消耗方式执行不变量检查时的预期 gas 成本。ConstantFee 参数以 0x01 前缀存储在模块参数状态中,可以通过治理或由具备权限的地址进行更新。
- 参数:
mint/params -> legacy_amino(sdk.Coin)
消息
本节介绍 crisis 消息的处理流程,以及它们对状态产生的相应更新。MsgVerifyInvariant
可以使用MsgVerifyInvariant 消息检查区块链不变量。
- 发送者没有足够的代币支付固定费用
- 不变量路由未注册
事件
crisis 模块会发出以下事件:处理器
MsgVerifyInvariant
| 类型 | 属性键 | 属性值 |
|---|---|---|
| invariant | route | {invariantRoute} |
| message | module | crisis |
| message | action | verify_invariant |
| message | sender | {senderAddress} |
参数
crisis 模块包含以下参数:| 键 | 类型 | 示例 |
|---|---|---|
| ConstantFee | object (coin) | {"denom":"uatom","amount":"1000"} |
客户端
CLI
用户可以使用 CLI 查询并与crisis 模块交互。
交易
tx 命令允许用户与 crisis 模块交互。
invariant-broken
invariant-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
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 of0x01,
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 theMsgVerifyInvariant message.
- the sender does not have enough coins for the constant fee
- the invariant route is not registered
Events
The crisis module emits the following events:Handlers
MsgVerifyInvariant
| 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 thecrisis module using the CLI.
Transactions
Thetx commands allow users to interact with the crisis module.
invariant-broken
Theinvariant-broken command submits proof when an invariant was broken to halt the chain