Skip to content

Commit

Permalink
testing/staking: Remove controller account from bond
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv committed Jul 5, 2023
1 parent 8bd8fdb commit 0767c3c
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions testing/integration-tests/src/full_client/frame/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ fn default_validator_prefs() -> ValidatorPrefs {
}

#[tokio::test]
async fn validate_with_controller_account() {
async fn validate_with_stash_account() {
let ctx = test_context().await;
let api = ctx.client();

let alice = dev::alice();
let alice_stash = get_from_seed("Alice//stash");

let tx = node_runtime::tx()
.staking()
.validate(default_validator_prefs());

api.tx()
.sign_and_submit_then_watch_default(&tx, &alice)
.sign_and_submit_then_watch_default(&tx, &alice_stash)
.await
.unwrap()
.wait_for_finalized_success()
Expand All @@ -55,19 +55,19 @@ async fn validate_with_controller_account() {
}

#[tokio::test]
async fn validate_not_possible_for_stash_account() -> Result<(), Error> {
async fn validate_not_possible_for_controller_account() -> Result<(), Error> {
let ctx = test_context().await;
let api = ctx.client();

let alice_stash = get_from_seed("Alice//stash");
let alice = dev::alice();

let tx = node_runtime::tx()
.staking()
.validate(default_validator_prefs());

let announce_validator = api
.tx()
.sign_and_submit_then_watch_default(&tx, &alice_stash)
.sign_and_submit_then_watch_default(&tx, &alice)
.await?
.wait_for_finalized_success()
.await;
Expand All @@ -80,19 +80,19 @@ async fn validate_not_possible_for_stash_account() -> Result<(), Error> {
}

#[tokio::test]
async fn nominate_with_controller_account() {
async fn nominate_with_stash_account() {
let ctx = test_context().await;
let api = ctx.client();

let alice = dev::alice();
let alice_stash = get_from_seed("Alice//stash");
let bob = dev::bob();

let tx = node_runtime::tx()
.staking()
.nominate(vec![bob.public_key().to_address()]);

api.tx()
.sign_and_submit_then_watch_default(&tx, &alice)
.sign_and_submit_then_watch_default(&tx, &alice_stash)
.await
.unwrap()
.wait_for_finalized_success()
Expand All @@ -101,11 +101,11 @@ async fn nominate_with_controller_account() {
}

#[tokio::test]
async fn nominate_not_possible_for_stash_account() -> Result<(), Error> {
async fn nominate_not_possible_for_controller_account() -> Result<(), Error> {
let ctx = test_context().await;
let api = ctx.client();

let alice_stash = get_from_seed("Alice//stash");
let alice = dev::alice();
let bob = dev::bob();

let tx = node_runtime::tx()
Expand All @@ -114,7 +114,7 @@ async fn nominate_not_possible_for_stash_account() -> Result<(), Error> {

let nomination = api
.tx()
.sign_and_submit_then_watch_default(&tx, &alice_stash)
.sign_and_submit_then_watch_default(&tx, &alice)
.await
.unwrap()
.wait_for_finalized_success()
Expand All @@ -129,7 +129,7 @@ async fn nominate_not_possible_for_stash_account() -> Result<(), Error> {
}

#[tokio::test]
async fn chill_works_for_controller_only() -> Result<(), Error> {
async fn chill_works_for_stash_only() -> Result<(), Error> {
let ctx = test_context().await;
let api = ctx.client();

Expand All @@ -142,14 +142,14 @@ async fn chill_works_for_controller_only() -> Result<(), Error> {
.staking()
.nominate(vec![bob_stash.public_key().to_address()]);
api.tx()
.sign_and_submit_then_watch_default(&nominate_tx, &alice)
.sign_and_submit_then_watch_default(&nominate_tx, &alice_stash)
.await?
.wait_for_finalized_success()
.await?;

let ledger_addr = node_runtime::storage()
.staking()
.ledger(alice.public_key().to_account_id());
.ledger(alice_stash.public_key().to_account_id());
let ledger = api
.storage()
.at_latest()
Expand All @@ -163,7 +163,7 @@ async fn chill_works_for_controller_only() -> Result<(), Error> {

let chill = api
.tx()
.sign_and_submit_then_watch_default(&chill_tx, &alice_stash)
.sign_and_submit_then_watch_default(&chill_tx, &alice)
.await?
.wait_for_finalized_success()
.await;
Expand All @@ -176,7 +176,7 @@ async fn chill_works_for_controller_only() -> Result<(), Error> {

let is_chilled = api
.tx()
.sign_and_submit_then_watch_default(&chill_tx, &alice)
.sign_and_submit_then_watch_default(&chill_tx, &alice_stash)
.await?
.wait_for_finalized_success()
.await?
Expand Down

0 comments on commit 0767c3c

Please sign in to comment.