|
|
@@ -457,13 +457,21 @@ impl<'a> CodeGen<'a> {
|
|
|
}
|
|
|
AExprType::Point { is_vec: false, .. } => {
|
|
|
if allocated_vars.insert(id.clone()) {
|
|
|
+ // sigma-proofs reserves element index 0 for the
|
|
|
+ // canonical group generator. Reuse it whenever a
|
|
|
+ // declared point has that value; otherwise keep
|
|
|
+ // the point as an ordinary instance element.
|
|
|
element_allocs = quote! {
|
|
|
#element_allocs
|
|
|
- let #id = #lr_var.allocate_element();
|
|
|
- };
|
|
|
- element_assigns = quote! {
|
|
|
- #element_assigns
|
|
|
- #lr_var.set_element(#id, #instance_var.#id);
|
|
|
+ let #id = if #instance_var.#id
|
|
|
+ == <Point as group::Group>::generator()
|
|
|
+ {
|
|
|
+ #lr_var.generator()
|
|
|
+ } else {
|
|
|
+ let #id = #lr_var.allocate_element();
|
|
|
+ #lr_var.set_element(#id, #instance_var.#id);
|
|
|
+ #id
|
|
|
+ };
|
|
|
};
|
|
|
}
|
|
|
Ok(quote! {#id})
|