Skip to content

Commit

Permalink
Merge branch 'main' into proxy-contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Jul 20, 2023
2 parents bce2a2c + c1ff60a commit 7888b50
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cumulus
21 changes: 20 additions & 1 deletion parachain/pallets/inbound-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pub mod pallet {
}

#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig {
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
Gateway::<T>::put(self.gateway);
}
Expand Down Expand Up @@ -267,5 +267,24 @@ pub mod pallet {
) -> DispatchResult {
<Self as OwnedBridgeModule<_>>::set_operating_mode(origin, operating_mode)
}

/// Change `PalletOwner`.
/// May only be called either by root, or by `PalletOwner`.
#[pallet::call_index(3)]
#[pallet::weight((T::DbWeight::get().reads_writes(1, 1), DispatchClass::Operational))]
pub fn set_owner(origin: OriginFor<T>, new_owner: Option<T::AccountId>) -> DispatchResult {
<Self as OwnedBridgeModule<_>>::set_owner(origin, new_owner)
}

/// Halt or resume all pallet operations.
/// May only be called either by root, or by `PalletOwner`.
#[pallet::call_index(4)]
#[pallet::weight((T::DbWeight::get().reads_writes(1, 1), DispatchClass::Operational))]
pub fn set_operating_mode(
origin: OriginFor<T>,
operating_mode: BasicOperatingMode,
) -> DispatchResult {
<Self as OwnedBridgeModule<_>>::set_operating_mode(origin, operating_mode)
}
}
}
6 changes: 4 additions & 2 deletions parachain/pallets/inbound-queue/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,12 @@ pub fn new_tester(gateway: H160) -> sp_io::TestExternalities {
new_tester_with_config(inbound_queue::GenesisConfig { gateway })
}

pub fn new_tester_with_config(config: inbound_queue::GenesisConfig) -> sp_io::TestExternalities {
pub fn new_tester_with_config<T: Config>(
config: inbound_queue::GenesisConfig<T>,
) -> sp_io::TestExternalities {
let mut storage = frame_system::GenesisConfig::default().build_storage::<Test>().unwrap();

GenesisBuild::<Test>::assimilate_storage(&config, &mut storage).unwrap();
GenesisBuild::<T>::assimilate_storage(&config, &mut storage).unwrap();

let mut ext: sp_io::TestExternalities = storage.into();
ext.execute_with(|| System::set_block_number(1));
Expand Down

0 comments on commit 7888b50

Please sign in to comment.