-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Feature] Async parameter preloading #1987
Open
iamalwaysuncomfortable
wants to merge
19
commits into
testnet3
Choose a base branch
from
feat/async-parameter-preloading
base: testnet3
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iamalwaysuncomfortable
force-pushed
the
feat/async-parameter-preloading
branch
from
September 25, 2023 20:55
5efad99
to
78965e5
Compare
iamalwaysuncomfortable
force-pushed
the
feat/async-parameter-preloading
branch
from
September 26, 2023 12:18
7375e2c
to
d7dbbd5
Compare
vicsn
reviewed
Sep 26, 2023
iamalwaysuncomfortable
force-pushed
the
feat/async-parameter-preloading
branch
from
October 18, 2023 07:59
d7dbbd5
to
abc4a89
Compare
… to ensure bytes aren't included within wasm builds
Signed-off-by: Howard Wu <9260812+howardwu@users.noreply.github.com>
Signed-off-by: Howard Wu <9260812+howardwu@users.noreply.github.com>
iamalwaysuncomfortable
force-pushed
the
feat/async-parameter-preloading
branch
from
October 24, 2023 20:03
2f14414
to
cf78d63
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Currently parameter downloads in SnarkVM in a
wasm
environment use a synchronous version ofXmlHttpRequest
to download parameters. However this has been considered deprecated behavior for browsers for a long time and enforce suboptimal restrictions on them. Further, upcoming changes toChrome Manifest v3
are not allowingXmlHttpRequest
to be used in chrome extensions whatsoever and are enforcing the move to fetch.Chrome manifest V3 changes are explained here
This has the following consequences for parameter & key downloads during program execution:
wasm
for the download) and degrading end user experience in both performance & time waiting for network i/o.To support modern web standards & enable future chrome apps to be built on Aleo, this PR introduces an option to download necessary powers asynchronously prior to program execution. The asynchronous downloads use the
reqwest
library which uses fetch under the hood inwasm
environments (therefore eliminating reliance onXmlHttpRequest
) and enables bytes to be downloaded directly without needing a conversion to text encoding beforehand.This enables both Chrome extensions & NodeJS to perform a normal synchronous execution flow without having to reach out to the web for parameters during execution. Acceptance of the asynchronous download path in this PR would reduce
wasm
memory needed by 3x, enable support for modern chrome extensions, de-risk possible future deprecation of synchronous XmlHttpRequests in web browsers. Further, the option to usefetch
(instead of XmlHttpRequest) for parameter downloads enables Aleo program key synthesis & Deployment within NodeJS.Test Plan
Tests to test changes made in order to support this have have been added as well as a test demonstrating program execution in wasm after parameter pre-downloads
Related PRs
https://github.com/AleoHQ/snarkVM/pull/1955 proposes a single committer key. In #1955 - ProvingKeys don't contain CommiterKeys (this is delegated to a
UniversalProver
). ProvingKeys will continue to contain Degree Information required to download parameters for the Universal Prover and thepreload_powers
method in this PR would be provide a Browser/Wasm friendly path for downloading these parameters.