Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resharding: verify proof (near#12485)
Completes the resharding validation flow on the chunk validator side. The code replaces `MainTransition::ShardLayoutChange` with actual logic. The whole preparation is needed to call `let new_root = trie.retain_split_shard(&boundary_account, retain_mode)?;`, to verify it against state root provided in transition. The main complexity is to introduce implicit transition for resharding to the right place - after applying last chunk in old shard layout, potentially missing, and before applying first chunk in the new layout. To do that, I needed to modify `get_state_witness_block_range` once again, and to make it readable, I rewrote it using `TraversalPosition`. The point of that is to change all parameters of the loop at once, instead of changing them one-by-one in the loop. Then, I generate `ImplicitTransitionParams` right in the loop. Finally, this allows to insert resharding transition before jumping to the previous block hash and child shard id, if needed. Note that this flow happens in reverse to chain flow. Also unfortunately this is not triggered on production tests, because when nodes track all shards, the condition `if let Ok(prev_chunk_extra) = chain.get_chunk_extra(prev_block_hash, &shard_uid) { ... }` is triggered - if latest chunk extra is already computed, we skip unnecessary validations. So for now I checked the correctness by commenting this path and running tests locally.
- Loading branch information