merge master and resolve bors failing test

This commit is contained in:
gluax 2021-02-18 11:50:13 -05:00
commit 34b8e766ac
6 changed files with 31 additions and 24 deletions

6
Cargo.lock generated
View File

@ -1415,7 +1415,7 @@ dependencies = [
"notify",
"num-bigint",
"rand",
"rand_core 0.6.1",
"rand_core 0.6.2",
"reqwest",
"rusty-hook",
"self_update",
@ -2176,9 +2176,9 @@ dependencies = [
[[package]]
name = "rand_core"
version = "0.6.1"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5"
checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
[[package]]
name = "rand_hc"

View File

@ -123,7 +123,7 @@ version = "0.3"
version = "0.7"
[dependencies.rand_core]
version = "0.6.1"
version = "0.6.2"
[dependencies.reqwest]
version = "0.11.0"

View File

@ -30,12 +30,6 @@ fn test_const_fail() {
load_asg(&new_context(), program_string).err().unwrap();
}
#[test]
fn test_const_mut_fail() {
let program_string = include_str!("const_mut.leo");
load_asg(&new_context(), program_string).err().unwrap();
}
#[test]
fn test_array() {
let program_string = include_str!("array.leo");

View File

@ -27,5 +27,5 @@ fn test_num_returns_fail() {
#[test]
fn test_const_declaration_fail() {
let program_string = include_str!("const_declaration_fail.leo");
load_asg(program_string).err().unwrap();
load_asg(&new_context(), program_string).err().unwrap();
}

View File

@ -119,14 +119,17 @@ impl Command for Publish {
.send();
// Get a response result
let result = match response {
Ok(json_result) => match json_result.json::<ResponseJson>() {
Ok(json) => json,
Err(error) => {
tracing::warn!("{:?}", error);
return Err(anyhow!("Package not published"));
let result: ResponseJson = match response {
Ok(json_result) => {
let text = json_result.text()?;
match serde_json::from_str(&text) {
Ok(json) => json,
Err(_) => {
return Err(anyhow!("Package not published: {}", text));
}
}
},
}
Err(error) => {
tracing::warn!("{:?}", error);
return Err(anyhow!("Connection unavailable"));

View File

@ -19,7 +19,7 @@
use crate::{
errors::ZipFileError,
imports::IMPORTS_DIRECTORY_NAME,
inputs::{INPUTS_DIRECTORY_NAME, INPUT_FILE_EXTENSION},
inputs::{INPUTS_DIRECTORY_NAME, INPUT_FILE_EXTENSION, STATE_FILE_EXTENSION},
outputs::{
CHECKSUM_FILE_EXTENSION,
CIRCUIT_FILE_EXTENSION,
@ -151,9 +151,8 @@ impl ZipFile {
/// Check if the file path should be included in the package zip file.
fn is_included(path: &Path) -> bool {
// excluded directories: `input`, `output`, `imports`
if path.ends_with(INPUTS_DIRECTORY_NAME.trim_end_matches('/'))
| path.ends_with(OUTPUTS_DIRECTORY_NAME.trim_end_matches('/'))
// excluded directories: `output`, `imports`
if path.ends_with(OUTPUTS_DIRECTORY_NAME.trim_end_matches('/'))
| path.ends_with(IMPORTS_DIRECTORY_NAME.trim_end_matches('/'))
{
return false;
@ -161,8 +160,7 @@ fn is_included(path: &Path) -> bool {
// excluded extensions: `.in`, `.bytes`, `lpk`, `lvk`, `.proof`, `.sum`, `.zip`, `.bytes`
if let Some(true) = path.extension().map(|ext| {
ext.eq(INPUT_FILE_EXTENSION.trim_start_matches('.'))
| ext.eq(ZIP_FILE_EXTENSION.trim_start_matches('.'))
ext.eq(ZIP_FILE_EXTENSION.trim_start_matches('.'))
| ext.eq(PROVING_KEY_FILE_EXTENSION.trim_start_matches('.'))
| ext.eq(VERIFICATION_KEY_FILE_EXTENSION.trim_start_matches('.'))
| ext.eq(PROOF_FILE_EXTENSION.trim_start_matches('.'))
@ -173,6 +171,18 @@ fn is_included(path: &Path) -> bool {
return false;
}
// Allow `inputs` folder
if path.ends_with(INPUTS_DIRECTORY_NAME.trim_end_matches('/')) {
return true;
}
// Allow `.state` and `.in` files
if let Some(true) = path.extension().map(|ext| {
ext.eq(INPUT_FILE_EXTENSION.trim_start_matches('.')) | ext.eq(STATE_FILE_EXTENSION.trim_start_matches('.'))
}) {
return true;
}
// Allow the README.md and Leo.toml files in the root directory
if (path.ends_with(README_FILENAME) | path.ends_with(MANIFEST_FILENAME)) & (path.parent() == Some(Path::new(""))) {
return true;