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

Stop using hard-coded compile-time verification keys #8584

Merged
merged 8 commits into from
Apr 8, 2021

Conversation

mrmr1993
Copy link
Member

@mrmr1993 mrmr1993 commented Apr 7, 2021

This PR builds upon #8497. This ensures that we don't depend on verification keys from the Precomputed_values library, which will not necessarily be the correct ones if we switch between signature schemes.

Checklist:

  • Document code purpose, how to use it
    • Mention expected invariants, implicit constraints
  • Tests were added for the new behavior
    • Document test purpose, significance of failures
    • Test names should reflect their purpose
  • All tests pass (CI will check this if you didn't)
  • Serialized types are in stable-versioned modules
  • Does this close issues? List them:

@mrmr1993 mrmr1993 added the ci-build-me Add this label to trigger a circle+buildkite build for this branch label Apr 7, 2021
@mrmr1993 mrmr1993 requested review from a team as code owners April 7, 2021 19:16
Base automatically changed from feature/optional-compiled-genesis-proof to compatible April 7, 2021 21:23
@mrmr1993
Copy link
Member Author

mrmr1993 commented Apr 7, 2021

Reviewer guide:

  • the basic changes are
    • use the snark keys for the configuration that we start with, rather than the compile-time ones from Precomputed_values
    • use the hashes for those keys instead of the compile-time ones from Precomputed_values when computing the chain-id
  • the tweaks to Transaction_snark and Blockchain_snark_state make the hashes available from their functors
    • crypto code is unchanged
  • in order to choose the correct keys, the verifier takes the configuration as an additional argument
    • all of the callsites -- mostly unit tests -- are updated with this new argument (the vast majority of the diff)
  • the chain-id calculations are updated to use the hashes for the config's snark keys
    • these are added to the Genesis_proof.t = Precomputed_values.t type, so that they are easily kept in sync and available everywhere we need them
  • the command to list compile-time snark key hashes is updated
    • if there is no compile-time proof, then no keys are stored and the command lists no hashes
    • this was called by a couple of scripts but the results were never used, and this wasn't used elsewhere. These calls have been removed.

@bkase
Copy link
Member

bkase commented Apr 7, 2021

!approved-for-mainnet

Copy link
Member

@deepthiskumar deepthiskumar left a comment

Choose a reason for hiding this comment

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

Should we remove this fatal error when constraint constants don't match?

@mrmr1993
Copy link
Member Author

mrmr1993 commented Apr 8, 2021

Should we remove this fatal error when constraint constants don't match?

I think we should do this as a follow-up PR, I've tested the signatures interaction for this series, but I'd like to test changing the constraint constants themselves before we go all in.

@mrmr1993 mrmr1993 merged commit c83b2b1 into compatible Apr 8, 2021
@mrmr1993 mrmr1993 deleted the feature/no-precomputed-values branch April 8, 2021 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-build-me Add this label to trigger a circle+buildkite build for this branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants