Consensys / quorum

A permissioned implementation of Ethereum supporting data privacy
https://www.goquorum.com/
GNU Lesser General Public License v3.0
4.68k stars 1.29k forks source link

Performing private transactions with a subset of the initial keys causes the non included nodes to stop working #596

Closed kikoncuo closed 5 years ago

kikoncuo commented 5 years ago

In private contracts, subsets of participants should be able to still send private transactions without breaking consensus for the non included parties.

This behaviour was cited in other issue, however, the transaction keeps failing for all nodes which keys were including during deployment and not into this transaction.

System information

Geth version: 1.7.2-stable

Quorum Version: 2.0.0

OS & Version: Linux/OSX

Branch, Commit Hash or Release: 0905eda48eb07a4ce0e7072c1a2ecbf690ddff77

Expected behaviour

Private transaction on a private smart contract which only includes a subset of the keys specified during contract deployment generates a valid transaction accepted by all members on the network

Actual behaviour

All members which have not been included in the subset will deem the block which contains the transaction invalid, and if they are in the minority, fall off consensus.

Steps to reproduce the behaviour

1 Deploy contract privately: 2 Perform transaction without all keys specified in deployment: 3... 4 No profit

Backtrace

Contract mined

INFO [12-13|14:48:41|internal/ethapi/api.go:1154]               sending private tx                       data=6080604052600160005534801561001557600080fd5b50610124806100256000396000f3fe6080604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806307391dd61460585780638381f58a14608f578063f2c9ecd81460b7575b600080fd5b348015606357600080fd5b50608d60048036036020811015607857600080fd5b810190808035906020019092919050505060df565b005b348015609a57600080fd5b5060a160e9565b6040518082815260200191505060405180910390f35b34801560c257600080fd5b5060c960ef565b6040518082815260200191505060405180910390f35b8060008190555050565b60005481565b6000805490509056fea165627a7a723058204fd1212c7a2d1f0d95dcf704da5f84f9d3f5069fa7cae8f6f39539683d91acd70029 privatefrom= privatefor="[DOyg9OklD5BcDD0c3y6xIxwiXlXzBRK4X/2rrV/FAnc= Bkh3JgO4L8r4lal9STvp+++ei5dUdxlIPViAIsyfLwY= RRsuq+jGKNJZPuY3D/IxAsU8TPx3n9VoYcG3oGJldCw=]"
INFO [12-13|14:48:41|internal/ethapi/api.go:1156]               sent private tx                          data=a4a669e63f3bc05095b3371f65abaabd00d48b6085547af86f72e94b3236ddd1ef212b77e0c81892c8ea9b0be17462f6b19944f94db229b1cb431580fbdbd345

                                                       privatefrom= privatefor="[DOyg9OklD5BcDD0c3y6xIxwiXlXzBRK4X/2rrV/FAnc= Bkh3JgO4L8r4lal9STvp+++ei5dUdxlIPViAIsyfLwY= RRsuq+jGKNJZPuY3D/IxAsU8TPx3n9VoYcG3oGJldCw=]"
INFO [12-13|14:48:41|internal/ethapi/api.go:1123]               Submitted contract creation              fullhash=0x1594a3ba28a60bb17a3288f37eef7cb03eba8e7ef14fa27b2638e8b8d2c32008 to=0x3e13579257E2590989299905eCfd7645E0792836
INFO [12-13|14:48:47|consensus/istanbul/backend/backend.go:173] Committed                                address=0x051e0B7eAef576F6A00B4991A244E7EF7a971b26 hash=3be269…92b0db number=26928
INFO [12-13|14:48:47|miner/agent.go:104]                        Successfully sealed new block            number=26928 hash=3be269…92b0db
INFO [12-13|14:48:47|miner/unconfirmed.go:82]                   🔨 mined potential block                  number=26928 hash=3be269…92b0db
INFO [12-13|14:48:47|miner/worker.go:501]                       Commit new mining work                   number=26929 txs=1 uncles=0 elapsed=730.494µs
INFO [12-13|14:48:47|consensus/istanbul/backend/backend.go:173] Committed                                address=0x051e0B7eAef576F6A00B4991A244E7EF7a971b26 hash=05bdc7…a8bc14 number=26929
INFO [12-13|14:48:47|core/blockchain.go:1099]                   Imported new chain segment               blocks=1 txs=1 mgas=0.000 elapsed=1.883ms   mgasps=0.000    number=26929 hash=05bdc7…a8bc14
INFO [12-13|14:48:47|miner/worker.go:501]                       Commit new mining work                   number=26930 txs=0 uncles=0 elapsed=195.944µs

