From b2a3987f7856cfbf8e0bc7648da965acd467f113 Mon Sep 17 00:00:00 2001 From: simlecode Date: Mon, 5 Jul 2021 11:18:42 +0800 Subject: [PATCH] update messager doc --- docs/modules/How-To-Use-Messager.md | 90 +++---- docs/zh/modules/How to use venus messager.md | 245 ------------------- docs/zh/modules/How-To-Use-Messager.md | 222 +++++++++++++++++ 3 files changed, 254 insertions(+), 303 deletions(-) delete mode 100644 docs/zh/modules/How to use venus messager.md create mode 100644 docs/zh/modules/How-To-Use-Messager.md diff --git a/docs/modules/How-To-Use-Messager.md b/docs/modules/How-To-Use-Messager.md index c2d244a1f..02a598c33 100644 --- a/docs/modules/How-To-Use-Messager.md +++ b/docs/modules/How-To-Use-Messager.md @@ -9,34 +9,23 @@ messager is a component used to manage local messages, with the purpose of savin ### Clone this git repository to your machine ``` -git clone git@github.com:ipfs-force-community/venus-messager.git +git clone https://github.com/filecoin-project/venus-messager.git ``` -### Install Dependencies - -1. First, load all the Git submodules. - -``` -git submodule update --init --recursive -``` - -2. Initialize build dependencies. +### Install Dependencies and Build ``` make deps +make ``` -### Build and run tests +### Run messager -``` -# First, build the binary -make +> ./venus-messager --config=xx.toml run [options] -# Then, run the tests. -make test -``` - -### Start messager +* Specify the directory of the configuration file by `--config=xxx.toml`,default: `./messager.toml` +* If the specified configuration file does not exist at startup, a configuration file with the corresponding name will be generated and the value of the set parameter will be written to the configuration file +* When the specified configuration file exists at startup, the values of the set parameters will be used, but will not be written to the configuration file. If the parameters are not set, the values of the parameters in the configuration file will be used ``` # --config | -c specify config file (default: "./messager.toml") @@ -46,11 +35,6 @@ make test # --db-type which db to use. sqlite/mysql (default: "sqlite") # --sqlite-path sqlite db path (default: "./message.db") # --mysql-dsn mysql connection string - -# use sqlite db -./venus-messager run --config --auth-url --node-url --node-token --db-type sqlite --sqlite-path -# use mysql db -./venus-messager run --config --auth-url --node-url --node-token --db-type mysql --mysql-dsn ``` ## Commands @@ -71,19 +55,19 @@ make test ./venus-messager msg list --from
``` -3. manual update one filled message state +3. update one filled message state ``` ./venus-messager msg update_filled_msg --id= ``` -4. manual update all filled message state +4. update all filled message state ``` ./venus-messager msg update_all_filled_msg ``` -5. wait a messager msg id for result +5. wait a message result by id ``` ./venus-messager msg wait @@ -135,10 +119,12 @@ make test ./venus-messager address list ``` -3. update address nonce +3. reset address + +> The nonce of the address is set to nonce on the chain, and all unchain messages are marked as failed messages ``` -./venus-messager address update_nonce --nonce=5
+./venus-messager reset
``` 4. forbidden address @@ -156,41 +142,20 @@ make test 6. set the number of address selection messages ``` -./venus-messager address set_sel_msg_num --num=5
+./venus-messager address set-sel-msg-num --num=5
``` -### Wallet commands +7. set parameters related to address fee -1. search wallet by name +> venus message address set-fee-params [options] address ``` -./venus-messager wallet search -``` + # options + # --gas-overestimation value Estimate the coefficient of gas (default: 0) + # --max-feecap value Max feecap for a message (burn and pay to miner, attoFIL/GasUnit) + # --max-fee value Spend up to X attoFIL for message -2. add wallet - -``` -./venus-messager wallet add --name= --url= --token= -``` - -3. list wallet - -``` -./venus-messager wallet list -``` - -4. list remote wallet address - -``` -./venus-messager wallet list-addr --uuid= -# or -./venus-messager wallet list-addr --name= -``` - -5. delete wallet by name - -``` -./venus-messager wallet del +./venus-messager address set-fee-params
``` ### shared params commands @@ -242,4 +207,13 @@ make test ``` ./venus-messager node del +``` + +### log + +1. set log level + +``` +# eg. trace,debug,info,warn|warning,error,fatal,panic +./venus-messager log set-level ``` \ No newline at end of file diff --git a/docs/zh/modules/How to use venus messager.md b/docs/zh/modules/How to use venus messager.md deleted file mode 100644 index 0dbe83403..000000000 --- a/docs/zh/modules/How to use venus messager.md +++ /dev/null @@ -1,245 +0,0 @@ -# 如何使用 Venus Messager - -messager是用于管理本地消息的组件,目的是保存地址消息,管理消息状态以及控制推送消息的频率。 - -[目录] - -## 从这开始 - -### 将此git仓库Clone到您的机器 - -``` -git clone git@github.com:ipfs-force-community/venus-messager.git -``` - -### 安装依赖项 - -1. 首先, 加载所有Git子模块。 - -``` -git submodule update --init --recursive -``` - -2. 初始化构建依赖关系。 - -``` -make deps -``` - -### 构建并运行测试 - -``` -# 首先,构建二进制文件 -make - -# 然后,运行并测试 -make test -``` - -### 启动messager - -``` -# --config | -c specify config file (default: "./messager.toml") -# --auth-url url for auth server (default: "http://127.0.0.1:8989") -# --node-url url for connection lotus/venus -# --node-token token auth for lotus/venus -# --db-type which db to use. sqlite/mysql (default: "sqlite") -# --sqlite-path sqlite db path (default: "./message.db") -# --mysql-dsn mysql connection string - -# use sqlite db -./venus-messager run --config --auth-url --node-url --node-token --db-type sqlite --sqlite-path -# use mysql db -./venus-messager run --config --auth-url --node-url --node-token --db-type mysql --mysql-dsn -``` - -## 命令 - -### Message命令 - -1. 搜索message - -``` -./venus-messager msg search --id= -``` - -2. message列表 - -``` -./venus-messager msg list -# list messages with the same address -./venus-messager msg list --from
-``` - -3. 手动更新一个已fill的message状态 - -``` -./venus-messager msg update_filled_msg --id= -``` - -4. 手动更新所有已fill的message状态 - -``` -./venus-messager msg update_all_filled_msg -``` - -5. 等待消息MSG id的结果 - -``` -./venus-messager msg wait -``` - -6. 通过ID重新发布message - -``` -./venus-messager msg republish -``` - -7. 替换message - -``` -./venus-messager msg replace --gas-feecap=[gas-feecap] --gas-premium=[gas-premium] --gas-limit=[gas-limit] --auto=[auto] --max-fee=[max-fee] -# or -./venus-messager msg replace --gas-feecap=[gas-feecap] --gas-premium=[gas-premium] --gas-limit=[gas-limit] --auto=[auto] --max-fee=[max-fee] -``` - -8. 列出失败的messages,可能是消息签名失败或gas估算失败 - -``` -./venus-messager msg list-fail -``` - -9. 列出一段时间未链接的message - -``` -./venus-messager msg list-blocked -``` - -10. 手动标记错误的messages - -``` -./venus-messager msg mark-bad -``` - -### 地址命令 - -1. 搜索地址 - -``` -./venus-messager address search
-``` - -2. 地址清单 - -``` -./venus-messager address list -``` - -3. 更新地址随机数 - -``` -./venus-messager address update_nonce --nonce=5
-``` - -4. 禁止地址 - -``` -./venus-messager address forbidden
-``` - -5. 激活冻结的地址 - -``` -./venus-messager address active
-``` - -6. 设置地址选择消息的数量 - -``` -./venus-messager address set_sel_msg_num --num=5
-``` - -### 签名命令 - -1. 通过名称搜索钱包 - -``` -./venus-messager wallet search -``` - -2. 添加钱包 - -``` -./venus-messager wallet add --name= --url= --token= -``` - -3. 钱包列表 - -``` -./venus-messager wallet list -``` - -4. 远程钱包地址列表 - -``` -./venus-messager wallet list-addr --uuid= -# or -./venus-messager wallet list-addr --name= -``` - -5. 通过名称删除钱包 - -``` -./venus-messager wallet del -``` - -### 共享参数的命令 - -1. 获取共享的参数 - -``` -./venus-messager share-params get -``` - -2. 设置共享的参数 - -``` -# expireEpoch is the expiration height of the message, 0 means it will not expire -# selMsgNum is the maximum number of messages pushed to mpool by a single address at a time -# scanInterval is the interval to scan the remote wallet -# maxEstFailNumOfMsg is the number of failures allowed to estimate gas consumption - -./venus-messager share-params set "{\"expireEpoch\": 0, \"gasOverEstimation\": 1.25, \"maxFee\": 7000000000000000, \"maxFeeCap\": 0, \"selMsgNum\": 20, \"scanInterval\": 10, \"maxEstFailNumOfMsg\": 50}" -``` - -3. 从数据库手动刷新共享参数 - -``` -./venus-messager share-params refresh -``` - -### 节点命令 - -1. 按名称搜索节点信息 - -``` -./venus-messager node search -``` - -2. 添加节点信息 - -``` -./venus-messager node add --name= --url= --token= -``` - -3. 节点信息列表 - -``` -./venus-messager node list -``` - -4. 根据名称删除节点信息 - -``` -./venus-messager node del -``` diff --git a/docs/zh/modules/How-To-Use-Messager.md b/docs/zh/modules/How-To-Use-Messager.md new file mode 100644 index 000000000..7fcb50c16 --- /dev/null +++ b/docs/zh/modules/How-To-Use-Messager.md @@ -0,0 +1,222 @@ +# 如何使用 Venus Messager + +messager 是用于管理本地消息的组件,目的是保存地址消息,管理消息状态以及控制推送消息的频率。 + +[Toc] + +## 开始 + +### 克隆代码到你的机器 + +``` +git clone https://github.com/filecoin-project/venus-messager.git +``` + +### 安装依赖及构建 + +``` +make deps +make +``` + +### 启动messager + +> ./venus-messager --config=xx.toml run [options] + +* 可以通过 `--config=xx.toml` 来指定配置文件的目录,默认目录是 `./messager.toml` +* 启动时指定的配置文件不存在,则会生成对应名称的配置文件,并把设置的参数的值写到配置文件 +* 启动时指定的配置文件存在,设置的参数的值会被使用,但不会写到配置文件,未设置的参数则使用配置文件中参数的值 + +``` +options: + --auth-url auth服务的URL,默认: http://127.0.0.1:8989 + --auth-token auth服务的token + --node-url lotus/venus 节点的URL + --node-token auth服务的URL + --db-type 使用的数据库类型,sqlite 或者 mysql,默认: sqlite + --sqlite-path sqlite 数据库的路径,默认: ./message.db + --mysql-dsn mysql dsn,eg. user:password@(127.0.0.1:3306)/messager?parseTime=true&loc=Local + --gateway-url gateway的URL + --gateway-token gateway的token +``` + +## 命令行 + +### 消息 + +1. 查询消息 + +``` +./venus-messager msg search --id= or --cid= +``` + +2. 列出消息 + +``` +./venus-messager msg list +# 列出相同地址的消息 +./venus-messager msg list --from
+``` + +3. 更新一个已上链消息(但数据库的状态未更新)的状态 + +``` +./venus-messager msg update_filled_msg --id= +``` + +4. 更新所有已上链消息(但数据库的状态未更新)的状态 + +``` +./venus-messager msg update_all_filled_msg +``` + +5. 等待消息的结果 + +``` +./venus-messager msg wait +``` + +6. 通过ID重新发布消息 + +``` +./venus-messager msg republish +``` + +7. 替换消息 + +``` +./venus-messager msg replace --gas-feecap=[gas-feecap] --gas-premium=[gas-premium] --gas-limit=[gas-limit] --auto=[auto] --max-fee=[max-fee] +# or +./venus-messager msg replace --gas-feecap=[gas-feecap] --gas-premium=[gas-premium] --gas-limit=[gas-limit] --auto=[auto] --max-fee=[max-fee] +``` + +8. 列出失败的消息,可能是消息签名失败或gas估算失败 + +``` +./venus-messager msg list-fail +``` + +9. 列出一段时间未链接的消息 + +``` +./venus-messager msg list-blocked +``` + +10. 手动标记异常的消息 + +``` +./venus-messager msg mark-bad +``` + +### 地址 + +1. 查询地址 + +``` +./venus-messager address search
+``` + +2. 列出地址 + +``` +./venus-messager address list +``` + +3. 重置地址 + +> 把地址的nonce设置为链上的nonce,并且全部未上链消息都被标记为`错误消息` + +``` +./venus-messager reset
+``` + +4. 冻结地址,不再接收推送的消息 + +``` +./venus-messager address forbidden
+``` + +5. 激活冻结的地址 + +``` +./venus-messager address active
+``` + +6. 设置地址一轮推送选择消息的最大数量 + +``` +./venus-messager address set-sel-msg-num --num=5
+``` + +7. 设置地址fee相关参数 + +> venus message address set-fee-params [options] address + +``` + # options + # --gas-overestimation 估算gas的系数 (default: 0) + # --max-feecap 单个消息愿意付出的最多 feecap (包括燃烧和支付给矿工, attoFIL/GasUnit) + # --max-fee 单个消息最多花费 X attoFIL + +./venus-messager address set-fee-params
+``` + +### 共享参数 + +1. 获取共享的参数 + +``` +./venus-messager share-params get +``` + +2. 设置共享的参数 + +``` +# expireEpoch is the expiration height of the message, 0 means it will not expire +# selMsgNum is the maximum number of messages pushed to mpool by a single address at a time +# scanInterval is the interval to scan the remote wallet +# maxEstFailNumOfMsg is the number of failures allowed to estimate gas consumption + +./venus-messager share-params set "{\"expireEpoch\": 0, \"gasOverEstimation\": 1.25, \"maxFee\": 7000000000000000, \"maxFeeCap\": 0, \"selMsgNum\": 20, \"scanInterval\": 10, \"maxEstFailNumOfMsg\": 50}" +``` + +3. 从数据库手动刷新共享参数 + +``` +./venus-messager share-params refresh +``` + +### 节点 + +1. 按名称搜索节点信息 + +``` +./venus-messager node search +``` + +2. 添加节点信息 + +``` +./venus-messager node add --name= --url= --token= +``` + +3. 节点信息列表 + +``` +./venus-messager node list +``` + +4. 根据名称删除节点信息 + +``` +./venus-messager node del +``` + +### 日志 + +1. 设置日志级别 + +``` +# 支持的级别:trace,debug,info,warn|warning,error,fatal,panic +./venus-messager log set-level +```