-
Notifications
You must be signed in to change notification settings - Fork 100
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: finding the best way to create a history of block executions results #835
Conversation
If all nodes upgrade and re-sync we may have the same problem as before. If we go in this direction, perhaps we should do a Sparse Graph or a MPT for that purpose. |
I just want to try to fix it as much as i can without incur much change to the existing protocol. Still thinking. |
Can we come up with a way to avoid resync? i really hate resync. |
I see, @Liaojinghui, Then, this issue is related to: "finding the best way to create a history of block executions results", right? |
private static void OnCommitting(NeoSystem system, Block block, DataCache snapshot, IReadOnlyList<Blockchain.ApplicationExecuted> applicationExecutedList) | ||
{ | ||
var serializedData = JsonSerializer.SerializeToUtf8Bytes(applicationExecutedList); | ||
var hash = ComputeSha256Hash(serializedData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, you are proposing the Sha256
(of all Executed List) on every payload for PrepareRequest.
@@ -19,13 +19,17 @@ public class PrepareRequest : ConsensusMessage | |||
{ | |||
public uint Version; | |||
public UInt256 PrevHash; | |||
// The execution result hash of the previous block transactions | |||
// since we do not need to update it or search it, no merkel tree is needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct, in this case, it is not a storage, it is a protocol communication level that ensure nodes will not proceed.
@Liaojinghui, I am checking the code, it is in fact something that can help, in particular considering that the Consensus is made by nodes with different protocols. It is a kind of "hard" warning! In any case, I think that, doing things correctly, we may need Tests for this PR. Would you like to give a hand in pushing forward these tests again? What we need would be just the template of the PR compiling with simple tests. Then, I can tune and all the previous cases and more. |
I can do the test kit thing. But we can discuss more before we carry out the test. In the mean while, I think there is a formal modeling tool that we can use. |
Adding MPT state root of the previous block would be great and not hard to do, it doesn't need to be signed by SVs as well. It's enough for every CN to have some local state root and include it into messages, if it's the same for every CN, then SV signature doesn't matter much (do we need SV role at all in this case is a separate matter). Well, just like was proposed in neo-project/neo#1526. |
The advantage of the MPT may be that we could check the existence of a result easier. But maybe, for this case, hash will be enough. |
Inventing a scheme to capture block side-effects just for the consensus doesn't seem to be productive to me, that's why I'd strongly prefer reusing MPT. MPT itself is quite cheap for Neo. |
I� would love to use MPT as well, just not sure how much cost it will incur, if you all vote on MPT, then why not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jim8y,
I think you can close this one and move to an issue for us to discuss the idea.
There are possibilities such as sending the state along with the commit. We can append that to the block.
There are possibilities to do in our round.
@vncoelho Updating the consensus is not gonna happen, the key of existing dbft model is |
Execution results is not a decision made by consensus, @Jim8y. But the PR is not the correct place to design and discuss that. I think an issue is needed if we decide to move in that direction. |
You don't, the reason of not execute transactions during the consensus is to avoid prolonged execution delay the consensus. You change that, you change everything. You can create an issue to discuss this, not necessarily to close this pr. The best case you can have is two block state finality, no better than that unless you want to reevaluate everything. |
No @Jim8y , It is possible. |
what state you have without execution? when we talk state here, we refer to transaction execution results. |
We are doing something similar for sidechain NEOX, so soon we can apply it here. |
please dont tell me its ' shadow block' |
Since DBFT is an
execute after consensus
model, we do not have a proper mechanism to ensure the state consistency cross nodes, thus i propose adding the transaction execution results to the next round consensus.core idea here is:
if the primary has an inconsistent execution result for the last block, then other consensus nodes will reject his proporal.
Benifit of this pr is that we can ensure a cross nodes state consistency, no matter core versions, vm versions, plugin versions, storage damages.
Problem of this idea is that can not verify current consensus states.