Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShardId Semantics #572

Merged
merged 2 commits into from
Nov 7, 2024
Merged

ShardId Semantics #572

merged 2 commits into from
Nov 7, 2024

Conversation

wacban
Copy link
Contributor

@wacban wacban commented Nov 6, 2024

No description provided.

@wacban wacban requested a review from a team as a code owner November 6, 2024 16:27
Copy link

@staffik staffik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@wacban wacban removed the request for review from a team November 6, 2024 16:55
Copy link

@Trisfald Trisfald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

neps/nep-0568.md Show resolved Hide resolved
neps/nep-0568.md Outdated
@@ -143,6 +143,10 @@ supporting smooth transitions without altering storage structures directly.

### ShardId Semantics

Currently, shard IDs are represented as numbers within the range `[0,n)`, where n is the total number of shards. These shard IDs are sorted in the same order as the account ID ranges assigned to them. While this approach is straightforward, it complicates resharding operations, particularly when splitting a shard in the middle of the range. Such a split requires reindexing all subsequent shards with higher IDs, adding complexity to the process.

In this NEP, we propose updating the ShardID semantics to allow for arbitrary identifiers. Although ShardIDs will remain integers, they will no longer be restricted to the `[0,n)` range, and they may appear in any order. The only requirement is that each ShardID must be unique. In practice, during resharding, the ID of a parent shard will be removed from the ShardLayout, and the new child shards will be assigned unique IDs - `max(shard_ids)+1` and `max(shard_ids)+2`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that each ShardID must be unique

Unique in a given shard_layout or in the entire history of the blockchain? Just asking for myself

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well in the past they were not unique so it's not going to be entire history. Going forward, yes, the new ones will be unique forever. (unless we run out of numbers and need to improvise ;) )

@wacban wacban merged commit 5368857 into resharding Nov 7, 2024
1 check passed
@wacban wacban deleted the wacban-patch-1 branch November 7, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: NEW
Development

Successfully merging this pull request may close these issues.

3 participants