-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add EmergencyMode #2226
Add EmergencyMode #2226
Conversation
{ | ||
// Restore original committee because the block it's in emergency mode | ||
var candidates = GetCandidates(snapshot); | ||
return new CachedCommittee(Blockchain.StandbyCommittee.Select(p => (p, candidates.FirstOrDefault(k => k.PublicKey.Equals(p)).Votes))); |
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 will be a complete Hard Fork
.
How will other nodes and the history sync?
We need to mark this on the Ledger somehow.
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.
A flag inside the block?
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.
Perhaps a flag will be enough, @shargon.
Let me talk to @igormcoelho about this situation first and discuss with him.
@@ -18,6 +18,7 @@ public class ProtocolSettings | |||
public int MemoryPoolMaxTransactions { get; } | |||
public uint MaxTraceableBlocks { get; } | |||
public IReadOnlyDictionary<string, uint> NativeActivations { get; } | |||
public IReadOnlyList<uint> EmergencyMode { get; } |
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.
It also need StartBlock
, which is an index of a block that start the emergency mode.
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 thought to put the block who was under emergency, in order to alter only these blocks.
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 agree with Erik, from StartBlock
, and I even dare saying that we also need some EndBlock
... because by changing consensus during emergency, we should guarantee a certain time to update this consensus, and come back to "normal" (at EndBlock
). And since this emergency may happen many times (see my comment below), we will need a list of PastEmergencyEvents, including which height each emergency started, ended and which forced consensus it lead to. This means a big responsibility for nodes (and node maintainers) willing to perform several emergencies, which definitely shouldn't happen in a stable network.
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 thought to put the block who was under emergency, in order to alter only these blocks.
Now I got your idea @shargon... You plan on putting a list of all blocks in emergency... I think it works, but it's so much better to make a list of pairs <begin,end> instead of a direct list of blocks... because each emergency may last many blocks (due to its uncertain nature), and I guess we need some explicit EmergencyOut
, for nodes to know when they should exit emergency and go back to "normal". I think we also need this in/out
on blocks (as Vitor mentioned), but maybe it's better to have this on ProtocolSettings as well, to have some very certain and predictable behavior of what happened and when it happened.
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 understand the pairs, but it could be slower to check all the pairs because we will need to iterate all the possible emergency pairs, if we have a single list, it will be faster because it could be a hashSet
.
I think that we should be able to solve the emergency in one block, otherwise, we always can add a new entry in this list. What do you think?
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.
Edited comment, invalid.
I think this is a very fundamental feature, which I congratulate as a Mature Neo 3.0 technology. The ability of Hard Fork on emergency is necessary, because World Consensus should have higher priority than technocratic Blockchain Consensus. But that requires very high level of transparency. For example, one node joins network and realizes current block is in emergency... that should be disabled by default (automatically joining emergencies). But suppose it joins the emergency, when should it leave? So, I think it's necessary to have two markers on every block:
By having this in mind, we can keep One Block Finality, otherwise we may need to drop it during emergency, which causes many more problems (as nodes "regretting" entering "bad emergencies"... we shouldn't allow that). The algorithm I have in mind for a node joining the network is:
This means that some "frequent hard forking network" would have a large list of forced changes on its protocol, which is obviously some not welcome situation, but at least supported by the protocol. |
Maybe we should focus on NEO3 now. These things can be considered later. |
By reading neo-project/proposals#82, I believe that this PR also accomplishes almost all of its motivations. If this PR is merged, we need to remember to update specifications accordingly to create awareness among the community. |
Any updates on this issue? |
I don't think we need to worry about it at the moment. |
Alternative to #2205
Close #2203
Idea from: #2205 (comment)