1+ import { MlArray , MlOption , MlTuple } from '../../lib/ml/base.js' ;
2+ import type * as napiNamespace from '../compiled/node_bindings/plonk_wasm.cjs' ;
13import type {
2- WasmPastaFpLookupTable ,
4+ WasmFpLookupCommitments ,
5+ WasmFpOpeningProof ,
6+ WasmFpProverCommitments ,
7+ WasmFpProverProof ,
38 WasmFpRuntimeTable ,
9+ WasmFqLookupCommitments ,
10+ WasmFqOpeningProof ,
11+ WasmFqProverCommitments ,
12+ WasmFqProverProof ,
13+ WasmFqRuntimeTable ,
14+ WasmPastaFpLookupTable ,
415 WasmPastaFpRuntimeTableCfg ,
516 WasmPastaFqLookupTable ,
6- WasmFqRuntimeTable ,
717 WasmPastaFqRuntimeTableCfg ,
818 WasmVecVecFp ,
919 WasmVecVecFq ,
10- WasmFpProverCommitments ,
11- WasmFqProverCommitments ,
12- WasmFpOpeningProof ,
13- WasmFqOpeningProof ,
14- WasmFpProverProof ,
15- WasmFqProverProof ,
16- WasmFpLookupCommitments ,
17- WasmFqLookupCommitments ,
1820} from '../compiled/node_bindings/plonk_wasm.cjs' ;
19- import type * as napiNamespace from '../compiled/node_bindings/plonk_wasm.cjs' ;
21+ import {
22+ fieldFromRust ,
23+ fieldToRust ,
24+ fieldsFromRustFlat ,
25+ fieldsToRustFlat ,
26+ } from './bindings/conversion-base.js' ;
27+ import type { Field } from './bindings/field.js' ;
2028import type {
21- RuntimeTable ,
22- RuntimeTableCfg ,
29+ LookupCommitments ,
2330 LookupTable ,
31+ OpeningProof ,
32+ OrInfinity ,
33+ PointEvaluations ,
34+ PolyComm ,
35+ ProofEvaluations ,
2436 ProofWithPublic ,
37+ ProverCommitments ,
2538 ProverProof ,
26- LookupCommitments ,
27- PolyComm , PointEvaluations , ProofEvaluations ,
2839 RecursionChallenge ,
29- ProverCommitments ,
30- OpeningProof ,
31- OrInfinity ,
40+ RuntimeTable ,
41+ RuntimeTableCfg ,
3242} from './bindings/kimchi-types.js' ;
33- import { MlArray , MlTuple , MlOption } from '../../lib/ml/base.js' ;
34- import {
35- fieldsToRustFlat ,
36- fieldToRust ,
37- fieldsFromRustFlat ,
38- fieldFromRust ,
39- } from './bindings/conversion-base.js' ;
4043import { ConversionCore , ConversionCores } from './napi-conversion-core.js' ;
41- import type { Field } from './bindings/field.js' ;
4244
4345export { napiProofConversion } ;
44-
46+
4547const fieldToRust_ = ( x : Field ) => fieldToRust ( x ) ;
4648const proofEvaluationsToRust = mapProofEvaluations ( fieldToRust_ ) ;
4749const proofEvaluationsFromRust = mapProofEvaluations ( fieldFromRust ) ;
4850const pointEvalsOptionToRust = mapPointEvalsOption ( fieldToRust_ ) ;
4951const pointEvalsOptionFromRust = mapPointEvalsOption ( fieldFromRust ) ;
5052
51-
5253type NapiProofEvaluations = [
5354 0 ,
5455 MlOption < PointEvaluations < Uint8Array > > ,
@@ -129,7 +130,7 @@ function proofConversionPerField(
129130 commitments . free ( ) ;
130131 return [ 0 , wComm as MlTuple < PolyComm , 15 > , zComm , tComm , lookup ] ;
131132 }
132-
133+
133134 function lookupCommitmentsToRust ( lookup : LookupCommitments ) : NapiLookupCommitments {
134135 let sorted = core . polyCommsToRust ( lookup [ 1 ] ) ;
135136 let aggreg = core . polyCommToRust ( lookup [ 2 ] ) ;
@@ -143,7 +144,7 @@ function proofConversionPerField(
143144 lookup . free ( ) ;
144145 return [ 0 , sorted , aggreg , runtime ] ;
145146 }
146-
147+
147148 function openingProofToRust ( proof : OpeningProof ) : NapiOpeningProof {
148149 let [ _ , [ , ...lr ] , delta , z1 , z2 , sg ] = proof ;
149150 // We pass l and r as separate vectors over the FFI
@@ -175,8 +176,9 @@ function proofConversionPerField(
175176 proof . free ( ) ;
176177 return [ 0 , [ 0 , ...lr ] , delta , z1 , z2 , sg ] ;
177178 }
178-
179+
179180 function runtimeTableToRust ( [ , id , data ] : RuntimeTable ) : NapiRuntimeTable {
181+ console . log ( 'runtime table' ) ;
180182 return new RuntimeTable ( id , core . vectorToRust ( data ) ) ;
181183 }
182184
@@ -251,7 +253,7 @@ function proofConversionPerField(
251253 ] ;
252254 return [ 0 , publicEvals , proof ] ;
253255 } ,
254-
256+
255257 runtimeTablesToRust ( [ , ...tables ] : MlArray < RuntimeTable > ) : NapiRuntimeTable [ ] {
256258 return tables . map ( runtimeTableToRust ) ;
257259 } ,
0 commit comments