This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Conversation
4eb8ffc to
6a8cc30
Compare
gavofyork
reviewed
Jan 12, 2019
| last: Block::Hash, | ||
| key: &[u8] | ||
| first: NumberFor<Block>, | ||
| last: BlockId<Block>, |
Member
There was a problem hiding this comment.
any reason to switch API from hash to number?
Contributor
Author
There was a problem hiding this comment.
When you identify blocks range by two hashes, there's additional ambiguity - blocks could be from different forks. When you identify range by first_number..last_hash, the only possible issue is when number(last) < first. That's the only reason, iirc.
gavofyork
approved these changes
Jan 16, 2019
bkchr
reviewed
Jan 17, 2019
core/client/db/src/lib.rs
Outdated
| config: &ChangesTrieConfiguration, | ||
| best_finalized_block: u64 | ||
| ) -> u64 { | ||
| let min_blocks_to_keep = match self.min_blocks_to_keep { |
Member
There was a problem hiding this comment.
Sorry for being late to the party, this can just be replaced by self.min_blocks_to_keep.unwrap_or(1).
Contributor
Author
There was a problem hiding this comment.
Welcome! :) No, it can't, because None branch has return in it. I've changed code a bit so that now there's no explicit return + temp var.
MTDK1
pushed a commit
to bdevux/substrate
that referenced
this pull request
Apr 12, 2019
* use changes tries in query_storage RPC * let + match + return + call -> match
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The idea is that
state_queryStoragecould use changes tries (if they're enabled) to avoid reading key(s) value(s) at every block of the range. Instead we could ask changes tries to filter blocks where the value has been changed && read values at these blocks only.I assume that there will be no positive effect for small blocks ranges, but for big ranges + for keys that are changing rarely it should increase performance significantly. So probably it could be tweaked in the future (like
if range.legth < 16 => do not use changes tries).