Skip to content

Commit

Permalink
benches: fix the default validator key for signing txs
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Dec 6, 2023
1 parent ce7f498 commit 6df5ae6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 7 additions & 2 deletions apps/src/lib/wallet/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
pub use dev::{
addresses, albert_address, albert_keypair, bertha_address, bertha_keypair,
christel_address, christel_keypair, daewon_address, daewon_keypair,
ester_address, ester_keypair, keys, tokens, validator_address,
validator_keypair, validator_keys,
ester_address, ester_keypair, keys, tokens, validator_account_keypair,
validator_address, validator_keypair, validator_keys,
};

#[cfg(any(test, feature = "testing", feature = "benches"))]
Expand Down Expand Up @@ -176,6 +176,11 @@ mod dev {
VALIDATOR_WALLET.consensus_key.clone()
}

/// Get the validator account keypair from the wallet.
pub fn validator_account_keypair() -> common::SecretKey {
get_unencrypted_keypair("validator-0-account-key")
}

/// The name of a file that is unique to the project's root directory.
const PROJECT_ROOT_UNIQUE_FILE: &str = "rust-toolchain.toml";

Expand Down
12 changes: 6 additions & 6 deletions benches/vps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ fn vp_validator(c: &mut Criterion) {
},
None,
None,
vec![&defaults::validator_keypair()],
vec![&defaults::validator_account_keypair()],
);

let received_transfer = shell.generate_tx(
Expand Down Expand Up @@ -371,15 +371,15 @@ fn vp_validator(c: &mut Criterion) {
.finalize_reset()
.into(),
)),
public_keys: vec![defaults::validator_keypair().to_public()],
public_keys: vec![defaults::validator_account_keypair().to_public()],
threshold: None,
};
let vp = shell.generate_tx(
TX_UPDATE_ACCOUNT_WASM,
data,
None,
Some(vec![extra_section]),
vec![&defaults::validator_keypair()],
vec![&defaults::validator_account_keypair()],
);

let commission_rate = shell.generate_tx(
Expand All @@ -390,7 +390,7 @@ fn vp_validator(c: &mut Criterion) {
},
None,
None,
vec![&defaults::validator_keypair()],
vec![&defaults::validator_account_keypair()],
);

let vote = shell.generate_tx(
Expand All @@ -403,7 +403,7 @@ fn vp_validator(c: &mut Criterion) {
},
None,
None,
vec![&defaults::validator_keypair()],
vec![&defaults::validator_account_keypair()],
);

let pos = shell.generate_tx(
Expand All @@ -415,7 +415,7 @@ fn vp_validator(c: &mut Criterion) {
},
None,
None,
vec![&defaults::validator_keypair()],
vec![&defaults::validator_account_keypair()],
);

for (signed_tx, bench_name) in [
Expand Down

0 comments on commit 6df5ae6

Please sign in to comment.