diff --git a/src/lib/crypto/kimchi_bindings/js/bindings/gate-vector.js b/src/lib/crypto/kimchi_bindings/js/bindings/gate-vector.js index 4a4d0d04c37c..e69de29bb2d1 100644 --- a/src/lib/crypto/kimchi_bindings/js/bindings/gate-vector.js +++ b/src/lib/crypto/kimchi_bindings/js/bindings/gate-vector.js @@ -1,122 +0,0 @@ -/* eslint-disable no-unused-vars */ -/* global plonk_wasm, caml_string_of_jsstring, - free_on_finalize, tsRustConversion, caml_bytes_of_uint8array -*/ - -// Provides: caml_pasta_fp_plonk_gate_vector_create -// Requires: plonk_wasm, free_on_finalize -var caml_pasta_fp_plonk_gate_vector_create = function () { - return free_on_finalize(plonk_wasm.caml_pasta_fp_plonk_gate_vector_create()); -}; - -// Provides: caml_pasta_fp_plonk_gate_vector_add -// Requires: plonk_wasm, tsRustConversion -var caml_pasta_fp_plonk_gate_vector_add = function (v, x) { - return plonk_wasm.caml_pasta_fp_plonk_gate_vector_add( - v, - tsRustConversion.fp.gateToRust(x) - ); -}; - -// Provides: caml_pasta_fp_plonk_gate_vector_get -// Requires: plonk_wasm, tsRustConversion -var caml_pasta_fp_plonk_gate_vector_get = function (v, i) { - return tsRustConversion.fp.gateFromRust( - plonk_wasm.caml_pasta_fp_plonk_gate_vector_get(v, i) - ); -}; - -// Provides: caml_pasta_fp_plonk_gate_vector_len -// Requires: plonk_wasm -var caml_pasta_fp_plonk_gate_vector_len = function (v) { - return plonk_wasm.caml_pasta_fp_plonk_gate_vector_len(v); -}; - -// Provides: caml_pasta_fp_plonk_gate_vector_wrap -// Requires: plonk_wasm, tsRustConversion -var caml_pasta_fp_plonk_gate_vector_wrap = function (v, x, y) { - return plonk_wasm.caml_pasta_fp_plonk_gate_vector_wrap( - v, - tsRustConversion.wireToRust(x), - tsRustConversion.wireToRust(y) - ); -}; - -// Provides: caml_pasta_fp_plonk_gate_vector_digest -// Requires: plonk_wasm, caml_bytes_of_uint8array -var caml_pasta_fp_plonk_gate_vector_digest = function ( - public_input_size, - gate_vector -) { - var uint8array = plonk_wasm.caml_pasta_fp_plonk_gate_vector_digest( - public_input_size, - gate_vector - ); - return caml_bytes_of_uint8array(uint8array); -}; - -// Provides: caml_pasta_fp_plonk_circuit_serialize -// Requires: plonk_wasm, caml_string_of_jsstring -var caml_pasta_fp_plonk_circuit_serialize = function ( - public_input_size, - gate_vector -) { - return caml_string_of_jsstring( - plonk_wasm.caml_pasta_fp_plonk_circuit_serialize( - public_input_size, - gate_vector - ) - ); -}; - -// Provides: caml_pasta_fq_plonk_gate_vector_create -// Requires: plonk_wasm, free_on_finalize -var caml_pasta_fq_plonk_gate_vector_create = function () { - return free_on_finalize(plonk_wasm.caml_pasta_fq_plonk_gate_vector_create()); -}; - -// Provides: caml_pasta_fq_plonk_gate_vector_add -// Requires: plonk_wasm, tsRustConversion -var caml_pasta_fq_plonk_gate_vector_add = function (v, x) { - return plonk_wasm.caml_pasta_fq_plonk_gate_vector_add( - v, - tsRustConversion.fq.gateToRust(x) - ); -}; - -// Provides: caml_pasta_fq_plonk_gate_vector_get -// Requires: plonk_wasm, tsRustConversion -var caml_pasta_fq_plonk_gate_vector_get = function (v, i) { - return tsRustConversion.fq.gateFromRust( - plonk_wasm.caml_pasta_fq_plonk_gate_vector_get(v, i) - ); -}; - -// Provides: caml_pasta_fq_plonk_gate_vector_len -// Requires: plonk_wasm -var caml_pasta_fq_plonk_gate_vector_len = function (v) { - return plonk_wasm.caml_pasta_fq_plonk_gate_vector_len(v); -}; - -// Provides: caml_pasta_fq_plonk_gate_vector_wrap -// Requires: plonk_wasm, tsRustConversion -var caml_pasta_fq_plonk_gate_vector_wrap = function (v, x, y) { - return plonk_wasm.caml_pasta_fq_plonk_gate_vector_wrap( - v, - tsRustConversion.wireToRust(x), - tsRustConversion.wireToRust(y) - ); -}; - -// Provides: caml_pasta_fq_plonk_gate_vector_digest -// Requires: plonk_wasm, caml_bytes_of_uint8array -var caml_pasta_fq_plonk_gate_vector_digest = function ( - public_input_size, - gate_vector -) { - var uint8array = plonk_wasm.caml_pasta_fq_plonk_gate_vector_digest( - public_input_size, - gate_vector - ); - return caml_bytes_of_uint8array(uint8array); -}; diff --git a/src/lib/crypto/kimchi_bindings/js/bindings/prover-index.js b/src/lib/crypto/kimchi_bindings/js/bindings/prover-index.js index e866af6c519e..e69de29bb2d1 100644 --- a/src/lib/crypto/kimchi_bindings/js/bindings/prover-index.js +++ b/src/lib/crypto/kimchi_bindings/js/bindings/prover-index.js @@ -1,230 +0,0 @@ -/* global plonk_wasm, tsRustConversion, caml_string_of_jsstring, - free_on_finalize, caml_jsstring_of_string - */ - -// Provides: caml_pasta_fq_plonk_circuit_serialize -// Requires: plonk_wasm, caml_string_of_jsstring -var caml_pasta_fq_plonk_circuit_serialize = function ( - public_input_size, - gate_vector -) { - return caml_string_of_jsstring( - plonk_wasm.caml_pasta_fq_plonk_circuit_serialize( - public_input_size, - gate_vector - ) - ); -}; - -// Provides: caml_pasta_fp_plonk_index_create -// Requires: plonk_wasm, free_on_finalize, tsRustConversion -var caml_pasta_fp_plonk_index_create = function ( - gates, - public_inputs, - caml_lookup_tables, - caml_runtime_table_cfgs, - prev_challenges, - urs, - lazy_mode -) { - var wasm_lookup_tables = - tsRustConversion.fp.lookupTablesToRust(caml_lookup_tables); - var wasm_runtime_table_cfgs = tsRustConversion.fp.runtimeTableCfgsToRust( - caml_runtime_table_cfgs - ); - - var t = plonk_wasm.caml_pasta_fp_plonk_index_create( - gates, - public_inputs, - wasm_lookup_tables, - wasm_runtime_table_cfgs, - prev_challenges, - urs, - lazy_mode - ); - return free_on_finalize(t); -}; - -// Provides: caml_pasta_fp_plonk_index_create_bytecode -// Requires: caml_pasta_fp_plonk_index_create -var caml_pasta_fp_plonk_index_create_bytecode = function ( - gates, - public_inputs, - caml_lookup_tables, - caml_runtime_table_cfgs, - prev_challenges, - urs, - lazy_mode -) { - return caml_pasta_fp_plonk_index_create( - gates, - public_inputs, - caml_lookup_tables, - caml_runtime_table_cfgs, - prev_challenges, - urs, - lazy_mode - ); -}; - -// Provides: caml_pasta_fp_plonk_index_max_degree -// Requires: plonk_wasm -var caml_pasta_fp_plonk_index_max_degree = - plonk_wasm.caml_pasta_fp_plonk_index_max_degree; - -// Provides: caml_pasta_fp_plonk_index_public_inputs -// Requires: plonk_wasm -var caml_pasta_fp_plonk_index_public_inputs = - plonk_wasm.caml_pasta_fp_plonk_index_public_inputs; - -// Provides: caml_pasta_fp_plonk_index_domain_d1_size -// Requires: plonk_wasm -var caml_pasta_fp_plonk_index_domain_d1_size = - plonk_wasm.caml_pasta_fp_plonk_index_domain_d1_size; - -// Provides: caml_pasta_fp_plonk_index_domain_d4_size -// Requires: plonk_wasm -var caml_pasta_fp_plonk_index_domain_d4_size = - plonk_wasm.caml_pasta_fp_plonk_index_domain_d4_size; - -// Provides: caml_pasta_fp_plonk_index_domain_d8_size -// Requires: plonk_wasm -var caml_pasta_fp_plonk_index_domain_d8_size = - plonk_wasm.caml_pasta_fp_plonk_index_domain_d8_size; - -// Provides: caml_pasta_fp_plonk_index_read -// Requires: plonk_wasm, caml_jsstring_of_string -var caml_pasta_fp_plonk_index_read = function (offset, urs, path) { - if (offset === 0) { - offset = undefined; - } else { - offset = offset[1]; - } - return plonk_wasm.caml_pasta_fp_plonk_index_read( - offset, - urs, - caml_jsstring_of_string(path) - ); -}; - -// Provides: caml_pasta_fp_plonk_index_write -// Requires: plonk_wasm, caml_jsstring_of_string -var caml_pasta_fp_plonk_index_write = function (append, t, path) { - if (append === 0) { - append = undefined; - } else { - append = append[1]; - } - return plonk_wasm.caml_pasta_fp_plonk_index_write( - append, - t, - caml_jsstring_of_string(path) - ); -}; - -// Provides: caml_pasta_fq_plonk_index_create -// Requires: plonk_wasm, free_on_finalize, tsRustConversion -var caml_pasta_fq_plonk_index_create = function ( - gates, - public_inputs, - caml_lookup_tables, - caml_runtime_table_cfgs, - prev_challenges, - urs, - lazy_mode -) { - var wasm_lookup_tables = - tsRustConversion.fq.lookupTablesToRust(caml_lookup_tables); - var wasm_runtime_table_cfgs = tsRustConversion.fq.runtimeTableCfgsToRust( - caml_runtime_table_cfgs - ); - - return free_on_finalize( - plonk_wasm.caml_pasta_fq_plonk_index_create( - gates, - public_inputs, - wasm_lookup_tables, - wasm_runtime_table_cfgs, - prev_challenges, - urs, - lazy_mode - ) - ); -}; - -// Provides: caml_pasta_fq_plonk_index_create_bytecode -// Requires: caml_pasta_fq_plonk_index_create -var caml_pasta_fq_plonk_index_create_bytecode = function ( - gates, - public_inputs, - caml_lookup_tables, - caml_runtime_table_cfgs, - prev_challenges, - urs, - lazy_mode -) { - return caml_pasta_fq_plonk_index_create( - gates, - public_inputs, - caml_lookup_tables, - caml_runtime_table_cfgs, - prev_challenges, - urs, - lazy_mode - ); -}; - -// Provides: caml_pasta_fq_plonk_index_max_degree -// Requires: plonk_wasm -var caml_pasta_fq_plonk_index_max_degree = - plonk_wasm.caml_pasta_fq_plonk_index_max_degree; - -// Provides: caml_pasta_fq_plonk_index_public_inputs -// Requires: plonk_wasm -var caml_pasta_fq_plonk_index_public_inputs = - plonk_wasm.caml_pasta_fq_plonk_index_public_inputs; - -// Provides: caml_pasta_fq_plonk_index_domain_d1_size -// Requires: plonk_wasm -var caml_pasta_fq_plonk_index_domain_d1_size = - plonk_wasm.caml_pasta_fq_plonk_index_domain_d1_size; - -// Provides: caml_pasta_fq_plonk_index_domain_d4_size -// Requires: plonk_wasm -var caml_pasta_fq_plonk_index_domain_d4_size = - plonk_wasm.caml_pasta_fq_plonk_index_domain_d4_size; - -// Provides: caml_pasta_fq_plonk_index_domain_d8_size -// Requires: plonk_wasm -var caml_pasta_fq_plonk_index_domain_d8_size = - plonk_wasm.caml_pasta_fq_plonk_index_domain_d8_size; - -// Provides: caml_pasta_fq_plonk_index_read -// Requires: plonk_wasm, caml_jsstring_of_string -var caml_pasta_fq_plonk_index_read = function (offset, urs, path) { - if (offset === 0) { - offset = undefined; - } else { - offset = offset[1]; - } - return plonk_wasm.caml_pasta_fq_plonk_index_read( - offset, - urs, - caml_jsstring_of_string(path) - ); -}; - -// Provides: caml_pasta_fq_plonk_index_write -// Requires: plonk_wasm, caml_jsstring_of_string -var caml_pasta_fq_plonk_index_write = function (append, t, path) { - if (append === 0) { - append = undefined; - } else { - append = append[1]; - } - return plonk_wasm.caml_pasta_fq_plonk_index_write( - append, - t, - caml_jsstring_of_string(path) - ); -}; diff --git a/src/lib/crypto/kimchi_bindings/js/bindings/srs.js b/src/lib/crypto/kimchi_bindings/js/bindings/srs.js index e7432f3b1c7b..e69de29bb2d1 100644 --- a/src/lib/crypto/kimchi_bindings/js/bindings/srs.js +++ b/src/lib/crypto/kimchi_bindings/js/bindings/srs.js @@ -1,201 +0,0 @@ -/* global plonk_wasm, caml_jsstring_of_string, - tsBindings, tsRustConversion -*/ - -// Provides: tsSrs -// Requires: tsBindings, plonk_wasm -var tsSrs = tsBindings.srs(plonk_wasm); - -// srs - -// Provides: caml_fp_srs_create -// Requires: tsSrs -var caml_fp_srs_create = tsSrs.fp.create; - -// Provides: caml_fp_srs_write -// Requires: plonk_wasm, caml_jsstring_of_string -var caml_fp_srs_write = function (append, t, path) { - if (append === 0) { - append = undefined; - } else { - append = append[1]; - } - return plonk_wasm.caml_fp_srs_write(append, t, caml_jsstring_of_string(path)); -}; - -// Provides: caml_fp_srs_read -// Requires: plonk_wasm, caml_jsstring_of_string -var caml_fp_srs_read = function (offset, path) { - if (offset === 0) { - offset = undefined; - } else { - offset = offset[1]; - } - var res = plonk_wasm.caml_fp_srs_read(offset, caml_jsstring_of_string(path)); - if (res) { - return [0, res]; // Some(res) - } else { - return 0; // None - } -}; - -// Provides: caml_fp_srs_lagrange_commitments_whole_domain -// Requires: tsSrs -var caml_fp_srs_lagrange_commitments_whole_domain = - tsSrs.fp.lagrangeCommitmentsWholeDomain; - -// Provides: caml_fq_srs_lagrange_commitments_whole_domain -// Requires: tsSrs -var caml_fq_srs_lagrange_commitments_whole_domain = - tsSrs.fq.lagrangeCommitmentsWholeDomain; - -// Provides: caml_fp_srs_lagrange_commitment -// Requires: tsSrs -var caml_fp_srs_lagrange_commitment = tsSrs.fp.lagrangeCommitment; - -// Provides: caml_fp_srs_commit_evaluations -// Requires: plonk_wasm, tsRustConversion -var caml_fp_srs_commit_evaluations = function (t, domain_size, fps) { - var res = plonk_wasm.caml_fp_srs_commit_evaluations( - t, - domain_size, - tsRustConversion.fp.vectorToRust(fps) - ); - return tsRustConversion.fp.polyCommFromRust(res); -}; - -// Provides: caml_fp_srs_b_poly_commitment -// Requires: plonk_wasm, tsRustConversion -var caml_fp_srs_b_poly_commitment = function (srs, chals) { - var res = plonk_wasm.caml_fp_srs_b_poly_commitment( - srs, - tsRustConversion.fieldsToRustFlat(chals) - ); - return tsRustConversion.fp.polyCommFromRust(res); -}; - -// Provides: caml_fp_srs_batch_accumulator_check -// Requires: plonk_wasm, tsRustConversion -var caml_fp_srs_batch_accumulator_check = function (srs, comms, chals) { - var rust_comms = tsRustConversion.fp.pointsToRust(comms); - var rust_chals = tsRustConversion.fp.vectorToRust(chals); - var ok = plonk_wasm.caml_fp_srs_batch_accumulator_check( - srs, - rust_comms, - rust_chals - ); - return ok; -}; - -// Provides: caml_fp_srs_batch_accumulator_generate -// Requires: plonk_wasm, tsRustConversion -var caml_fp_srs_batch_accumulator_generate = function (srs, n_comms, chals) { - var rust_chals = tsRustConversion.fp.vectorToRust(chals); - var rust_comms = plonk_wasm.caml_fp_srs_batch_accumulator_generate( - srs, - n_comms, - rust_chals - ); - return tsRustConversion.fp.pointsFromRust(rust_comms); -}; - -// Provides: caml_fp_srs_h -// Requires: plonk_wasm, tsRustConversion -var caml_fp_srs_h = function (t) { - return tsRustConversion.fp.pointFromRust(plonk_wasm.caml_fp_srs_h(t)); -}; - -// Provides: caml_fp_srs_add_lagrange_basis -// Requires: tsSrs -var caml_fp_srs_add_lagrange_basis = tsSrs.fp.addLagrangeBasis; - -// Provides: caml_fq_srs_create -// Requires: tsSrs -var caml_fq_srs_create = tsSrs.fq.create; - -// Provides: caml_fq_srs_write -// Requires: plonk_wasm, caml_jsstring_of_string -var caml_fq_srs_write = function (append, t, path) { - if (append === 0) { - append = undefined; - } else { - append = append[1]; - } - return plonk_wasm.caml_fq_srs_write(append, t, caml_jsstring_of_string(path)); -}; - -// Provides: caml_fq_srs_read -// Requires: plonk_wasm, caml_jsstring_of_string -var caml_fq_srs_read = function (offset, path) { - if (offset === 0) { - offset = undefined; - } else { - offset = offset[1]; - } - var res = plonk_wasm.caml_fq_srs_read(offset, caml_jsstring_of_string(path)); - if (res) { - return [0, res]; // Some(res) - } else { - return 0; // None - } -}; - -// Provides: caml_fq_srs_lagrange_commitment -// Requires: tsSrs -var caml_fq_srs_lagrange_commitment = tsSrs.fq.lagrangeCommitment; - -// Provides: caml_fq_srs_commit_evaluations -// Requires: plonk_wasm, tsRustConversion -var caml_fq_srs_commit_evaluations = function (t, domain_size, fqs) { - var res = plonk_wasm.caml_fq_srs_commit_evaluations( - t, - domain_size, - tsRustConversion.fq.vectorToRust(fqs) - ); - return tsRustConversion.fq.polyCommFromRust(res); -}; - -// Provides: caml_fq_srs_b_poly_commitment -// Requires: plonk_wasm, tsRustConversion -var caml_fq_srs_b_poly_commitment = function (srs, chals) { - var res = plonk_wasm.caml_fq_srs_b_poly_commitment( - srs, - tsRustConversion.fieldsToRustFlat(chals) - ); - return tsRustConversion.fq.polyCommFromRust(res); -}; - -// Provides: caml_fq_srs_batch_accumulator_check -// Requires: plonk_wasm, tsRustConversion -var caml_fq_srs_batch_accumulator_check = function (srs, comms, chals) { - var rust_comms = tsRustConversion.fq.pointsToRust(comms); - var rust_chals = tsRustConversion.fq.vectorToRust(chals); - var ok = plonk_wasm.caml_fq_srs_batch_accumulator_check( - srs, - rust_comms, - rust_chals - ); - return ok; -}; - -// Provides: caml_fq_srs_batch_accumulator_generate -// Requires: plonk_wasm, tsRustConversion -var caml_fq_srs_batch_accumulator_generate = function (srs, comms, chals) { - var rust_chals = tsRustConversion.fq.vectorToRust(chals); - var rust_comms = plonk_wasm.caml_fq_srs_batch_accumulator_generate( - srs, - comms, - rust_chals - ); - return tsRustConversion.fq.pointsFromRust(rust_comms); -}; - -// Provides: caml_fq_srs_h -// Requires: plonk_wasm, tsRustConversion -var caml_fq_srs_h = function (t) { - return tsRustConversion.fq.pointFromRust(plonk_wasm.caml_fq_srs_h(t)); -}; - -// Provides: caml_fq_srs_add_lagrange_basis -// Requires: tsSrs -var caml_fq_srs_add_lagrange_basis = tsSrs.fq.addLagrangeBasis; diff --git a/src/lib/crypto/kimchi_bindings/js/dune b/src/lib/crypto/kimchi_bindings/js/dune index f81673461f13..6af252023e0a 100644 --- a/src/lib/crypto/kimchi_bindings/js/dune +++ b/src/lib/crypto/kimchi_bindings/js/dune @@ -15,9 +15,12 @@ bindings/util.js bindings/srs.js bindings/verifier-index.js + native/native-overrides/circuit.js + native/native-overrides/gate-vector.js native/native-overrides/oracles.js - native/native-overrides/util.js - native/native-overrides/circuit.js)) + native/native-overrides/prover-index.js + native/native-overrides/srs.js + native/native-overrides/util.js)) (instrumentation (backend bisect_ppx)) (preprocess diff --git a/src/lib/crypto/kimchi_bindings/js/native/native-overrides/circuit.js b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/circuit.js index b02530564d8b..b14d7b4fbedd 100644 --- a/src/lib/crypto/kimchi_bindings/js/native/native-overrides/circuit.js +++ b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/circuit.js @@ -5,7 +5,7 @@ // Requires: plonk_wasm, tsRustConversionNative function prover_to_json(prover_index) { var bytes = prover_index.serialize() - var index = plonk_wasm.prover_index_from_bytes(bytes); + var index = plonk_wasm.prover_index_fp_from_bytes(bytes); // TODO: ^ remove the round trip when napi has direct access to the object return plonk_wasm.prover_to_json(index); diff --git a/src/lib/crypto/kimchi_bindings/js/native/native-overrides/gate-vector.js b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/gate-vector.js new file mode 100644 index 000000000000..af60dd36c0b2 --- /dev/null +++ b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/gate-vector.js @@ -0,0 +1,126 @@ +/* global plonk_wasm, caml_string_of_jsstring */ +/* eslint-disable no-unused-vars */ +/* global plonk_wasm, tsRustConversionNative, caml_bytes_of_uint8array, caml_string_of_jsstring */ + +// Provides: caml_pasta_fp_plonk_gate_vector_create +// Requires: plonk_wasm +var caml_pasta_fp_plonk_gate_vector_create = function () { + return plonk_wasm.caml_pasta_fp_plonk_gate_vector_create(); +}; + +// Provides: caml_pasta_fp_plonk_gate_vector_add +// Requires: plonk_wasm, tsRustConversionNative +var caml_pasta_fp_plonk_gate_vector_add = function (vector, gate) { + return plonk_wasm.caml_pasta_fp_plonk_gate_vector_add( + vector, + tsRustConversionNative.fp.gateToRust(gate) + ); +}; + +// Provides: caml_pasta_fp_plonk_gate_vector_get +// Requires: plonk_wasm, tsRustConversionNative +var caml_pasta_fp_plonk_gate_vector_get = function (vector, index) { + return tsRustConversionNative.fp.gateFromRust( + plonk_wasm.caml_pasta_fp_plonk_gate_vector_get(vector, index) + ); +}; + +// Provides: caml_pasta_fp_plonk_gate_vector_len +// Requires: plonk_wasm +var caml_pasta_fp_plonk_gate_vector_len = function (vector) { + return plonk_wasm.caml_pasta_fp_plonk_gate_vector_len(vector); +}; + +// Provides: caml_pasta_fp_plonk_gate_vector_wrap +// Requires: plonk_wasm, tsRustConversionNative +var caml_pasta_fp_plonk_gate_vector_wrap = function (vector, target, head) { + return plonk_wasm.caml_pasta_fp_plonk_gate_vector_wrap( + vector, + tsRustConversionNative.wireToRust(target), + tsRustConversionNative.wireToRust(head) + ); +}; + +// Provides: caml_pasta_fp_plonk_gate_vector_digest +// Requires: plonk_wasm, caml_bytes_of_uint8array +var caml_pasta_fp_plonk_gate_vector_digest = function (public_input_size, gate_vector) { + var bytes = plonk_wasm.caml_pasta_fp_plonk_gate_vector_digest( + public_input_size, + gate_vector + ); + if (!(bytes instanceof Uint8Array)) { + bytes = Uint8Array.from(bytes); + } + return caml_bytes_of_uint8array(bytes); +}; + +// Provides: caml_pasta_fp_plonk_circuit_serialize +// Requires: plonk_wasm, caml_string_of_jsstring +var caml_pasta_fp_plonk_circuit_serialize = function (public_input_size, gate_vector) { + return caml_string_of_jsstring( + plonk_wasm.caml_pasta_fp_plonk_circuit_serialize(public_input_size, gate_vector) + ); +}; + +// --- Fq versions --- + +// Provides: caml_pasta_fq_plonk_gate_vector_create +// Requires: plonk_wasm +var caml_pasta_fq_plonk_gate_vector_create = function () { + return plonk_wasm.caml_pasta_fq_plonk_gate_vector_create(); +}; + +// Provides: caml_pasta_fq_plonk_gate_vector_add +// Requires: plonk_wasm, tsRustConversionNative +var caml_pasta_fq_plonk_gate_vector_add = function (vector, gate) { + return plonk_wasm.caml_pasta_fq_plonk_gate_vector_add( + vector, + tsRustConversionNative.fq.gateToRust(gate) + ); +}; + +// Provides: caml_pasta_fq_plonk_gate_vector_get +// Requires: plonk_wasm, tsRustConversionNative +var caml_pasta_fq_plonk_gate_vector_get = function (vector, index) { + return tsRustConversionNative.fq.gateFromRust( + plonk_wasm.caml_pasta_fq_plonk_gate_vector_get(vector, index) + ); +}; + + +// Provides: caml_pasta_fq_plonk_gate_vector_len +// Requires: plonk_wasm +var caml_pasta_fq_plonk_gate_vector_len = function (vector) { + return plonk_wasm.caml_pasta_fq_plonk_gate_vector_len(vector); +}; + +// Provides: caml_pasta_fq_plonk_gate_vector_wrap +// Requires: plonk_wasm, tsRustConversionNative +var caml_pasta_fq_plonk_gate_vector_wrap = function (vector, target, head) { + return plonk_wasm.caml_pasta_fq_plonk_gate_vector_wrap( + vector, + tsRustConversionNative.wireToRust(target), + tsRustConversionNative.wireToRust(head) + ); +}; + +// Provides: caml_pasta_fq_plonk_gate_vector_digest +// Requires: plonk_wasm, caml_bytes_of_uint8array +var caml_pasta_fq_plonk_gate_vector_digest = function (public_input_size, gate_vector) { + var bytes = plonk_wasm.caml_pasta_fq_plonk_gate_vector_digest( + public_input_size, + gate_vector + ); + if (!(bytes instanceof Uint8Array)) { + bytes = Uint8Array.from(bytes); + } + return caml_bytes_of_uint8array(bytes); +}; + +// Provides: caml_pasta_fq_plonk_circuit_serialize +// Requires: plonk_wasm, caml_string_of_jsstring +var caml_pasta_fq_plonk_circuit_serialize = function (public_input_size, gate_vector) { + return caml_string_of_jsstring( + plonk_wasm.caml_pasta_fq_plonk_circuit_serialize(public_input_size, gate_vector) + ); +}; diff --git a/src/lib/crypto/kimchi_bindings/js/native/native-overrides/prover-index.js b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/prover-index.js new file mode 100644 index 000000000000..f87b4527ed0b --- /dev/null +++ b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/prover-index.js @@ -0,0 +1,291 @@ +/* global plonk_wasm, tsRustConversionNative, caml_jsstring_of_string */ + +// Provides: caml_pasta_fp_plonk_index_max_degree +// Requires: plonk_wasm +function caml_pasta_fp_plonk_index_max_degree(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fp_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fp_plonk_index_max_degree(index); +} + +// Provides: caml_pasta_fp_plonk_index_public_inputs +// Requires: plonk_wasm +function caml_pasta_fp_plonk_index_public_inputs(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fp_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fp_plonk_index_public_inputs(index); +} + +// Provides: caml_pasta_fp_plonk_index_domain_d1_size +// Requires: plonk_wasm +function caml_pasta_fp_plonk_index_domain_d1_size(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fp_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fp_plonk_index_domain_d1_size(index); +} + +// Provides: caml_pasta_fp_plonk_index_domain_d4_size +// Requires: plonk_wasm +function caml_pasta_fp_plonk_index_domain_d4_size(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fp_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fp_plonk_index_domain_d4_size(index); +} + +// Provides: caml_pasta_fp_plonk_index_domain_d8_size +// Requires: plonk_wasm +function caml_pasta_fp_plonk_index_domain_d8_size(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fp_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fp_plonk_index_domain_d8_size(index); +} + + +//////// FQ //////// + + +// Provides: caml_pasta_fq_plonk_index_max_degree +// Requires: plonk_wasm +function caml_pasta_fq_plonk_index_max_degree(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fq_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fq_plonk_index_max_degree(index); +} + +// Provides: caml_pasta_fq_plonk_index_public_inputs +// Requires: plonk_wasm +function caml_pasta_fq_plonk_index_public_inputs(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fq_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fq_plonk_index_public_inputs(index); +} + +// Provides: caml_pasta_fq_plonk_index_domain_d1_size +// Requires: plonk_wasm +function caml_pasta_fq_plonk_index_domain_d1_size(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fq_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fq_plonk_index_domain_d1_size(index); +} + +// Provides: caml_pasta_fq_plonk_index_domain_d4_size +// Requires: plonk_wasm +function caml_pasta_fq_plonk_index_domain_d4_size(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fq_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fq_plonk_index_domain_d4_size(index); +} + +// Provides: caml_pasta_fq_plonk_index_domain_d8_size +// Requires: plonk_wasm +function caml_pasta_fq_plonk_index_domain_d8_size(prover_index) { + var bytes = prover_index.serialize() + var index = plonk_wasm.prover_index_fq_from_bytes(bytes); + // TODO: ^ remove the round trip when napi has direct access to the object + + return plonk_wasm.caml_pasta_fq_plonk_index_domain_d8_size(index); +} + + +// Provides: caml_pasta_fp_plonk_index_create +// Requires: plonk_wasm, free_on_finalize, tsRustConversionNative +var caml_pasta_fp_plonk_index_create = function ( + gates, + public_inputs, + caml_lookup_tables, + caml_runtime_table_cfgs, + prev_challenges, + urs, + lazy_mode +) { + var wasm_lookup_tables = + tsRustConversionNative.fp.lookupTablesToRust(caml_lookup_tables); + var wasm_runtime_table_cfgs = tsRustConversionNative.fp.runtimeTableCfgsToRust( + caml_runtime_table_cfgs + ); + console.time("conversion") + var gate_vec = plonk_wasm.caml_pasta_fp_plonk_gate_vector_from_bytes(gates.serialize()); + var urs_ser = plonk_wasm.caml_fp_srs_from_bytes(urs.serialize()) + console.timeEnd("conversion") + + console.time("index_create") + var t = plonk_wasm.caml_pasta_fp_plonk_index_create( + gate_vec, + public_inputs, + wasm_lookup_tables, + wasm_runtime_table_cfgs, + prev_challenges, + urs_ser, + lazy_mode + ); + console.timeEnd("index_create"); + + console.time("finalize_conversion") + var wasm_t = plonk_wasm.WasmPastaFpPlonkIndex.deserialize(plonk_wasm.prover_index_fp_to_bytes(t)) + console.timeEnd("finalize_conversion") + + return free_on_finalize(wasm_t); +}; + +// Provides: caml_pasta_fp_plonk_index_create_bytecode +// Requires: caml_pasta_fp_plonk_index_create +var caml_pasta_fp_plonk_index_create_bytecode = function ( + gates, + public_inputs, + caml_lookup_tables, + caml_runtime_table_cfgs, + prev_challenges, + urs, + lazy_mode +) { + return caml_pasta_fp_plonk_index_create( + gates, + public_inputs, + caml_lookup_tables, + caml_runtime_table_cfgs, + prev_challenges, + urs, + lazy_mode + ); +}; + +// Provides: caml_pasta_fp_plonk_index_read +// Requires: plonk_wasm, caml_jsstring_of_string +var caml_pasta_fp_plonk_index_read = function (offset, urs, path) { + if (offset === 0) { + offset = undefined; + } else { + offset = offset[1]; + } + return plonk_wasm.caml_pasta_fp_plonk_index_read( + offset, + urs, + caml_jsstring_of_string(path) + ); +}; + +// Provides: caml_pasta_fp_plonk_index_write +// Requires: plonk_wasm, caml_jsstring_of_string +var caml_pasta_fp_plonk_index_write = function (append, t, path) { + if (append === 0) { + append = undefined; + } else { + append = append[1]; + } + return plonk_wasm.caml_pasta_fp_plonk_index_write( + append, + t, + caml_jsstring_of_string(path) + ); +}; + +// Provides: caml_pasta_fq_plonk_index_create +// Requires: plonk_wasm, free_on_finalize, tsRustConversion +var caml_pasta_fq_plonk_index_create = function ( + gates, + public_inputs, + caml_lookup_tables, + caml_runtime_table_cfgs, + prev_challenges, + urs, + lazy_mode +) { + var wasm_lookup_tables = + tsRustConversionNative.fq.lookupTablesToRust(caml_lookup_tables); + var wasm_runtime_table_cfgs = tsRustConversionNative.fq.runtimeTableCfgsToRust( + caml_runtime_table_cfgs + ); + + console.time("conversion") + var gate_vec = plonk_wasm.caml_pasta_fq_plonk_gate_vector_from_bytes(gates.serialize()); + var urs_ser = plonk_wasm.caml_fq_srs_from_bytes(urs.serialize()) + console.timeEnd("conversion") + + console.time("index_create") + var t = plonk_wasm.caml_pasta_fq_plonk_index_create( + gate_vec, + public_inputs, + wasm_lookup_tables, + wasm_runtime_table_cfgs, + prev_challenges, + urs_ser, + lazy_mode + ); + console.timeEnd("index_create"); + + console.time("finalize_conversion") + var wasm_t = plonk_wasm.WasmPastaFqPlonkIndex.deserialize(plonk_wasm.prover_index_fq_to_bytes(t)) + console.timeEnd("finalize_conversion") + + return free_on_finalize(wasm_t); +}; + +// Provides: caml_pasta_fq_plonk_index_create_bytecode +// Requires: caml_pasta_fq_plonk_index_create +var caml_pasta_fq_plonk_index_create_bytecode = function ( + gates, + public_inputs, + caml_lookup_tables, + caml_runtime_table_cfgs, + prev_challenges, + urs, + lazy_mode +) { + return caml_pasta_fq_plonk_index_create( + gates, + public_inputs, + caml_lookup_tables, + caml_runtime_table_cfgs, + prev_challenges, + urs, + lazy_mode + ); +}; + +// Provides: caml_pasta_fq_plonk_index_read +// Requires: plonk_wasm, caml_jsstring_of_string +var caml_pasta_fq_plonk_index_read = function (offset, urs, path) { + if (offset === 0) { + offset = undefined; + } else { + offset = offset[1]; + } + return plonk_wasm.caml_pasta_fq_plonk_index_read( + offset, + urs, + caml_jsstring_of_string(path) + ); +}; + +// Provides: caml_pasta_fq_plonk_index_write +// Requires: plonk_wasm, caml_jsstring_of_string +var caml_pasta_fq_plonk_index_write = function (append, t, path) { + if (append === 0) { + append = undefined; + } else { + append = append[1]; + } + return plonk_wasm.caml_pasta_fq_plonk_index_write( + append, + t, + caml_jsstring_of_string(path) + ); +}; diff --git a/src/lib/crypto/kimchi_bindings/js/native/native-overrides/srs.js b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/srs.js new file mode 100644 index 000000000000..20d4bfaf61a5 --- /dev/null +++ b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/srs.js @@ -0,0 +1,215 @@ +/* global plonk_wasm, caml_jsstring_of_string, + tsBindings, tsRustConversion +*/ + +// Provides: tsSrs +// Requires: tsBindings, plonk_wasm +var tsSrs = tsBindings.srs(plonk_wasm); + +// srs + +// Provides: caml_fp_srs_create +// Requires: tsSrs +var caml_fp_srs_create = tsSrs.fp.create; + +// Provides: caml_fp_srs_write +// Requires: plonk_wasm, caml_jsstring_of_string +var caml_fp_srs_write = function (append, t, path) { + console.log("native caml_fp_srs_write"); + if (append === 0) { + append = undefined; + } else { + append = append[1]; + } + return plonk_wasm.caml_fp_srs_write(append, t, caml_jsstring_of_string(path)); +}; + +// Provides: caml_fp_srs_read +// Requires: plonk_wasm, caml_jsstring_of_string +var caml_fp_srs_read = function (offset, path) { + console.log("native caml_fp_srs_read"); + if (offset === 0) { + offset = undefined; + } else { + offset = offset[1]; + } + var res = plonk_wasm.caml_fp_srs_read(offset, caml_jsstring_of_string(path)); + if (res) { + return [0, res]; // Some(res) + } else { + return 0; // None + } +}; + +// Provides: caml_fp_srs_lagrange_commitments_whole_domain +// Requires: tsSrs +var caml_fp_srs_lagrange_commitments_whole_domain = + tsSrs.fp.lagrangeCommitmentsWholeDomain; + +// Provides: caml_fq_srs_lagrange_commitments_whole_domain +// Requires: tsSrs +var caml_fq_srs_lagrange_commitments_whole_domain = + tsSrs.fq.lagrangeCommitmentsWholeDomain; + +// Provides: caml_fp_srs_lagrange_commitment +// Requires: tsSrs +var caml_fp_srs_lagrange_commitment = tsSrs.fp.lagrangeCommitment; + +// Provides: caml_fp_srs_commit_evaluations +// Requires: plonk_wasm, tsRustConversionNative +var caml_fp_srs_commit_evaluations = function (t, domain_size, fps) { + console.log("native caml_fp_srs_commit_evaluations"); + var res = plonk_wasm.caml_fp_srs_commit_evaluations( + t, + domain_size, + tsRustConversionNative.fp.vectorToRust(fps) + ); + return tsRustConversionNative.fp.polyCommFromRust(res); +}; + +// Provides: caml_fp_srs_b_poly_commitment +// Requires: plonk_wasm, tsRustConversionNative +var caml_fp_srs_b_poly_commitment = function (srs, chals) { + console.log("native caml_fp_srs_b_poly_commitment"); + var res = plonk_wasm.caml_fp_srs_b_poly_commitment( + srs, + tsRustConversionNative.fp.vectorToRust(chals) + ); + return tsRustConversionNative.fp.polyCommFromRust(res); +}; + +// Provides: caml_fp_srs_batch_accumulator_check +// Requires: plonk_wasm, tsRustConversionNative +var caml_fp_srs_batch_accumulator_check = function (srs, comms, chals) { + console.log("native caml_fp_srs_batch_accumulator_check"); + var rust_comms = tsRustConversionNative.fp.pointsToRust(comms); + var rust_chals = tsRustConversionNative.fp.vectorToRust(chals); + var ok = plonk_wasm.caml_fp_srs_batch_accumulator_check( + srs, + rust_comms, + rust_chals + ); + return ok; +}; + +// Provides: caml_fp_srs_batch_accumulator_generate +// Requires: plonk_wasm, tsRustConversionNative +var caml_fp_srs_batch_accumulator_generate = function (srs, n_comms, chals) { + console.log("native caml_fp_srs_batch_accumulator_generate"); + var rust_chals = tsRustConversionNative.fp.vectorToRust(chals); + var rust_comms = plonk_wasm.caml_fp_srs_batch_accumulator_generate( + srs, + n_comms, + rust_chals + ); + return tsRustConversionNative.fp.pointsFromRust(rust_comms); +}; + +// Provides: caml_fp_srs_h +// Requires: plonk_wasm, tsRustConversionNative +var caml_fp_srs_h = function (t) { + console.log("native caml_fp_srs_h"); + return tsRustConversionNative.fp.pointFromRust(plonk_wasm.caml_fp_srs_h(t)); +}; + +// Provides: caml_fp_srs_add_lagrange_basis +// Requires: tsSrs +var caml_fp_srs_add_lagrange_basis = tsSrs.fp.addLagrangeBasis; + +// Provides: caml_fq_srs_create +// Requires: tsSrs +var caml_fq_srs_create = tsSrs.fq.create; + +// Provides: caml_fq_srs_write +// Requires: plonk_wasm, caml_jsstring_of_string +var caml_fq_srs_write = function (append, t, path) { + console.log("native caml_fq_srs_write"); + if (append === 0) { + append = undefined; + } else { + append = append[1]; + } + return plonk_wasm.caml_fq_srs_write(append, t, caml_jsstring_of_string(path)); +}; + +// Provides: caml_fq_srs_read +// Requires: plonk_wasm, caml_jsstring_of_string +var caml_fq_srs_read = function (offset, path) { + console.log("native caml_fq_srs_read"); + if (offset === 0) { + offset = undefined; + } else { + offset = offset[1]; + } + var res = plonk_wasm.caml_fq_srs_read(offset, caml_jsstring_of_string(path)); + if (res) { + return [0, res]; // Some(res) + } else { + return 0; // None + } +}; + +// Provides: caml_fq_srs_lagrange_commitment +// Requires: tsSrs +var caml_fq_srs_lagrange_commitment = tsSrs.fq.lagrangeCommitment; + +// Provides: caml_fq_srs_commit_evaluations +// Requires: plonk_wasm, tsRustConversionNative +var caml_fq_srs_commit_evaluations = function (t, domain_size, fqs) { + console.log("native caml_fq_srs_commit_evaluations"); + var res = plonk_wasm.caml_fq_srs_commit_evaluations( + t, + domain_size, + tsRustConversionNative.fq.vectorToRust(fqs) + ); + return tsRustConversionNative.fq.polyCommFromRust(res); +}; + +// Provides: caml_fq_srs_b_poly_commitment +// Requires: plonk_wasm, tsRustConversionNative +var caml_fq_srs_b_poly_commitment = function (srs, chals) { + console.log("native caml_fq_srs_b_poly_commitment"); + var res = plonk_wasm.caml_fq_srs_b_poly_commitment( + srs, + tsRustConversionNative.fq.vectorToRust(chals) + ); + return tsRustConversionNative.fq.polyCommFromRust(res); +}; + +// Provides: caml_fq_srs_batch_accumulator_check +// Requires: plonk_wasm, tsRustConversion +var caml_fq_srs_batch_accumulator_check = function (srs, comms, chals) { + console.log("native caml_fq_srs_batch_accumulator_check"); + var rust_comms = tsRustConversionNative.fq.pointsToRust(comms); + var rust_chals = tsRustConversionNative.fq.vectorToRust(chals); + var ok = plonk_wasm.caml_fq_srs_batch_accumulator_check( + srs, + rust_comms, + rust_chals + ); + return ok; +}; + +// Provides: caml_fq_srs_batch_accumulator_generate +// Requires: plonk_wasm, tsRustConversionNative +var caml_fq_srs_batch_accumulator_generate = function (srs, comms, chals) { + console.log("native caml_fq_srs_batch_accumulator_generate"); + var rust_chals = tsRustConversionNative.fq.vectorToRust(chals); + var rust_comms = plonk_wasm.caml_fq_srs_batch_accumulator_generate( + srs, + comms, + rust_chals + ); + return tsRustConversionNative.fq.pointsFromRust(rust_comms); +}; + +// Provides: caml_fq_srs_h +// Requires: plonk_wasm, tsRustConversionNative +var caml_fq_srs_h = function (t) { + console.log("native caml_fq_srs_h"); + return tsRustConversionNative.fq.pointFromRust(plonk_wasm.caml_fq_srs_h(t)); +}; + +// Provides: caml_fq_srs_add_lagrange_basis +// Requires: tsSrs +var caml_fq_srs_add_lagrange_basis = tsSrs.fq.addLagrangeBasis; diff --git a/src/lib/crypto/kimchi_bindings/js/native/native-overrides/util.js b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/util.js index 139fa4a3bb4d..4b9d427acdc1 100644 --- a/src/lib/crypto/kimchi_bindings/js/native/native-overrides/util.js +++ b/src/lib/crypto/kimchi_bindings/js/native/native-overrides/util.js @@ -1,5 +1,4 @@ -/* global plonk_wasm, tsRustConversionNative, getTsBindings, tsBindings */ - +/* global plonk_wasm, tsRustConversionNative, getTsBindings, tsBindings */ // Provides: tsRustConversionNative // Requires: tsBindings, plonk_wasm, getTsBindings diff --git a/src/lib/crypto/kimchi_bindings/js/node_js/node_backend.js b/src/lib/crypto/kimchi_bindings/js/node_js/node_backend.js index b9a659d8bdba..87b70eec4773 100644 --- a/src/lib/crypto/kimchi_bindings/js/node_js/node_backend.js +++ b/src/lib/crypto/kimchi_bindings/js/node_js/node_backend.js @@ -11,19 +11,90 @@ var plonk_wasm = (function() { // IS SET var overrides = [ "prover_to_json", - "prover_index_from_bytes", - "prover_index_to_bytes", + "prover_index_fp_from_bytes", + "prover_index_fq_from_bytes", + "prover_index_fp_to_bytes", + "prover_index_fq_to_bytes", "caml_pasta_fp_poseidon_block_cipher", "caml_pasta_fq_poseidon_block_cipher", "caml_pasta_fp_plonk_proof_create", "caml_pasta_fp_plonk_verifier_index_shifts", "caml_pasta_fq_plonk_verifier_index_shifts", - ] + "WasmFpPolyComm", + "WasmFqPolyComm", + "caml_pasta_fp_plonk_gate_vector_create", + "caml_pasta_fq_plonk_gate_vector_create", + "caml_pasta_fp_plonk_gate_vector_add", + "caml_pasta_fq_plonk_gate_vector_add", + "caml_pasta_fp_plonk_gate_vector_get", + "caml_pasta_fq_plonk_gate_vector_get", + "caml_pasta_fp_plonk_gate_vector_len", + "caml_pasta_fq_plonk_gate_vector_len", + "caml_pasta_fp_plonk_gate_vector_wrap", + "caml_pasta_fq_plonk_gate_vector_wrap", + "caml_pasta_fp_plonk_gate_vector_digest", + "caml_pasta_fq_plonk_gate_vector_digest", + "caml_pasta_fp_plonk_gate_vector_from_bytes", + "caml_pasta_fq_plonk_gate_vector_from_bytes", + "caml_pasta_fp_plonk_circuit_serialize", + "caml_pasta_fq_plonk_circuit_serialize", + "caml_pasta_fp_plonk_index_max_degree", + "caml_pasta_fq_plonk_index_max_degree", + "caml_pasta_fp_plonk_index_public_inputs", + "caml_pasta_fq_plonk_index_public_inputs", + "caml_pasta_fp_plonk_index_domain_d1_size", + "caml_pasta_fq_plonk_index_domain_d1_size", + "caml_pasta_fp_plonk_index_domain_d4_size", + "caml_pasta_fq_plonk_index_domain_d4_size", + "caml_pasta_fp_plonk_index_domain_d8_size", + "caml_pasta_fq_plonk_index_domain_d8_size", + "caml_pasta_fp_plonk_index_create", + "caml_pasta_fq_plonk_index_create", + "caml_pasta_fp_plonk_index_decode", + "caml_pasta_fq_plonk_index_decode", + "caml_pasta_fp_plonk_index_encode", + "caml_pasta_fq_plonk_index_encode", + "caml_pasta_fp_plonk_index_read", + "caml_pasta_fq_plonk_index_read", + "caml_fp_srs_from_bytes", + "caml_fq_srs_from_bytes", + "WasmFpSrs", + "caml_fp_srs_create", + "caml_fp_srs_create_parallel", + "caml_fq_srs_get", + "caml_fq_srs_set", + "caml_fp_srs_write", + "caml_fp_srs_read", + "caml_fp_srs_add_lagrange_basis", + "caml_fp_srs_commit_evaluations", + "caml_fp_srs_b_poly_commitment", + "caml_fp_srs_batch_accumulator_check", + "caml_fp_srs_batch_accumulator_generate", + "caml_fp_srs_h", + "WasmFqSrs", + "caml_fq_srs_create", + "caml_fq_srs_create_parallel", + "caml_fq_srs_get", + "caml_fq_srs_set", + "caml_fq_srs_write", + "caml_fq_srs_read", + "caml_fq_srs_add_lagrange_basis", + "caml_fq_srs_commit_evaluations", + "caml_fq_srs_b_poly_commitment", + "caml_fq_srs_batch_accumulator_check", + "caml_fq_srs_batch_accumulator_generate", + "caml_fq_srs_h", + "WasmFpPolyComm", + "WasmFqPolyComm", + "WasmGPallas", + "WasmGVesta", + "WasmPastaFp", + "WasmPastaFq", + ]; overrides.forEach(function (override) { wasm[override] = native[override] }) - wasm.native = true; } catch (e) { if (process.env.O1JS_REQUIRE_NATIVE_BINDINGS) { @@ -32,6 +103,5 @@ var plonk_wasm = (function() { process.exit(1); } } - return wasm })() diff --git a/src/lib/crypto/kimchi_bindings/stubs/kimchi_bindings.ml b/src/lib/crypto/kimchi_bindings/stubs/kimchi_bindings.ml index 062a57691ca1..8e2e05126c9a 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/kimchi_bindings.ml +++ b/src/lib/crypto/kimchi_bindings/stubs/kimchi_bindings.ml @@ -215,7 +215,8 @@ module Protocol = struct -> SRS.Fp.t -> bool -> t - = "caml_pasta_fp_plonk_index_create_bytecode" "caml_pasta_fp_plonk_index_create" + = "caml_pasta_fp_plonk_index_create_bytecode" + "caml_pasta_fp_plonk_index_create" external max_degree : t -> int = "caml_pasta_fp_plonk_index_max_degree" @@ -250,7 +251,8 @@ module Protocol = struct -> SRS.Fq.t -> bool -> t - = "caml_pasta_fq_plonk_index_create_bytecode" "caml_pasta_fq_plonk_index_create" + = "caml_pasta_fq_plonk_index_create_bytecode" + "caml_pasta_fq_plonk_index_create" external max_degree : t -> int = "caml_pasta_fq_plonk_index_max_degree" diff --git a/src/lib/crypto/proof-systems b/src/lib/crypto/proof-systems index 953bc32b9865..4f80d3cecc36 160000 --- a/src/lib/crypto/proof-systems +++ b/src/lib/crypto/proof-systems @@ -1 +1 @@ -Subproject commit 953bc32b9865fc707abebd4f47f07d520eb72008 +Subproject commit 4f80d3cecc361686b2f48fbadded2dceb0e9a1c1 diff --git a/src/lib/pickles/plonk_checks/scalars.ml b/src/lib/pickles/plonk_checks/scalars.ml index 17383baa0b4f..0ebaff44ae78 100644 --- a/src/lib/pickles/plonk_checks/scalars.ml +++ b/src/lib/pickles/plonk_checks/scalars.ml @@ -2831,8 +2831,7 @@ module Tick : S = struct + if_feature ( LookupPattern RangeCheck , (fun () -> - cell (var (LookupKindIndex RangeCheck, Curr)) - ) + cell (var (LookupKindIndex RangeCheck, Curr)) ) , fun () -> field "0x0000000000000000000000000000000000000000000000000000000000000000" @@ -2842,8 +2841,7 @@ module Tick : S = struct , (fun () -> cell (var - (LookupKindIndex ForeignFieldMul, Curr) ) - ) + (LookupKindIndex ForeignFieldMul, Curr) ) ) , fun () -> field "0x0000000000000000000000000000000000000000000000000000000000000000"