merge develop
This commit is contained in:
commit
0c491f47d7
10 changed files with 34 additions and 37 deletions
10
Cargo.lock
generated
10
Cargo.lock
generated
|
@ -623,7 +623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "zokrates_cli"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"assert_cli 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -631,13 +631,13 @@ dependencies = [
|
|||
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"zokrates_core 0.3.0",
|
||||
"zokrates_fs_resolver 0.3.0",
|
||||
"zokrates_core 0.3.1",
|
||||
"zokrates_fs_resolver 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zokrates_core"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
dependencies = [
|
||||
"assert_cli 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bimap 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -658,7 +658,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zokrates_fs_resolver"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
|
||||
[metadata]
|
||||
"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
|
||||
|
|
1
Jenkinsfile
vendored
1
Jenkinsfile
vendored
|
@ -92,7 +92,6 @@ pipeline {
|
|||
steps {
|
||||
script {
|
||||
ansiColor('xterm') {
|
||||
// currently not run due to bug in Jenkins Docker Plugin.
|
||||
// prodImage = docker.build("zokrates/zokrates")
|
||||
// docker.withRegistry('https://registry.hub.docker.com', 'dockerhub-kyroy') {
|
||||
// prodImage.push(patchVersion)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_cli"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["Jacob Eberhardt <jacob.eberhardt@tu-berlin.de>", "Dennis Kuhnert <mail@kyroy.com>", "Thibaut Schaeffer <thibaut@schaeff.fr>"]
|
||||
repository = "https://github.com/JacobEberhardt/ZoKrates.git"
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ fn main() {
|
|||
// cli specification using clap library
|
||||
let matches = App::new("ZoKrates")
|
||||
.setting(AppSettings::SubcommandRequiredElseHelp)
|
||||
.version("0.3.0")
|
||||
.version("0.3.1")
|
||||
.author("Jacob Eberhardt, Thibaut Schaeffer, Dennis Kuhnert")
|
||||
.about("Supports generation of zkSNARKs from high level language code including Smart Contracts for proof verification on the Ethereum Blockchain.\n'I know that I show nothing!'")
|
||||
.subcommand(SubCommand::with_name("compile")
|
||||
|
@ -410,7 +410,7 @@ fn main() {
|
|||
println!("{}", main_flattened);
|
||||
|
||||
// transform to R1CS
|
||||
let (variables, private_inputs_offset, a, b, c) = r1cs_program(&program_ast);
|
||||
let (variables, public_variables_count, a, b, c) = r1cs_program(&program_ast);
|
||||
|
||||
// write variables meta information to file
|
||||
let var_inf_path = Path::new(sub_matches.value_of("meta-information").unwrap());
|
||||
|
@ -419,13 +419,15 @@ fn main() {
|
|||
Err(why) => panic!("couldn't open {}: {}", var_inf_path.display(), why),
|
||||
};
|
||||
let mut bw = BufWriter::new(var_inf_file);
|
||||
|
||||
write!(
|
||||
&mut bw,
|
||||
"Private inputs offset:\n{}\n",
|
||||
private_inputs_offset
|
||||
public_variables_count
|
||||
)
|
||||
.expect("Unable to write data to file.");
|
||||
write!(&mut bw, "R1CS variable order:\n").expect("Unable to write data to file.");
|
||||
|
||||
for var in &variables {
|
||||
write!(&mut bw, "{} ", var).expect("Unable to write data to file.");
|
||||
}
|
||||
|
@ -436,36 +438,21 @@ fn main() {
|
|||
let pk_path = sub_matches.value_of("proving-key-path").unwrap();
|
||||
let vk_path = sub_matches.value_of("verification-key-path").unwrap();
|
||||
|
||||
let public_inputs_indices =
|
||||
main_flattened
|
||||
.arguments
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(index, x)| match x.private {
|
||||
true => None,
|
||||
false => Some(index),
|
||||
});
|
||||
|
||||
let public_inputs = public_inputs_indices
|
||||
.map(|i| main_flattened.signature.inputs[i].get_primitive_count())
|
||||
.fold(0, |acc, e| acc + e);
|
||||
|
||||
let outputs = main_flattened
|
||||
.signature
|
||||
.outputs
|
||||
.iter()
|
||||
.map(|t| t.get_primitive_count())
|
||||
.fold(0, |acc, e| acc + e);
|
||||
|
||||
let num_inputs = public_inputs + outputs;
|
||||
|
||||
// run setup phase
|
||||
#[cfg(feature = "libsnark")]
|
||||
{
|
||||
// number of inputs in the zkSNARK sense, i.e., input variables + output variables
|
||||
println!(
|
||||
"setup successful: {:?}",
|
||||
setup(variables, a, b, c, num_inputs, pk_path, vk_path)
|
||||
setup(
|
||||
variables,
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
public_variables_count - 1,
|
||||
pk_path,
|
||||
vk_path
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
1
zokrates_cli/tests/code/return_array.arguments.json
Normal file
1
zokrates_cli/tests/code/return_array.arguments.json
Normal file
|
@ -0,0 +1 @@
|
|||
[1, 1, 1, 2, 2, 3, 4, 4, 4, 4]
|
2
zokrates_cli/tests/code/return_array.code
Normal file
2
zokrates_cli/tests/code/return_array.code
Normal file
|
@ -0,0 +1,2 @@
|
|||
def main(field[3] a, private field[2] b, field c, private field[4] d) -> (field[3], field[4]):
|
||||
return a, d
|
7
zokrates_cli/tests/code/return_array.expected.witness
Normal file
7
zokrates_cli/tests/code/return_array.expected.witness
Normal file
|
@ -0,0 +1,7 @@
|
|||
~out_0 1
|
||||
~out_1 1
|
||||
~out_2 1
|
||||
~out_3 4
|
||||
~out_4 4
|
||||
~out_5 4
|
||||
~out_6 4
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_core"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["Jacob Eberhardt <jacob.eberhardt@tu-berlin.de>", "Dennis Kuhnert <mail@kyroy.com>"]
|
||||
repository = "https://github.com/JacobEberhardt/ZoKrates"
|
||||
readme = "README.md"
|
||||
|
|
|
@ -88,7 +88,8 @@ impl<T: Field> Folder<T> for DeadCode {
|
|||
.inputs(exps.iter().map(|e| e.get_type()).collect())
|
||||
.outputs(vec![Type::FieldElementArray(size)]);
|
||||
|
||||
self.called.insert(format!("{}_{}", id, signature));
|
||||
self.called
|
||||
.insert(format!("{}_{}", id, signature.to_slug()));
|
||||
FieldElementArrayExpression::FunctionCall(size, id, exps)
|
||||
}
|
||||
e => fold_field_array_expression(self, e),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zokrates_fs_resolver"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["Thibaut Schaeffer <thibaut@schaeff.fr>"]
|
||||
repository = "https://github.com/JacobEberhardt/ZoKrates.git"
|
||||
|
||||
|
|
Loading…
Reference in a new issue