-
Notifications
You must be signed in to change notification settings - Fork 632
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
feat(storage): Store Validator State Test + Binary #2680
Conversation
34da6ea
to
549b6e1
Compare
b9b02b7
to
b7f9d62
Compare
|
||
let mut store_validator = StoreValidator::new( | ||
near_config.genesis.config.clone(), | ||
runtime_adapter.get_tries(), |
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.
could do ShardTries::new(store, num_shards)
unless we need RuntimeAdapter for something else
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 need RuntimeAdapter to call num_shards()
then.
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.
RuntimeAdapter gets it from genesis:
genesis.config.num_block_producer_seats_per_shard.len() as NumShards
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.
Do you think that's a good idea to bypass standard and transparent way of getting the data and use some weird unclear way to use length of the array of seats per shard as num_shards
just to save a couple of lines of code in the separate util?
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.
Just to make sure that I didn't miss anything, does this PR actually add any tests?
for shard_id in 0..self.shard_tries.len() { | ||
let _trie = self.shard_tries.get_trie_for_shard(shard_id).unwrap(); | ||
// TODO #2597 | ||
// Collect somehow (ask Misha) all State Roots |
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 can get head of the chain from store
and then go from there (getting latest block and get state roots similar to how it's done in state-viewer).
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.
That's not correct because it's not guaranteed we will receive all the data that stored in the Trie.
This will be resolved in #2696.
b7f9d62
to
b500daf
Compare
b500daf
to
005dcb8
Compare
|
@@ -5,6 +5,8 @@ extern crate jemallocator; | |||
#[global_allocator] | |||
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; | |||
|
|||
pub use borsh; |
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.
what is this for? Doesn't make sense to me as borsh is an external library.
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 needs by validator to deserialize Storage data.
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.
Why don't you import borsh in that crate?
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 can't understand what's wrong with adding borsh for public usage here. Could you please decide it with @mikhailOK? I'm okay with any solution.
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.
Re-exporting solves inconsistencies, so I think it is a good practice: near/near-sdk-rs#142
Related to #2597
chunks_state_roots_in_trie
test is addedstart_from_genesis.py
fix