Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Process sudo (#177)
Browse files Browse the repository at this point in the history
* Process sudo

* Add testing key
  • Loading branch information
AurevoirXavier authored Jan 5, 2023
1 parent 459beca commit 702cdea
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion node/src/chain_spec/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub fn genesis_config() -> ChainSpec {
treasury: Default::default(),

// Utility stuff.
sudo: Default::default(),
sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) },
vesting: Default::default(),

// XCM stuff.
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub fn genesis_config() -> ChainSpec {
treasury: Default::default(),

// Utility stuff.
sudo: Default::default(),
sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) },
vesting: Default::default(),

// XCM stuff.
Expand Down
2 changes: 1 addition & 1 deletion node/src/chain_spec/pangolin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ pub fn genesis_config() -> ChainSpec {
treasury: Default::default(),

// Utility stuff.
sudo: Default::default(),
sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) },
vesting: Default::default(),

// XCM stuff.
Expand Down
1 change: 1 addition & 0 deletions tool/state-processor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mod evm;
mod indices;
mod proxy;
mod staking;
mod sudo;
mod system;
mod vesting;

Expand Down
1 change: 1 addition & 0 deletions tool/state-processor/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ where
.process_indices()
.process_vesting()
.process_proxy()
.process_sudo()
.process_staking()
.process_evm();

Expand Down
17 changes: 17 additions & 0 deletions tool/state-processor/src/sudo/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// darwinia
use crate::*;

impl<S> Processor<S> {
pub fn process_sudo(&mut self) -> &mut Self {
// Storage items.
// https://github.dev/darwinia-network/substrate/blob/darwinia-v0.12.5/frame/sudo/src/lib.rs#L268
//
// The new sudo key will be set on the genesis side.
// We just need to kill the old keys.
log::info!("drain solo and para `Sudo::Key`");
self.solo_state.take_value(b"Sudo", b"Key", "", &mut [0_u8; 32]);
self.para_state.take_value(b"Sudo", b"Key", "", &mut [0_u8; 32]);

self
}
}

0 comments on commit 702cdea

Please sign in to comment.