Consensys / quorum-examples

Examples for Quorum
Apache License 2.0
321 stars 348 forks source link

Private Transaction is throwing error and bringing all the 7nodes down. #52

Closed Satavim closed 6 years ago

Satavim commented 6 years ago

I am writing this contract :: var testContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"getValue","outputs":[{"name":"a","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"a","type":"uint256"}],"name":"setValue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]); var test = testContract.new( { from: web3.eth.accounts[0], data: '0x6060604052341561000f57600080fd5b60ce8061001d6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063209652551460465780635524107714606c57600080fd5b3415605057600080fd5b6056608c565b6040518082815260200191505060405180910390f35b3415607657600080fd5b608a60048080359060200190919050506098565b005b60008054905080905090565b80600081905550505600a165627a7a7230582024e016d5e5847222cc207652bed2e9ed9b95abe6ae8f9e2acf46d6ac5f401d740029', gas: '4700000', privateFor: ["QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc=", "1iTZde/ndBHvzhcl7V68x44Vx7pl8nwx9LqnM/AfJUg="] }, function (e, contract){ console.log(e, contract); if (typeof contract.address !== 'undefined') { console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash); } })

[6:46] but getting error and all the nodes are coming down.

Issue:::: INFO [11-15|12:58:28] sending private tx data=6060604052341561000f57600080fd5b60ce8061001d6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063209652551460465780635524107714606c57600080fd5b3415605057600080fd5b6056608c565b6040518082815260200191505060405180910390f35b3415607657600080fd5b608a60048080359060200190919050506098565b005b60008054905080905090565b80600081905550505600a165627a7a7230582024e016d5e5847222cc207652bed2e9ed9b95abe6ae8f9e2acf46d6ac5f401d740029 privatefrom= privatefor="[QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc= 1iTZde/ndBHvzhcl7V68x44Vx7pl8nwx9LqnM/AfJUg=]" INFO [11-15|12:58:28] sent private tx data=3935801486d7c735609b68952f96f08e4032df71f8911ece30ac152097178b78a98a79609e57b78107e28075c22e346a2e69abef3789ae5e7ed8019256b312d8 privatefrom= privatefor="[QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc= 1iTZde/ndBHvzhcl7V68x44Vx7pl8nwx9LqnM/AfJUg=]" INFO [11-15|12:58:28] Submitted contract creation fullhash=0xc28f32887f553b0e167c3cc5872e4918ce363559d26286472dfe9905c1eddb97 to=0x1932c48b2bF8102Ba33B4A6B545C32236e342f34 INFO [11-15|12:58:30] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=5e4fdb…df3e77 number=70 INFO [11-15|12:58:30] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=1.840ms mgasps=0.000 number=70 hash=5e4fdb…df3e77 panic: runtime error: index out of range

Can you suggest what is the issue

This is happening when we starting the node using the Istanbul BFT mode

Satavim commented 6 years ago

@markya0616 can you please suggest any solution to the above issue.

markya0616 commented 6 years ago

@Satavim The root cause is Quorum always uses HomesteadSigner, but worker uses EIP155Signer. It may get wrong address and make some tx array index out of range. We've already file a PR to solve this issue and make private transactions work. Please refer our PR: https://github.com/jpmorganchase/quorum/pull/217.

Satavim commented 6 years ago

@markya0616 Ok will wait for issue to be fixed.

patrickmn commented 6 years ago

jpmorganchase/quorum#217 is merged now

Satavim commented 6 years ago

Have downloaded the latest branch. But still not able to do private transaction. Giving the below error:: err creating contract Error: Non-200 status code: &{Status:500 Internal Server Error StatusCode:500 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Date:[Fri, 17 Nov 2017 13:47:31 GMT] Server:[Warp/3.2.13]] Body:0xc4353d1e00 ContentLength:-1 TransferEncoding:[chunked] Close:false Uncompressed:false Trailer:map[] Request:0xc4350d7c20 TLS:}

markya0616 commented 6 years ago

@Satavim I tried the latest branch in my side, and it works! Can you try it again? or provide more geth log. Thanks.

abhayar commented 6 years ago

I'm also facing the same problem. In node log, I'm getting panic: runtime error: index out of range:

