Skip to content

Commit

Permalink
handle network dependencies correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebenfield committed Dec 7, 2024
1 parent 28b9324 commit d45cd77
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions leo/cli/commands/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.

use std::path::PathBuf;
use std::{fs, path::PathBuf};

use snarkvm::prelude::{Network, ProgramID, TestnetV0};

Expand Down Expand Up @@ -114,7 +114,21 @@ fn handle_debug<N: Network>(command: &LeoDebug, context: Context) -> Result<()>
})
.collect();

leo_interpreter::interpret(&paths, &[], address, command.block_height)
let imports_directory = package_path.join("build/imports");

let aleo_paths: Vec<PathBuf> = if let Ok(dir) = fs::read_dir(imports_directory) {
dir.flat_map(|maybe_filename| maybe_filename.ok())
.filter(|entry| entry.file_type().ok().map(|filetype| filetype.is_file()).unwrap_or(false))
.flat_map(|entry| {
let path = entry.path();
if path.extension().map(|e| e == "aleo").unwrap_or(false) { Some(path) } else { None }
})
.collect()
} else {
Vec::new()
};

leo_interpreter::interpret(&paths, &aleo_paths, address, command.block_height)
} else {
let private_key: PrivateKey<TestnetV0> = PrivateKey::from_str(leo_package::VALIDATOR_0_PRIVATE_KEY)?;
let address = Address::try_from(&private_key)?;
Expand Down

0 comments on commit d45cd77

Please sign in to comment.