<commit_before># 配额管理

## 简述

cita 中的配额数量存在两个限制：
* `BQL(BlockQuotaLimit)` : 表示块配额的最大值， 默认 1073741824
* `AQL(AccountQuotaLimit)` : 表示账户配额的最大值， 默认 268435456

我们可以通过配额管理合约实现对区块以及账户配额消耗上限的管理:

* 设置区块配额上限(BQL)
* 设置账号配额上限(AQL):

    - 默认的账号配额上限
    - 设置指定账号配额上限

## 操作示例

> 接下来的测试，用 [cita-cli](https://github.com/cryptape/cita-cli) 交互模式进行演示。

### 块配额操作

确保你的链正常运行，查询默认块配额，进入 cita-cli 交互式模式，输入命令：
```shell
$ scm QuotaManager getBQL
```

输出：
```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000040000000"
}
```

管理员修改块配额， 输入命令：

```shell
scm QuotaManager setBQL --quota-limit 0x0000000000000000000000000000000000000000000000000000000020000000 --admin-private 0x5f0258a4778057a8a7d97809bd209055b2fbafa654ce7d31ec7191066b9225e6
```

查询修改后的块配额：
```shell
$ scm QuotaManager getBQL
```

输出：
```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000020000000"
  "
}
```
默认块配额已更新。

### 账户配额操作

确保你的链正常运行，查询默认账户配额，进入 cita-cli 交互式模式，输入命令：
```shell
$ scm QuotaManager getDefaultAQL
```

输出：
```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000010000000"
}
```

管理员修改账户配额， 输入命令：

```shell
$ scm QuotaManager setDefaultAQL --quota-limit 0x0000000000000000000000000000000000000000000000000000000020000000 --admin-private 0x5f0258a4778057a8a7d97809bd209055b2fbafa654ce7d31ec7191066b9225e6
```

查询修改后的账户配额：
```shell
$ scm QuotaManager getDefaultAQL
```

输出：
```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000020000000"
}
```
默认账户配额已更新。<commit_msg>translate quota management docs[skip ci]<commit_after># Quota Management

## Overview

There are two limitations to the quota value in CITA:
* `BQL(BlockQuotaLimit)` : Indicates the maximum value of the block quota. The default value is 1073741824
* `AQL(AccountQuotaLimit)` : Indicates the maximum value of the account quota. The default value is 268435456

We can manage the block and account quota consumption caps through quota management contracts:

* Set block quota limit (BQL)
* Set the account quota limit (AQL):

    - Default account quota limit
    - Set the specified account quota limit

## Operation example

> we use [cita-cli](https://github.com/cryptape/cita-cli) in the following operations.

### Block quota management operation

Make sure that your chain is running normally, and then query the default block quota:

```shell
$ scm QuotaManager getBQL
```

Output:

```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000040000000"
}
```

Admin can modify the block quota limitation value by the following command:

```shell
scm QuotaManager setBQL --quota-limit 0x0000000000000000000000000000000000000000000000000000000020000000 --admin-private 0x5f0258a4778057a8a7d97809bd209055b2fbafa654ce7d31ec7191066b9225e6
```

Query the modified block quota limitation value:

```shell
$ scm QuotaManager getBQL
```

输出：
```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000020000000"
  "
}
```
The default block quota limitation value has been updated.

### Account Quota Management Operation

Make sure that your chain is running normally, and then query the default account quota limitation:

```shell
$ scm QuotaManager getDefaultAQL
```

Output:

```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000010000000"
}
```

Admin can modify the account quota limitation value by the following command:

```shell
$ scm QuotaManager setDefaultAQL --quota-limit 0x0000000000000000000000000000000000000000000000000000000020000000 --admin-private 0x5f0258a4778057a8a7d97809bd209055b2fbafa654ce7d31ec7191066b9225e6
```

Query the account quota limitation:

```shell
$ scm QuotaManager getDefaultAQL
```

Output:

```json
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x0000000000000000000000000000000000000000000000000000000020000000"
}
```

The default account quota limitation value has been updated.
{'fraction_non_alphanumeric': 0.10759187620889749, 'fraction_numerical': 0.24709864603481624, 'mean_word_length': 5.9296482412060305, 'pattern_counts': {'":': 24, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 24, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4136188', 'n_tokens_mistral': 2429, 'n_tokens_neox': 1622, 'n_words': 348}