Load sync states from the chain spec on the light client#7329
Load sync states from the chain spec on the light client#7329
Conversation
…-state-WIP-loading
…-state-WIP-loading
…-state-WIP-loading
…rove-sync-state-WIP-loading
This reverts commit a8f0966.
We should probably try and find out what the difference between the two is 🤔 |
|
cheme
left a comment
There was a problem hiding this comment.
I do not know if 'allow_missing_parent' can be avoided, if it can't, it could also think of naming it 'snapshot_syncing' or something that refer to the actual action it is used for.
Still 'allow_missing_parent' is similar to existing 'allow_missing_state' (probably for light client), so maybe that is not a good idea at all place.
Generally loading from a snapshot do not use the same trust assumption, so I do not find this that surprising it is needed (maybe some specific api or trait could make it looks less hacky, I think making code generic may help here but that should be next steps).
|
|
||
| /// Write the cumulative chain-weight of a block ot aux storage. | ||
| pub(crate) fn write_block_weight<H: Encode, F, R>( | ||
| pub fn write_block_weight<H: Encode, F, R>( |
There was a problem hiding this comment.
why not have a specific 'load_snapshot_state' method that is also public but makes it clear that in should not be use lighty?
Could be part of a trait.
| // used by pruning may not know about the block that is being | ||
| // imported. | ||
| let prune_and_import = || { | ||
| /* |
There was a problem hiding this comment.
Wonder if light pruning method from https://github.com/paritytech/substrate/pull/6851/files would work here, really just a wild guess.
| let best_tree_route = { | ||
| let best_hash = self.storage.read().best_hash; | ||
| if &best_hash == header.parent_hash() { | ||
| if &best_hash == header.parent_hash() || allow_missing_parent { |
There was a problem hiding this comment.
I wonder if modifying tree_route to not fail on missing parent may be better, or if it could break some assumption and make existing code unsecure.
|
Closing due to the PR being stale for a while. |
A follow-up to #7225 and part of #6804.
Some questions about the PR that we should:
allow_missing_parentcode?EpochChangestree? See Add missing fields to the light sync state #7225 (comment).