#fabric-orderer #fabric-chaincode #fabric-orderer #fabric-chaincode
marco.comuzzi@...
I have a question regarding the ordering of transactions changing the value of the same variable in the world state:
Lets' assume that the 2 clients C1 and C2 submit two transactions (T1 submitted from C1 and T2 submitted from C2) that modify the value of the same variable "v" (identified by key "k"). Let's also assume, for simplicity, that for both T1 and T2 have an empty read set. As far as I understand (reading [1]), both transactions will be endorsed by the endorsing peers, because they do not violate the "read your writes" policy. However, what determines the order in which T1 and T2 will be included in block(s) and, therefore, what determine which will be the value of the variable "v" after both transactions are validated and committed by peers? (I guess that in case T1 and T2 are submitted by the same client, then the orderer service will follow the timestamp to determine the correct order. The client must in fact timestamp the transactions progressively. I am not sure what happens when such transactions are originated from different clients) Thank you Marco [1] https://hyperledger-fabric.readthedocs.io/en/release-2.0/readwrite.html |
||||||||||
|
||||||||||
Adhav Pavan
Hello Marco, When committing a peer to get block from the orderer, first it validates the block signature(Signed by orderer). If the orderer is valid, then committing peers to decode all transactions from the block. It goes through VSCC(validate System Chaincode- checks if the transaction has sufficient endorsement policy as per Endorsement policy) and if transaction do not satisfy this policy, it will be marked as invalid. Once Successful validation of VSCC, peer check for MVCC(Multiversion concurrency control), for each transaction, it checks the existing version of the asset(Key), if this is a new asset, peer update current state database with version vo, when it picks second transaction(Same asset), it checks if state database has it, if it has, the peer checks the existing version of the asset (T1 updated asset with vo), but T2 has written with vo, so it will get rejected and generally we get MVCC conflicts error. Guys, Please correct me if I am wrong somewhere. Thank you.
Please excuse my brevity. On Sat, May 9, 2020 at 7:16 PM <marco.comuzzi@...> wrote: I have a question regarding the ordering of transactions changing the value of the same variable in the world state: |
||||||||||
|
||||||||||
David Enyeart
Not quite... Hello Marco, When committing a peer to get block from the orderer, first it validates the block signature(Signed by orderer). If the orderer is valid, then committing peers to decode all transactions from the block. It goes through VSCC(validate System Chaincode- checks if the transaction has sufficient endorsement policy as per Endorsement policy) and if transaction do not satisfy this policy, it will be marked as invalid. Once Successful validation of VSCC, peer check for MVCC(Multiversion concurrency control), for each transaction, it checks the existing version of the asset(Key), if this is a new asset, peer update current state database with version vo, when it picks second transaction(Same asset), it checks if state database has it, if it has, the peer checks the existing version of the asset (T1 updated asset with vo), but T2 has written with vo, so it will get rejected and generally we get MVCC conflicts error. Guys, Please correct me if I am wrong somewhere. Thank you.
Please excuse my brevity. On Sat, May 9, 2020 at 7:16 PM <marco.comuzzi@...> wrote:
Lets' assume that the 2 clients C1 and C2 submit two transactions (T1 submitted from C1 and T2 submitted from C2) that modify the value of the same variable "v" (identified by key "k"). Let's also assume, for simplicity, that for both T1 and T2 have an empty read set. As far as I understand (reading [1]), both transactions will be endorsed by the endorsing peers, because they do not violate the "read your writes" policy. However, what determines the order in which T1 and T2 will be included in block(s) and, therefore, what determine which will be the value of the variable "v" after both transactions are validated and committed by peers? (I guess that in case T1 and T2 are submitted by the same client, then the orderer service will follow the timestamp to determine the correct order. The client must in fact timestamp the transactions progressively. I am not sure what happens when such transactions are originated from different clients) Thank you Marco [1] https://hyperledger-fabric.readthedocs.io/en/release-2.0/readwrite.html |
||||||||||
|
||||||||||
marco.comuzzi@...
Thank you! That's very helpful.
In particular, I see now how dangerous the "blind write" can be. Regards, Marco |
||||||||||
|
||||||||||
Rob Murgai <murgai@...>
I am curious, what use case would require a blind-write vs a read-write?
----- Original message ----- |
||||||||||
|
||||||||||
David Enyeart
I think most use cases will want the read-write behavior. I am curious, what use case would require a blind-write vs a read-write?
----- Original message -----
From: marco.comuzzi@... Sent by: fabric@... To: fabric@... Cc: Subject: [EXTERNAL] Re: [Hyperledger Fabric] #fabric-orderer #fabric-chaincode Date: Sun, May 10, 2020 7:36 PM Thank you! That's very helpful. In particular, I see now how dangerous the "blind write" can be. Regards, Marco |
||||||||||
|