create zk module

This commit is contained in:
ghassmo
2022-01-08 18:39:44 +04:00
parent aa6fbc1085
commit 2c46091faa
11 changed files with 12 additions and 10 deletions

View File

@@ -18,7 +18,7 @@ use darkfi::{
util::pedersen_commitment_u64,
},
serial::Decodable,
vm,
zk::vm,
};
fn main() -> std::result::Result<(), failure::Error> {

View File

@@ -27,7 +27,7 @@ use darkfi::{
util::pedersen_commitment_u64,
},
serial::Decodable,
vm,
zk::vm,
};
fn root(path: [pallas::Base; 32], leaf_pos: u32, leaf: pallas::Base) -> pallas::Base {

View File

@@ -2,14 +2,12 @@ pub mod blockchain;
pub mod circuit;
pub mod cli;
pub mod crypto;
pub mod endian;
pub mod net;
pub mod rpc;
pub mod system;
pub mod tx;
pub mod types;
pub mod vm;
pub mod vm_serial;
pub mod zk;
pub mod node;

View File

@@ -1,6 +1,6 @@
use futures::prelude::*;
use crate::{endian, serial::VarInt, Error, Result};
use super::{endian, serial::VarInt, Error, Result};
impl VarInt {
pub async fn encode_async<W: AsyncWrite + Unpin>(&self, stream: &mut W) -> Result<usize> {

View File

@@ -3,10 +3,11 @@ use std::{fs::*, path::PathBuf, time::Instant};
use crate::{
circuit::MintContract,
crypto::proof::{ProvingKey, VerifyingKey},
serial::Decodable,
vm, Result,
zk::vm,
};
use super::{serial::Decodable, Result};
pub struct ContractLoader {}
impl ContractLoader {

View File

@@ -1,6 +1,7 @@
pub mod address;
pub mod async_serial;
pub mod async_util;
pub mod endian;
pub mod error;
pub mod loader;
pub mod net_name;

View File

@@ -8,7 +8,7 @@ use std::{
use num_bigint::BigUint;
use crate::{
use super::{
endian,
error::{Error, Result},
};

2
src/zk/mod.rs Normal file
View File

@@ -0,0 +1,2 @@
pub mod vm;
pub mod vm_serial;

View File

@@ -1,10 +1,10 @@
use std::io;
use super::vm::{ZkBinary, ZkContract, ZkFunctionCall, ZkType};
use crate::{
error::{Error, Result},
impl_vec,
serial::{Decodable, Encodable, ReadExt, VarInt},
vm::{ZkBinary, ZkContract, ZkFunctionCall, ZkType},
};
impl_vec!((String, ZkType));