1- use crate :: {
2- wrappers:: group:: { WasmGPallas , WasmGVesta } ,
3- wasm_vector:: WasmVector ,
4- } ;
1+ use crate :: wasm_vector:: WasmVector ;
52use napi_derive:: napi;
63use paste:: paste;
74use poly_commitment:: commitment:: PolyComm ;
85
96macro_rules! impl_poly_comm {
107 (
11- $wasm_g : ty,
8+ $WasmG : ty,
129 $g: ty,
1310 $field_name: ident
1411 ) => {
@@ -17,14 +14,14 @@ macro_rules! impl_poly_comm {
1714 #[ derive( Clone ) ]
1815 pub struct [ <Wasm $field_name: camel PolyComm >] {
1916 #[ napi( skip) ]
20- pub unshifted: WasmVector <$wasm_g >,
21- pub shifted: Option <$wasm_g >,
17+ pub unshifted: WasmVector <$WasmG >,
18+ pub shifted: Option <$WasmG >,
2219 }
2320
2421 #[ napi]
2522 impl [ <Wasm $field_name: camel PolyComm >] {
2623 #[ napi( constructor) ]
27- pub fn new( unshifted: WasmVector <$wasm_g >, shifted: Option <$wasm_g >) -> Self {
24+ pub fn new( unshifted: WasmVector <$WasmG >, shifted: Option <$WasmG >) -> Self {
2825 assert!(
2926 shifted. is_none( ) ,
3027 "mina#14628: Shifted commitments are deprecated and must not be used" ,
@@ -33,20 +30,20 @@ macro_rules! impl_poly_comm {
3330 }
3431
3532 #[ napi( getter) ]
36- pub fn unshifted( & self ) -> WasmVector <$wasm_g > {
33+ pub fn unshifted( & self ) -> WasmVector <$WasmG > {
3734 self . unshifted. clone( )
3835 }
3936
4037 #[ napi( setter) ]
41- pub fn set_unshifted( & mut self , value : WasmVector <$wasm_g >) {
42- self . unshifted = value ;
38+ pub fn set_unshifted( & mut self , x : WasmVector <$WasmG >) {
39+ self . unshifted = x ;
4340 }
4441 }
4542
4643 impl From <PolyComm <$g>> for [ <Wasm $field_name: camel PolyComm >] {
47- fn from( value : PolyComm <$g>) -> Self {
48- let PolyComm { chunks } = value ;
49- let unshifted: Vec <$wasm_g > = chunks. into_iter( ) . map( Into :: into) . collect( ) ;
44+ fn from( x : PolyComm <$g>) -> Self {
45+ let PolyComm { chunks } = x ;
46+ let unshifted: Vec <$WasmG > = chunks. into_iter( ) . map( Into :: into) . collect( ) ;
5047 Self {
5148 unshifted: unshifted. into( ) ,
5249 shifted: None ,
@@ -55,8 +52,8 @@ macro_rules! impl_poly_comm {
5552 }
5653
5754 impl From <& PolyComm <$g>> for [ <Wasm $field_name: camel PolyComm >] {
58- fn from( value : & PolyComm <$g>) -> Self {
59- let unshifted: Vec <$wasm_g > = value . chunks. iter( ) . map( |chunk| ( * chunk) . into( ) ) . collect( ) ;
55+ fn from( x : & PolyComm <$g>) -> Self {
56+ let unshifted: Vec <$WasmG > = x . chunks. iter( ) . map( |chunk| ( * chunk) . into( ) ) . collect( ) ;
6057 Self {
6158 unshifted: unshifted. into( ) ,
6259 shifted: None ,
@@ -65,14 +62,14 @@ macro_rules! impl_poly_comm {
6562 }
6663
6764 impl From <[ <Wasm $field_name: camel PolyComm >] > for PolyComm <$g> {
68- fn from( value : [ <Wasm $field_name: camel PolyComm >] ) -> Self {
69- let [ <Wasm $field_name: camel PolyComm >] { unshifted, shifted } = value ;
65+ fn from( x : [ <Wasm $field_name: camel PolyComm >] ) -> Self {
66+ let [ <Wasm $field_name: camel PolyComm >] { unshifted, shifted } = x ;
7067 assert!(
7168 shifted. is_none( ) ,
7269 "mina#14628: Shifted commitments are deprecated and must not be used" ,
7370 ) ;
7471 PolyComm {
75- chunks: Vec :: <$wasm_g >:: from( unshifted)
72+ chunks: Vec :: <$WasmG >:: from( unshifted)
7673 . into_iter( )
7774 . map( Into :: into)
7875 . collect( ) ,
@@ -81,13 +78,13 @@ macro_rules! impl_poly_comm {
8178 }
8279
8380 impl From <& [ <Wasm $field_name: camel PolyComm >] > for PolyComm <$g> {
84- fn from( value : & [ <Wasm $field_name: camel PolyComm >] ) -> Self {
81+ fn from( x : & [ <Wasm $field_name: camel PolyComm >] ) -> Self {
8582 assert!(
86- value . shifted. is_none( ) ,
83+ x . shifted. is_none( ) ,
8784 "mina#14628: Shifted commitments are deprecated and must not be used" ,
8885 ) ;
8986 PolyComm {
90- chunks: value
87+ chunks: x
9188 . unshifted
9289 . iter( )
9390 . cloned( )
@@ -102,13 +99,15 @@ macro_rules! impl_poly_comm {
10299
103100pub mod pallas {
104101 use super :: * ;
102+ use crate :: wrappers:: group:: WasmGPallas ;
105103 use mina_curves:: pasta:: Pallas as GAffine ;
106104
107105 impl_poly_comm ! ( WasmGPallas , GAffine , Fq ) ;
108106}
109107
110108pub mod vesta {
111109 use super :: * ;
110+ use crate :: wrappers:: group:: WasmGVesta ;
112111 use mina_curves:: pasta:: Vesta as GAffine ;
113112
114113 impl_poly_comm ! ( WasmGVesta , GAffine , Fp ) ;
0 commit comments