Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poseidon evm hasher optimizations for lower input widths #43

Open
kilic opened this issue May 4, 2020 · 0 comments
Open

Poseidon evm hasher optimizations for lower input widths #43

kilic opened this issue May 4, 2020 · 0 comments

Comments

@kilic
Copy link

kilic commented May 4, 2020

With lower values of t there are some tricks that can be applied to reduce gas cost.

  • Use add instead of addmod in mds multiplication and round constant phases. bn254 base field is suitable for deferred reductions upto 5 since 2**256 / Q ~= 5.29
  • Use stack intensively by storing some of matrix cells at stack.

Applying these for (3, 8, 55) setup, I'm observing reduction of gas cost from 35k to 21k. Here you can check the example.

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

No branches or pull requests

1 participant