Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@dnjscksdn98
Copy link
Collaborator

@dnjscksdn98 dnjscksdn98 commented Dec 13, 2023

Description

  • Sort address typed vector on address modifications

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Something else (simple changes that are not related to existing functionality or others)

Checklist

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • I have made new test codes regarding to my changes.
  • I have no personal secrets or credentials described on my changes.
  • I have run cargo-clippy and linted my code.
  • My changes generate no new warnings.
  • My changes passed the existing test codes.
  • My changes are able to compile.

@dnjscksdn98 dnjscksdn98 added the bug Working incorrectly label Dec 13, 2023
@dnjscksdn98 dnjscksdn98 self-assigned this Dec 13, 2023
Comment on lines +555 to 569
/// 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>;
Copy link
Member

Choose a reason for hiding this comment

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

BoundedVec -> BoundedBTreeSet으로 변경을 고려해봐도 좋을 것 같습니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

두개의 차이가 클까요?

Copy link
Collaborator Author

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 같은것으로 수정해야 될것 같아서요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

살짝 대규모 작업이 될수도 있을것 같긴 하네요

Copy link
Member

Choose a reason for hiding this comment

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

네 당장 바꾸자는 뜻은 아니었습니다. 지금 보니 더 나은 collection들을 쓸 여지가 보여서 의견남겨봤습니다.

@alstjd0921 alstjd0921 self-assigned this Dec 13, 2023
@dnjscksdn98 dnjscksdn98 merged commit 9b0d193 into v1.2.5 Dec 14, 2023
@dnjscksdn98 dnjscksdn98 deleted the alex/sort-on-set branch December 14, 2023 04:47
dnjscksdn98 added a commit that referenced this pull request Dec 19, 2023
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Working incorrectly

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.