Skip to content

Commit

Permalink
set_main_chain_scripts extrinsic (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmbientTea authored Sep 20, 2024
1 parent 9b2fae0 commit 3ce6a8c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ This changelog is based on [Keep A Changelog](https://keepachangelog.com/en/1.1.
`pallet-native-token-management` crates; data sources behind the `native-token` feature in
`main-chain-follower-api` and `db-sync-follower` crates.
* added helper functions to `SidechainParams` and all `MainChainScripts` types to read them from environment
* Extrinsic `set_main_chain_scripts` for migrating to new committee selection main chain scripts

# v1.0.0rc1

Expand Down
1 change: 1 addition & 0 deletions pallets/session-validator-management/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sp-runtime = { workspace = true }
sp-core = { workspace = true }
sp-session-validator-management = { workspace = true }
sp-io = { workspace = true, optional = true }
sidechain-domain = { workspace = true }

[dev-dependencies]
sp-io = { workspace = true }
Expand Down
22 changes: 22 additions & 0 deletions pallets/session-validator-management/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub mod pallet {
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use log::{info, warn};
use sidechain_domain::{MainchainAddress, PolicyId};
use sp_runtime::traits::{One, Zero};
use sp_session_validator_management::*;
use sp_std::fmt::Display;
Expand Down Expand Up @@ -252,6 +253,27 @@ pub mod pallet {
});
Ok(())
}

/// Changes the main chain scripts used for committee rotation.
///
/// This extrinsic must be run either using `sudo` or some other chain governance mechanism.
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::set(1))]
pub fn set_main_chain_scripts(
origin: OriginFor<T>,
committee_candidate_address: MainchainAddress,
d_parameter_policy_id: PolicyId,
permissioned_candidates_policy_id: PolicyId,
) -> DispatchResult {
ensure_root(origin)?;
let new_scripts = MainChainScripts {
committee_candidate_address,
d_parameter_policy_id,
permissioned_candidates_policy_id,
};
MainChainScriptsConfiguration::<T>::put(new_scripts);
Ok(())
}
}

impl<T: Config> Pallet<T> {
Expand Down

0 comments on commit 3ce6a8c

Please sign in to comment.