-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from agoraxyz/I116-unapprove-validators
I116 unapprove validators
- Loading branch information
Showing
13 changed files
with
153 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use gn_client::{ | ||
tx::{self, Signer}, | ||
AccountId, Api, | ||
}; | ||
|
||
use std::str::FromStr; | ||
use std::sync::Arc; | ||
|
||
pub async fn sudo( | ||
api: Api, | ||
root: Arc<Signer>, | ||
pallet: &str, | ||
method: &str, | ||
maybe_operator: Option<&str>, | ||
) { | ||
let account_id = if let Some(operator) = maybe_operator { | ||
AccountId::from_str(operator).expect("invalid operator id string") | ||
} else { | ||
root.account_id().clone() | ||
}; | ||
|
||
let payload = match (pallet, method) { | ||
("oracle", "register") => tx::register_operator(&account_id), | ||
("oracle", "deregister") => tx::deregister_operator(&account_id), | ||
("validator", "add") => tx::add_validator(&account_id), | ||
("validator", "remove") => tx::remove_validator(&account_id), | ||
_ => unimplemented!(), | ||
}; | ||
|
||
tx::send_tx_in_block(api, &tx::sudo(payload), root) | ||
.await | ||
.unwrap(); | ||
println!("{pallet} {method} {account_id} submitted successfully"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use super::*; | ||
|
||
pub fn on_runtime_upgrade<T: Config>() { | ||
let validators = Validators::<T>::get(); | ||
log::info!("# validators: {}", validators.len()); | ||
log::info!( | ||
"# approved validators: {}", | ||
ApprovedValidators::<T>::get().len() | ||
); | ||
ApprovedValidators::<T>::set(validators); | ||
log::info!( | ||
"# approved validators post-migration: {}", | ||
ApprovedValidators::<T>::get().len() | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.