Move proving and verification keys to outputs folder

This commit is contained in:
howardwu 2020-05-02 18:11:38 -07:00
parent 5f5a3399ac
commit 7d5a5b71c3
3 changed files with 12 additions and 12 deletions

View File

@ -57,12 +57,12 @@ impl CLI for SetupCommand {
log::info!("Setup completed in {:?} milliseconds", start.elapsed().as_millis());
// Write the proving key file to the inputs directory
// Write the proving key file to the outputs directory
let mut proving_key = vec![];
parameters.write(&mut proving_key)?;
ProvingKeyFile::new(&package_name).write_to(&path, &proving_key)?;
// Write the proving key file to the inputs directory
// Write the proving key file to the outputs directory
let mut verification_key = vec![];
prepared_verifying_key.write(&mut verification_key)?;
VerificationKeyFile::new(&package_name).write_to(&path, &verification_key)?;

View File

@ -1,6 +1,6 @@
//! The `main.leo` file.
use crate::directories::inputs::INPUTS_DIRECTORY_NAME;
use crate::directories::outputs::OUTPUTS_DIRECTORY_NAME;
use crate::errors::ProvingKeyFileError;
use serde::Deserialize;
@ -25,8 +25,8 @@ impl ProvingKeyFile {
pub fn exists_at(self, path: &PathBuf) -> bool {
let mut path = path.to_owned();
if path.is_dir() {
if !path.ends_with(INPUTS_DIRECTORY_NAME) {
path.push(PathBuf::from(INPUTS_DIRECTORY_NAME));
if !path.ends_with(OUTPUTS_DIRECTORY_NAME) {
path.push(PathBuf::from(OUTPUTS_DIRECTORY_NAME));
}
path.push(PathBuf::from(format!("{}{}", self.package_name, PROVING_KEY_FILE_EXTENSION)));
}
@ -36,8 +36,8 @@ impl ProvingKeyFile {
pub fn write_to(self, path: &PathBuf, proving_key: &[u8]) -> Result<(), ProvingKeyFileError> {
let mut path = path.to_owned();
if path.is_dir() {
if !path.ends_with(INPUTS_DIRECTORY_NAME) {
path.push(PathBuf::from(INPUTS_DIRECTORY_NAME));
if !path.ends_with(OUTPUTS_DIRECTORY_NAME) {
path.push(PathBuf::from(OUTPUTS_DIRECTORY_NAME));
}
path.push(PathBuf::from(format!("{}{}", self.package_name, PROVING_KEY_FILE_EXTENSION)));
}

View File

@ -1,6 +1,6 @@
//! The `main.leo` file.
use crate::directories::inputs::INPUTS_DIRECTORY_NAME;
use crate::directories::outputs::OUTPUTS_DIRECTORY_NAME;
use crate::errors::VerificationKeyFileError;
use serde::Deserialize;
@ -25,8 +25,8 @@ impl VerificationKeyFile {
pub fn exists_at(self, path: &PathBuf) -> bool {
let mut path = path.to_owned();
if path.is_dir() {
if !path.ends_with(INPUTS_DIRECTORY_NAME) {
path.push(PathBuf::from(INPUTS_DIRECTORY_NAME));
if !path.ends_with(OUTPUTS_DIRECTORY_NAME) {
path.push(PathBuf::from(OUTPUTS_DIRECTORY_NAME));
}
path.push(PathBuf::from(format!("{}{}", self.package_name, VERIFICATION_KEY_FILE_EXTENSION)));
}
@ -36,8 +36,8 @@ impl VerificationKeyFile {
pub fn write_to(self, path: &PathBuf, verification_key: &[u8]) -> Result<(), VerificationKeyFileError> {
let mut path = path.to_owned();
if path.is_dir() {
if !path.ends_with(INPUTS_DIRECTORY_NAME) {
path.push(PathBuf::from(INPUTS_DIRECTORY_NAME));
if !path.ends_with(OUTPUTS_DIRECTORY_NAME) {
path.push(PathBuf::from(OUTPUTS_DIRECTORY_NAME));
}
path.push(PathBuf::from(format!("{}{}", self.package_name, VERIFICATION_KEY_FILE_EXTENSION)));
}