HyperLeDger织物中交易确认的解释

发布于 2025-01-24 08:16:56 字数 1192 浏览 1 评论 0原文

Fabric docs ,,以下示例被解释了。

World state: (k1,1,v1), (k2,1,v2), (k3,1,v3), (k4,1,v4), (k5,1,v5)
T1 -> Write(k1, v1'), Write(k2, v2')
T2 -> Read(k1), Write(k3, v3')
T3 -> Write(k2, v2'')
T4 -> Write(k2, v2'''), read(k2)
T5 -> Write(k6, v6'), read(k5)

T1 passes validation because it does not perform any read. Further, the tuple of
keys k1 and k2 in the world state are updated to (k1,2,v1'), (k2,2,v2')
T2 fails validation because it reads a key, k1, which was modified by a
preceding transaction - T1
T3 passes the validation because it does not perform a read. Further the tuple
of the key, k2, in the world state is updated to (k2,3,v2'')
T4 fails the validation because it reads a key, k2, which was modified by a
preceding transaction T1
T5 passes validation because it reads a key, k5, which was not modified by any
of the preceding transactions

提到所有交易,即T1至T5都是基于同一快照的 在验证之前,世界DB。我知道面料遵循执行订单验证阶段进行交易确认。

但是,我不明白,尽管K2的值是 由T1修改。到T3在执行阶段中获得的读取集验证时,由于其值已通过T1修改,因此不再有效。任何人都可以解释该示例是错误的还是错误地理解的。

In Fabric docs, following example is explained.

World state: (k1,1,v1), (k2,1,v2), (k3,1,v3), (k4,1,v4), (k5,1,v5)
T1 -> Write(k1, v1'), Write(k2, v2')
T2 -> Read(k1), Write(k3, v3')
T3 -> Write(k2, v2'')
T4 -> Write(k2, v2'''), read(k2)
T5 -> Write(k6, v6'), read(k5)

T1 passes validation because it does not perform any read. Further, the tuple of
keys k1 and k2 in the world state are updated to (k1,2,v1'), (k2,2,v2')
T2 fails validation because it reads a key, k1, which was modified by a
preceding transaction - T1
T3 passes the validation because it does not perform a read. Further the tuple
of the key, k2, in the world state is updated to (k2,3,v2'')
T4 fails the validation because it reads a key, k2, which was modified by a
preceding transaction T1
T5 passes validation because it reads a key, k5, which was not modified by any
of the preceding transactions

It is mentioned that all transaction viz., T1 to T5 are based on same snapshot of the
world state DB before their validation. I am aware that Fabric follows Execute-Order-Validate phases for transaction confirmation.

But, I could not understand, how T3 passes the validation though value of K2 is
modified by T1. By the time T3 is to be validated the read-set acquired by T3 during its execution phase, is no longer valid as its value has been modified by T1. Can any one explain whether the example is wrong or it is being understood incorrectly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

禾厶谷欠 2025-01-31 08:16:56

没有与T3关联的读取集(或其读取集为空)。 T3仅对给定的分类帐键执行写作,因此没有任何不一致。

T3可能会做的一个具体示例是:

  • 创建具有给定ID(键)的新资产,而无需先检查资产是否已经存在;或
  • 在不检查当前余额的情况下将帐户的余额设置为特定值。

如果T3 更新了密钥的值(首先读取密钥,然后编写更新值),则它将使用MVCC读取冲突验证,T4就是这种情况。

There is no read set associated with T3 (or its read set is empty). T3 is only performing a write to a given ledger key so there is no inconsistency.

A concrete example of what T3 might be doing is:

  • Creating a new asset with a given ID (key) without first checking whether the asset already exists; or
  • Setting the balance of an account to a specific value without checking the current balance.

If T3 updated the key's value (by first reading the key and then writing an updated value), it would fail validation with an MVCC read conflict, which is the case with T4.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文