quorum icon indicating copy to clipboard operation
quorum copied to clipboard

Private State is not populated properly for validation check in smart contract

Open bansatya opened this issue 8 years ago • 2 comments

Lets consider a private transaction between Node-A and Node-B.Node-A wants to transfer some amounts to Node-B. So,after end of the transaction --Node-A should have it's updated balance. --Node-B should have it's updated balance.

If we look the solidity code as below, we have two observation. Case 1. If we don't keep the require check for the balance, both the nodes display the updated balances. Case 2. However, if we keep the require check, updated balance is not populated at Node-B end.

So, one node state gets updated and another node state is not updated.

function transfer(address _to, uint _value) public returns (bool success) { //require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender] - _value; balances[_to] = balances[_to] + _value; Transfer(msg.sender, _to, _value); return true; }

Is it how these has been designed? If Yes, How validation check can be added within smart contract for private transaction?

bansatya avatar Feb 13 '18 10:02 bansatya

As per my understanding, the same code gets executed at both the node end to produce the result. If this is so, then require can't be used or any validation can't be used within the smart contract code.

bansatya avatar Feb 13 '18 11:02 bansatya

Please reopen if this is still an issue. Thanks.

fixanoid avatar Aug 17 '18 18:08 fixanoid