Skip to content

Commit 002320e

Browse files
authored
Merge branch 'master' into vaivaswatha/memcpy_prop_new
2 parents d1553e6 + e4cabdd commit 002320e

File tree

2 files changed

+189
-79
lines changed

2 files changed

+189
-79
lines changed

test/src/e2e_vm_tests/harness.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ use futures::Future;
1919
use rand::rngs::StdRng;
2020
use rand::{Rng, SeedableRng};
2121
use regex::{Captures, Regex};
22-
use std::{fs, io::Read, path::PathBuf, str::FromStr};
22+
use std::{fs, io::Read, path::PathBuf};
2323
use sway_core::{asm_generation::ProgramABI, BuildTarget, Observer};
2424

2525
pub const NODE_URL: &str = "http://127.0.0.1:4000";
26-
pub const SECRET_KEY: &str = "de97d8624a438121b86a1956544bd72ed68cd69f2c99555b08b1e8c51ffd511c";
2726

2827
pub(crate) async fn run_and_capture_output<F, Fut, T>(func: F) -> (T, String)
2928
where
@@ -61,10 +60,14 @@ where
6160
(result, output)
6261
}
6362

64-
pub(crate) async fn deploy_contract(file_name: &str, run_config: &RunConfig) -> Result<ContractId> {
65-
// build the contract
66-
// deploy it
63+
pub(crate) async fn deploy_contract(
64+
file_name: &str,
65+
run_config: &RunConfig,
66+
signing_key: &SecretKey,
67+
) -> Result<ContractId> {
6768
println!(" Deploying {} ...", file_name.bold());
69+
println!(" Signing key used: {}", signing_key.to_string().bold());
70+
6871
let manifest_dir = env!("CARGO_MANIFEST_DIR");
6972

7073
let deployed_packages = deploy(DeployCommand {
@@ -76,7 +79,7 @@ pub(crate) async fn deploy_contract(file_name: &str, run_config: &RunConfig) ->
7679
locked: run_config.locked,
7780
..Default::default()
7881
},
79-
signing_key: Some(SecretKey::from_str(SECRET_KEY).unwrap()),
82+
signing_key: Some(*signing_key),
8083
default_salt: true,
8184
build_profile: match run_config.release {
8285
true => BuildProfile::RELEASE.to_string(),
@@ -106,16 +109,16 @@ pub(crate) async fn runs_on_node(
106109
file_name: &str,
107110
run_config: &RunConfig,
108111
contract_ids: &[fuel_tx::ContractId],
112+
signing_key: &SecretKey,
109113
) -> (Result<Vec<fuel_tx::Receipt>>, String) {
110114
run_and_capture_output(|| async {
111115
println!(" Running on node {} ...", file_name.bold());
112116
let manifest_dir = env!("CARGO_MANIFEST_DIR");
113117

114-
let mut contracts = Vec::<String>::with_capacity(contract_ids.len());
115-
for contract_id in contract_ids {
116-
let contract = format!("0x{contract_id:x}");
117-
contracts.push(contract);
118-
}
118+
let contracts = contract_ids
119+
.iter()
120+
.map(|contract_id| format!("0x{contract_id:x}"))
121+
.collect::<Vec<_>>();
119122

120123
let command = RunCommand {
121124
pkg: forc_client::cmd::run::Pkg {
@@ -131,7 +134,7 @@ pub(crate) async fn runs_on_node(
131134
..Default::default()
132135
},
133136
contract: Some(contracts),
134-
signing_key: Some(SecretKey::from_str(SECRET_KEY).unwrap()),
137+
signing_key: Some(*signing_key),
135138
experimental: run_config.experimental.clone(),
136139
..Default::default()
137140
};

0 commit comments

Comments
 (0)