Skip to content

Conversation

@ThomasPiellard
Copy link
Contributor

Description

Fixes # 697

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@ThomasPiellard ThomasPiellard requested a review from Tabaie June 20, 2025 15:52
@Tabaie Tabaie requested a review from Copilot June 23, 2025 01:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issue #697 by updating the BlockSize computation and corresponding memory allocation to use a dynamic calculation based on the permutation parameters rather than a constant value.

  • Updated the BlockSize method to return (h.params.Width / 2)*fr.Bytes across multiple permutation implementations.
  • Revised the hash initialization functions to allocate byte slices using the computed block size.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
field/koalabear/poseidon2/poseidon2.go Updated BlockSize method to use h.params.Width / 2 * fr.Bytes
field/koalabear/poseidon2/hash.go Updated Merkle Damgard hasher to use dynamic block size
field/goldilocks/poseidon2/poseidon2.go Updated BlockSize method to use h.params.Width / 2 * fr.Bytes
field/goldilocks/poseidon2/hash.go Revised hash initialization with dynamic block size allocation
field/generator/internal/templates/poseidon2/poseidon2.go.tmpl Updated BlockSize method template to compute dynamic block size
field/generator/internal/templates/poseidon2/hash.go.tmpl Updated template for hash initializer to use dynamic block size
field/babybear/poseidon2/poseidon2.go Updated BlockSize method to compute dynamic block size
field/babybear/poseidon2/hash.go Updated Merkle Damgard hasher to use dynamic block size allocation

@ThomasPiellard ThomasPiellard merged commit 0569cf8 into master Jun 23, 2025
6 checks passed
@ThomasPiellard ThomasPiellard deleted the fix/issue_697 branch June 23, 2025 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants