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

[develop] Bindings - add runtime table cfg to prover index creation #79

Conversation

dannywillems
Copy link
Member

@dannywillems dannywillems commented Jul 10, 2023

See MinaProtocol/mina#13549 for more explanation.
Related to o1-labs/o1js#1020.

Built on top of #78
Also did:

git merge origin/fix-snarkyjs-berkeley
git checkout HEAD compiled MINA_COMMIT
npm run bindings

The result of npm run bindings has been commited in the latest commit.

@dannywillems dannywillems requested a review from a team as a code owner July 10, 2023 18:41
@dannywillems dannywillems force-pushed the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch from 33be4ed to 7c170df Compare July 11, 2023 08:13
@dannywillems dannywillems force-pushed the dannywillems/converters-runtime-table-cfg-js branch from 8ca90f8 to f6bbee5 Compare July 11, 2023 15:19
@dannywillems dannywillems force-pushed the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch 2 times, most recently from 29df59b to 586c3bb Compare July 11, 2023 16:19
@dannywillems dannywillems force-pushed the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch from 586c3bb to aaa0d26 Compare July 13, 2023 12:46
@dannywillems dannywillems changed the base branch from dannywillems/converters-runtime-table-cfg-js to develop July 27, 2023 09:58
@dannywillems dannywillems changed the base branch from develop to dannywillems/converters-runtime-table-cfg-js July 27, 2023 09:59
@dannywillems dannywillems changed the base branch from dannywillems/converters-runtime-table-cfg-js to develop July 27, 2023 10:05
@dannywillems dannywillems force-pushed the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch from 3dfadad to e8e4d40 Compare July 27, 2023 14:49
@dannywillems dannywillems changed the title Add runtime table cfg to prover index creation [develop] Bindings - add runtime table cfg to prover index creation Jul 27, 2023
kimchi/js/bindings.js Outdated Show resolved Hide resolved
@dannywillems dannywillems force-pushed the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch from 4087d49 to 3b8142a Compare August 1, 2023 16:30
@dannywillems
Copy link
Member Author

dannywillems commented Aug 2, 2023

EDIT: it seems happening because of other changes, removed later in this branch. I kept track of it in dannywillems/add-runtime-table-cfg-to-prover-index-creation-backup.

With the latest changes, I have runtime errors with null pointers passed to rust. Trying to fix it. It seems to be related to the finalizer. Digging into it. As we do allocations for the runtime table cfgs, it might come from there.
I have opened multiple other PR which are merged in this branch as it is overlapping with the changes here and good to have here.

See snarkyjs CI.
For instance:

/workspace_root/src/lib/snarkyjs/src/bindings/ocaml/overrides.js:34
    if (err instanceof Error) throw err;
                              ^


Error: null pointer passed to rust
    at module.exports.__wbindgen_throw (/home/runner/work/snarkyjs/snarkyjs/dist/node/bindings/compiled/_node_bindings/plonk_wasm.cjs:8113:11)
    at wasm_bindgen::throw_str::habe968293e902f28 (wasm://wasm/010e0fd6:wasm-function[4697]:0x3bda89)
    at wasm_bindgen::__rt::throw_null::h1d564009f7b78f7c (wasm://wasm/010e0fd6:wasm-function[4698]:0x3bda96)
    at __wbg_wasmfpgatevector_free (wasm://wasm/010e0fd6:wasm-function[3798]:0x3ac3b7)
    at WasmFpGateVector.free (/home/runner/work/snarkyjs/snarkyjs/dist/node/bindings/compiled/_node_bindings/plonk_wasm.cjs:3497:14)
    at joo_global_object (/workspace_root/src/lib/snarkyjs/src/bindings/kimchi/js/bindings.js:588:5)
    at FinalizationRegistry.cleanupSome (<anonymous>)

or

 /workspace_root/src/lib/snarkyjs/src/bindings/ocaml/overrides.js:34
    if (err instanceof Error) throw err;
                              ^


Error: null pointer passed to rust
    at module.exports.__wbindgen_throw (/home/runner/work/snarkyjs/snarkyjs/dist/node/bindings/compiled/_node_bindings/plonk_wasm.cjs:8113:11)
    at wasm_bindgen::throw_str::habe968293e902f28 (wasm://wasm/010e0fd6:wasm-function[4697]:0x3bda89)
    at wasm_bindgen::__rt::throw_null::h1d564009f7b78f7c (wasm://wasm/010e0fd6:wasm-function[4698]:0x3bda96)
    at __wbg_wasmpallasgprojective_free (wasm://wasm/010e0fd6:wasm-function[4465]:0x3bc654)
    at WasmVestaGProjective.free (/home/runner/work/snarkyjs/snarkyjs/dist/node/bindings/compiled/_node_bindings/plonk_wasm.cjs:7795:14)
    at joo_global_object (/workspace_root/src/lib/snarkyjs/src/bindings/kimchi/js/bindings.js:588:5)
    at FinalizationRegistry.cleanupSome (<anonymous>)

Copy link
Member

@mrmr1993 mrmr1993 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to include unrelated changes (deleting tests etc.). Please revert

@dannywillems dannywillems force-pushed the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch from f43e72b to 8462906 Compare August 2, 2023 16:36
kimchi/js/bindings.js Outdated Show resolved Hide resolved
kimchi/wasm/src/plonk_proof.rs Outdated Show resolved Hide resolved
@dannywillems dannywillems force-pushed the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch from 8462906 to 9546526 Compare August 2, 2023 16:52
@dannywillems dannywillems force-pushed the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch from 9546526 to c5871c6 Compare August 2, 2023 17:22
@dannywillems dannywillems force-pushed the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch from c5871c6 to 410a97b Compare August 2, 2023 17:38
@dannywillems
Copy link
Member Author

This seems to include unrelated changes (deleting tests etc.). Please revert

Done

@dannywillems
Copy link
Member Author

#104 (and the counterpart #105) should be merged first to solve the conflict.

var caml_create_rust_empty_vector = function () {
// If this is correct, it should be equivalent than calling
// js_class_vector_to_rust_vector with an empty js array
return new joo_global_object.Uint32Array(0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this comment, IIUC, you want me to remove these two functions? It is equivalent to caml_array_to_rust_vector with the JS array [0] (i.e. the empty caml array).

It was the initial version but I thought introducing helpers would be nice. Removed here.

// ...] is
// represented as a JavaScript array [0, v1, v2, ...] where [0] is the runtime
// tag
return caml_array.length === 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -1219,6 +1235,46 @@ var caml_fq_plonk_gate_to_rust = function (gate) {
);
};

// Provides: caml_fp_lookup_table_to_rust
// Requires: plonk_wasm, caml_fp_vector_of_rust
var caml_fp_lookup_table_to_rust = function (caml_lookup_table, mk_class) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused, delete

Copy link
Member Author

@dannywillems dannywillems Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 96ba0ae. However, it was there because this PR is built on top of others, which introduce it. Will add it back later.


// Provides: caml_fq_lookup_table_to_rust
// Requires: plonk_wasm, caml_fq_vector_to_rust
var caml_fq_lookup_table_to_rust = function (caml_lookup_table, mk_class) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused, delete

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -2129,6 +2251,22 @@ var caml_pasta_fp_proof_of_rust = function (x) {
return [0, messages, proof, evals, ft_eval1, public_, prev_challenges];
};

// Provides: caml_fp_runtime_table_to_rust
// Requires: plonk_wasm, caml_fp_vector_to_rust
var caml_fp_runtime_table_to_rust = function (caml_runtime_table, mk_class) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused, delete

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for lookup tables, removed in 6070f67

@@ -2367,6 +2505,22 @@ var caml_pasta_fq_proof_of_rust = function (x) {
return [0, messages, proof, evals, ft_eval1, public_, prev_challenges];
};

// Provides: caml_fq_runtime_table_to_rust
// Requires: plonk_wasm, caml_fq_vector_to_rust
var caml_fq_runtime_table_to_rust = function (caml_runtime_table, mk_class) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused, delete

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -46,6 +46,22 @@ var caml_bigint_256_of_decimal_string = function (s) {
);
};

// Provides: caml_create_rust_empty_vector
var caml_create_rust_empty_vector = function () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is misleading.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be reintroduced later
Will be reintroduced later
It is equivalent to caml_array_to_rust_vector with an empty array
@dannywillems dannywillems merged commit b84776e into develop Aug 3, 2023
1 check passed
@dannywillems dannywillems deleted the dannywillems/add-runtime-table-cfg-to-prover-index-creation branch August 3, 2023 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants