Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
pull-requests: write

steps:
- name: Checkout sources
Expand Down
11 changes: 4 additions & 7 deletions src/poseidon2.nr
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ impl Poseidon2 {

fn perform_duplex(&mut self) {
// add the cache into sponge state
for i in 0..RATE {
// We effectively zero-pad the cache by only adding to the state
// cache that is less than the specified `cache_size`
if i < self.cache_size {
self.state[i] += self.cache[i];
}
}
self.state[0] += self.cache[0] * (0 < self.cache_size) as Field;
self.state[1] += self.cache[1] * (1 < self.cache_size) as Field;
self.state[2] += self.cache[2] * (2 < self.cache_size) as Field;
self.state[3] += self.cache[3] * (3 < self.cache_size) as Field;
self.state = crate::poseidon2_permutation(self.state, 4);
}

Expand Down