This commit is contained in:
kilic 2020-06-07 18:48:04 +03:00
parent b7e2954a69
commit bc5c0e1363
3 changed files with 16 additions and 7 deletions

View File

@ -1,3 +1,14 @@
# RLN
[see wip document about rln](https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view)
This is the development repo of rate limit nullifier zkSNARK circuits.
For details, see work in progress document [here](https://hackmd.io/tMTLMYmTR5eynw2lwK9n1w?view))
## Wasm support
### Test
```
wasm-pack test --release --node -- --features wasm
```

View File

@ -7,7 +7,7 @@ pub struct MerkleTree<E>
where
E: Engine,
{
hasher: Hasher<E>,
pub hasher: Hasher<E>,
zero: Vec<E::Fr>,
depth: usize,
nodes: HashMap<(usize, usize), E::Fr>,
@ -72,8 +72,8 @@ where
}
}
};
self.recalculate_from(leaf_index);
let leaf = self.hasher.hash(vec![new]);
self.update(leaf_index, leaf);
}
pub fn update(&mut self, leaf_index: usize, leaf: E::Fr) {

View File

@ -56,7 +56,6 @@ impl<E: Engine> PoseidonParams<E> {
}
pub fn round_constant(&self, round: usize) -> E::Fr {
let w = self.width();
return self.round_constants[round];
}
@ -193,8 +192,7 @@ impl<E: Engine> Poseidon<E> {
}
fn add_round_constants(&mut self, round: usize) {
let w = self.params.t;
for (j, b) in self.state.iter_mut().enumerate() {
for (_, b) in self.state.iter_mut().enumerate() {
let c = self.params.round_constants[round];
b.add_assign(&c);
}