-
Notifications
You must be signed in to change notification settings - Fork 624
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
Comments
I could only deduce the work to be done from your description here as I’m brand new to NEAR.
By "deprecate", I suppose you mean to wipe it out instead of to show a deprecation warning about using And I guess some of the occurrences of
Do you mean something like "new code should work on old data"? |
Let's first disambiguate:
I can also see that there is
Then later you can find any reference to v0 and try tro replace those with v2.
Finally once all references to v0 are gone we can delete it altogether. Feel free to pick and choose any of the subtasks here.
I think it should be sufficient to keep V0 as is. |
nearcore/core/primitives/src/shard_layout.rs Lines 552 to 573 in 89dbf98
These would panic when given an invalid id/index in the case of V2. Does it mean a deliberately crafted block could crash a validator? Panicking here doesn't feel like desirable behavior anyways. Off the topic, curious what are the reasons for running checks against nightly in CI? The only reason I could think of is to be a good citizen by discovering early and reporting issues back to the Rust community. But that doesn't justify doing it on a per PR basis as it might block development if there're issues on nightly. |
Thanks, that is a great catch. I will look into it. Generally speaking the shard id is validated very early on in the block processing pipeline and it is handled correctly there as far as I can tell (we do have a test for this). Still it's a terrible pattern that should be improved.
Just to be on the same page, there is rust nightly and nearcore nightly. I think you're talking about rust nightly and the CI is about nearcore nightly. As far as I can tell we don't run rust nightly anywhere. The nearcore nightly contains features to be released in the future but that aren't quite ready. We do want to run CI on those. |
Those and there should be one in Yeah V2 and non-contiguous ShardIds are still work in progress. I will be migrating more tests to use V2 in the coming days as part of the resharding V3 project. If you are curious you can have a look at #11881 and NEP-568. btw I always thought it would be cool to implement a method to create a new shard layout from the previous one by adding a new boundary account. If you are interested I can create an issue for you. |
sure please do :) |
helps #12176 --------- Co-authored-by: wacban <wac.banasik@gmail.com> Co-authored-by: Waclaw Banasik <wacban@users.noreply.github.com>
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.
The text was updated successfully, but these errors were encountered: