From c3a89764bfd4672c7f88f1f689addbabc1144f79 Mon Sep 17 00:00:00 2001 From: collin Date: Tue, 18 Aug 2020 22:58:14 -0700 Subject: [PATCH] fix example naming and manifest files --- compiler/src/value/value.rs | 2 +- examples/fibonacci/Leo.toml | 3 +++ examples/{hello_world => hello-world}/.gitignore | 0 examples/hello-world/Leo.toml | 6 ++++++ examples/hello-world/inputs/hello-world.in | 6 ++++++ .../inputs/hello-world.state} | 0 examples/hello-world/src/main.leo | 5 +++++ examples/hello_world/Leo.toml | 3 --- examples/hello_world/inputs/hello_world.in | 2 -- examples/hello_world/src/main.leo | 5 ----- examples/{pedersen_hash => pedersen-hash}/.gitignore | 0 examples/pedersen-hash/Leo.toml | 6 ++++++ .../inputs/pedersen-hash.in} | 0 .../inputs/pedersen-hash.state} | 0 examples/{pedersen_hash => pedersen-hash}/src/main.leo | 0 examples/pedersen_hash/Leo.toml | 3 --- examples/{square_root => square-root}/.gitignore | 0 examples/square-root/Leo.toml | 6 ++++++ .../square_root.in => square-root/inputs/square-root.in} | 4 ++-- .../inputs/square-root.state} | 0 examples/square-root/src/main.leo | 5 +++++ examples/square_root/Leo.toml | 3 --- examples/square_root/src/main.leo | 5 ----- package/src/root/manifest.rs | 7 +++++-- 24 files changed, 45 insertions(+), 26 deletions(-) rename examples/{hello_world => hello-world}/.gitignore (100%) create mode 100644 examples/hello-world/Leo.toml create mode 100644 examples/hello-world/inputs/hello-world.in rename examples/{hello_world/inputs/hello_world.state => hello-world/inputs/hello-world.state} (100%) create mode 100644 examples/hello-world/src/main.leo delete mode 100644 examples/hello_world/Leo.toml delete mode 100644 examples/hello_world/inputs/hello_world.in delete mode 100644 examples/hello_world/src/main.leo rename examples/{pedersen_hash => pedersen-hash}/.gitignore (100%) create mode 100644 examples/pedersen-hash/Leo.toml rename examples/{pedersen_hash/inputs/pedersen_hash.in => pedersen-hash/inputs/pedersen-hash.in} (100%) rename examples/{pedersen_hash/inputs/pedersen_hash.state => pedersen-hash/inputs/pedersen-hash.state} (100%) rename examples/{pedersen_hash => pedersen-hash}/src/main.leo (100%) delete mode 100644 examples/pedersen_hash/Leo.toml rename examples/{square_root => square-root}/.gitignore (100%) create mode 100644 examples/square-root/Leo.toml rename examples/{square_root/inputs/square_root.in => square-root/inputs/square-root.in} (71%) rename examples/{square_root/inputs/square_root.state => square-root/inputs/square-root.state} (100%) create mode 100644 examples/square-root/src/main.leo delete mode 100644 examples/square_root/Leo.toml delete mode 100644 examples/square_root/src/main.leo diff --git a/compiler/src/value/value.rs b/compiler/src/value/value.rs index 6c7184926e..fe8ba6a1b1 100644 --- a/compiler/src/value/value.rs +++ b/compiler/src/value/value.rs @@ -26,7 +26,7 @@ use crate::{ GroupType, Integer, }; -use leo_typed::{Circuit, Function, Identifier, Span, Type, GroupValue}; +use leo_typed::{Circuit, Function, GroupValue, Identifier, Span, Type}; use snarkos_errors::gadgets::SynthesisError; use snarkos_models::{ diff --git a/examples/fibonacci/Leo.toml b/examples/fibonacci/Leo.toml index 9e35608c56..ad054e8e19 100644 --- a/examples/fibonacci/Leo.toml +++ b/examples/fibonacci/Leo.toml @@ -1,3 +1,6 @@ [package] name = "fibonacci" version = "0.1.0" +description = "Returns a fibonnaci sequence" +remote = "aleo/fibonacci" +license = "LICENSE-MIT" diff --git a/examples/hello_world/.gitignore b/examples/hello-world/.gitignore similarity index 100% rename from examples/hello_world/.gitignore rename to examples/hello-world/.gitignore diff --git a/examples/hello-world/Leo.toml b/examples/hello-world/Leo.toml new file mode 100644 index 0000000000..b4c5f858d9 --- /dev/null +++ b/examples/hello-world/Leo.toml @@ -0,0 +1,6 @@ +[package] +name = "hello-world" +version = "0.1.0" +description = "Returns the sum of two u32 integers" +remote = "aleo/hello-world" +license = "LICENSE-MIT" diff --git a/examples/hello-world/inputs/hello-world.in b/examples/hello-world/inputs/hello-world.in new file mode 100644 index 0000000000..684a41fbef --- /dev/null +++ b/examples/hello-world/inputs/hello-world.in @@ -0,0 +1,6 @@ +[main] +a: u32 = 1; +b: u32 = 2; + +[registers] +r0: u32 = 0; \ No newline at end of file diff --git a/examples/hello_world/inputs/hello_world.state b/examples/hello-world/inputs/hello-world.state similarity index 100% rename from examples/hello_world/inputs/hello_world.state rename to examples/hello-world/inputs/hello-world.state diff --git a/examples/hello-world/src/main.leo b/examples/hello-world/src/main.leo new file mode 100644 index 0000000000..5447723bf5 --- /dev/null +++ b/examples/hello-world/src/main.leo @@ -0,0 +1,5 @@ +// The 'hello_world' main function. +function main(a: u32, b: u32) -> u32 { + let c: u32 = a + b; + return c +} diff --git a/examples/hello_world/Leo.toml b/examples/hello_world/Leo.toml deleted file mode 100644 index c0e09f8307..0000000000 --- a/examples/hello_world/Leo.toml +++ /dev/null @@ -1,3 +0,0 @@ -[package] -name = "hello_world" -version = "0.1.0" diff --git a/examples/hello_world/inputs/hello_world.in b/examples/hello_world/inputs/hello_world.in deleted file mode 100644 index 494a224d5d..0000000000 --- a/examples/hello_world/inputs/hello_world.in +++ /dev/null @@ -1,2 +0,0 @@ -[registers] -r0: u32 = 0; \ No newline at end of file diff --git a/examples/hello_world/src/main.leo b/examples/hello_world/src/main.leo deleted file mode 100644 index b51882a62f..0000000000 --- a/examples/hello_world/src/main.leo +++ /dev/null @@ -1,5 +0,0 @@ -// The 'hello_world' main function. -function main() -> u32 { - let a: u32 = 1 + 1; - return a -} diff --git a/examples/pedersen_hash/.gitignore b/examples/pedersen-hash/.gitignore similarity index 100% rename from examples/pedersen_hash/.gitignore rename to examples/pedersen-hash/.gitignore diff --git a/examples/pedersen-hash/Leo.toml b/examples/pedersen-hash/Leo.toml new file mode 100644 index 0000000000..acbc713136 --- /dev/null +++ b/examples/pedersen-hash/Leo.toml @@ -0,0 +1,6 @@ +[package] +name = "pedersen-hash" +version = "0.1.0" +description = "A 256bit hash function" +remote = "aleo/pedersen-hash" +license = "LICENSE-MIT" diff --git a/examples/pedersen_hash/inputs/pedersen_hash.in b/examples/pedersen-hash/inputs/pedersen-hash.in similarity index 100% rename from examples/pedersen_hash/inputs/pedersen_hash.in rename to examples/pedersen-hash/inputs/pedersen-hash.in diff --git a/examples/pedersen_hash/inputs/pedersen_hash.state b/examples/pedersen-hash/inputs/pedersen-hash.state similarity index 100% rename from examples/pedersen_hash/inputs/pedersen_hash.state rename to examples/pedersen-hash/inputs/pedersen-hash.state diff --git a/examples/pedersen_hash/src/main.leo b/examples/pedersen-hash/src/main.leo similarity index 100% rename from examples/pedersen_hash/src/main.leo rename to examples/pedersen-hash/src/main.leo diff --git a/examples/pedersen_hash/Leo.toml b/examples/pedersen_hash/Leo.toml deleted file mode 100644 index e104d9d929..0000000000 --- a/examples/pedersen_hash/Leo.toml +++ /dev/null @@ -1,3 +0,0 @@ -[package] -name = "pedersen_hash" -version = "0.1.0" diff --git a/examples/square_root/.gitignore b/examples/square-root/.gitignore similarity index 100% rename from examples/square_root/.gitignore rename to examples/square-root/.gitignore diff --git a/examples/square-root/Leo.toml b/examples/square-root/Leo.toml new file mode 100644 index 0000000000..6cda034dc4 --- /dev/null +++ b/examples/square-root/Leo.toml @@ -0,0 +1,6 @@ +[package] +name = "square-root" +version = "0.1.0" +description = "prove knowledge of the square root `a` of a number `b`" +remote = "aleo/square-root" +license = "LICENSE-MIT" diff --git a/examples/square_root/inputs/square_root.in b/examples/square-root/inputs/square-root.in similarity index 71% rename from examples/square_root/inputs/square_root.in rename to examples/square-root/inputs/square-root.in index bd12bc402f..1d6a8cf5d3 100644 --- a/examples/square_root/inputs/square_root.in +++ b/examples/square-root/inputs/square-root.in @@ -1,7 +1,7 @@ // The program input for square_root/src/main.leo [main] -a: field = 337; -b: field = 113569; +a: u32 = 337; +b: u32 = 113569; [registers] r0: bool = false; \ No newline at end of file diff --git a/examples/square_root/inputs/square_root.state b/examples/square-root/inputs/square-root.state similarity index 100% rename from examples/square_root/inputs/square_root.state rename to examples/square-root/inputs/square-root.state diff --git a/examples/square-root/src/main.leo b/examples/square-root/src/main.leo new file mode 100644 index 0000000000..e440bac5dd --- /dev/null +++ b/examples/square-root/src/main.leo @@ -0,0 +1,5 @@ +// The 'square_root' main function. +// prove knowledge of the square root `a` of a number `b` +function main(a: u32, b: u32) -> bool { + return a * a == b +} diff --git a/examples/square_root/Leo.toml b/examples/square_root/Leo.toml deleted file mode 100644 index 28a89b9c2c..0000000000 --- a/examples/square_root/Leo.toml +++ /dev/null @@ -1,3 +0,0 @@ -[package] -name = "square_root" -version = "0.1.0" diff --git a/examples/square_root/src/main.leo b/examples/square_root/src/main.leo deleted file mode 100644 index 7b63b27007..0000000000 --- a/examples/square_root/src/main.leo +++ /dev/null @@ -1,5 +0,0 @@ -// The 'square_root' main function. -// prove knowledge of the square root `a` of a number `b`: -function main(a: field, b: field) -> bool { - return a * a == b -} diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs index 57295a7bb7..f18c98b30b 100644 --- a/package/src/root/manifest.rs +++ b/package/src/root/manifest.rs @@ -95,10 +95,13 @@ impl Manifest { fn template(&self) -> String { format!( r#"[package] -name = "{}" +name = "{name}" version = "0.1.0" +description = "The {name} package" +remote = "[AUTHOR]/{name}" +license = "LICENSE-MIT" "#, - self.package.name + name = self.package.name ) } }