Constellation result of the node not included in the group

constellation-2_1  | 2018 Dec-13 15:00:17010292 [WARN] Error performing API request: ApiReceive (Receive {rreqKey = "+ulZJbqepAEZb6DbDnu/x+pYfuh/K0W/KyoK86ex8Erw/Uhp2rvl+S9fzcraPFZEdtMIjFii6SOzy29YF//EAA==", rreqTo = "7hU2YrvtEtmcllzp1TfS
bB+VjytfOi3265bj+vyfZh8="}); Payload not found in BerkeleyDb payload.db    

And the node connected to that address processes the block as a bad block And starts returning an inconsistent sequence number

validator-2_1      | ERROR[12-13|15:00:27|core/blockchain.go:1288]                                                                                                                                                                            
validator-2_1      | ########## BAD BLOCK #########                                                                                                                                                                                           
validator-2_1      | Chain config: {ChainID: 2017 Homestead: 1 DAO: <nil> DAOSupport: false EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 0 IsQuorum: true Engine: unknown}                                                                        
validator-2_1      |                                                                                                                                                                                                                          
validator-2_1      | Number: 27087                                                                                                                                                                                                            
validator-2_1      | Hash: 0xd3bd05fe6113097565d6b57da9b99f4e16e940173ff8bc466c0e9ad983f80af7                                                                                                                                                 
validator-2_1      |    receipt{status=0 cgas=0 bloom=0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 logs=[]}                                                                                                                                           
validator-2_1      |                                                                                                                                                                                                                          
validator-2_1      |                                                                                                                                                                                                                          
validator-2_1      | Error: invalid receipt root hash (remote: b64408da6b8fe39ab764af88ece1e8cca1c35fd988db57806e99138c629365a0 local: 703c035562d8e37c66f2f9461219b45c710e59c8d0d234f6b062107de627758c)                                      
validator-2_1      | ##############################                                                                                                                                                                                           
validator-2_1   

validator-2_1      | WARN [12-13|15:02:57|consensus/istanbul/core/roundchange.go:83] Inconsistent sequence number             address=0x09950D4e677c1d978435e6752a42d6ee9739EDA1 state=Committed        from=0x051e0B7eAef576F6A00B4991A244E7E
F7a971b26 expected=27087 got=27088  
prd-fox commented 5 years ago

Is there a specific contract you are using to cause this issue? I assume you can reproduce it quite easily. I've just tried with some basic contracts and using subsets of participants worked, so knowing what contract was deployed is helpful.

Also, I assume that system information you provided is a copy paste error? Quorum hasn't caught up to that version of geth yet, and doesn't contain that commit.

kikoncuo commented 5 years ago

You are right, I put there the geth version of my system not of the docker container, we were using an old container with an old docker version 1.7.2-stable and quorum 2.0.0, fixing now.

I tried with a contract as simple as possible, just changing one global value:

pragma solidity ^0.4.24;

contract Test{
    uint256 private number = 1;

    constructor() public{
    }

    function setNumber(uint _number) public{
        number = _number;
    }

    function getNumber() public view returns(uint256){
        return number;
    }

}
prd-fox commented 5 years ago

Thanks for the contract. I compiled the contract and deployed it between 3 keys. I then sent a transaction calling setNumber, for just 2 of the keys, and no error was thrown in the node that was left out. I see you performed this with 4 keys (including the originator), so there is no big difference there.

Some extra questions: You upgraded to Quorum v2.2.0? Does this error happen on a fresh chain, or only occurred on your existing chain that was running v2.0.0? Are you able to share your genesis file? Lastly, what is the network setup? (how many nodes, deployed in a cloud provider)

kikoncuo commented 5 years ago

We've noticed that newer versions have fixed many problems we are currently encountering.

Answers: We have not, but will upgrade, try again and get back to this issue Fresh chain

'{"config":{"chainId":2017,"homesteadBlock":1,"eip150Block":2,"eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000","eip155Block":3,"eip158Block":3,"istanbul":{"epoch":30000,"policy":0},"isQuorum":true},"nonce":"0x0","timestamp":"0x5beb2518","extraData":"0x0000000000000000000000000000000000000000000000000000000000000000f89af85494051e0b7eaef576f6a00b4991a244e7ef7a971b2694e3466a89fd4018432634de2c0af1c2e13a6c763e9409950d4e677c1d978435e6752a42d6ee9739eda194a69898f79eae7a6eff5404d69a6dc23dcdcb9a9cb8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0","gasLimit":"0x47b760","difficulty":"0x1","mixHash":"0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365","coinbase":"0x0000000000000000000000000000000000000000","alloc":{"051e0b7eaef576f6a00b4991a244e7ef7a971b26":{"balance":"0x446c3b15f9926687d2c40534fdb564000000000000"},"09950d4e677c1d978435e6752a42d6ee9739eda1":{"balance":"0x446c3b15f9926687d2c40534fdb564000000000000"},"a69898f79eae7a6eff5404d69a6dc23dcdcb9a9c":{"balance":"0x446c3b15f9926687d2c40534fdb564000000000000"},"e3466a89fd4018432634de2c0af1c2e13a6c763e":{"balance":"0x446c3b15f9926687d2c40534fdb564000000000000"}},"number":"0x0","gasUsed":"0x0","parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000"}'

4 nodes on docker containers deployed in the same aws instance

prd-fox commented 5 years ago

Yep, there have been quite a few fixes for various causes of the "bad block" error. Let me know how you get on with the newer version.

If the issue persists even after upgrade, we can keep digging into the root cause.

fixanoid commented 5 years ago

Enrique, the genesis appears to be generated by older Istanbul tools as well. Please update to latest jpmorganchase/istanbul-tools and regen or manually bump gas limit and replace homesteadBlock with byzantiumBlock.

On Fri, Dec 14, 2018, 10:36 AM Enrique Alcázar Garzás < notifications@github.com wrote:

We've noticed that newer versions have fixed many problems we are currently encountering.

Answers: We have not, but will upgrade, try again and get back to this issue Fresh chain

'{"config":{"chainId":2017,"homesteadBlock":1,"eip150Block":2,"eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000","eip155Block":3,"eip158Block":3,"istanbul":{"epoch":30000,"policy":0},"isQuorum":true},"nonce":"0x0","timestamp":"0x5beb2518","extraData":"0x0000000000000000000000000000000000000000000000000000000000000000f89af85494051e0b7eaef576f6a00b4991a244e7ef7a971b2694e3466a89fd4018432634de2c0af1c2e13a6c763e9409950d4e677c1d978435e6752a42d6ee9739eda194a69898f79eae7a6eff5404d69a6dc23dcdcb9a9cb8410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0","gasLimit":"0x47b760","difficulty":"0x1","mixHash":"0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365","coinbase":"0x0000000000000000000000000000000000000000","alloc":{"051e0b7eaef576f6a00b4991a244e7ef7a971b26":{"balance":"0x446c3b15f9926687d2c40534fdb564000000000000"},"09950d4e677c1d978435e6752a42d6ee9739eda1":{"balance":"0x446c3b15f9926687d2c40534fdb564000000000000"},"a69898f79eae7a6eff5404d69a6dc23dcdcb9a9c":{"balance":"0x446c3b15f9926687d2c40534fdb564000000000000"},"e3466a89fd4018432634de2c0af1c2e13a6c763e":{"balance":"0x446c3b15f9926687d2c40534fdb564000000000000"}},"number":"0x0","gasUsed":"0x0","parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000"}'

4 nodes on docker containers deployed in the same aws instance

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jpmorganchase/quorum/issues/596#issuecomment-447361070, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbPjDqajbRI-CCa5CfqSt9bp9Bgu4u8ks5u48VngaJpZM4ZR0mh .

fixanoid commented 5 years ago

Please reopen once you've encountered it again. Thank you.

kikoncuo commented 5 years ago

Updated Quorum to 2.1, fixed our genesis file and everything is working now