Skip to content

Commit

Permalink
Merge and resolve conflicts with dev
Browse files Browse the repository at this point in the history
  • Loading branch information
AdaJane committed Mar 15, 2023
2 parents 1464659 + 2d95af1 commit 1e2fc93
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions runtime/src/tests/task_scheduling.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::mock::runtime::{Balances, Runtime, RuntimeOrigin, Staking, TaskScheduler};
use crate::KeyTypeId;
use frame_support::{
assert_ok,
traits::{tokens::currency::Currency, GenesisBuild},
Expand Down Expand Up @@ -38,6 +39,29 @@ fn generate_bonded_stash(
(stash_pubkey, controller_pubkey)
}

#[test]
#[tracing_test::traced_test]
fn scheduler_doesnt_run_if_pubkey_cant_sign() {
// for example see
// https://github.com/gluwa/creditcoin-authority-manager/blob/43c61aa177146e4ecfde944678db851b941d4ae6/src/main.rs#L245-L265
let builder = ExtBuilder::default().with_keystore();

let _pubkey = builder
.keystore
.as_ref()
.expect("A keystore")
// keys where KeyID is not "gots" can't be used for OTS tasks
.sr25519_generate_new(KeyTypeId(*b"ctcs"), Some("//CanNotSign"))
.unwrap();

builder.build_sans_config().execute_with(|| {
WithWorkerHook::<TaskScheduler, Runtime>::roll_to(1);

assert!(logs_contain("local keys []"));
assert!(logs_contain("Not an authority, skipping offchain work"));
});
}

#[test]
#[tracing_test::traced_test]
/// Needs improvement, add a pubkey to the keystore but dont bond it. Bond an account but dont add it to the keystore.
Expand Down

0 comments on commit 1e2fc93

Please sign in to comment.