Skip to content

Commit

Permalink
Merge pull request #2285 from AleoHQ/fix_nested_packagerun
Browse files Browse the repository at this point in the history
Use execute_function for nested calls in CallStack::PackageRun
  • Loading branch information
howardwu authored Jan 11, 2024
2 parents 6b2a814 + f6e262f commit 2eb75c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion synthesizer/process/src/stack/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<N: Network> CallTrait<N> for Call<N> {
call_stack.push(request.clone())?;

// Evaluate the request.
let response = substack.evaluate_function::<A>(call_stack, console_caller)?;
let response = substack.execute_function::<A, _>(call_stack, console_caller, rng)?;

// Return the request and response.
(request, response)
Expand Down
8 changes: 1 addition & 7 deletions synthesizer/process/src/stack/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ impl<N: Network> StackEvaluate<N> for Stack<N> {
// Retrieve the next request, based on the call stack mode.
let (request, call_stack) = match &call_stack {
CallStack::Evaluate(authorization) => (authorization.next()?, call_stack),
CallStack::PackageRun(requests, _, _) => {
let last_request = requests.last().ok_or(anyhow!("CallStack does not contain request"))?.clone();
(last_request, call_stack)
}
// If the evaluation is performed in the `Execute` mode, create a new `Evaluate` mode.
// This is done to ensure that evaluation during execution is performed consistently.
CallStack::Execute(authorization, _) => {
Expand All @@ -120,9 +116,7 @@ impl<N: Network> StackEvaluate<N> for Stack<N> {
let call_stack = CallStack::Evaluate(authorization);
(request, call_stack)
}
_ => bail!(
"Illegal operation: call stack must be `PackageRun`, `Evaluate` or `Execute` in `evaluate_function`."
),
_ => bail!("Illegal operation: call stack must be `Evaluate` or `Execute` in `evaluate_function`."),
};
lap!(timer, "Retrieve the next request");

Expand Down

0 comments on commit 2eb75c6

Please sign in to comment.