-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consensus fails on private txn that are intended to fail, such as revert op. #434
Comments
Just an update on investigation, commenting out line 93-96 of block_validator.go helped to avoid the BAD BLOCK issue and chain seem to generate blocks fine, although there might be potential impact of the having inconsistent tx receipts between nodes. |
I am seeing the same thing. |
from the slack @fixanoid asked. I can confirm this but I'm running in normal raft.System information
Expected Behavior Actual Behavior Step to Reproduce
Note for the solidity contract
|
Preliminary tests confirm that this is a bug in privacy core. |
Previously we had populated the public receipt `failed` field with the result of the transaction. This is correct for public transactions. It's also correct for successful private transactions. But it's not correct for failing private transactions, because their public receipt should not indicate failure. The fix is straightforward. Testing: I used this contract: contract RevertTest{ uint public newValue; function revertFunction() public{ uint a = 1; require(a == 0); } } After deploying the contract I sent in several failing transactions via function sendBad() { eth.sendTransaction({ from: eth.accounts[0], data: web3.sha3("revertFunction()"), gas: 0x47b760, privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] }); } Watching the logs (`1.log` and `2.log`), I saw the `TX-ACCEPTED` events scroll as I sent `revertFunction` transactions. I see 10 `TX-ACCEPTED` events in both logs (1 for deploy and 9 tests via `sendBad`). Via extra logging, in `1.log` I see that the public receipts have status `1`, whereas private receipts have status `0`. In `2.log` they all have status `1`. All nodes stayed up the whole time. Fixes #434
Hi @xuguojie, @jmc265, and @AldelopiomicA. I proposed a fix above (#517). I'd love to know whether it fixes the problem for you. |
Thanks, @joelburget. Will take a look. :) |
Sorry to ask simple question. But how to test it?
Then this is part I'm not to sure
Then I proceed to test at the quorum example. But then there is still crash happen. I check geth version it still show the same commit as I've post so I'm not sure whether I built and install the quorum correctly. Or missing some step.
|
@AldelopiomicA all the commands are correct. Last step is to overwrite geth executable, after make all, like so: |
Follow @fixanoid now I've test the PR. And it does fix the problem for me. I've test with what I've describe here. And also test on my project which using a lot of revert. And so far it doesn't fail/crash. @joelburget @fixanoid Thank you very much. The geth version are now
|
Fix consensus on private contract failure. Fixes #434
System information
Geth version:
geth version
OS & Version: Windows/Linux/OSX
Branch, Commit Hash or Release:
git status
Expected behaviour
With Istanbul BFT, Quorum nodes should be able to reach consensus when executes a private contract that has revert/require operation. In such case, both privateFor nodes and public nodes should have consensus of the reverted transaction (status=0).
Actual behaviour
PrivateFor nodes ran the private reverting code, and marked the local tx failed (status=0), but the public nodes can't receive the private reverting code, so it ran and resulted as succeed (status=1). When the proposer (most likely to be a public node) seal a new block and propagated back to the private nodes, the privateFor nodes stuck on BAD BLOCK error.
Steps to reproduce the behaviour
Solidity contracts:
Backtrace
I managed to add logging to print out the tx receipts, which are different in status as below:
The text was updated successfully, but these errors were encountered: