Fix Lagrange bases caching on the web #313
Merged
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.
companion of o1-labs/o1js#1906
this fixes a case where
compile()
got stuck on the web version and kept spinning without error.diagnosis:
lagrangeCommitment()
insrs.ts
getLagrangeBasis()
to get the entire lagrange basis and store it in the cachecaml_fq_srs_get_lagrange_basis
whichgetLagrangeBasis()
aliases to. this additional layer (seeweb-backend.js
>overrideBindings()
) was not able to handle the Uint32Array return value ofcaml_fq_srs_get_lagrange_basis()
. instead, that return value was interpreted in a way that caused the method to never return (even though the lagrange basis had been successfully created!)the minimal fix is twofold:
The fix circumvents the problem in the most typical case, where we don't have a writable cache in the browser. In the case where we do have a writable cache, the error message and comments added here will make it very obvious what the problem is.
The full solution (which I don't have time for) is outlined in code comments