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

Deprecate ShardLayout::v0 #12176

Open
Longarithm opened this issue Oct 1, 2024 · 2 comments
Open

Deprecate ShardLayout::v0 #12176

Longarithm opened this issue Oct 1, 2024 · 2 comments
Labels
A-resharding Area: State resharding C-good-first-issue Category: issues that are self-contained and easy for newcomers to work on. C-housekeeping Category: Refactoring, cleanups, code quality

Comments

@Longarithm
Copy link
Member

Longarithm commented Oct 1, 2024

Description

ShardLayout::v0 is responsible for random assignment of accounts to shards. It is incompatible with current and future shard layouts because it makes it impossible to derive range of accounts from boundary accounts.
The first mainnet config was v0. However, there was only one shard, so random assignment wasn't used.
It could be nice to remove all occurrences of v0 from code, including all kinds of tests up to pytests.
But we need to be very careful to preserve compatibility with genesis.

There was assumption in some test that localnet accounts are located on different shards; but this can be handled with v1/v2 as well.

@Longarithm Longarithm added C-housekeeping Category: Refactoring, cleanups, code quality C-good-first-issue Category: issues that are self-contained and easy for newcomers to work on. A-resharding Area: State resharding labels Oct 1, 2024
@eagr
Copy link
Contributor

eagr commented Oct 18, 2024

I could only deduce the work to be done from your description here as I’m brand new to NEAR.


remove all occurrences of v0 from code

By "deprecate", I suppose you mean to wipe it out instead of to show a deprecation warning about using V0, right?

And I guess some of the occurrences of V0 in the tests should be replaced by V2 (assuming V2 is preferred over V1 now, that right?).

preserve compatibility with genesis

Do you mean something like "new code should work on old data"?
If so, to be backward-compatible, I suppose we need to do some transformation if it’s v0, providing the related code is removed?
Could you expand on that? Not so sure about this.

@wacban
Copy link
Contributor

wacban commented Oct 24, 2024

@eagr

Let's first disambiguate:

  • V0 is an old variant of that ShardLayout structure - this is a protocol structure so it likely needs to stay as is in order to preserve serialization and replayability.
  • v0 is a method used to create shard layouts using the V0 structure. This method should be removed and replaced with calls to v2.
  • I think mainnet genesis contains a V0 layout but it's constructed using deseralization when genesis is read so the v0 method shouldn't be needed.

I can also see that there is v0_single_shard -> perhaps a good first step for you would be to

  • rename it to single_shard
  • make it use v2 instead of v0
  • run tests - I would hope they all pass but if not -> let's discuss

Then later you can find any reference to v0 and try tro replace those with v2.

  • This has potential to break things like the implicit assumptions made by some tests that Longarithm mentioned.
  • Feel free to debug but if it doesn't work it's ok to leave some as is or ping me and I'll help debugging.

Finally once all references to v0 are gone we can delete it altogether.

Feel free to pick and choose any of the subtasks here.

preserve compatibility with genesis

I think it should be sufficient to keep V0 as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resharding Area: State resharding C-good-first-issue Category: issues that are self-contained and easy for newcomers to work on. C-housekeeping Category: Refactoring, cleanups, code quality
Projects
None yet
Development

No branches or pull requests

3 participants