当前位置:网站首页>Sub chain cross technology source level exploration: an overview of xcvm
Sub chain cross technology source level exploration: an overview of xcvm
2022-06-30 16:58:00 【InfoQ】
Premise : XCM Message format and version
Xcm<Call>
enum
#[scale_info(bounds(), skip_type_params(Call))]pub enum Xcm<Call> { //...snippets WithdrawAsset(MultiAssets), ReserveAssetDeposited(MultiAssets), ReceiveTeleportedAsset(MultiAssets), //...snippets}
Tuple Struct
#[scale_info(bounds(), skip_type_params(Call))]pub struct Xcm<Call>(pub Vec<Instruction<Call>>);
Instruction<Call>
version: u8
message
: the message, Must be in version Valid in certain cases
Version: u8 = 2
,message: Vec<Instruction>
, therefore , A complete XCM The message is 2 byte Version ID of +SCALE
CodedXCVM
Command sequence
- One XCM The final implementation effect , It depends on two
XCVM
Whether the two registers are properly initialized :Original Programme
A message andOriginal Origin
Indicates the source of the information
XCVM register
XCVM
Programme
Vec<Instruction>
Original Programme
XCVM
Programme Counter
Storage type : u32
Initial value :0
Programme
Programme
Error
Storage type : Option<(u32, Error)>
Initial value : None
Programme Counter
Error Handler
Vec<Instruction>
Programme
Appendix
Storage type : Vec<Instruction>
Error Handler
Programme
Origin
Storage type : Option<MultiLocation>
None
Holding Register
Storage type : MultiAssets
unspent
non-persistent
Surplus Weight
Storage type : u64
Initial value :0
Refunded Weight
Storage type : u64
Initial value : 0
effect : Surplus Weight
XCM
XCVM
Basic execution process
XCVM
fetch-dispatch
Programme
When the register is empty , downtime
- from
Programme
Get in theProgramme Counter
The instruction that the index value points to
- If the instruction exists , Then execute the instruction , And check the execution results :
- If there are no mistakes , On behalf of successful execution , Will
Programme Counter
Add 1
- If an error occurs , be
- Set up
Error
Register value ( The index where the error occurred and the type of error )
- take
Programme Counter
Set as0
- take
Programme
Replace the content of withError Handler
The content of , And emptyError Handler
- If the instruction doesn't exist , be :
Programme Counter
Set as0
- take
Programme
Replace the content of withAppendix Register
The content of
- take
Error Handler
The estimated weight of the content in , Add toSurplus Weight
In the middle
- Empty
Appendix Register
andError Handler
- With the ordinary
fetch/dispatch
The mechanism is different ,XCVM
During the implementation ofError Handler
andAppendix
register , It should be noted that :
Error
The register will not be cleared after the program is executed , This will allowAppendix
Registers can useError
Values reserved in
- Whether the program is successfully executed or not ,
Error Handler
All registers will be cleared , This ensures that the error handling logic of the previous program will not affect the subsequent code execution
Be careful
- Instruction type
Instruction
Is a label union type (Rust Mediumenum
), Each instruction consists ofSCALE
Encoded in0
Is the position in the instruction list of the initial index + Its operation is built , We need to pay attention to
Origin
The term is here , ExpressOrigin
The position represented by the value in the register , thereforecontrolled by the Origin
It means the same as " fromOrigin
The value in the register represents the address control
Holding
The term meansHolding
Value in register , thereforereduce Holding by the asset
be equal to " fromHolding
Reduce assets in the register
Appendix
andError Handler
It's similar
on-chain
The term , It should be understood as " Persistent state under local consensus system (within the persistent state of the local consensus system)", We should not only treat blockchain as a local consensus .
Compact
,Weight
andQueryId
Type should be understood asSCALE
Packed integer type defined in
边栏推荐
- 更多龙蜥自研特性!生产可用的 Anolis OS 8.6 正式发布
- Raft introduction
- Lambda表达式_Stream流_File类
- HMS core audio editing service 3D audio technology helps create an immersive auditory feast
- Eight basic sorting (detailed explanation)
- 药品管理系统加数据库,一夜做完,加报告
- 【微信小程序】常用组件基本使用(view/scroll-view/swiper、text/rich-text、button/image)
- php7.3 centos7.9安装sqlserver扩展
- Hologres共享集群助力淘宝订阅极致精细化运营
- JS ES5也可以创建常量?
猜你喜欢
备战数学建模33-灰色预测模型2
坚果云-在新电脑上同步移动硬盘的文件
idea必用插件
Etcd tutorial - Chapter 8 compact, watch, and lease APIs for etcd
数据安全合规之后,给风控团队带来了新的问题
The meaning of linetypes enumeration values (line_4, line_8, line_aa) in opencv
Carry two load balancing notes and find them in the future
【牛客网刷题系列 之 Verilog快速入门】~ 位拆分与运算
Bc1.2 PD protocol
Niuke network: longest continuous subarray with positive product
随机推荐
I implement "stack" with C I
After 15 years of working on 21 types of hardware, where is Google?
数据库系统概论习题册
Substrate 跨链技术源码级探索: XCVM的概览
IO流_递归
容联云首发基于统信UOS的Rphone,打造国产化联络中心新生态
荣盛生物冲刺科创板:拟募资12.5亿 年营收2.6亿
Go micro tutorial - Chapter 1 getting started
Home office discussion on the experience of remote assistance to quickly improve efficiency | community essay solicitation
Undistorted resize using pil
Additional: (not written yet, don't look at ~ ~ ~) webmvcconfigurer interface;
Tencent two sides: @bean and @component are used on the same class. What happens?
[Demo] 循环写文件
山西化工园区智能化管控平台建设时间表
[activity registration] it's your turn to explore the yuan universe! I will be waiting for you in Shenzhen on July 2!
编译丨迅为STM32P157开发板编译U-Boot源码
快照和备份
牛客网:乘积为正数的最长连续子数组
微信表情符号写入判决书,你发的OK、炸弹都可能成为“呈堂证供”
restartProcessIfVisible的流程