-
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
[Core] optimize the resync process #3540
base: master
Are you sure you want to change the base?
Conversation
@roman-khimov @shargon this pr is for the resync optimization, it still verify blocks, but can achieve the speed of unverify. Consensus change is not frequent, here is the full list of consensus history: 0 NVg7LjGcUSrgxgjX3zEgqaksfMaiS8Z6e1 |
Only the block whose Nextconsensu is changed will be verified by witness, rest of them will be verified with prehash. According to the chain of hash, only if someone can break the Sha256, can it create a valid blockhash that can pass tthis verification. |
Should still execute |
This is a demo, will also add the consensus history as checkpoint. |
Yeah. The checkpoint will eliminate this attack method: no consensus change at all, with a totally faked chain. |
I still don't understand how checking signatures in one place and not checking in another improves anything. Exactly because of
Checkpoints are OK, but as an index->hash map, and you don't need many of them I think (mostly it'd be a single one). The main value of checkpoints to me is that they can be used to avoid messing with old blocks completely, just fetch state/blocks from this known-good block (#3463). |
I am also thinking about what is the best way of doing this. Could be index-> hash map, chould be nextconsensus update history, looks all work for me. As is reminded by @dusmart, hardcode the checkpoint to the core can actually defend the |
@@ -163,7 +166,8 @@ public static ProtocolSettings Load(IConfigurationSection section) | |||
InitialGasDistribution = section.GetValue("InitialGasDistribution", Default.InitialGasDistribution), | |||
Hardforks = section.GetSection("Hardforks").Exists() | |||
? EnsureOmmitedHardforks(section.GetSection("Hardforks").GetChildren().ToDictionary(p => Enum.Parse<Hardfork>(p.Key, true), p => uint.Parse(p.Value))).ToImmutableDictionary() | |||
: Default.Hardforks | |||
: Default.Hardforks, | |||
CheckPoint = section.GetSection("CheckPoint").GetChildren().Select(p => p.Value).ToList() |
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 could make a class for this json to be bind on
Description
Previously we have two sync mode, 1. resync with all witness verified, its slow; 2. resync without witness being verified, fast but sort of unsecure. This pr tries to optimize the resync process to achieve the speed of
unverify
while remaining it as verifiable.Fixes # (issue)
Type of change
Test Configuration:
Checklist: