-
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
fix: State dump creates dumps at the correct point #8794
Conversation
The dump needs to be of the state at the beginning of the last block of the previous epoch.
Please ping me when this PR is ready to be merged. |
nearcore/src/state_sync.rs
Outdated
let sync_prev_hash = sync_prev_header.prev_hash(); | ||
let prev_sync_block = chain.get_block(&sync_prev_hash)?; | ||
if runtime.cares_about_shard(None, prev_sync_block.header().prev_hash(), shard_id, false) { | ||
assert_eq!(num_shards, prev_sync_block.chunks().len() as u64); |
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.
for this whole thing, did you consider just using Chain::get_state_response_part()
? The logic around finding the right state roots and such is already implemented there, so you could just call that function in the main loop of state_sync_dump()
if InProgress
just stored the shard ID, part_id and sync_hash. Unless maybe I'm missing something
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.
Amazing suggestion. Done.
Using `get_state_response_header()` instead of reimplementing it.
@akhi3030 Please take a look |
The dump needs to be of the state at the beginning of the last block of the previous epoch. Add latency metrics to functions `fn obtain_state_part()` and `fn apply_state_part()`. Improves debugging to be more verbose about which state root is used for dumping and application. Add a command `neard view-state state-parts read-state-header` to read a state header from the DB.
The dump needs to be of the state at the beginning of the last block of the previous epoch.
Add latency metrics to functions
fn obtain_state_part()
andfn apply_state_part()
.Improves debugging to be more verbose about which state root is used for dumping and application.
Add a command
neard view-state state-parts read-state-header
to read a state header from the DB.