Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
staffik committed Jan 30, 2025
1 parent 58bb90d commit 128b2af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions neps/nep-0568.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ This approach minimizes complexity while maintaining consistency across hot and
Since [Stateless Validation][NEP-509], all shards tracking is no longer required. Currently, shard cleanup (e.g. when we stopped tracking one shard and started tracking another shard) has not been implemented. With resharding, we would also want to cleanup parent shard once we stop tracking all its descendants. We propose a shard cleanup mechanism that will also handle post-resharding cleanup.

When garbage collection removes the last block of an epoch from the canonical chain, we determine which shards were tracked during that epoch by examining the shards present in `TrieChanges` at that block. Similarly, we collect information on shards tracked in subsequent epochs, up to the present one. A shard State is removed only if:
- It was tracked in the old epoch (for which the last block has just been garbage collected).
- It was not tracked in later epochs, is not currently tracked, and will not be tracked in the next epoch.

* It was tracked in the old epoch (for which the last block has just been garbage collected).
* It was not tracked in later epochs, is not currently tracked, and will not be tracked in the next epoch.

To ensure compatibility with resharding, instead of checking tracked shards directly, we analyze the `ShardUId` prefixes they use. A parent shard's state is retained as long as it remains referenced in `DBCol::StateShardUIdMapping` by any descendant shard. Once all descendant shards are no longer tracked, we clean up the parent shard's state (along with its descendants) and remove all mappings to the parent from `DBCol::StateShardUIdMapping`.

Expand Down

0 comments on commit 128b2af

Please sign in to comment.