-
Notifications
You must be signed in to change notification settings - Fork 109
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: bundle and auto-load trusted setup #422
feat: bundle and auto-load trusted setup #422
Conversation
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.
This seems reasonable to me. I like that users can still specify a trusted setup.
@matthewkeil what does "enabling exceptions" do exactly and what are the implications? |
@jtraglia a JavaScript These two layers of indirection allow for the data to be tracked/moved/managed/deleted etc by the runtime. When a The sticky wicket comes in that if exceptions are turned on, requesting a Generally this does not happen because there are several checks that occur in the workflow under the hood. However the one that is most critical is if memory is not allocated correctly for the value (little v) the system will think it is a valid There are other considerations as well with regards to errors in JS propagating back into native code, however our codebase does not enter this territory so I will not elaborate. Turning on exceptions is the preferred way of handling this and is something the docs advocate for. This was something that slipped by me when we worked on this before and I only caught it recently. If we do not want to turn on exceptions there will need to be code added to check and unwrap the It will not affect the c-kzg code, its strictly to protect from Here is the doc about exception handling: And the subsection about code compliance with exceptions turned off: |
@matthewkeil thanks for the explanation. I think this is a bit over my head. Could you split the exception changes into a separate PR and ask a teammate (or just someone that would know) to review it? |
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. Thanks for making those changes!
Motivation
Allows for easier initialization of library for Ethereum use cases. Also bundles the trusted setup so that it does not need to be manually downloaded by consumers and stored separately. Will simplify the
lodestar
use case. Defaults to using the file passed by the user first. If none is passed use the one found in the dist bundle (checks here for the prod case first). If one is not found in the prod location fall back to the src location (for development purposes). Still throws error if none is sourced (invalid bundle/build).Description of Changes
trusted_setup.txt
with the c-kzg deps for node.js bindingskzg.js
to functions to allow for passing a trusted setup or for loading the default setup from either the bundle or the repo srcgetTrustedSetupFilepath
for testing purposes but do not announce via types file.getTrustedSetupFilepath
to ensure proper loading.