-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix: sort on address modification #32
Conversation
/// The active validator set (full and basic) selected for the current round. This storage is sorted by address. | ||
pub type SelectedCandidates<T: Config> = | ||
StorageValue<_, BoundedVec<T::AccountId, ConstU32<MAX_AUTHORITIES>>, ValueQuery>; | ||
|
||
#[pallet::storage] | ||
#[pallet::getter(fn selected_full_candidates)] | ||
/// The active full validator set selected for the current round | ||
/// The active full validator set selected for the current round. This storage is sorted by address. | ||
pub type SelectedFullCandidates<T: Config> = | ||
StorageValue<_, BoundedVec<T::AccountId, ConstU32<MAX_AUTHORITIES>>, ValueQuery>; | ||
|
||
#[pallet::storage] | ||
#[pallet::getter(fn selected_basic_candidates)] | ||
/// The active basic validator set selected for the current round | ||
/// The active basic validator set selected for the current round. This storage is sorted by address. | ||
pub type SelectedBasicCandidates<T: Config> = | ||
StorageValue<_, BoundedVec<T::AccountId, ConstU32<MAX_AUTHORITIES>>, ValueQuery>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BoundedVec
-> BoundedBTreeSet
으로 변경을 고려해봐도 좋을 것 같습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
두개의 차이가 클까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
적용을 하려고 했는데, 아무래도 타입이 기존 벡터와 다르다보니�사용하는 곳에서 로직 수정이 많이 요구가 되긴 하네요. 다른 스토리지들과 호환이 안되는 부분도 있기도 하고요, 이를테면 CachedSelectedCandidates
처럼요.
그래서 우선은 BoundedVec
으로 유지하고, 이후에 저희 스토리지 값들 전부 migration하는 것은 어떨까요? CachedSelectedCandidates
이런것들도 전부 BTreeMap
같은것으로 수정해야 될것 같아서요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
살짝 대규모 작업이 될수도 있을것 같긴 하네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네 당장 바꾸자는 뜻은 아니었습니다. 지금 보니 더 나은 collection들을 쓸 여지가 보여서 의견남겨봤습니다.
* sc-executor: Increase maximum instance count (polkadot-sdk#1856) * remove `pallet::without_storage_info` macros * Update Cargo.toml, Cargo.lock (#31) * fix: sort on address modification (#32) * fix: sort vector on address modification * chore: increase testnet runtime version * test: update package.json version --------- Co-authored-by: alstjd0921 <kwonarseus@gmail.com>
Description
Type of change
Checklist
cargo-clippy
and linted my code.