Closed frolosofsky closed 5 years ago
I also suggest adding short info on why the previous approach wasn't eventually used and this one is better (you can also link to the specific commit)
As we discussed and the majority agreed on the fast/full sync order of commands. I want to express my proposal (which is different) just for the sake of the record. Then we can always reference this thread why we didn't pick it up. Also, I think it can go to UIP to the section of other ideas considered
as that's what we wanted to have.
The summary of the agreed fast sync solution (correct me if smth is missing)
my proposal is the following (some steps common for full/fast sync):
The reasoning of the proposal:
MIN_BLOCKS_TO_KEEP
)@kostyantyn,
As we already had conversation about this, I totally agree with your points. But let's don't mix and discuss multiple topics in single PR, otherwise we never merge it. I'd love to see your proposal in different PR to this ADR once this one gets merged (or, if you're eager to start, setup your branch on top of this one and then rebase).
One thing I want to point out you can address in our PR:
node doesn't need to keep all headers in memory (from the Genesis to the tip) because as we progress gradually, we can delete those between two checkpoints up to the MIN_BLOCKS_TO_KEEP)
I believe we shouldn't delete headers as well as commits from memory, because it's quite often scenario that other peers would ask you to sync from some point in past. Before do this, we have to measure all cons and pros. I can imagine this is useful when node is almost out of memory only.
@kostyantyn,
As we already had conversation about this, I totally agree with your points. But let's don't mix and discuss multiple topics in single PR, otherwise we never merge it. I'd love to see your proposal in different PR to this ADR once this one gets merged (or, if you're eager to start, setup your branch on top of this one and then rebase).
One thing I want to point out you can address in our PR:
node doesn't need to keep all headers in memory (from the Genesis to the tip) because as we progress gradually, we can delete those between two checkpoints up to the MIN_BLOCKS_TO_KEEP)
I believe we shouldn't delete headers as well as commits from memory, because it's quite often scenario that other peers would ask you to sync from some point in past. Before do this, we have to measure all cons and pros. I can imagine this is useful when node is almost out of memory only.
I totally agree with @frolosofsky, the Bitcoin protocol heavily relies on being able to iterate over ALL the headers fast - in our case headers + commits. I don't think it's related to being out of memory or not, the importance of the first header is as the last one. There are other ways to decrease the overall memory consumption (mempool, dbcache, as specified here https://gist.github.com/laanwj/efe29c7661ce9b6620a7).
@kostyantyn I'm not sure on how the items you wrote are related to the this proposal. We should discuss about it separately and think on all the different tradeoffs but what sometimes looks like an optimization can have security or other implications. Anyway It already took us good amount of work until we got to something good for this ADR and I wouldn't mix the fork choice rule with the fast sync specifics.
@frolosofsky @thothd will move this discussion to a separate PR to this ADR.
Since this ADR defines messages that will be used for fast/full sync, I think it's good if such parts are covered in this and not separate ADR and we already have sections in the document where we describe the impact on fast sync / SPV, so it's good to extend.
This change relates to ADR-12, fork-choice rule.
This document describes a new headers-and-votes exchange approach. Peer downloads headers+votes in an epoch. If it looks legitimate, peer downloads the bunch of blocks in this epoch, validates them, and continue with next epoch until it reaches the end-of-chain.
Signed-off-by: Stanislav Frolov stanislav@thirdhash.com