Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Prevent Commit after ChangeView #642
Prevent Commit after ChangeView #642
Changes from 13 commits
aa16b7f
d686236
0d98768
d9ea44e
57065f8
442bfe8
f471b32
7d5b201
470b35c
bfb729e
76bd576
ee72d58
3dcc435
b18735e
aa365fd
4959176
abb8063
68f5235
eee35cc
2e7d8ad
28b45cc
b6bf4da
ce7685b
b8beafc
731b915
7ba991b
6fc4864
b7e7981
9838afc
663a8ae
d0f89c6
c3005ac
dda3e9a
5e925b0
45091ce
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
You should allow receiving
PrepareRequest
andPrepareResponse
even whenViewChanging() == true
. BecauseViewChanging()
indicates that I want to change views, it may not be able to change successfully.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.
See the comments below if it accepts prepare requests and prepare responses in the current view after it has sent a
ChangeView
message it can end up sending the other nodes to the next view, where they will never be able to receive the recovery message from this view with the commits, since it will be a lower view number; thus the network will be stalled.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.
If the view has not been changed, then we should allow consensus on the current view. Otherwise, we may not be able to reach a consensus or change views.
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.
If the view is changing for a node (then the view has to be considered to be changed from it's perspective), because it has already sent a change view message that can be used to allow others to accept a change view, so it cannot commit in the current view. If it did commit in the current view after sending a change view, then the others can all accept moving to the later view, where they won't be able to reach consensus.
If more than
F
nodes have committed, then this code does allow receivingPrepareRequest
andPrepareResponse
in the current view effectively to obtain consensus by treating theViewChanging
flag as not changing. Maybe you missed this line that is changed in this PR:neo/neo/Consensus/Helper.cs
Line 39 in ee72d58
If less than or equal to
F
nodes have been committed then they will still be able to obtain consensus in a higher view. So this code should address your concern of nodes being able to reach consensus in the current view when it is not possible to change view anymore.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.
I think it should be
>= context.F()
. WhenF
nodes are committed, iffalse
is returned here, then the local node may commit, and the committed nodes may becomeF+1
.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.
But in that case the other nodes can join it in this view because they won’t be able to get
M
nodes to change view out of this view. So I think it is correct as is.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.
Also, if you use >= F it causes a problem because that would allow a node to commit after sending it’s change view, possibly allowing the other nodes to move to the next view after it had committed leading to a stall.
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.
commits > F
andcommits >= F
only differ whencommits == F
. I think you should not commit whencommits == F
. Otherwise it will enter theF+1
situation. So here we should use>= F
.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.
When
commits == F
, the remaining nodes areM
nodes which is enough to still come to consensus in the next view. Therefore this must use> F
as the criteria for forcing coming to consensus in this view.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.
Actually I thought of how to solve it. It needs to have a new protocol message that is like a change view commit. When
M
of those messages have been received committed nodes in lower view can uncommit.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.
Actually, a recovery message that contains M
ChangeView
messages is equivalent to a Commitment to change view.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.
If a recovery message is received from a higher view it will be possible to uncommit from the lower view. No new protocol messages are needed. We just need to send the recovery if we see a node committed in a lower view.
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.
I have an elegant solution almost complete now to maintain liveness with
F
failed nodes. Changing view needed to distinguish between a request to change view and a commitment to change view. In this way, nodes can continue to accept preparations until they commit to change view, this in combination with commits from lower views able to be uncommitted, solves liveness issues when there are up toF
failed nodes.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.
Jeff, I agree. I think it is a good idea. If we have a solution that do not block
commit
forever it is much better and will respect the properties of the classicalpBFT
.But I think that we still need some properties that we worked and developed in this PR. The properties are locking nodes to commit if they are on
viewchanging
(this is a specification of thepbft
).@erikzhang and @igormcoelho & @shargon, let's insight possible "worst case situations" and think if this idea will cause any possibility of exposing a double header:
f_0 = |f|
honest nodes are committed inview0
;2f+1 =|M|
nodes change view toview1
.Consideration:
f_m = |f|
nodes fromview1
are malicious and can use their commit signatures both atview0
andview1
;Implications:
2f = |f_0| + |f_m|
signatures can exist atview0
;f_0
nodes atview0
can be moved toview1
(any of the2f+1
CN can move then toview1
);Security:
f+1
honests that went toview1
(2.) will have a hardware fail. In this sense, I am thinking thatPR-643
still should be merged, @jsolman. We do not want these nodes to be back because of hardware fail and give their signatures tof_c + f_m = |M| -1
atview0
.2f+1
nodes duringchangeview
(lock withviewchanging
flag) that went toview1
, otherwise, we can produce two headers:f_0 = |f|
honest nodes are committed inview0
;2f+1 =|M|
nodes change view toview1
.f_h = |f|
honest nodes stayed at view0committed
while they also sent theirchangeview
package toview1
Hypotheses:
n \in f_m
can now produce a double header;Procedure:
n
would only need to sign the block atview0
and do notrelay
it. Then, move other nodes toview1
generating a new block.