From 6ef9efcde65c3ef7a2bae645631cb804d2ce6d10 Mon Sep 17 00:00:00 2001 From: benr-ml <112846738+benr-ml@users.noreply.github.com> Date: Mon, 13 Mar 2023 09:42:42 +0200 Subject: [PATCH] Update fastcrypto pointer (#9192) ## Description Update fastcrypto pointer ## Test Plan All tests pass --- Cargo.lock | 19 ++++++++++++++++--- Cargo.toml | 4 ++-- .../src/natives/crypto/groth16.rs | 2 +- crates/workspace-hack/Cargo.toml | 12 +++++++----- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1d1f05f3fc1b2..25688d9e1cfa0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -253,6 +253,17 @@ dependencies = [ "ark-std 0.4.0", ] +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec 0.4.1", + "ark-ff 0.4.1", + "ark-std 0.4.0", +] + [[package]] name = "ark-crypto-primitives" version = "0.4.0" @@ -3007,7 +3018,7 @@ dependencies = [ [[package]] name = "fastcrypto" version = "0.1.4" -source = "git+https://github.com/MystenLabs/fastcrypto?rev=5454b7f65632b35cb9503fb14ac0aca3823b5706#5454b7f65632b35cb9503fb14ac0aca3823b5706" +source = "git+https://github.com/MystenLabs/fastcrypto?rev=9fbe55e9d477eac6a6d13e872e1dee19b0c83f53#9fbe55e9d477eac6a6d13e872e1dee19b0c83f53" dependencies = [ "aes", "aes-gcm", @@ -3055,7 +3066,7 @@ dependencies = [ [[package]] name = "fastcrypto-derive" version = "0.1.2" -source = "git+https://github.com/MystenLabs/fastcrypto?rev=5454b7f65632b35cb9503fb14ac0aca3823b5706#5454b7f65632b35cb9503fb14ac0aca3823b5706" +source = "git+https://github.com/MystenLabs/fastcrypto?rev=9fbe55e9d477eac6a6d13e872e1dee19b0c83f53#9fbe55e9d477eac6a6d13e872e1dee19b0c83f53" dependencies = [ "convert_case 0.6.0", "proc-macro2 1.0.51", @@ -3066,9 +3077,10 @@ dependencies = [ [[package]] name = "fastcrypto-zkp" version = "0.1.0" -source = "git+https://github.com/MystenLabs/fastcrypto?rev=5454b7f65632b35cb9503fb14ac0aca3823b5706#5454b7f65632b35cb9503fb14ac0aca3823b5706" +source = "git+https://github.com/MystenLabs/fastcrypto?rev=9fbe55e9d477eac6a6d13e872e1dee19b0c83f53#9fbe55e9d477eac6a6d13e872e1dee19b0c83f53" dependencies = [ "ark-bls12-381", + "ark-bn254", "ark-crypto-primitives", "ark-ec 0.4.1", "ark-ff 0.4.1", @@ -11585,6 +11597,7 @@ dependencies = [ "arc-swap", "ark-bls12-377", "ark-bls12-381", + "ark-bn254", "ark-crypto-primitives", "ark-ec 0.3.0", "ark-ec 0.4.1", diff --git a/Cargo.toml b/Cargo.toml index 3e66cb7285638..d473881568b5a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -129,8 +129,8 @@ move-prover-boogie-backend = { git = "https://github.com/move-language/move", re move-stackless-bytecode = { git = "https://github.com/move-language/move", rev = "8729cf2445696cb29f1e0ca06df7d09cf3c2c55f" } move-symbol-pool = { git = "https://github.com/move-language/move", rev = "8729cf2445696cb29f1e0ca06df7d09cf3c2c55f" } -fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "5454b7f65632b35cb9503fb14ac0aca3823b5706" } -fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "5454b7f65632b35cb9503fb14ac0aca3823b5706", package = "fastcrypto-zkp" } +fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "9fbe55e9d477eac6a6d13e872e1dee19b0c83f53" } +fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "9fbe55e9d477eac6a6d13e872e1dee19b0c83f53", package = "fastcrypto-zkp" } # anemo dependencies anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "d4017b6cefad7ebc5e84b5c6b8eeff4668f719ff" } diff --git a/crates/sui-framework/src/natives/crypto/groth16.rs b/crates/sui-framework/src/natives/crypto/groth16.rs index 14872bd75ef71..e8dd6f2f4f056 100644 --- a/crates/sui-framework/src/natives/crypto/groth16.rs +++ b/crates/sui-framework/src/natives/crypto/groth16.rs @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 use crate::legacy_empty_cost; -use fastcrypto_zkp::api::{prepare_pvk_bytes, verify_groth16_in_bytes}; +use fastcrypto_zkp::bls12381::api::{prepare_pvk_bytes, verify_groth16_in_bytes}; use move_binary_format::errors::PartialVMResult; use move_vm_runtime::native_functions::NativeContext; use move_vm_types::{ diff --git a/crates/workspace-hack/Cargo.toml b/crates/workspace-hack/Cargo.toml index 8eeabb7ca6cf6..921a82fd09e3c 100644 --- a/crates/workspace-hack/Cargo.toml +++ b/crates/workspace-hack/Cargo.toml @@ -35,6 +35,7 @@ anyhow = { version = "1", features = ["backtrace"] } arc-swap = { version = "1", default-features = false, features = ["serde"] } ark-bls12-377 = { version = "0.3", features = ["std"] } ark-bls12-381 = { version = "0.4" } +ark-bn254 = { version = "0.4" } ark-crypto-primitives = { version = "0.4", features = ["parallel", "prf", "r1cs", "snark"] } ark-ec-468e82937335b1c9 = { package = "ark-ec", version = "0.3", default-features = false, features = ["std"] } ark-ec-9fbad63c4bcf4a8f = { package = "ark-ec", version = "0.4", features = ["parallel"] } @@ -198,8 +199,8 @@ expect-test = { version = "1", default-features = false } eyre = { version = "0.6" } fail-9fbad63c4bcf4a8f = { package = "fail", version = "0.4", default-features = false } fail-d8f496e17d97b5cb = { package = "fail", version = "0.5", default-features = false } -fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "5454b7f65632b35cb9503fb14ac0aca3823b5706", features = ["copy_key"] } -fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "5454b7f65632b35cb9503fb14ac0aca3823b5706", default-features = false } +fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "9fbe55e9d477eac6a6d13e872e1dee19b0c83f53", features = ["copy_key"] } +fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "9fbe55e9d477eac6a6d13e872e1dee19b0c83f53", default-features = false } fastrand = { version = "1", default-features = false } fd-lock = { version = "3", default-features = false } fdlimit = { version = "0.2", default-features = false } @@ -664,6 +665,7 @@ anyhow = { version = "1", features = ["backtrace"] } arc-swap = { version = "1", default-features = false, features = ["serde"] } ark-bls12-377 = { version = "0.3", features = ["std"] } ark-bls12-381 = { version = "0.4" } +ark-bn254 = { version = "0.4" } ark-crypto-primitives = { version = "0.4", features = ["parallel", "prf", "r1cs", "snark"] } ark-ec-468e82937335b1c9 = { package = "ark-ec", version = "0.3", default-features = false, features = ["std"] } ark-ec-9fbad63c4bcf4a8f = { package = "ark-ec", version = "0.4", features = ["parallel"] } @@ -862,9 +864,9 @@ expect-test = { version = "1", default-features = false } eyre = { version = "0.6" } fail-9fbad63c4bcf4a8f = { package = "fail", version = "0.4", default-features = false } fail-d8f496e17d97b5cb = { package = "fail", version = "0.5", default-features = false } -fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "5454b7f65632b35cb9503fb14ac0aca3823b5706", features = ["copy_key"] } -fastcrypto-derive = { git = "https://github.com/MystenLabs/fastcrypto", rev = "5454b7f65632b35cb9503fb14ac0aca3823b5706", default-features = false } -fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "5454b7f65632b35cb9503fb14ac0aca3823b5706", default-features = false } +fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "9fbe55e9d477eac6a6d13e872e1dee19b0c83f53", features = ["copy_key"] } +fastcrypto-derive = { git = "https://github.com/MystenLabs/fastcrypto", rev = "9fbe55e9d477eac6a6d13e872e1dee19b0c83f53", default-features = false } +fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "9fbe55e9d477eac6a6d13e872e1dee19b0c83f53", default-features = false } fastrand = { version = "1", default-features = false } fd-lock = { version = "3", default-features = false } fdlimit = { version = "0.2", default-features = false }