-
Notifications
You must be signed in to change notification settings - Fork 676
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: various cleanups and fixes in
chain.rs
(#10327)
get_state_response_part(): - remove the contiguous shard_ids assumption. Instead of checking the shard id against the number of chunks, look up the list of shard ids instead. - since the epoch id is remains the same for the current and the prev block, the set of shard ids should also remain the same so we only need to do the check once. - remove some unnecessary clones - finally rename some variables to make them shorter. Mainly remove the `sync_` prefix. I am not sure how much value this prefix is adding and the shorter variables are still conveying the same amount of information. compute_state_response_header(): - Similar to above, remove the contiguous shard_ids assumption. - Remove some unnecessary clones and dereferences save_receipt_id_to_shard_id_for_block(): - there is a potential bug in the function where if encounter an error in middle of iteration, we do not roll back the changes. Hence, pre compute the list of hashmaps before saving receipts. - Take a list of shard ids instead of num_shards to remove the contiguous shard ids assumption
- Loading branch information
Showing
1 changed file
with
33 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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