From 74301d0b612802d123ee503ec73b27ac9b6fafe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Chuda=C5=9B?= <18039094+staffik@users.noreply.github.com> Date: Fri, 3 Jan 2025 18:19:38 +0100 Subject: [PATCH] fix(resharding): update pseudocode (#583) --- neps/nep-0568.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/neps/nep-0568.md b/neps/nep-0568.md index 6e4d9dd93..ebdcebc81 100644 --- a/neps/nep-0568.md +++ b/neps/nep-0568.md @@ -509,10 +509,14 @@ Mappings in `DBCol::ShardUIdMapping` persist as long as any descendant relies on ```rust fn set_shard_uid_mapping(&mut self, child_shard_uid: ShardUId, parent_shard_uid: ShardUId) { + let mapped_parent_shard_uid = store + .get_ser::(DBCol::StateShardUIdMapping, &parent_shard_uid.to_bytes()) + .expect("set_shard_uid_mapping() failed") + .unwrap_or(parent_shard_uid); self.store_update.set( DBCol::StateShardUIdMapping, child_shard_uid.to_bytes().as_ref(), - &borsh::to_vec(&parent_shard_uid).expect("Borsh serialize cannot fail"), + &borsh::to_vec(&mapped_parent_shard_uid).expect("Borsh serialize cannot fail"), ) } ```