Skip to content

Commit

Permalink
fix(resharding): update pseudocode (#583)
Browse files Browse the repository at this point in the history
  • Loading branch information
staffik authored Jan 3, 2025
1 parent 1efd6cf commit 74301d0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion neps/nep-0568.md
Original file line number Diff line number Diff line change
Expand Up @@ -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::<ShardUId>(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"),
)
}
```
Expand Down

0 comments on commit 74301d0

Please sign in to comment.