44// Requires: plonk_wasm
55function caml_pasta_fp_plonk_index_max_degree ( prover_index ) {
66 var bytes = prover_index . serialize ( )
7- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
7+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
88 // TODO: ^ remove the round trip when napi has direct access to the object
99
1010 return plonk_wasm . caml_pasta_fp_plonk_index_max_degree ( index ) ;
@@ -14,7 +14,7 @@ function caml_pasta_fp_plonk_index_max_degree(prover_index) {
1414// Requires: plonk_wasm
1515function caml_pasta_fp_plonk_index_public_inputs ( prover_index ) {
1616 var bytes = prover_index . serialize ( )
17- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
17+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
1818 // TODO: ^ remove the round trip when napi has direct access to the object
1919
2020 return plonk_wasm . caml_pasta_fp_plonk_index_public_inputs ( index ) ;
@@ -24,7 +24,7 @@ function caml_pasta_fp_plonk_index_public_inputs(prover_index) {
2424// Requires: plonk_wasm
2525function caml_pasta_fp_plonk_index_domain_d1_size ( prover_index ) {
2626 var bytes = prover_index . serialize ( )
27- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
27+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
2828 // TODO: ^ remove the round trip when napi has direct access to the object
2929
3030 return plonk_wasm . caml_pasta_fp_plonk_index_domain_d1_size ( index ) ;
@@ -34,7 +34,7 @@ function caml_pasta_fp_plonk_index_domain_d1_size(prover_index) {
3434// Requires: plonk_wasm
3535function caml_pasta_fp_plonk_index_domain_d4_size ( prover_index ) {
3636 var bytes = prover_index . serialize ( )
37- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
37+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
3838 // TODO: ^ remove the round trip when napi has direct access to the object
3939
4040 return plonk_wasm . caml_pasta_fp_plonk_index_domain_d4_size ( index ) ;
@@ -44,7 +44,7 @@ function caml_pasta_fp_plonk_index_domain_d4_size(prover_index) {
4444// Requires: plonk_wasm
4545function caml_pasta_fp_plonk_index_domain_d8_size ( prover_index ) {
4646 var bytes = prover_index . serialize ( )
47- var index = plonk_wasm . prover_index_fp_from_bytes ( bytes ) ;
47+ var index = plonk_wasm . prover_index_fp_deserialize ( bytes ) ;
4848 // TODO: ^ remove the round trip when napi has direct access to the object
4949
5050 return plonk_wasm . caml_pasta_fp_plonk_index_domain_d8_size ( index ) ;
@@ -58,7 +58,7 @@ function caml_pasta_fp_plonk_index_domain_d8_size(prover_index) {
5858// Requires: plonk_wasm
5959function caml_pasta_fq_plonk_index_max_degree ( prover_index ) {
6060 var bytes = prover_index . serialize ( )
61- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
61+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
6262 // TODO: ^ remove the round trip when napi has direct access to the object
6363
6464 return plonk_wasm . caml_pasta_fq_plonk_index_max_degree ( index ) ;
@@ -68,7 +68,7 @@ function caml_pasta_fq_plonk_index_max_degree(prover_index) {
6868// Requires: plonk_wasm
6969function caml_pasta_fq_plonk_index_public_inputs ( prover_index ) {
7070 var bytes = prover_index . serialize ( )
71- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
71+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
7272 // TODO: ^ remove the round trip when napi has direct access to the object
7373
7474 return plonk_wasm . caml_pasta_fq_plonk_index_public_inputs ( index ) ;
@@ -78,7 +78,7 @@ function caml_pasta_fq_plonk_index_public_inputs(prover_index) {
7878// Requires: plonk_wasm
7979function caml_pasta_fq_plonk_index_domain_d1_size ( prover_index ) {
8080 var bytes = prover_index . serialize ( )
81- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
81+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
8282 // TODO: ^ remove the round trip when napi has direct access to the object
8383
8484 return plonk_wasm . caml_pasta_fq_plonk_index_domain_d1_size ( index ) ;
@@ -88,7 +88,7 @@ function caml_pasta_fq_plonk_index_domain_d1_size(prover_index) {
8888// Requires: plonk_wasm
8989function caml_pasta_fq_plonk_index_domain_d4_size ( prover_index ) {
9090 var bytes = prover_index . serialize ( )
91- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
91+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
9292 // TODO: ^ remove the round trip when napi has direct access to the object
9393
9494 return plonk_wasm . caml_pasta_fq_plonk_index_domain_d4_size ( index ) ;
@@ -98,13 +98,33 @@ function caml_pasta_fq_plonk_index_domain_d4_size(prover_index) {
9898// Requires: plonk_wasm
9999function caml_pasta_fq_plonk_index_domain_d8_size ( prover_index ) {
100100 var bytes = prover_index . serialize ( )
101- var index = plonk_wasm . prover_index_fq_from_bytes ( bytes ) ;
101+ var index = plonk_wasm . prover_index_fq_deserialize ( bytes ) ;
102102 // TODO: ^ remove the round trip when napi has direct access to the object
103103
104104 return plonk_wasm . caml_pasta_fq_plonk_index_domain_d8_size ( index ) ;
105105}
106106
107107
108+ // Provides: caml_pasta_fp_plonk_index_serialize
109+ // Requires: plonk_wasm
110+ var caml_pasta_fp_plonk_index_serialize = function ( index ) {
111+ // Workaround for napi issue where methods on External objects are not accessible
112+ if ( typeof index . serialize === 'function' ) {
113+ return index . serialize ( ) ;
114+ }
115+ return plonk_wasm . prover_index_fp_serialize ( index ) ;
116+ } ;
117+
118+ // Provides: caml_pasta_fp_plonk_index_deserialize
119+ // Requires: plonk_wasm
120+ var caml_pasta_fp_plonk_index_deserialize = function ( index ) {
121+ // Workaround for napi issue where methods on External objects are not accessible
122+ if ( typeof index . deserialize === 'function' ) {
123+ return index . deserialize ( ) ;
124+ }
125+ return plonk_wasm . prover_index_fp_deserialize ( index ) ;
126+ } ;
127+
108128// Provides: caml_pasta_fp_plonk_index_create
109129// Requires: plonk_wasm, tsRustConversionNative
110130var caml_pasta_fp_plonk_index_create = function (
@@ -116,6 +136,7 @@ var caml_pasta_fp_plonk_index_create = function (
116136 urs ,
117137 lazy_mode
118138) {
139+ console . log ( 'passing through wasm lookup tables' )
119140 var wasm_lookup_tables =
120141 tsRustConversionNative . fp . lookupTablesToRust ( caml_lookup_tables ) ;
121142 var wasm_runtime_table_cfgs = tsRustConversionNative . fp . runtimeTableCfgsToRust (
@@ -138,7 +159,7 @@ var caml_pasta_fp_plonk_index_create = function (
138159 ) ;
139160 console . timeEnd ( "index_create" ) ;
140161
141- return plonk_wasm . prover_index_fp_to_bytes ( t ) ;
162+ return t ;
142163} ;
143164
144165// Provides: caml_pasta_fp_plonk_index_create_bytecode
@@ -193,6 +214,26 @@ var caml_pasta_fp_plonk_index_write = function (append, t, path) {
193214 ) ;
194215} ;
195216
217+ // Provides: caml_pasta_fq_plonk_index_serialize
218+ // Requires: plonk_wasm
219+ var caml_pasta_fq_plonk_index_serialize = function ( index ) {
220+ // Workaround for napi issue where methods on External objects are not accessible
221+ if ( typeof index . serialize === 'function' ) {
222+ return index . serialize ( ) ;
223+ }
224+ return plonk_wasm . prover_index_fq_serialize ( index ) ;
225+ } ;
226+
227+ // Provides: caml_pasta_fq_plonk_index_deserialize
228+ // Requires: plonk_wasm
229+ var caml_pasta_fq_plonk_index_deserialize = function ( index ) {
230+ // Workaround for napi issue where methods on External objects are not accessible
231+ if ( typeof index . deserialize === 'function' ) {
232+ return index . deserialize ( ) ;
233+ }
234+ return plonk_wasm . prover_index_fq_deserialize ( index ) ;
235+ } ;
236+
196237// Provides: caml_pasta_fq_plonk_index_create
197238// Requires: plonk_wasm, tsRustConversionNative
198239var caml_pasta_fq_plonk_index_create = function (
@@ -214,7 +255,7 @@ var caml_pasta_fq_plonk_index_create = function (
214255 console . log ( "anais: 3" ) ;
215256
216257 console . time ( "conversion" )
217- var gate_vec = plonk_wasm . caml_pasta_fq_plonk_gate_vector_from_bytes ( gates . serialize ( ) ) ;
258+ var gate_vec = plonk_wasm . caml_pasta_fq_plonk_gate_vector_deserialize ( gates . serialize ( ) ) ;
218259 var urs_ser = plonk_wasm . caml_fq_srs_from_bytes_external ( urs . serialize ( ) )
219260 console . timeEnd ( "conversion" )
220261 console . log ( "anais: 4" ) ;
@@ -231,7 +272,7 @@ var caml_pasta_fq_plonk_index_create = function (
231272 ) ;
232273 console . timeEnd ( "index_create" ) ;
233274
234- return plonk_wasm . prover_index_fq_to_bytes ( t ) ;
275+ return t ;
235276} ;
236277
237278// Provides: caml_pasta_fq_plonk_index_create_bytecode
@@ -284,4 +325,4 @@ var caml_pasta_fq_plonk_index_write = function (append, t, path) {
284325 t ,
285326 caml_jsstring_of_string ( path )
286327 ) ;
287- } ;
328+ } ;
0 commit comments