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

Use execute_function for nested calls in CallStack::PackageRun #2285

Merged
merged 1 commit into from
Jan 11, 2024
Merged
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: 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