IBC中的vector commitment——ics-023

1. 引言

vector commitment为:

  • constant-size commitment
  • binding commitment to an indexed vector of elements
  • short membership and/or non-membership proofs for any indices & elements in the vector

Cosmos IBC中使用的vector commitment还额外要求具有:

  • positionally binding属性:必须可证明 existence or nonexistence of values at specific positions (indices)。

IBC中的vector commitment主要用于保证:

  • 链A上的特定状态变更可在链B上进行验证,vector commitment可 prove inclusion or non-inclusion of particular values at particular paths in state。

2. IBC中vector commitment相关定义

  • “manager”:a vector commitment的manager,为负责从commitment中增减items的actor。该actor通常为某链的state machine。

  • “prover”:为生成特定element inclusion 或 non-inclusion proof的actor,通常为a relayer。

  • “verifier”:检查proof,以验证该commitment的manager 确实加了 或 确实没加某特定element 的actor。通常为运行在另一条链上的an IBC handler(实现了IBC的module)。

  • “path and value”:commitments以"path and value"类型进行实例化,可为任意可序列化数据。

3. IBC vector commitment技术说明

具体的数据类型定义可参看confio/ics23(Go语言,构建的generic merkle proof format for IBC)。

3.1 数据类型

构建的commitment需遵循如下数据类型,必须为可序列化的:

  • 1)Commitment State:为该commitment的full state,由 manager存储。
  • 2)Commitment Root:commit to a particular commitment state 且应为constant-size的。
  • 3)Commitment Path:为用于验证commitment proof的path,可构建为任意结构对象(由commitment类型决定),单必须使用applyPrefix计算。
  • 4)Prefix:CommitmentPrefix中定义了a store prefix of the commitment proof。在path传送到proof verification函数之前,用于path。
    applyPrefix函数会根据参数构建新的commitment path,会在prefix参数中解析path参数。
    对于2个相同的 (prefix, path) tuples,applyPrefix(prefix, path) 必须返回相同的key。
    必须为每个Path实现applyPrefix,因为Path具有不同的详细结构。applyPrefix可接受多个CommitmentPrefix类型。
    applyPrefix返回的CommitmentPath不要求可序列化(比如,可为a list of tree node identifiers),但是要求可进行equality比较。
  • 5)Proof:CommitmentProof表示了membership or non-membership for an element or set of elements,verifiable in conjunction with a known commitment root。 Proofs should be succinct。

3.2 必须实现的函数

commitment构建过程中必须实现以下函数。其中path为可序列化object,value为byte arrays:

type Path = string
type Value = []byte
  • 1)初始化:generate函数会根据可能为空的初始path->value map 对应的commitment state来初始化。
  • 2)计算root:calculateRoot函数为commitment state计算a constant-size commitment,用于验证proof。
  • 3)增减元素:set函数用于设置commitment中某value的path。remove函数用于从commitment中移除某path和相应的value。
  • 4)生成proof:createMembershipProof用于生成commitment中某特定path对应为某特定值 的 proof。createNonMembershipProof函数用于生成commitment中任意值均未设定该commitment path 的proof。
  • 5)验证proof:verifyMembership用于验证proof 中某特定path对应为commitment内某特定值。verifyNonMembership 用于验证proof中某coMmitment path不对应commitment中任意值。
  • 6)可选函数:batchVerifyMembership 验证多个path 与 多个value之间的关系。batchVerifyNonMembership 验证多个path 均不对应commitment中任意值的关系。这两个函数应分别与verifyMembershipverifyNonMembership 这两个函数的验证结果一致。batch方法可能比单一验证方法效率更高。

4. IBC vector commitment属性

IBC vector commitment具有如下属性:

  • 1)完备性
  • 2)可靠性
  • 3)position binding

5. 相关论文参考

相关论文参考有:

参考资料

[1] ics-023-vector-commitment

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值