nohup: appending output to 'nohup.out' INFO [11-27|20:24:29] Starting peer-to-peer node instance="Geth/vquorum 2.0.0 (geth 1.7.2-stable)-3d91976f/linux-amd64/go1.9.2" INFO [11-27|20:24:29] Allocated cache and file handles database=/home/dev/quorum-examples/examples/7nodes/qdata/dd1/geth/chaindata cache=128 handles=1024 WARN [11-27|20:24:29] Upgrading database to use lookup entries INFO [11-27|20:24:29] Reconfiguring old genesis as Quorum INFO [11-27|20:24:29] Initialised chain configuration config="{ChainID: Homestead: 1 DAO: DAOSupport: false EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: IsQuorum: true Engine: unknown}" INFO [11-27|20:24:29] Initialising Ethereum protocol versions="[63 62]" network=1 INFO [11-27|20:24:29] Loaded most recent local header number=0 hash=62c2c0…5a3c94 td=1 INFO [11-27|20:24:29] Loaded most recent local full block number=0 hash=62c2c0…5a3c94 td=1 INFO [11-27|20:24:29] Loaded most recent local fast block number=0 hash=62c2c0…5a3c94 td=1 INFO [11-27|20:24:29] Regenerated local transaction journal transactions=0 accounts=0 INFO [11-27|20:24:29] Starting P2P networking INFO [11-27|20:24:29] Database deduplication successful deduped=0 INFO [11-27|20:24:31] UDP listener up self=enode://ac6b1096ca56b9f6d004b779ae3728bf83f8e22453404cc3cef16a3d9b96608bc67c4b30db88e0a5a6c6390213f7acbe1153ff6d23ce57380104288ae19373ef@[::]:21000 INFO [11-27|20:24:31] RLPx listener up self=enode://ac6b1096ca56b9f6d004b779ae3728bf83f8e22453404cc3cef16a3d9b96608bc67c4b30db88e0a5a6c6390213f7acbe1153ff6d23ce57380104288ae19373ef@[::]:21000 WARN [11-27|20:24:31] Removing static dial candidate id=ac6b1096ca56b9f6 addr=127.0.0.1:21000 err="is self" INFO [11-27|20:24:31] IPC endpoint opened: /home/dev/quorum-examples/examples/7nodes/qdata/dd1/geth.ipc INFO [11-27|20:24:31] HTTP endpoint opened: http://0.0.0.0:22000 INFO [11-27|20:24:33] Unlocked account address=0xed9d02e382b34818e88B88a309c7fe71E65f419d INFO [11-27|20:24:33] Transaction pool price threshold updated price=18000000000 INFO [11-27|20:24:33] Starting mining operation INFO [11-27|20:24:33] Commit new mining work number=1 txs=0 uncles=0 elapsed=132.296µs INFO [11-27|20:24:38] Block synchronisation started INFO [11-27|20:24:38] Mining aborted due to sync INFO [11-27|20:24:38] Imported new chain segment blocks=4 txs=0 mgas=0.000 elapsed=10.734ms mgasps=0.000 number=4 hash=ffe65f…663f61 INFO [11-27|20:24:38] Starting mining operation INFO [11-27|20:24:38] Commit new mining work number=5 txs=0 uncles=0 elapsed=54.967µs INFO [11-27|20:24:40] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=ab3996…d04001 number=5 INFO [11-27|20:24:40] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=3.535ms mgasps=0.000 number=5 hash=ab3996…d04001 INFO [11-27|20:24:40] Commit new mining work number=6 txs=0 uncles=0 elapsed=278.64µs INFO [11-27|20:24:42] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=6bad01…d01fa0 number=6 INFO [11-27|20:24:42] Successfully sealed new block number=6 hash=6bad01…d01fa0 INFO [11-27|20:24:42] 🔨 mined potential block number=6 hash=6bad01…d01fa0 INFO [11-27|20:24:42] Commit new mining work number=7 txs=0 uncles=0 elapsed=218.73µs INFO [11-27|20:24:44] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=9bdb65…3ab350 number=7 INFO [11-27|20:24:44] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=14.721ms mgasps=0.000 number=7 hash=9bdb65…3ab350 INFO [11-27|20:24:44] Commit new mining work number=8 txs=0 uncles=0 elapsed=254.604µs INFO [11-27|20:24:46] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=2c669f…7a447a number=8 INFO [11-27|20:24:46] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=6.195ms mgasps=0.000 number=8 hash=2c669f…7a447a INFO [11-27|20:24:46] Commit new mining work number=9 txs=0 uncles=0 elapsed=215.846µs INFO [11-27|20:24:48] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=3de924…cf834f number=9 INFO [11-27|20:24:48] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=11.150ms mgasps=0.000 number=9 hash=3de924…cf834f INFO [11-27|20:24:48] Commit new mining work number=10 txs=0 uncles=0 elapsed=239.597µs INFO [11-27|20:24:50] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=51feb3…be5af6 number=10 INFO [11-27|20:24:50] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=24.833ms mgasps=0.000 number=10 hash=51feb3…be5af6 INFO [11-27|20:24:50] Commit new mining work number=11 txs=0 uncles=0 elapsed=224.721µs INFO [11-27|20:24:52] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=4a5962…e5038f number=11 INFO [11-27|20:24:52] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=7.861ms mgasps=0.000 number=11 hash=4a5962…e5038f INFO [11-27|20:24:52] Commit new mining work number=12 txs=0 uncles=0 elapsed=2.541ms INFO [11-27|20:24:52] 🔗 block reached canonical chain number=6 hash=6bad01…d01fa0 INFO [11-27|20:24:54] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=d6eb5e…21812e number=12 INFO [11-27|20:24:54] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=11.420ms mgasps=0.000 number=12 hash=d6eb5e…21812e INFO [11-27|20:24:54] Commit new mining work number=13 txs=0 uncles=0 elapsed=245.444µs INFO [11-27|20:24:56] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=9ac93d…313874 number=13 INFO [11-27|20:24:56] Successfully sealed new block number=13 hash=9ac93d…313874 INFO [11-27|20:24:56] 🔨 mined potential block number=13 hash=9ac93d…313874 INFO [11-27|20:24:56] Commit new mining work number=14 txs=0 uncles=0 elapsed=218.595µs INFO [11-27|20:24:58] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=f1cc49…20463c number=14 INFO [11-27|20:24:58] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=2.956ms mgasps=0.000 number=14 hash=f1cc49…20463c INFO [11-27|20:24:58] Commit new mining work number=15 txs=0 uncles=0 elapsed=4.855ms INFO [11-27|20:25:00] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=2df760…1166cf number=15 INFO [11-27|20:25:00] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=5.115ms mgasps=0.000 number=15 hash=2df760…1166cf INFO [11-27|20:25:00] Commit new mining work number=16 txs=0 uncles=0 elapsed=228.262µs INFO [11-27|20:25:02] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=313e52…bfc526 number=16 INFO [11-27|20:25:02] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=3.149ms mgasps=0.000 number=16 hash=313e52…bfc526 INFO [11-27|20:25:02] Commit new mining work number=17 txs=0 uncles=0 elapsed=214.989µs INFO [11-27|20:25:04] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=23ae31…3260f4 number=17 INFO [11-27|20:25:04] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=8.086ms mgasps=0.000 number=17 hash=23ae31…3260f4 INFO [11-27|20:25:04] Commit new mining work number=18 txs=0 uncles=0 elapsed=215.369µs INFO [11-27|20:25:05] sending private tx data=6060604052341561000f57600080fd5b604051602080610149833981016040528080519060200190919050505b806000819055505b505b610104806100456000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632a1afcd914605157806360fe47b11460775780636d4ce63c146097575b600080fd5b3415605b57600080fd5b606160bd565b6040518082815260200191505060405180910390f35b3415608157600080fd5b6095600480803590602001909190505060c3565b005b341560a157600080fd5b60a760ce565b6040518082815260200191505060405180910390f35b60005481565b806000819055505b50565b6000805490505b905600a165627a7a72305820d5851baab720bba574474de3d09dbeaabc674a15f4dd93b974908476542c23f00029000000000000000000000000000000000000000000000000000000000000002a privatefrom= privatefor="[QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc=]" INFO [11-27|20:25:05] sent private tx data=dbca8cfaecd7af19819e4e0696859b98e289a1b8ad9ab497644957d784787b4b8d6358c32d265b9dace74269482fa05d88442aec3b9049ea26e6d53ab57c1da7 privatefrom= privatefor="[QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc=]" INFO [11-27|20:25:05] Submitted contract creation fullhash=0xaa6ad1d4040907102db4baa9e61cb1fc28e802fc43df56d6fa402732d55d6338 to=0x1932c48b2bF8102Ba33B4A6B545C32236e342f34 INFO [11-27|20:25:06] Committed address=0xd8Dba507e85F116b1f7e231cA8525fC9008A6966 hash=26e6a3…776725 number=18 INFO [11-27|20:25:06] Imported new chain segment blocks=1 txs=0 mgas=0.000 elapsed=8.852ms mgasps=0.000 number=18 hash=26e6a3…776725 panic: runtime error: index out of range

