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

fix: remove shorthash override for same field #1008

Merged
merged 2 commits into from
Jan 19, 2024
Merged

Conversation

ivokub
Copy link
Collaborator

@ivokub ivokub commented Jan 19, 2024

Reported by @readygo67 in #1000.

Description

For proof recursion, we are using "short-hash". When computing Fiat-Shamir challenges in-circuit then instead of emulating the whole MiMC hash in non-native, we instead use the native hash of the circuit and map the values to the target field. For this mapping, we have to perform binary decomposition of the inputs and outputs to ensure that the constructed elements fit into the field.

We had a premature optimization for the case where the target field and native field are the same, then we omitted the binary decomposition by using native hash instead. However, this doesn't work well with the rest of the stack (Fiat-Shamir transcript object and recursion implementations), as we do not exclude bits what the rest of the stack assumes are removed.

It would be difficult to retrofit as would require handling edge-cases in point marshalling, Fiat-Shamir and recursion gadgets, so it is better to remove the optimization in whole. This PR does exactly this.

Fixes #1000.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

  • Test BN254-in-BN254 PLONK verification

How has this been benchmarked?

Not benchmarked

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

Copy link
Contributor

@yelhousni yelhousni left a comment

Choose a reason for hiding this comment

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

Makes sense 👍 it works and is not on the critical path for Linea, so we can merge.

@ivokub ivokub merged commit 6a5318b into master Jan 19, 2024
7 checks passed
@ivokub ivokub deleted the fix/shorthash-same branch January 19, 2024 14:53
@ivokub
Copy link
Collaborator Author

ivokub commented Jan 19, 2024

Thanks for prompt review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: In plonk recursion, if the inner /outer circuit both use BN254 curve, outer circuit prove fail
2 participants