当前位置:网站首页>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 +SCALECodedXCVMCommand sequence
- One XCM The final implementation effect , It depends on two
XCVMWhether the two registers are properly initialized :Original ProgrammeA message andOriginal OriginIndicates the source of the information
XCVM register
XCVMProgramme
Vec<Instruction>Original ProgrammeXCVMProgramme Counter
Storage type : u32 Initial value :0ProgrammeProgrammeError
Storage type : Option<(u32, Error)> Initial value : NoneProgramme CounterError HandlerVec<Instruction>ProgrammeAppendix
Storage type : Vec<Instruction>Error HandlerProgrammeOrigin
Storage type : Option<MultiLocation>NoneHolding Register
Storage type : MultiAssetsunspent non-persistent Surplus Weight
Storage type : u64 Initial value :0Refunded Weight
Storage type : u64 Initial value : 0 effect : Surplus WeightXCMXCVM
Basic execution process
XCVMfetch-dispatchProgrammeWhen the register is empty , downtime
- from
ProgrammeGet in theProgramme CounterThe 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 CounterAdd 1
- If an error occurs , be
- Set up
ErrorRegister value ( The index where the error occurred and the type of error )
- take
Programme CounterSet as0
- take
ProgrammeReplace the content of withError HandlerThe content of , And emptyError Handler
- If the instruction doesn't exist , be :
Programme CounterSet as0
- take
ProgrammeReplace the content of withAppendix RegisterThe content of
- take
Error HandlerThe estimated weight of the content in , Add toSurplus WeightIn the middle
- Empty
Appendix RegisterandError Handler
- With the ordinary
fetch/dispatchThe mechanism is different ,XCVMDuring the implementation ofError HandlerandAppendixregister , It should be noted that :
ErrorThe register will not be cleared after the program is executed , This will allowAppendixRegisters can useErrorValues reserved in
- Whether the program is successfully executed or not ,
Error HandlerAll 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
InstructionIs a label union type (Rust Mediumenum), Each instruction consists ofSCALEEncoded in0Is the position in the instruction list of the initial index + Its operation is built , We need to pay attention to
OriginThe term is here , ExpressOriginThe position represented by the value in the register , thereforecontrolled by the OriginIt means the same as " fromOriginThe value in the register represents the address control
HoldingThe term meansHoldingValue in register , thereforereduce Holding by the assetbe equal to " fromHoldingReduce assets in the register
AppendixandError HandlerIt's similar
on-chainThe 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,WeightandQueryIdType should be understood asSCALEPacked integer type defined in
边栏推荐
- Go micro tutorial - Chapter 1 getting started
- [Verilog quick start of Niuke online question series] ~ bit splitting and operation
- IO流_递归
- RT thread heap size Setting
- 观测云与 TDengine 达成深度合作,优化企业上云体验
- 云技能提升好伙伴,亚马逊云师兄今天正式营业
- restartProcessIfVisible的流程
- Additional: (not written yet, don't look at ~ ~ ~) corsfilter filter;
- Observation cloud reached in-depth cooperation with tdengine to optimize enterprise cloud experience
- MicroBlaze serial port learning · 2
猜你喜欢
![9: Chapter 3: e-commerce engineering analysis: 4: [general module]; (to be written...)](/img/96/cbed98ec69c952f1d231ce2ed25aab.png)
9: Chapter 3: e-commerce engineering analysis: 4: [general module]; (to be written...)

【牛客网刷题系列 之 Verilog快速入门】~ 位拆分与运算

IO stream_ recursion

Mathematical modeling for war preparation 34-bp neural network prediction 2

华为帐号多端协同,打造美好互联生活

山西化工园区智能化管控平台建设时间表

RT-Thread 堆区大小设置

异常类_日志框架

Restartprocessifvisible process

Mathematical modeling for war preparation 35 time series prediction model
随机推荐
Delete duplicates in an ordered array ii[double pointers -- unified in multiple cases]
2022 Blue Bridge Cup group B - expense reimbursement - (linear dp| status DP)
Rong Lianyun launched rphone based on Tongxin UOS to create a new ecology of localization contact center
Yunhe enmo won the bid for Oracle maintenance project of Tianjin Binhai rural commercial bank in 2022-2023
Etcd教程 — 第八章 Etcd之Compact、Watch和Lease API
牛客网:最小花费爬楼梯
go-micro教程 — 第一章 快速入门
Talk about telecommuting | community essay solicitation
[Demo] 循环写文件
Good partner for cloud skill improvement, senior brother cloud of Amazon officially opened today
数据库系统概论习题册
赛芯电子冲刺科创板:拟募资6.2亿 实控人谭健为美国籍
Niuke.com: minimum cost of climbing stairs
Php7.3 centos7.9 installing sqlserver extensions
2020蓝桥杯国赛B组-搬砖-(贪心排序+01背包)
微信表情符号写入判决书,你发的OK、炸弹都可能成为“呈堂证供”
Hologres共享集群助力淘宝订阅极致精细化运营
CGR 21 (D,E,F)
HMS core audio editing service 3D audio technology helps create an immersive auditory feast
【微信小程序】小程序的宿主环境