From f5af8785403914aa6220dd6121a5bb84dd690cde Mon Sep 17 00:00:00 2001 From: Giacomo Pasini Date: Mon, 16 Dec 2024 12:27:01 +0100 Subject: [PATCH] use included sha --- emmarin/cl/cl/Cargo.toml | 5 +++-- emmarin/cl/cl/src/cl/balance.rs | 2 +- emmarin/cl/cl/src/cl/input.rs | 2 +- emmarin/cl/cl/src/cl/merkle.rs | 2 +- emmarin/cl/cl/src/cl/mmr.rs | 2 +- emmarin/cl/cl/src/cl/note.rs | 7 +++---- emmarin/cl/cl/src/cl/nullifier.rs | 2 +- emmarin/cl/ledger/Cargo.toml | 3 +-- emmarin/cl/ledger_proof_statements/Cargo.toml | 2 +- emmarin/cl/ledger_proof_statements/src/bundle.rs | 2 +- 10 files changed, 14 insertions(+), 15 deletions(-) diff --git a/emmarin/cl/cl/Cargo.toml b/emmarin/cl/cl/Cargo.toml index ead4861..5dfae5f 100644 --- a/emmarin/cl/cl/Cargo.toml +++ b/emmarin/cl/cl/Cargo.toml @@ -12,5 +12,6 @@ rand = "0.8.5" rand_core = "0.6.0" hex = "0.4.3" curve25519-dalek = {version = "4.1", features = ["serde", "digest", "rand_core"]} -sha2 = "0.10" -lazy_static = "1.5.0" \ No newline at end of file +lazy_static = "1.5.0" +risc0-zkvm = "1.2" +sha2 = "0.10" \ No newline at end of file diff --git a/emmarin/cl/cl/src/cl/balance.rs b/emmarin/cl/cl/src/cl/balance.rs index 1f2cc99..74db387 100644 --- a/emmarin/cl/cl/src/cl/balance.rs +++ b/emmarin/cl/cl/src/cl/balance.rs @@ -1,6 +1,6 @@ use rand_core::CryptoRngCore; +use risc0_zkvm::sha::rust_crypto::{Digest, Sha256}; use serde::{Deserialize, Serialize}; -use sha2::{Digest, Sha256}; use crate::cl::PartialTxWitness; diff --git a/emmarin/cl/cl/src/cl/input.rs b/emmarin/cl/cl/src/cl/input.rs index 56a6a08..a4d3085 100644 --- a/emmarin/cl/cl/src/cl/input.rs +++ b/emmarin/cl/cl/src/cl/input.rs @@ -11,7 +11,7 @@ use crate::{ zone_layer::notes::ZoneId, }; use serde::{Deserialize, Serialize}; -use sha2::{Digest, Sha256}; +use risc0_zkvm::sha::rust_crypto::{Digest, Sha256}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub struct Input { diff --git a/emmarin/cl/cl/src/cl/merkle.rs b/emmarin/cl/cl/src/cl/merkle.rs index d88923d..3b21614 100644 --- a/emmarin/cl/cl/src/cl/merkle.rs +++ b/emmarin/cl/cl/src/cl/merkle.rs @@ -1,5 +1,5 @@ use serde::{Deserialize, Serialize}; -use sha2::{Digest, Sha256}; +use risc0_zkvm::sha::rust_crypto::{Digest, Sha256}; pub fn padded_leaves(elements: &[Vec]) -> [[u8; 32]; N] { let mut leaves = [[0u8; 32]; N]; diff --git a/emmarin/cl/cl/src/cl/mmr.rs b/emmarin/cl/cl/src/cl/mmr.rs index 62e8ff1..66284a1 100644 --- a/emmarin/cl/cl/src/cl/mmr.rs +++ b/emmarin/cl/cl/src/cl/mmr.rs @@ -1,6 +1,6 @@ use crate::cl::merkle; +use risc0_zkvm::sha::rust_crypto::{Digest, Sha256}; use serde::{Deserialize, Serialize}; -use sha2::{Digest, Sha256}; use std::cmp::Ordering; #[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)] diff --git a/emmarin/cl/cl/src/cl/note.rs b/emmarin/cl/cl/src/cl/note.rs index e9b6c31..675df6a 100644 --- a/emmarin/cl/cl/src/cl/note.rs +++ b/emmarin/cl/cl/src/cl/note.rs @@ -1,8 +1,7 @@ -use rand::RngCore; -use serde::{Deserialize, Serialize}; -use sha2::{Digest, Sha256}; - use crate::cl::{balance::Unit, nullifier::NullifierCommitment}; +use rand::RngCore; +use risc0_zkvm::sha::rust_crypto::{Digest, Sha256}; +use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] pub struct Constraint(pub [u8; 32]); diff --git a/emmarin/cl/cl/src/cl/nullifier.rs b/emmarin/cl/cl/src/cl/nullifier.rs index 9af8265..a2af8f8 100644 --- a/emmarin/cl/cl/src/cl/nullifier.rs +++ b/emmarin/cl/cl/src/cl/nullifier.rs @@ -8,7 +8,7 @@ use rand_core::RngCore; use serde::{Deserialize, Serialize}; -use sha2::{Digest, Sha256}; +use risc0_zkvm::sha::rust_crypto::{Digest, Sha256}; use crate::cl::NoteCommitment; diff --git a/emmarin/cl/ledger/Cargo.toml b/emmarin/cl/ledger/Cargo.toml index 6bde197..c4d5495 100644 --- a/emmarin/cl/ledger/Cargo.toml +++ b/emmarin/cl/ledger/Cargo.toml @@ -14,5 +14,4 @@ risc0-zkvm = { version = "1.0", features = ["prove", "metal"] } risc0-groth16 = { version = "1.0" } rand = "0.8.5" rand_core = "0.6.0" -thiserror = "1.0.62" -sha2 = "0.10" +thiserror = "1.0.62" \ No newline at end of file diff --git a/emmarin/cl/ledger_proof_statements/Cargo.toml b/emmarin/cl/ledger_proof_statements/Cargo.toml index 4a2f051..64ec791 100644 --- a/emmarin/cl/ledger_proof_statements/Cargo.toml +++ b/emmarin/cl/ledger_proof_statements/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" [dependencies] cl = { path = "../cl" } serde = { version = "1.0", features = ["derive"] } -sha2 = "0.10" \ No newline at end of file +risc0-zkvm = "1.2" \ No newline at end of file diff --git a/emmarin/cl/ledger_proof_statements/src/bundle.rs b/emmarin/cl/ledger_proof_statements/src/bundle.rs index abefbb3..8952bb7 100644 --- a/emmarin/cl/ledger_proof_statements/src/bundle.rs +++ b/emmarin/cl/ledger_proof_statements/src/bundle.rs @@ -4,8 +4,8 @@ use cl::{ cl::{BalanceWitness, NoteCommitment, Nullifier}, zone_layer::notes::ZoneId, }; +use risc0_zkvm::sha::rust_crypto::{Digest, Sha256}; use serde::{Deserialize, Serialize}; -use sha2::{Digest, Sha256}; use crate::ptx::PtxPublic;