Skip to content

Conversation

@Vindaar
Copy link
Contributor

@Vindaar Vindaar commented Dec 17, 2025

I started looking at the following two comments:

to see if there was some room for optimization here by precomputing things (I don't believe so; apply is only called in non hot code paths directly and is the only place where we construct the domain separator on each call). While looking into this, I realized that the poseidon_safe_domain_separator helper was more complicated than necessary.

The doc comment previously explained that the function was specific to a single Poseidon permutation. However, it still tried to be generic. As a result the code was more complex than necessary (3 additional generic arguments) and technically broken for any permutation that does not use 24 field elements.

Instead it now is indeed specific to the poseidon2 permutation with 24 field elements.

For the use case of producing packed data, we simply broadcast the result after calling the function. This is only used in the preamble of the compute_tree_leaves code anyway.

I personally prefer code less generic than necessary, but I understand if we don't want to merge this.

The doc comment previously explained that the function was specific to
a single Poseidon permutation. However, it still tried to be
generic. As a result the code was more complex than necessary (3
additional generic arguments) and technically broken for any
permutation that does not use 24 field elements.

Instead it now is indeed specific to the poseidon2 permutation with 24
field elements.

For the use case of producing packed data, we simply broadcast the
result after calling the function. This is only used in the preamble
of the `compute_tree_leaves` code anyway.
Copy link
Contributor

@tcoratger tcoratger left a comment

Choose a reason for hiding this comment

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

Thanks this makes sense since this repo is a specialized version of XMSS for Ethereum so that we don't need the generic thing.

@tcoratger tcoratger merged commit b621826 into leanEthereum:main Dec 17, 2025
2 checks passed
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.

2 participants