-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Refactor CallStack::Synthesize to produce consistent dummy outputs for faster nested import deployments #2598
base: staging
Are you sure you want to change the base?
Conversation
NOTE: this PR will also significantly speed up tests using nested deployments, e.g. |
note: the failing |
@d0cd This may be relevant to some of your |
impl<N: Network> StackKeys<N> for Stack<N> { | ||
/// Returns `true` if the proving key for the given function name exists. | ||
#[inline] | ||
fn contains_proving_key(&self, function_name: &Identifier<N>) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that these functions are defined in impl<N: Network> StackKeys<N> for Stack<N>
, can they be removed in impl<N: Network> Stack<N>
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, addressed here: 46c8498
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, CI flakiness is unrelated
Summary
This PR refactors the way
CallStack::Synthesize
is run, decoupling theSynthesize
mode from the oldexecute_function
approach. It produces consistent dummy outputs (inspired byCheckDeployment
) more rapidly and skips sub-circuit construction for nested import calls. The result is significantly faster deployments for deeply nested imports, while still generating cryptographically coherent record nonces.Motivation
Previously,
Authorize
andSynthesize
modes were lumped together. As such, calls in CallStack::Synthesize were forced to run a real sub-circuit viaexecute_function
. This is slow for nested imports and has led to an exponential growth in deployment time w.r.t. the import depth.Thus, this PR refactors the
Synthesize
branch to skip full circuit execution and produce “dummy” outputs with consistent record nonces.Note
This PR changes expected future IDs in 3 of the
execute_and_finalize
tests. The reason is that previously, Synthesize always ran real sub-circuits, consuming RNG draws. With this PR, certain sub-circuits are skipped by producing dummy outputs. As a result, the RNG is executed less times, leading to different transaction commitments and future IDs.Test Plan
Tested the deployment and execution of programs with deep imports in a local devnet.
Related PRs