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

Add pallet-invulnerables (#163) #221

Merged
merged 18 commits into from
Aug 26, 2023

Conversation

rimbi
Copy link
Contributor

@rimbi rimbi commented Aug 23, 2023

This pallet mimics what we do in collator-selection:

  • A storage item that holds the accounts that are invulnerables
  • A extrinsic that updates this storage item via root origin

We would also need to include a migration to migrate those invulnerables from pallet-collator-selection to pallet-invulnerables.

@girazoki
Copy link
Collaborator

@rimbi Can you provide a description of what the PR does?

use sp_std::prelude::*;

pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>);
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont understand this migraiton. At the beginning there wont be any invulnerables. What we need to do is set them for the first time, but that has nothing to do with the storage version of the pallet (as it did not change). You can remove this fiole for now, as we need to do the migration in some other way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assumed we would work on it together. You can ignore it for now.

@rimbi rimbi changed the title Add pallet-invulnerables Add pallet-invulnerables (#163) Aug 23, 2023
@girazoki
Copy link
Collaborator

At some point I think it might be good to offer this pallet-abstraction to cumulus, leaving this comment here to remember :)

@rimbi rimbi force-pushed the cem-pallet-invulnerables branch 2 times, most recently from 1d5e498 to bdb2040 Compare August 25, 2023 12:04
})
.build()
.execute_with(|| {
let invulnerables_collator_selection = CollatorSelection::invulnerables();
Copy link
Collaborator

Choose a reason for hiding this comment

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

One suggestion now that we got this test working: remove the

.with_collators(vec![
            (AccountId::from(ALICE), 210 * UNIT),
            (AccountId::from(BOB), 100 * UNIT),
        ])

and use put_storage_value like in https://github.com/moonbeam-foundation/moonbeam/blob/446faeb04153d127211a499244c900a1a5c71e54/pallets/asset-manager/src/tests.rs#L468. That way we are ready to remove the CollatorSelection in the following PR without having to change the test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

@girazoki girazoki left a comment

Choose a reason for hiding this comment

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

A small comment regarding the migration test, but otherwise looking good!

@rimbi rimbi merged commit 7b6aac0 into moondance-labs:master Aug 26, 2023
15 checks passed
@rimbi rimbi deleted the cem-pallet-invulnerables branch August 26, 2023 09:38
rimbi pushed a commit to rimbi/tanssi that referenced this pull request Oct 17, 2023
* Add pallet-invulnerables

* Update api-augment interfaces

* Update migration

* Fix try-runtime build

* Rename migration variable

* Rename the migration

* Fix the build problem with try-runtime feature

* Add logging to runtime upgrade functions

* Add integration test for invulnerables migration

* Remove the explicit use of CollatorSelection in the integration test

* Remove the explicit use of CollatorSelection in the migration

* Fix typo

* Populate the invulnerables w/o using CollatorSelection pallet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants