Skip to content

Commit

Permalink
Merge pull request #28217 from ProvableHQ/fix/execute-program-name
Browse files Browse the repository at this point in the history
[Fix] Allow program names with or without the .aleo suffix in `leo execute`.
  • Loading branch information
d0cd committed Jul 12, 2024
2 parents ecd1c7f + d5fca61 commit 61680fb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion leo/cli/commands/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,13 @@ fn handle_execute<A: Aleo>(
// Initialize the VM.
let vm = VM::from(store)?;

// Remove the `.aleo` extension from the program name, if it exists.
let program_name = match program_name.strip_suffix(".aleo") {
Some(name) => name.to_string(),
None => program_name,
};
// Load the main program, and all of its imports.
let program_id = &ProgramID::<A::Network>::from_str(&format!("{}.aleo", program_name))?;
let program_id = &ProgramID::<A::Network>::from_str(&format!("{program_name}.aleo"))?;
load_program_from_network(context.clone(), &mut vm.process().write(), program_id, network, endpoint)?;

let fee_record = if let Some(record) = command.fee_options.record {
Expand Down

0 comments on commit 61680fb

Please sign in to comment.