1- use crate :: wasm_vector:: WasmVector ;
1+ use crate :: {
2+ wrappers:: group:: { WasmGPallas , WasmGVesta } ,
3+ wasm_vector:: WasmVector ,
4+ } ;
25use napi_derive:: napi;
36use paste:: paste;
47use poly_commitment:: commitment:: PolyComm ;
58
69macro_rules! impl_poly_comm {
710 (
8- $WasmG : ty,
11+ $wasm_g : ty,
912 $g: ty,
1013 $field_name: ident
1114 ) => {
@@ -14,14 +17,14 @@ macro_rules! impl_poly_comm {
1417 #[ derive( Clone ) ]
1518 pub struct [ <Wasm $field_name: camel PolyComm >] {
1619 #[ napi( skip) ]
17- pub unshifted: WasmVector <$WasmG >,
18- pub shifted: Option <$WasmG >,
20+ pub unshifted: WasmVector <$wasm_g >,
21+ pub shifted: Option <$wasm_g >,
1922 }
2023
2124 #[ napi]
2225 impl [ <Wasm $field_name: camel PolyComm >] {
2326 #[ napi( constructor) ]
24- pub fn new( unshifted: WasmVector <$WasmG >, shifted: Option <$WasmG >) -> Self {
27+ pub fn new( unshifted: WasmVector <$wasm_g >, shifted: Option <$wasm_g >) -> Self {
2528 assert!(
2629 shifted. is_none( ) ,
2730 "mina#14628: Shifted commitments are deprecated and must not be used" ,
@@ -30,20 +33,20 @@ macro_rules! impl_poly_comm {
3033 }
3134
3235 #[ napi( getter) ]
33- pub fn unshifted( & self ) -> WasmVector <$WasmG > {
36+ pub fn unshifted( & self ) -> WasmVector <$wasm_g > {
3437 self . unshifted. clone( )
3538 }
3639
3740 #[ napi( setter) ]
38- pub fn set_unshifted( & mut self , x : WasmVector <$WasmG >) {
39- self . unshifted = x ;
41+ pub fn set_unshifted( & mut self , value : WasmVector <$wasm_g >) {
42+ self . unshifted = value ;
4043 }
4144 }
4245
4346 impl From <PolyComm <$g>> for [ <Wasm $field_name: camel PolyComm >] {
44- fn from( x : PolyComm <$g>) -> Self {
45- let PolyComm { chunks } = x ;
46- let unshifted: Vec <$WasmG > = chunks. into_iter( ) . map( Into :: into) . collect( ) ;
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( ) ;
4750 Self {
4851 unshifted: unshifted. into( ) ,
4952 shifted: None ,
@@ -52,8 +55,8 @@ macro_rules! impl_poly_comm {
5255 }
5356
5457 impl From <& PolyComm <$g>> for [ <Wasm $field_name: camel PolyComm >] {
55- fn from( x : & PolyComm <$g>) -> Self {
56- let unshifted: Vec <$WasmG > = x . chunks. iter( ) . map( |chunk| ( * chunk) . into( ) ) . collect( ) ;
58+ fn from( value : & PolyComm <$g>) -> Self {
59+ let unshifted: Vec <$wasm_g > = value . chunks. iter( ) . map( |chunk| ( * chunk) . into( ) ) . collect( ) ;
5760 Self {
5861 unshifted: unshifted. into( ) ,
5962 shifted: None ,
@@ -62,14 +65,14 @@ macro_rules! impl_poly_comm {
6265 }
6366
6467 impl From <[ <Wasm $field_name: camel PolyComm >] > for PolyComm <$g> {
65- fn from( x : [ <Wasm $field_name: camel PolyComm >] ) -> Self {
66- let [ <Wasm $field_name: camel PolyComm >] { unshifted, shifted } = x ;
68+ fn from( value : [ <Wasm $field_name: camel PolyComm >] ) -> Self {
69+ let [ <Wasm $field_name: camel PolyComm >] { unshifted, shifted } = value ;
6770 assert!(
6871 shifted. is_none( ) ,
6972 "mina#14628: Shifted commitments are deprecated and must not be used" ,
7073 ) ;
7174 PolyComm {
72- chunks: Vec :: <$WasmG >:: from( unshifted)
75+ chunks: Vec :: <$wasm_g >:: from( unshifted)
7376 . into_iter( )
7477 . map( Into :: into)
7578 . collect( ) ,
@@ -78,13 +81,13 @@ macro_rules! impl_poly_comm {
7881 }
7982
8083 impl From <& [ <Wasm $field_name: camel PolyComm >] > for PolyComm <$g> {
81- fn from( x : & [ <Wasm $field_name: camel PolyComm >] ) -> Self {
84+ fn from( value : & [ <Wasm $field_name: camel PolyComm >] ) -> Self {
8285 assert!(
83- x . shifted. is_none( ) ,
86+ value . shifted. is_none( ) ,
8487 "mina#14628: Shifted commitments are deprecated and must not be used" ,
8588 ) ;
8689 PolyComm {
87- chunks: x
90+ chunks: value
8891 . unshifted
8992 . iter( )
9093 . cloned( )
@@ -99,15 +102,13 @@ macro_rules! impl_poly_comm {
99102
100103pub mod pallas {
101104 use super :: * ;
102- use crate :: wrappers:: group:: WasmGPallas ;
103105 use mina_curves:: pasta:: Pallas as GAffine ;
104106
105107 impl_poly_comm ! ( WasmGPallas , GAffine , Fq ) ;
106108}
107109
108110pub mod vesta {
109111 use super :: * ;
110- use crate :: wrappers:: group:: WasmGVesta ;
111112 use mina_curves:: pasta:: Vesta as GAffine ;
112113
113114 impl_poly_comm ! ( WasmGVesta , GAffine , Fp ) ;
0 commit comments