'Interpretation of Transaction Confirmation in Hyperledger Fabric

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.



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bestbeforetoday