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

Upgrade to snarkVM #317

Merged
merged 19 commits into from
Jul 28, 2021
Merged

Upgrade to snarkVM #317

merged 19 commits into from
Jul 28, 2021

Conversation

howardwu
Copy link
Collaborator

@howardwu howardwu commented Jul 28, 2021

Motivation

This PR upgrades the aleo-setup repository to snarkVM on the testnet2 branch, which uses hash to curve for curve generators and all cryptographic primitives related to account derivation for this repository.

  • Upgrades all usage of rand to v0.8 and enforces CryptoRng across the board
  • Removes all usage of rand_xorshift in favor of rand_chacha to enforce CryptoRng
  • Deprecates all usage of snarkOS-toolkit in favor of snarkVM-dpc
  • Updates CI to use Rust 1.53.0
  • [Critical] Changes signature format to have unambiguous serialization, please observe the new approach:
// Before
let signature_string = view_key.sign(&message.into_bytes(), rng)?.to_string();
let signature_struct = Signature::from_str(&signature_string)?;

// After
let signature_string = hex::encode(view_key.sign(&message.into_bytes(), rng)?.to_bytes_le()?);
let signature_struct: <<Testnet2Parameters as Parameters>::AccountSignatureScheme as SignatureScheme>::Signature = FromBytes::from_bytes_le(&hex::decode(signature_string)?)?;

Remarks

aleo-setup/phase2 needs to be reviewed in detail, it is very much out of date at this point. Most notably, some things to watch out for are:

  • There exists a seeded ChaChaRng based hash_to_g2 implementation in here.
  • There exists legacy/inefficient converters for compatibility with libzexe which is deprecated.
  • The aleo_compatibility integration test is commented out, given we do not need to cross-check anymore. This file should not be deleted, but rather updated to sanity check the Phase2 execution. Please see the equivalent phase1/tests/marlin.rs file to see how this conversion was done.

The same applies for the setup2 module. Most notable:

  • [Critical] The rng in Setup2::new() was previously hardcoded terribly as XorShiftRng::from_seed([0u8; 16])
  • This module is now pegged to snarkvm_dpc::testnet2 however the instantiation of this inside setup2 has not been inspected.
  • There exists legacy/inefficient converters for compatibility with libzexe which is deprecated.

@howardwu howardwu added dependencies Pull requests that update a dependency file enhancement New feature or request refactor Changes which affect the maintainability of the code labels Jul 28, 2021
@howardwu howardwu marked this pull request as ready for review July 28, 2021 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request refactor Changes which affect the maintainability of the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants