Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
kostekIV committed Nov 16, 2022
commit d8752f4f1bffcd5b0c766514309679ca3f6093f7
1 change: 1 addition & 0 deletions e2e-tests/Cargo.lock

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

1 change: 1 addition & 0 deletions e2e-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ serde_json = "1.0"
codec = { package = 'parity-scale-codec', version = "3.0", default-features = false, features = ['derive'] }
rayon = "1.5"
tokio = { version = "1.21.2", features = ["full"] }
futures = "0.3.25"

sp-core = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", default-features = false, features = ["full_crypto"] }
sp-runtime = { git = "https://github.com/Cardinal-Cryptography/substrate.git", branch = "aleph-v0.9.28", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/src/ban.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,14 @@ pub async fn check_underperformed_count_for_sessions(
let session_underperformed_count = connection
.get_underperformed_validator_session_count(val.clone(), session_end_block_hash)
.await
.unwrap();
.unwrap_or_default();
let previous_session_underperformed_count = connection
.get_underperformed_validator_session_count(
val.clone(),
previous_session_end_block_hash,
)
.await
.unwrap();
.unwrap_or_default();

let underperformed_diff =
session_underperformed_count.abs_diff(previous_session_underperformed_count);
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/src/test/version_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub async fn schedule_doomed_version_change_and_verify_finalization_stopped(
.await?;
connection
.connection
.wait_for_session(session_after_upgrade + 1, BlockStatus::Finalized)
.wait_for_session(session_after_upgrade + 1, BlockStatus::Best)
.await;

let last_finalized_block =
Expand Down
27 changes: 18 additions & 9 deletions e2e-tests/src/validators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use aleph_client::{
rpc::Rpc,
AccountId, KeyPair, RawKeyPair, SignedConnection, TxStatus,
};
use futures::future::join_all;
use primitives::{staking::MIN_VALIDATOR_BOND, TOKEN};

use crate::{accounts::get_validators_raw_keys, Config};
Expand Down Expand Up @@ -115,26 +116,34 @@ pub async fn prepare_validators(connection: &SignedConnection, node: &str, accou
.await
.unwrap();

let mut handles = vec![];
for (stash, controller) in accounts
.stash_raw_keys
.iter()
.zip(accounts.get_controller_accounts().iter())
{
let connection = SignedConnection::new(node.to_string(), KeyPair::new(stash.clone())).await;
connection
.bond(MIN_VALIDATOR_BOND, controller.clone(), TxStatus::Finalized)
.await
.unwrap();
let contr = controller.clone();
handles.push(tokio::spawn(async move {
connection
.bond(MIN_VALIDATOR_BOND, contr, TxStatus::Finalized)
.await
.unwrap();
}));
}

for controller in accounts.controller_raw_keys.iter() {
let keys = connection.author_rotate_keys().await;
let connection =
SignedConnection::new(node.to_string(), KeyPair::new(controller.clone())).await;
connection
.set_keys(keys, TxStatus::Finalized)
.await
.unwrap();
connection.validate(10, TxStatus::Finalized).await.unwrap();
handles.push(tokio::spawn(async move {
connection
.set_keys(keys, TxStatus::Finalized)
.await
.unwrap();
connection.validate(10, TxStatus::Finalized).await.unwrap();
}));
}

join_all(handles).await;
}