Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
Add cached VM program check
Browse files Browse the repository at this point in the history
  • Loading branch information
iamalwaysuncomfortable committed Nov 8, 2023
1 parent 4d9b616 commit 7482d2b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aleo"
version = "0.6.1"
version = "0.6.2"
authors = [ "The Aleo Team <[email protected]>" ]
description = "Aleo"
homepage = "https://aleo.org"
Expand All @@ -21,7 +21,7 @@ edition = "2021"
members = [ "rust", "rust/develop"]

[workspace.dependencies.aleo-rust]
version = "0.6.1"
version = "0.6.2"
path = "rust"
default-features = false

Expand Down
2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aleo-rust"
version = "0.6.1"
version = "0.6.2"
authors = [ "The Aleo Team <[email protected]>" ]
description = "Rust SDK for managing Aleo programs and communicating with the Aleo network"
homepage = "https://aleo.org"
Expand Down
13 changes: 13 additions & 0 deletions rust/src/program/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,19 @@ impl<N: Network> ProgramManager<N> {

// Initialize the VM
if let Some(vm) = vm {
let credits_id = ProgramID::<N>::from_str("credits.aleo")?;
api_client.get_program_imports_from_source(program)?.iter().try_for_each(|(_, import)| {
if import.id() != &credits_id && !vm.process().read().contains_program(import.id()) {
vm.process().write().add_program(import)?
}
Ok::<_, Error>(())
})?;

// If the initialization is for an execution, add the program. Otherwise, don't add it as
// it will be added during the deployment process
if !vm.process().read().contains_program(program.id()) {
vm.process().write().add_program(program)?;
}
vm.execute(private_key, (program_id, function_name), inputs, fee_record, priority_fee, Some(query), rng)
} else {
let vm = Self::initialize_vm(api_client, program, true)?;
Expand Down

0 comments on commit 7482d2b

Please sign in to comment.