mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
crypto: minor cleanup
This commit is contained in:
@@ -2,11 +2,11 @@ use std::{fs::*, path::PathBuf, time::Instant};
|
||||
|
||||
use crate::{
|
||||
crypto::proof::{ProvingKey, VerifyingKey},
|
||||
util::serial::Decodable,
|
||||
zk::{circuit::MintContract, vm},
|
||||
Result,
|
||||
};
|
||||
|
||||
use super::{serial::Decodable, Result};
|
||||
|
||||
pub struct ContractLoader {}
|
||||
|
||||
impl ContractLoader {
|
||||
@@ -69,7 +69,7 @@ impl ContractLoader {
|
||||
|
||||
pub fn create_prk(name: String) -> Result<()> {
|
||||
// TODO: implement this
|
||||
let _mint_vk = ProvingKey::build(11, MintContract::default());
|
||||
let _mint_pk = ProvingKey::build(11, MintContract::default());
|
||||
let _file = File::create(name + ".prk")?;
|
||||
// TODO: serialize and save file
|
||||
Ok(())
|
||||
|
||||
@@ -4,6 +4,7 @@ pub mod coin;
|
||||
pub mod constants;
|
||||
pub mod diffie_hellman;
|
||||
pub mod keypair;
|
||||
pub mod loader;
|
||||
pub mod merkle_node;
|
||||
pub mod mint_proof;
|
||||
pub mod note;
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::io;
|
||||
use halo2::{
|
||||
plonk,
|
||||
plonk::Circuit,
|
||||
poly::commitment,
|
||||
poly::commitment::Params,
|
||||
transcript::{Blake2bRead, Blake2bWrite},
|
||||
};
|
||||
use pasta_curves::vesta;
|
||||
@@ -17,13 +17,13 @@ use crate::{
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct VerifyingKey {
|
||||
pub params: commitment::Params<vesta::Affine>,
|
||||
pub params: Params<vesta::Affine>,
|
||||
pub vk: plonk::VerifyingKey<vesta::Affine>,
|
||||
}
|
||||
|
||||
impl VerifyingKey {
|
||||
pub fn build(k: u32, c: impl Circuit<DrkCircuitField>) -> Self {
|
||||
let params = commitment::Params::new(k);
|
||||
let params = Params::new(k);
|
||||
let vk = plonk::keygen_vk(¶ms, &c).unwrap();
|
||||
VerifyingKey { params, vk }
|
||||
}
|
||||
@@ -31,13 +31,13 @@ impl VerifyingKey {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ProvingKey {
|
||||
pub params: commitment::Params<vesta::Affine>,
|
||||
pub params: Params<vesta::Affine>,
|
||||
pub pk: plonk::ProvingKey<vesta::Affine>,
|
||||
}
|
||||
|
||||
impl ProvingKey {
|
||||
pub fn build(k: u32, c: impl Circuit<DrkCircuitField>) -> Self {
|
||||
let params = commitment::Params::new(k);
|
||||
let params = Params::new(k);
|
||||
let vk = plonk::keygen_vk(¶ms, &c).unwrap();
|
||||
let pk = plonk::keygen_pk(¶ms, vk, &c).unwrap();
|
||||
ProvingKey { params, pk }
|
||||
|
||||
Reference in New Issue
Block a user