goroutine 47 [running]: github.com/ethereum/go-ethereum/core/types.NewTransactionsByPriceAndNonce(0x19dd8c0, 0xc421a48570, 0xc4214f6360, 0x0) /home/dev/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/core/types/transaction.go:399 +0x492 github.com/ethereum/go-ethereum/miner.(worker).commitNewWork(0xc420468a00) /home/dev/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/miner/worker.go:463 +0xa40 github.com/ethereum/go-ethereum/miner.(worker).update(0xc420468a00) /home/dev/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/miner/worker.go:259 +0x6e9 created by github.com/ethereum/go-ethereum/miner.newWorker /home/dev/quorum/build/_workspace/src/github.com/ethereum/go-ethereum/miner/worker.go:158 +0x575

markya0616 commented 6 years ago

Please make sure that you pull the latest quorum code. Current quorum-example doesn't pull the latest quorum. https://github.com/jpmorganchase/quorum-examples/blob/master/vagrant/bootstrap.sh#L28

Or you can try another example, ibft in quroum by docker-compose. https://medium.com/getamis/istanbul-bft-ibft-c2758b7fe6ff

abhayar commented 6 years ago

@markya0616 Yeah..I have checked my quorum has latest version 2.0.0..let me try with another example

markya0616 commented 6 years ago

