Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 20 additions & 2 deletions rust/lit-node/lit-node-testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub struct TestSetupBuilder {
wait_for_root_keys: bool,
fund_wallet: bool,
fund_ledger_for_wallet: bool,
custom_binary_path: Option<String>,
start_staked_only_validators: bool,
}

impl Default for TestSetupBuilder {
Expand All @@ -57,6 +59,8 @@ impl Default for TestSetupBuilder {
wait_for_root_keys: true,
fund_wallet: true,
fund_ledger_for_wallet: true,
custom_binary_path: None,
start_staked_only_validators: true,
}
}
}
Expand All @@ -80,6 +84,11 @@ impl TestSetupBuilder {
self
}

pub fn start_staked_only_validators(mut self, start_staked_only_validators: bool) -> Self {
self.start_staked_only_validators = start_staked_only_validators;
self
}

pub fn force_deploy(mut self, force_deploy: bool) -> Self {
self.force_deploy = force_deploy;
self
Expand Down Expand Up @@ -140,6 +149,11 @@ impl TestSetupBuilder {
self
}

pub fn custom_binary_path(mut self, custom_binary_path: Option<String>) -> Self {
self.custom_binary_path = custom_binary_path;
self
}

pub async fn build(self) -> (Testnet, ValidatorCollection, EndUser) {
let node_keys_path = Path::new("./node_keys");
if node_keys_path.exists() {
Expand Down Expand Up @@ -190,8 +204,11 @@ impl TestSetupBuilder {
}
}

let num_staked_nodes =
self.num_staked_and_joined_validators + self.num_staked_only_validators;
let num_staked_nodes = if self.start_staked_only_validators {
self.num_staked_and_joined_validators + self.num_staked_only_validators
} else {
self.num_staked_and_joined_validators
};

let node_binary_feature_flags = if self.is_fault_test {
"lit-actions,testing,proxy_chatter".to_string()
Expand All @@ -204,6 +221,7 @@ impl TestSetupBuilder {
.wait_initial_epoch(self.wait_initial_epoch)
.wait_for_root_keys(self.wait_for_root_keys)
.node_binary_feature_flags(node_binary_feature_flags)
.custom_binary_path(self.custom_binary_path)
.build(&testnet)
.await
.expect("Failed to build validator collection");
Expand Down
2 changes: 1 addition & 1 deletion rust/lit-node/lit-node-testnet/src/node_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ pub async fn get_node_versions(node_set: &Vec<NodeSet>) -> Vec<String> {
// Parse response headers
headers
.iter()
.map(|header| header.get("X-Lit-Node-Version").unwrap().clone())
.map(|header| header.get("x-lit-node-version").unwrap().clone())
.collect::<Vec<String>>()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ pub fn generate_wallet_and_add_as_alias() {
"scripts/generate_wallet_and_add_as_alias.ts",
];
info!(
"Running full command in {}: npx {}",
"Running full generate_wallet_and_add_as_alias command in {}: npx {}",
LITCONTRACTPATH,
args.join(" ")
);
Expand Down
9 changes: 9 additions & 0 deletions rust/lit-node/lit-node-testnet/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,15 @@ impl ValidatorCollection {
})
.collect()
}
pub async fn active_node_set(&self) -> Result<Vec<NodeSet>> {
Ok(self.get_active_validators().await?
.iter()
.map(|v| NodeSet {
socket_address: v.public_address(),
value: 1,
})
.collect::<Vec<_>>())
}
}

impl Drop for ValidatorCollection {
Expand Down
2 changes: 1 addition & 1 deletion rust/lit-node/lit-node/src/git_info.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub const GIT_COMMIT_HASH: &str = "5caf4cb4b70f0ec3b5094e71785ce78421027805";
pub const GIT_COMMIT_HASH: &str = "b4bed941c968c152ef3ec7fde8e9754646673f5f";
2 changes: 1 addition & 1 deletion rust/lit-node/lit-node/tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub mod integration;
// sdk tests - downloads the latest SDK & test it against the nodes in full compilation in a local network configuration
pub mod sdk;
// upgrade tests - test the upgrade process
//pub mod upgrades;
pub mod upgrades;
// fault tests - test the fault tolerance of the network
pub mod toxiproxy;

Expand Down
Loading
Loading