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

[venus-messager] add spec config for actor type / 增加消息类型级别的策略配置 #5558

Closed
1 of 11 tasks
Tracked by #5580 ...
hunjixin opened this issue Dec 12, 2022 · 2 comments · Fixed by #5632 or ipfs-force-community/sophon-messager#303
Assignees
Labels
C-enhancement Category: feature enhancement C-need-testing Category: Venus testing related C-ux-change Category: ux change that need attentions (CLI, config, database, folder structure) P2 Medium - we should get to this soon V-venus-messager venus-messager component

Comments

@hunjixin
Copy link
Contributor

hunjixin commented Dec 12, 2022

链服务模块 / Chain Service Components

  • venus
  • venus-auth
  • venus-gateway
  • venus-messager
  • venus-miner
  • 文档 / docs

订单服务模块 / Deal Service Components

  • venus-market
  • 文档 / docs

算力服务模块 / Storage Power Service Components

  • venus-sector-manager
  • venus-worker
  • 文档 / docs

描述 / Description

目前设置各种费用设置分成三个级别, 消息级别, 地址级别,全局。

但是对于需要针对消息类型设置的策略一直没有支持, 一直的实践是通过不同的地址发送不同类型消息,通过这种方式来间接实现这个功能

目前遇到的一个问题是需要对PC2/C2消息进行basefee控制, 当其高于设置的阈值时停止PC2/C2型号消息的发送。 按原来的办法则需要对所有发送PC2/C2形地址的消息进行设置。这种设置方式及其复杂,设置,增加,移除设计操作十分麻烦。因此这里想增加一种方式来更容易的针对消息类型进行费用控制。

另外还带来的优势是,在大规模集群环境下,可以仅通过messager就完成所有集群的消息费用配置, 简化cluster组件的配置。在紧急情况下,适用于为所有集群附加相同的配置。

具体实现

数据库增加新的类型配置表

字段 类型 用途
ID string 唯一健
I actor_v uint 网络版本,便于管理
I Code string 和method结合代表消息类型
Method string 和CodeCid结合代表消息类型
gas... gas... gas相关设置
CreateTIme uint64 创建时间
UpdateTime uint64 更新实践

优先级是 消息级别 > 地址级别 > 消息类型级别 > 全局

选择消息的时候附加进入消息类型级别配置,逻辑和以前相似, 按优先级从低到高,发现配置即使用该级别的配置。

接口

messager 提供接口编辑消息类型级别的全局配置, 因为影响是全局的,所以接口权限应当是admin。

messager 提供接口读取消息类型级别的全局配置, 用户需要知道当前messager的配置情况,权限应当是read类型。

兼容性

网络升级时候,读取数据库中消息类型级别设置并写入新版本的CodeCid记录,为了保证升级完代码和实际升级之间这段时间功能的功能完备,这段时间,这段时间的编辑和配置需要双写/双更。

风险

增加消息类型级别之后,每条消息都需要进行到节点上进行GetActor操作,获取to address的CodeCid,可能会增加大量的接口访问,因此这里需要添加一个缓存, 同样为了保证升级时候的兼容性, 缓存的key应当设计为To_Addrees+网络版本,这样能保证升级前后都可以正常使用。

@hunjixin hunjixin added P2 Medium - we should get to this soon design Venus feature/system design issues V-venus-messager venus-messager component C-enhancement Category: feature enhancement labels Dec 12, 2022
@Fatman13
Copy link
Collaborator

这个是不是也需要个设计?

@hunjixin hunjixin mentioned this issue Dec 19, 2022
36 tasks
@hunjixin hunjixin self-assigned this Dec 22, 2022
@hunjixin hunjixin removed the design Venus feature/system design issues label Dec 22, 2022
@Fatman13 Fatman13 mentioned this issue Dec 30, 2022
54 tasks
@Fatman13 Fatman13 added the C-ux-change Category: ux change that need attentions (CLI, config, database, folder structure) label Jan 3, 2023
@hunjixin
Copy link
Contributor Author

hunjixin commented Jan 5, 2023

用法:

  1. 查询builtin actors的code和方法
 ./venus-messager actor list-builtin-actors
  1. 列出当前设置的actor方法的配置信息
./venus-messager actor list 

结果


ID                                    Code                                                            Method  MethodName            GasOverEstimation  GasOverPremium  MaxFee  GasFeeCap  BaseFee              CreateAt             AVersion  
67f0ec8a-b0cb-4205-97c9-7921c92731a3  bafk2bzacec3j7p6gklk64stax5px3xxd7hdtejaepnd4nw7s2adihde6emkcu  9                             0                  2               0       0          1000000000000000000  2023-01-04 16:59:57  9         
9d91b07e-9112-448e-aa2d-1f2492ce830b  bafk2bzacect2p7urje3pylrrrjy3tngn6yaih4gtzauuatf2jllk3ksgfiw2y  0                             100                100             0       0          0                    2023-01-05 10:04:47  0         
cb9209a0-b0df-41ab-94b7-0a92f2f5cf76  bafk2bzaced5llqnqqhypolyuogz3h2wjomugqkrhyhocvly3aoib4c5xiush6  0       Send                  1000               1000            0       0          0                    2023-01-05 10:32:05  0         
92906e59-6237-45dd-82ba-9eb6bab27301  bafk2bzacec23wjdmbm5pt6pqsbjb3w6j7vyrolijz2mysvp6clllfgpmhb6ge  26      ProveCommitAggregate  0                  0               0       0          0                    2023-01-05 10:50:52  9         
fa2beaa0-58f4-445c-8893-8e111cad019c  bafk2bzacec23wjdmbm5pt6pqsbjb3w6j7vyrolijz2mysvp6clllfgpmhb6ge  27      ProveReplicaUpdates   0                  0               0       0          10                   2023-01-05 10:51:57  9    

其中methodname可能是不存在的,如果是builtin actor的存在,其他情况不存在

  1. 增加一个配置
venus-message actor add [command options] <code> <method>

--base-fee  基础费用阈值 单位atto            
--gas-feecap value       feecap 单于atto
--gas-over-premium    premium倍率
--gas-overestimation   gas limit 倍率
--max-fee value            费用上限
--version value             actor版本, builtin的会自动解析。 其他情况需手写
  1. 更新费用配置
 venus-message actor update-fee-params [command options] <uid>

参数和上面近似

  1. 获取配置信息
venus-messager actor get <uid>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: feature enhancement C-need-testing Category: Venus testing related C-ux-change Category: ux change that need attentions (CLI, config, database, folder structure) P2 Medium - we should get to this soon V-venus-messager venus-messager component
Projects
Archived in project
3 participants