Skip to content
Merged
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
10 changes: 8 additions & 2 deletions crates/cli/src/cli/simnet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use serde::{Deserialize, Serialize};
use solana_keypair::Keypair;
use solana_signer::Signer;
use surfpool_core::{start_local_surfnet, surfnet::svm::SurfnetSvm};
use surfpool_types::{SanitizedConfig, SimnetEvent, SubgraphEvent};
use surfpool_types::{SanitizedConfig, SimnetCommand, SimnetEvent, SubgraphEvent};
use txtx_core::kit::{
channel::Receiver, futures::future::join_all, helpers::fs::FileLocation,
types::frontend::BlockEvent,
Expand Down Expand Up @@ -199,6 +199,7 @@ pub async fn handle_start_local_surfnet_command(
subgraph_events_rx,
cmd.debug,
deploy_progress_rx,
simnet_commands_tx,
)?;
} else {
tui::simnet::start_app(
Expand All @@ -222,6 +223,7 @@ fn log_events(
subgraph_events_rx: Receiver<SubgraphEvent>,
include_debug_logs: bool,
deploy_progress_rx: Vec<Receiver<BlockEvent>>,
simnet_commands_tx: Sender<SimnetCommand>,
) -> Result<(), String> {
let mut deployment_completed = false;
let stop_loop = Arc::new(AtomicBool::new(false));
Expand Down Expand Up @@ -324,10 +326,14 @@ fn log_events(
SimnetEvent::RunbookStarted(runbook_id) => {
deployment_completed = false;
info!("Runbook '{}' execution started", runbook_id);
let _ =
simnet_commands_tx.send(SimnetCommand::SetInstructionProfiling(false));
}
SimnetEvent::RunbookCompleted(runbook_id) => {
deployment_completed = true;
info!("Runbook '{}' execution completed", runbook_id);
let _ =
simnet_commands_tx.send(SimnetCommand::SetInstructionProfiling(true));
}
},
Err(_e) => {
Expand Down Expand Up @@ -372,6 +378,7 @@ fn log_events(
},
Err(_e) => {
deployment_completed = true;
let _ = simnet_commands_tx.send(SimnetCommand::SetInstructionProfiling(true));
}
},
}
Expand All @@ -389,7 +396,6 @@ async fn write_and_execute_iac(
.map_err(|e| format!("Failed to detect project framework: {}", e))?;

let (progress_tx, progress_rx) = crossbeam::channel::unbounded();

if let Some((framework, programs)) = deployment {
// Is infrastructure-as-code (IaC) already setup?
let base_location =
Expand Down
9 changes: 9 additions & 0 deletions crates/cli/src/tui/simnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,9 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut app: App) -> io::Result<(
Local::now(),
format!("Runbook '{}' execution started", runbook_id),
));
let _ = app
.simnet_commands_tx
.send(SimnetCommand::SetInstructionProfiling(false));
}
SimnetEvent::RunbookCompleted(runbook_id) => {
deployment_completed = true;
Expand All @@ -556,6 +559,9 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut app: App) -> io::Result<(
Local::now(),
format!("Runbook '{}' execution completed", runbook_id),
));
let _ = app
.simnet_commands_tx
.send(SimnetCommand::SetInstructionProfiling(true));
app.status_bar_message = None;
}
},
Expand Down Expand Up @@ -651,6 +657,9 @@ fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut app: App) -> io::Result<(
},
Err(_) => {
deployment_completed = true;
let _ = app
.simnet_commands_tx
.send(SimnetCommand::SetInstructionProfiling(true));
break;
}
},
Expand Down
5 changes: 5 additions & 0 deletions crates/core/src/runloops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ pub async fn start_block_production_runloop(
let _ = svm_locker.simnet_events_tx().send(SimnetEvent::Aborted("Terminated due to inactivity.".to_string()));
break;
}
SimnetCommand::SetInstructionProfiling(enabled) => {
svm_locker.with_svm_writer(|svm_writer| {
svm_writer.instruction_profiling_enabled = enabled;
});
}
}
},
}
Expand Down
1 change: 1 addition & 0 deletions crates/types/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ pub enum SimnetCommand {
bool,
),
Terminate(Option<(Hash, String)>),
SetInstructionProfiling(bool),
}

#[derive(Debug)]
Expand Down