Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/lazy load deployment #2519

Closed
Closed
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
2 changes: 2 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion ledger/puzzle/epoch/src/synthesis/program/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function synthesize:
let program = Program::from_str(&program_string)?;

// Initialize a new process.
let process = Process::<N>::load()?;
let process = Process::<N>::for_puzzle()?;
// Initialize the stack with the synthesis challenge program.
let stack = Stack::new(&process, &program)?;

Expand Down
2 changes: 1 addition & 1 deletion synthesizer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ aleo-cli = [ ]
async = [ "ledger-query/async", "synthesizer-process/async" ]
cuda = [ "algorithms/cuda" ]
history = [ "serde" ]
rocks = [ "ledger-store/rocks" ]
rocks = ["ledger-store/rocks", "synthesizer-process/rocks"]
serial = [
"console/serial",
"ledger-block/serial",
Expand Down
8 changes: 7 additions & 1 deletion synthesizer/process/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ package = "snarkvm-ledger-store"
path = "../../ledger/store"
version = "=0.16.19"

[dependencies.lru]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same nit, all the non-Aleo dependencies are below

version = "0.12"

[dependencies.synthesizer-program]
package = "snarkvm-synthesizer-program"
path = "../../synthesizer/program"
Expand All @@ -93,9 +96,12 @@ package = "snarkvm-utilities"
path = "../../utilities"
version = "=0.16.19"

[dependencies.tracing]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hate to nit, but these are ordered alphabetically, should be moved after [dependencies.serde_json]

version = "0.1"

[dependencies.aleo-std]
version = "0.1.24"
default-features = false
features = ["storage"]

[dependencies.colored]
version = "2"
Expand Down
2 changes: 1 addition & 1 deletion synthesizer/process/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl<N: Network> Process<N> {
/// Adds the newly-deployed program.
/// This method assumes the given deployment **is valid**.
#[inline]
pub fn load_deployment(&mut self, deployment: &Deployment<N>) -> Result<()> {
pub fn load_deployment(&self, deployment: &Deployment<N>) -> Result<()> {
let timer = timer!("Process::load_deployment");

// Compute the program stack.
Expand Down
10 changes: 5 additions & 5 deletions synthesizer/process/src/finalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl<N: Network> Process<N> {
// Retrieve the fee stack.
let fee_stack = self.get_stack(fee.program_id())?;
// Finalize the fee transition.
finalize_operations.extend(finalize_fee_transition(state, store, fee_stack, fee)?);
finalize_operations.extend(finalize_fee_transition(state, store, &fee_stack, fee)?);
lap!(timer, "Finalize transition for '{}/{}'", fee.program_id(), fee.function_name());

/* Finalize the deployment. */
Expand Down Expand Up @@ -109,15 +109,15 @@ impl<N: Network> Process<N> {
// Finalize the root transition.
// Note that this will result in all the remaining transitions being finalized, since the number
// of calls matches the number of transitions.
let mut finalize_operations = finalize_transition(state, store, stack, transition, call_graph)?;
let mut finalize_operations = finalize_transition(state, store, &stack, transition, call_graph)?;

/* Finalize the fee. */

if let Some(fee) = fee {
// Retrieve the fee stack.
let fee_stack = self.get_stack(fee.program_id())?;
// Finalize the fee transition.
finalize_operations.extend(finalize_fee_transition(state, store, fee_stack, fee)?);
finalize_operations.extend(finalize_fee_transition(state, store, &fee_stack, fee)?);
lap!(timer, "Finalize transition for '{}/{}'", fee.program_id(), fee.function_name());
}

Expand All @@ -143,7 +143,7 @@ impl<N: Network> Process<N> {
// Retrieve the stack.
let stack = self.get_stack(fee.program_id())?;
// Finalize the fee transition.
let result = finalize_fee_transition(state, store, stack, fee);
let result = finalize_fee_transition(state, store, &stack, fee);
finish!(timer, "Finalize transition for '{}/{}'", fee.program_id(), fee.function_name());
// Return the result.
result
Expand Down Expand Up @@ -495,7 +495,7 @@ function compute:
.unwrap();

// Initialize a new process.
let mut process = Process::load().unwrap();
let process = Process::load().unwrap();
// Deploy the program.
let deployment = process.deploy::<CurrentAleo, _>(&program, rng).unwrap();

Expand Down
Loading