This commit, 6f835c377e8a10c9b919ed8d49499b1aaff2a83d, is not included in v2.0.0. You need to pull the latest code and rebuild it.

abhayar commented 6 years ago

Tried with https://medium.com/getamis/istanbul-bft-ibft-c2758b7fe6ff and it worked fine. I see that it using the docker image quay.io/amis/quorum:feature_istanbul and it is created a month back. Not sure if its underlying code is same as master. But when Tried with master branch of quorum and https://github.com/jpmorganchase/quorum-examples/ , facing the same issue. Nodes gets down as I execute the private transaction. With public transaction it works fine.

Please advise.

markya0616 commented 6 years ago

Thanks for the reminder. We updated the image to the latest master. You can check it again. For the quorum-examples, you may need to remove the line https://github.com/jpmorganchase/quorum-examples/blob/master/vagrant/bootstrap.sh#L28 to not checkout to v2.0.0, and then re-create your vagrant instance.

abhayar commented 6 years ago

@markya0616 I'm not using virtual box & vagrant instance, working in Ubuntu OS..So no need to recreate vargrant instance

abhayar commented 6 years ago

@markya0616 Tried with master branch of quorum and https://github.com/jpmorganchase/quorum-examples/ ,i can execute private transaction

abhayar commented 6 years ago

@markya0616 https://medium.com/getamis/istanbul-bft-ibft-c2758b7fe6ff I tried with this link & created network of 4 validators . Can I add new node in existing network..?

markya0616 commented 6 years ago

Sure. The quickest way is that you can create a new docker-compose with number 5 by istanbul-tool, such as:

istanbul setup --num 5 --docker-compose --quorum --save

If you really want to add a new validator into the existing network, you can refer the generated docker-compose file, create a new dockerfile with the same configuration, and connect to the existing network. After your constellation and geth are connected, your original validators need to propose the new validator into your network. Then, the new validator become one of the validators in the network. :)

jpmsam commented 6 years ago

@markya0616 thanks for the followups and suggestions.