diff --git a/.licenserc.json b/.licenserc.json
new file mode 100644
index 0000000000..2dea00c3bd
--- /dev/null
+++ b/.licenserc.json
@@ -0,0 +1,29 @@
+{
+ "**/*.rs": [
+ "// Copyright (C) 2019-2020 Aleo Systems Inc.",
+ "// This file is part of the Leo library.",
+ "",
+ "// The Leo library is free software: you can redistribute it and/or modify",
+ "// it under the terms of the GNU General Public License as published by",
+ "// the Free Software Foundation, either version 3 of the License, or",
+ "// (at your option) any later version.",
+ "",
+ "// The Leo library is distributed in the hope that it will be useful,",
+ "// but WITHOUT ANY WARRANTY; without even the implied warranty of",
+ "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
+ "// GNU General Public License for more details.",
+ "",
+ "// You should have received a copy of the GNU General Public License",
+ "// along with the Leo library. If not, see .",
+ ""
+ ],
+ "ignore": [
+ ".cargo",
+ ".github",
+ ".resources",
+ ".travis",
+ "examples",
+ "target/"
+ ]
+}
+
diff --git a/Cargo.lock b/Cargo.lock
index 680523d15e..85d534da09 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -33,6 +33,18 @@ dependencies = [
"winapi 0.3.9",
]
+[[package]]
+name = "arrayref"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
+
+[[package]]
+name = "arrayvec"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
+
[[package]]
name = "atty"
version = "0.2.14"
@@ -70,6 +82,12 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5024ee8015f02155eee35c711107ddd9a9bf3cb689cf2a9089c97e79b6e1ae83"
+[[package]]
+name = "base64"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
+
[[package]]
name = "base64"
version = "0.12.3"
@@ -134,6 +152,17 @@ dependencies = [
"opaque-debug 0.2.3",
]
+[[package]]
+name = "blake2b_simd"
+version = "0.5.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a"
+dependencies = [
+ "arrayref",
+ "arrayvec",
+ "constant_time_eq",
+]
+
[[package]]
name = "block-buffer"
version = "0.7.3"
@@ -321,6 +350,12 @@ dependencies = [
"winapi 0.3.9",
]
+[[package]]
+name = "constant_time_eq"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
+
[[package]]
name = "core-foundation"
version = "0.7.0"
@@ -527,6 +562,26 @@ dependencies = [
"generic-array 0.14.4",
]
+[[package]]
+name = "dirs"
+version = "3.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "142995ed02755914747cc6ca76fc7e4583cd18578746716d0508ea6ed558b9ff"
+dependencies = [
+ "dirs-sys",
+]
+
+[[package]]
+name = "dirs-sys"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a"
+dependencies = [
+ "libc",
+ "redox_users",
+ "winapi 0.3.9",
+]
+
[[package]]
name = "dtoa"
version = "0.4.6"
@@ -1070,6 +1125,7 @@ version = "0.1.0"
dependencies = [
"clap",
"colored",
+ "dirs",
"env_logger",
"from-pest",
"lazy_static",
@@ -1095,6 +1151,7 @@ dependencies = [
"snarkos-utilities",
"thiserror",
"toml",
+ "zip",
]
[[package]]
@@ -1824,6 +1881,17 @@ version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
+[[package]]
+name = "redox_users"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431"
+dependencies = [
+ "getrandom",
+ "redox_syscall",
+ "rust-argon2",
+]
+
[[package]]
name = "regex"
version = "1.3.9"
@@ -1866,7 +1934,7 @@ version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12427a5577082c24419c9c417db35cfeb65962efc7675bb6b0d5f1f9d315bfe6"
dependencies = [
- "base64",
+ "base64 0.12.3",
"bytes",
"encoding_rs",
"futures-core",
@@ -1906,6 +1974,18 @@ dependencies = [
"librocksdb-sys",
]
+[[package]]
+name = "rust-argon2"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017"
+dependencies = [
+ "base64 0.11.0",
+ "blake2b_simd",
+ "constant_time_eq",
+ "crossbeam-utils",
+]
+
[[package]]
name = "rustc-demangle"
version = "0.1.16"
diff --git a/Cargo.toml b/Cargo.toml
index 0b3546764f..b6b70d9fcb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,6 +31,7 @@ snarkos-utilities = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package =
clap = { version = "2.33.3" }
colored = { version = "2.0" }
+dirs = { version = "3.0.1" }
env_logger = { version = "0.7" }
from-pest = { version = "0.3.1" }
lazy_static = { version = "1.4.0" }
@@ -44,6 +45,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
toml = { version = "0.5" }
thiserror = { version = "1.0" }
+zip = { version = "0.5" }
[dev-dependencies]
rusty-hook = { version = "0.11.2" }
diff --git a/README.md b/README.md
index 5e6878c84a..98f2b66357 100644
--- a/README.md
+++ b/README.md
@@ -3,782 +3,116 @@
![CI](https://github.com/AleoHQ/leo/workflows/CI/badge.svg)
[![codecov](https://codecov.io/gh/AleoHQ/leo/branch/master/graph/badge.svg?token=S6MWO60SYL)](https://codecov.io/gh/AleoHQ/leo)
-# Overview
+Leo is a functional, statically-typed programming language built for writing private applications.
-## Compiler Architecture
+## Table of Contents
-
-![~mermaid diagram 1~](/.resources/README-md-1.png)
-
- Mermaid markup
+* [1. Overview](#1-overview)
+* [2. Build Guide](#2-build-guide)
+ * [2.1 Install Rust](#21-install-rust)
+ * [2.2a Build from Crates.io](#22a-build-from-cratesio)
+ * [2.2b Build from Source Code](#22b-build-from-source-code)
+* [3. Quick Start](#3-quick-start)
+* [4. Documentation](#4-documentation)
+* [5. Contributing](#5-contributing)
+* [6. License](#6-license)
-```mermaid
-graph LR
- Pass1(Syntax Parser) -- ast --> Pass2(Type Resolver)
-
- Pass2 -- imports --> Pass3(Import Resolver)
- Pass3 -- statements --> Pass4
-
- Pass2 -- statements --> Pass4(Synthesizer)
-
- Pass4 -- constraints --> Pass5(Program)
-```
-
-
+## 1. Overview
+Welcome to the Leo programming language.
-## Language Specification
+Leo exists to provide a simple high-level language that abstracts low-level cryptographic concepts and makes it easy to
+integrate private applications into your stack. Leo compiles to R1CS circuits making zero-knowledge proofs practical.
+With Leo, you can support zero-knowledge tokens, private stable coins, and decentralized marketplaces.
-* Programs should be formatted:
- 1. Import definitions
- 2. Circuit definitions
- 3. Function definitions
+The syntax of Leo is influenced by JavaScript, Python, Scala, and Rust with a strong emphasis on readability and ease-of-use.
+Leo provides developers with never before seen tools to sanity check circuits including unit tests, integration tests, and console functions.
-## Defining Variables
-Leo supports `let` and `const` keywords for variable definition.
+Leo is one part of a greater ecosystem for building private applications on [Aleo](https://aleo.org/). If your goal is to build a user experience
+on the web that is both truly personal and truly private, then we recommend downloading the [Aleo Studio IDE](https://aleo.studio/)
+and checking out the [Aleo Package Manager]().
-```let a = true;``` defines an **allocated** program variable `a` with boolean value `true`.
+## 2. Build Guide
-```const a = true;``` defines a **constant** program variable `a` with boolean value `true`.
+### 2.1 Install Rust
-**Allocated** variables define private variables in the constraint system. Their value is constrained in the circuit on initialization.
+We recommend installing Rust using [rustup](https://www.rustup.rs/). You can install `rustup` as follows:
-**Constant** variables do not define a variable in the constraint system. Their value is constrained in the circuit on computation with an **allocated** variable.
-**Constant** variables cannot be mutable. They have the same functionality as `const` variables in other languages.
-```js
-function add_one() -> {
- let a = 0u8; // allocated, value enforced on this line
- const b = 1u8; // constant, value not enforced yet
+- macOS or Linux:
+ ```bash
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
+ ```
- return a + b // allocated, computed value is enforced to be the sum of both values
-}
-```
-Computations are expressed in terms of arithmetic circuits, in particular rank-1 quadratic constraint systems. Thus computing on an allocated variable always results in another allocated variable.
-
-## Mutability
-* All defined variables in Leo are immutable by default.
-* Variables can be made mutable with the `mut` keyword.
-
-```js
-function main() {
- let a = 0u32;
- //a = 1 <- Will fail
-
- let mut b = 0u32;
- b = 1; // <- Ok
-}
-```
-
-## Addresses
-
-Addresses are defined to enable compiler-optimized routines for parsing and operating over addresses. These semantics will be accompanied by a standard library in a future sprint.
-
-```js
-function main(owner: address) {
- let sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
- let receiver: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
- assert_eq!(owner, sender);
- assert_eq!(sender, receiver);
-}
-```
-
-## Booleans
-
-Explicit types are optional.
-```js
-function main() -> bool {
- let a: bool = true || false;
- let b = false && false;
- let c = 1u32 == 1u32;
- return a
-}
-```
-
-## Numbers
-* The definition of a number must include an explicit type.
-* After assignment, you can choose to explicitly add the type or let the compiler interpret implicitly.
-* Type casting is not supported.
-* Comparators are not supported.
-
-### Integers
-Supported integer types: `u8`, `u16`, `u32`, `u64`, `u128`
-```js
-function main() -> u32 {
- let a = 2u32; // explicit type
- let a: u32 = 1 + 1; // explicit type
-
- let b = a - 1; // implicit type
- let c = b * 4;
- let d = c / 2;
- let e = d ** 3;
- return e
-}
-```
-
-### Field Elements
-```js
-function main() -> field {
- let a = 1000field; // explicit type
- let a: field = 21888242871839275222246405745257275088548364400416034343698204186575808495617; // explicit type
- let b = a + 1; // implicit type
- let c = b - 1;
- let d = c * 4;
- let e = d / 2;
- return e
-}
-```
-
-### Group Elements
-An affine point on the elliptic curve passed into the Leo compiler forms a group.
-Leo supports this set as a primitive data type.
-
-```js
-function main() -> group {
- let a = 1000group; // explicit type
- let a = (21888242871839275222246405745257275088548364400416034343698204186575808495617, 21888242871839275222246405745257275088548364400416034343698204186575808495617)group; // explicit type
- let b = a + 0; // implicit type
- let c = b - 0;
- return c
-}
-```
-
-### Operator Assignment Statements
-```js
-function main() -> u32 {
- let mut a = 10;
- a += 5;
- a -= 10;
- a *= 5;
- a /= 5;
- a **= 2;
-
- return a
-}
-```
-
-## Arrays
-Leo supports static arrays with fixed length.
-```js
-function main() -> u32[2] {
- // initialize an integer array with integer values
- let mut a: u32[3] = [1, 2, 3];
-
- // set a mutable member to a value
- a[2] = 4;
-
- // initialize an array of 4 values all equal to 42
- let b = [42u8; 4];
-
- // initialize an array of 5 values copying all elements of b using a spread
- let c = [1, ...b];
-
- // initialize an array copying a slice from `c`
- let d = c[1..3];
-
- // initialize a field array
- let e = [5field; 2];
-
- // initialize a boolean array
- let f = [true, false || true, true];
-
- return d
-}
-```
-
-### Multidimensional Arrays
-```js
-function main() -> u32[3][2] {
- let m = [[0u32, 0u32], [0u32, 0u32]];
-
- let m: u32[3][2] = [[0; 3]; 2];
-
- return m
-}
-```
-
-## Conditionals
-
-Branching in Leo is different than traditional programming languages. Leo developers should keep in mind that every program compiles to a circuit which represents
-all possible evaluations.
-
-### If Else Ternary Expression
-Ternary `if [cond] ? [first] : [second];` expressions are the cheapest form of conditional.
-Since `first` and `second` are expressions, we can resolve their values before proceeding execution.
-In the underlying circuit, this is a single bit multiplexer.
-
-```js
-function main() -> u32 {
- let y = if 3==3 ? 1 : 5;
- return y
-}
-```
-
-### If Else Conditional Statement
-Leo supports the traditional `if [cond] { [first] } else { [second] }` which can be chained using `else if`.
-Since `first` and `second` are one or more statements, they resolve to separate circuits which will all be evaluated.
-In the underlying circuit this can be thought of as a demultiplexer.
-```js
-function main(a: bool, b: bool) -> u32 {
- let mut res = 0u32;
-
- if a {
- res = 1;
- } else if b {
- res = 2;
- } else {
- res = 3;
- }
-
- return res
-}
-```
-
-### For loop
-```js
-function main() -> fe {
- let mut a = 1field;
- for i in 0..4 {
- a = a + 1;
- }
- return a
-}
-```
-
-## Functions
-```js
-function test1(a : u32) -> u32 {
- return a + 1
-}
-
-function test2(b: fe) -> field {
- return b * 2field
-}
-
-function test3(c: bool) -> bool {
- return c && true
-}
-
-function main() -> u32 {
- return test1(5)
-}
-```
-
-
-### Function Scope
-```js
-function foo() -> field {
- // return myGlobal <- not allowed
- return 42field
-}
-
-function main() -> field {
- let myGlobal = 42field;
- return foo()
-}
-```
-
-### Multiple returns
-Functions can return tuples whose types are specified in the function signature.
-```js
-function test() -> (u32, u32[2]) {
- return (1, [2, 3])
-}
-
-function main() -> u32[3] {
- let (a, b) = test();
- // (a, u32[2] b) = test() <- explicit type also works
- return [a, ...b]
-}
-```
-
-### Function inputs
-Main function inputs are allocated private variables in the program's constraint system.
-`a` is implicitly private.
-```js
-function main(a: field) -> field {
- return a
-}
-```
-Normal function inputs are passed by value.
-```js
-function test(mut a: u32) {
- a = 0;
-}
-
-function main() -> u32 {
- let a = 1;
- test(a);
-
- return a // <- returns 1
-}
-```
-
-## Circuits
-Circuits in Leo are similar to classes in object oriented langauges. Circuits are defined above functions in a Leo program. Circuits can have one or more members.
-
-#### Circuit member values
-Members can be defined as fields which hold primitive values.
-```js
-circuit Point {
- x: u32
- y: u32
-}
-function main() -> u32 {
- let p = Point {x: 1, y: 0};
- return p.x
-}
-```
-
-#### Circuit member functions
-Members can also be defined as functions.
-```js
-circuit Foo {
- function echo(x: u32) -> u32 {
- return x
- }
-}
-
-function main() -> u32 {
- let c = Foo { };
- return c.echo(1u32)
-}
-```
-
-#### Circuit member static functions
-Circuit functions can be made static, enabling them to be called without instantiation.
-```js
-circuit Foo {
- static function echo(x: u32) -> u32 {
- return x
- }
-}
-
-function main() -> u32 {
- return Foo::echo(1u32)
-}
-```
-
-#### `Self` and `self`
-The `Self` keyword is supported in circuit functions.
-```js
-circuit Circ {
- b: bool
-
- static function new() -> Self { // Self resolves to Foo
- return Self { b: true }
- }
-}
-
-function main() -> bool {
- let c = Foo::new();
- return c.b
-}
-```
-
-The `self` keyword references the circuit's members.
-```rust
-circuit Foo {
- b: bool
+- Windows (64-bit):
- function bar() -> bool {
- return self.b
- }
-
- function baz() -> bool {
- return self.bar()
- }
-}
+ Download the [Windows 64-bit executable](https://win.rustup.rs/x86_64) and follow the on-screen instructions.
-function main() -> bool {
- let c = Foo { b: true };
-
- return c.baz()
-}
-```
-
-
-## Imports
-Leo supports importing functions
-}
-} and circuits by name into the current file with the following syntax:
-
-```js
-import [package].[name];
-```
-
-#### Import Aliases
-To import a name using an alias:
-```js
-import [package].[name] as [alias];
-```
-
-#### Import Multiple
-To import multiple names from the same package:
-```js
-import [package].(
- [name_1],
- [name_2] as [alias],
-);
-```
-
-#### Import Star
-To import all symbols from a package:
-Note that this will only import symbols from the package library `lib.leo` file.
-```js
-import [package].*;
-```
-
-### Local
-You can import from a local file in the same package using its direct path.
-`src/` directory by using its `[file].leo` as the `[package]` name.
-
-```js
-import [file].[name];
-```
-
-#### Example:
-`src/bar.leo`
-```js
-circuit Bar {
- b: u32
-}
-
-function baz() -> u32 {
- return 1u32
-}
-```
-
-`src/main.leo`
-```js
-import bar.(
- Bar,
- baz
-);
-
-function main() {
- const bar = Bar { b: 1u32};
- const z = baz();
-}
-```
-
-### Foreign
-You can import from a foreign package in the `imports/` directory using its `[package]` name.
-```js
-import [package].[name];
-```
-
-#### Example:
-`imports/bar/src/lib.leo`
-```js
-circuit Bar {
- b: u32
-}
-```
-
-`src/main.leo`
-```js
-import bar.Bar;
-
-function main() {
- const bar = Bar { b: 1u32 };
-}
-```
-
-### Package Paths
-Leo treats directories as package names when importing.
-```js
-import [package].[directory].[file].[name]
-```
-
-#### Example:
-We wish to import the `Baz` circuit from the `baz.leo` file in the `bar` directory in the `foo` package
-
-
-`imports/foo/src/bar/baz.leo`
-```js
-circuit Baz {
- b: u32
-}
-```
-
-`src/main.leo`
-```js
-import foo.bar.baz.Baz;
-
-function main() {
- const baz = Baz { b: 1u32 };
-}
-```
-
-## Constraints
-
-### Assert Equals
-This will enforce that the two values are equal in the constraint system.
-
-```js
-function main() {
- assert_eq!(45, 45);
+- Windows (32-bit):
- assert_eq!(2fe, 2fe);
-
- assert_eq!(true, true);
-}
+ Download the [Windows 32-bit executable](https://win.rustup.rs/i686) and follow the on-screen instructions.
+
+### 2.2a Build from Crates.io
+
+We recommend installing Leo this way. In your terminal, run:
+
+```bash
+cargo install leo
```
-## Testing
+Now to use Leo, in your terminal, run:
+```bash
+leo
+```
+
+### 2.2b Build from Source Code
-Use the `test` keyword to add tests to a leo program. Tests must have 0 function inputs and 0 function returns.
+Alternatively, you can install Leo by building from the source code as follows:
-```js
-function main(a: u32) -> u32 {
- return a
-}
+```bash
+# Download the source code
+git clone https://github.com/AleoHQ/leo
+cd leo
-test function expect_pass() {
- let a = 1u32;
-
- let res = main(a);
-
- assert_eq!(res, 1u32);
-}
-
-test function expect_fail() {
- assert_eq!(1u8, 0u8);
-}
+# Build in release mode
+$ cargo build --release
```
-## Logging
-
-Leo supports `print!`, `debug!`, and `error!` logging macros.
-
-The first argument a macro receives is a format string. This must be a string literal. The power of the formatting string is in the `{}`s contained.
-
-Additional parameters passed to a macro replace the `{}`s within the formatting string in the order given.
-
-#### `print!`
-Directly calls the `println!` macro in rust.
-```js
-function main(a: u32) {
- print!("a is {}", a);
-}
+This will generate an executable under the `./target/release` directory. To run snarkOS, run the following command:
+```bash
+./target/release/leo
```
-#### `debug!`
-Enabled by specifying the `-d` flag after a Leo command.
-```js
-function main(a: u32) {
- debug!("a is {}", a);
-}
+## 3. Quick Start
+
+Use the Leo CLI to create a new project
+
+```bash
+# create a new `hello_world` Leo project
+leo new hello_world
+cd hello_world
+
+# build & setup & prove & verify
+leo run
```
+The `leo new` command creates a new Leo project with a given name.
-#### `error!`
-Prints the error to console.
-```js
-function main(a: u32) {
- error!("a is {}", a);
-}
-```
+The `leo run` command will compile the main program, generate keys for a trusted setup, fetch inputs, generate a proof and verify it.
-# Leo Inputs
+Congratulations! You've just run your first Leo program.
-Private inputs for a Leo program are specified in the `inputs/` directory. The syntax for an input file is a limited subset of the Leo program syntax. The default inputs file is `inputs/inputs.leo`.
+## 4. Documentation
-## Sections
-A Leo input file is made up of sections. Sections are defined by a section header in brackets followed by one or more input definitions.
+* [Hello World - Next Steps](https://developer.aleo.org/developer/getting_started/hello_world)
+* [Leo Language Documentation](https://developer.aleo.org/developer/language/layout)
+* [Leo CLI Documentation](https://developer.aleo.org/developer/cli/new)
+* [Homepage](https://developer.aleo.org/developer/getting_started/overview)
-Section headers specify the target file which must have a main function with matching input names and types.
+## 5. Contributing
+
+Please see our guidelines in the [developer documentation](https://developer.aleo.org/developer/additional_material/contributing)
-`inputs/inputs.leo`
+Thank you for helping make Leo better!
-```rust
-[main] // <- section header
-a: u32 = 1;
-b: u32 = 2;
-```
-
-`src/main.leo`
-
-```rust
-function main(a: u32, b: u32) -> u32 {
- let c: u32 = a + b;
- return c
-}
-```
-
-## Input Definitions
-
-### Supported types
-```rust
-[main]
-a: bool = true; // <- booleans
-b: u8 = 2; // <- integers
-c: field = 0; // <- fields
-d: group = (0, 1)group // <- group tuples
-```
-
-### Arrays
-```rust
-[main]
-a: u8[4] = [0u8; 4]; // <- single
-b: u8[2][3] = [[0u8; 2]; 3]; // <- multi-dimensional
-```
-
-# Leo CLI
-
-## Develop
-
-### `leo new`
-
-To setup a new package, run:
-```
-leo new {$NAME}
-```
-This will create a new directory with a given package name. The new package will have a directory structure as follows:
-```
-- inputs # Your program inputs
- - inputs.leo # Your program inputs for main.leo
-- outputs # Your program outputs
-- src
- - main.leo # Your program
-- tests
- - test.leo # Your program tests
-- Leo.toml # Your program manifest
-```
-
-#### Flags
-```rust
-leo new {$Name} --bin
-```
-This will create a new directory with a given package name. The new package will have a directory structure as above.
-
-```rust
-leo new {$Name} --lib
-```
-This will create a new directory with a given package name. The new package will have a directory structure as follows:
-```
-- src
- - lib.leo # Your program library
-- Leo.toml # Your program manifest
-```
-
-### `leo init`
-
-To initialize an existing directory, run:
-```
-leo init
-```
-This will initialize the current directory with the same package directory setup.
-
-#### Flags
-`leo init` supports the same flags as `leo new`
-```rust
-leo init --bin
-```
-```rust
-leo init --lib
-```
-
-
-### `leo build`
-
-To compile your program and verify that it builds properly, run:
-```
-leo build
-```
-
-### `leo test`
-
-To execute unit tests on your program, run:
-```
-leo test
-```
-The results of test compilation and the constraint system will be printed:
-```
- INFO leo Running 2 tests
- INFO leo test language::expect_pass compiled. Constraint system satisfied: true
-ERROR leo test language::expect_fail errored: Assertion 1u8 == 0u8 failed
-```
-
-## Run
-
-### `leo setup`
-
-To perform the program setup, producing a proving key and verification key, run:
-```
-leo setup
-```
-Leo uses cryptographic randomness from your machine to perform the setup. The proving key and verification key are stored in the `target` directory as `.leo.pk` and `.leo.vk`:
-
-```
-{$LIBRARY}/target/{$PROGRAM}.leo.pk
-{$LIBRARY}/target/{$PROGRAM}.leo.vk
-```
-
-### `leo prove`
-
-To execute the program and produce an execution proof, run:
-```
-leo prove
-```
-Leo starts by checking the `target` directory for an existing `.leo.pk` file. If it doesn't exist, it will proceed to run `leo setup` and then continue.
-
-Next any input files in the `inputs` directory are parsed and all input values are passed to the program.
-
-Once again, Leo uses cryptographic randomness from your machine to produce the proof. The proof is stored in the `target` directory as `.leo.proof`:
-
-```
-{$LIBRARY}/target/{$PROGRAM}.leo.proof
-```
-
-### `leo verify`
-
-To verify the program proof, run:
-```
-leo verify
-```
-Leo starts by checking the `target` directory for an existing `.leo.proof` file. If it doesn't exist, it will proceed to run `leo prove` and then continue.
-
-After the verifier is run, Leo will output either `true` or `false` based on the verification.
-
-## Remote
-
-To use remote compilation features, start by authentication with:
-```
-leo login
-```
-You will proceed to authenticate using your username and password. Next, Leo will parse your `Leo.toml` file for `remote = True` to confirm whether remote compilation is enabled.
-
-If remote compilation is enabled, Leo syncs your workspace so when you run `leo build`, `leo test`, `leo setup` and `leo prove`, your program will run the program setup and execution performantly on remote machines.
-
-This speeds up the testing cycle and helps the developer to iterate significantly faster.
-
-## Publish
-
-To package your program as a gadget and publish it online, run:
-```
-leo publish
-```
-Leo will proceed to snapshot your directory and upload your directory to the circuit manager. Leo will verify that `leo build` succeeds and that `leo test` passes without error.
-
-If your gadget name has already been taken, `leo publish` will fail.
-
-## Deploy
-
-To deploy your program to Aleo, run:
-```
-leo deploy
-```
-
-# Install
-
-To install Leo from source, in the root directory of the repository, run:
-```
-cargo install --path .
-```
-
-## TODO
-
-- Change `target` directory to some other directory to avoid collision.
-- Figure out how `leo prove` should take in assignments.
-- Come up with a serialization format for `.leo.pk`, `.leo.vk`, and `.leo.proof`.
+## 6. License
+[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](./LICENSE.md)
\ No newline at end of file
diff --git a/ast/benches/ast.rs b/ast/benches/ast.rs
index 772aec33ba..5d4cc3f436 100644
--- a/ast/benches/ast.rs
+++ b/ast/benches/ast.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_ast::{errors::ParserError, files::File, LeoAst};
use criterion::{black_box, criterion_group, criterion_main, Criterion};
diff --git a/ast/src/access/access.rs b/ast/src/access/access.rs
index 44741af5c2..ac3e26bb17 100644
--- a/ast/src/access/access.rs
+++ b/ast/src/access/access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{access::*, ast::Rule};
use pest_ast::FromPest;
diff --git a/ast/src/access/array_access.rs b/ast/src/access/array_access.rs
index 87553d6a71..5e4096b6e5 100644
--- a/ast/src/access/array_access.rs
+++ b/ast/src/access/array_access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::RangeOrExpression, SpanDef};
use pest::Span;
diff --git a/ast/src/access/assignee_access.rs b/ast/src/access/assignee_access.rs
index a68123783c..ad66ee3539 100644
--- a/ast/src/access/assignee_access.rs
+++ b/ast/src/access/assignee_access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
access::{ArrayAccess, MemberAccess, TupleAccess},
ast::Rule,
diff --git a/ast/src/access/call_access.rs b/ast/src/access/call_access.rs
index 4690c94d13..0b26c5c6f3 100644
--- a/ast/src/access/call_access.rs
+++ b/ast/src/access/call_access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::TupleExpression, SpanDef};
use pest::Span;
diff --git a/ast/src/access/member_access.rs b/ast/src/access/member_access.rs
index 83cd90d767..721ab473c6 100644
--- a/ast/src/access/member_access.rs
+++ b/ast/src/access/member_access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Identifier, SpanDef};
use pest::Span;
diff --git a/ast/src/access/mod.rs b/ast/src/access/mod.rs
index cdb435a4f3..8d3e86d7d2 100644
--- a/ast/src/access/mod.rs
+++ b/ast/src/access/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod access;
pub use access::*;
diff --git a/ast/src/access/static_member_access.rs b/ast/src/access/static_member_access.rs
index 63c1712bf0..560f9143f2 100644
--- a/ast/src/access/static_member_access.rs
+++ b/ast/src/access/static_member_access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Identifier, SpanDef};
use pest::Span;
diff --git a/ast/src/access/tuple_access.rs b/ast/src/access/tuple_access.rs
index 428e0c09fc..0e96ac0870 100644
--- a/ast/src/access/tuple_access.rs
+++ b/ast/src/access/tuple_access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, values::PositiveNumber, SpanDef};
use pest::Span;
diff --git a/ast/src/annotations/annotation_arguments.rs b/ast/src/annotations/annotation_arguments.rs
index b25859a50b..eb56ed4aaf 100644
--- a/ast/src/annotations/annotation_arguments.rs
+++ b/ast/src/annotations/annotation_arguments.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::{span_into_string, Rule},
SpanDef,
diff --git a/ast/src/annotations/annotation_name.rs b/ast/src/annotations/annotation_name.rs
index e5260cda85..5ceb953ec2 100644
--- a/ast/src/annotations/annotation_name.rs
+++ b/ast/src/annotations/annotation_name.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, SpanDef};
use pest::Span;
diff --git a/ast/src/annotations/annotation_symbol.rs b/ast/src/annotations/annotation_symbol.rs
index b5e2b10bf5..d11c5965b4 100644
--- a/ast/src/annotations/annotation_symbol.rs
+++ b/ast/src/annotations/annotation_symbol.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, SpanDef};
use pest::Span;
diff --git a/ast/src/annotations/annotations.rs b/ast/src/annotations/annotations.rs
index 69b01558dd..7abf081658 100644
--- a/ast/src/annotations/annotations.rs
+++ b/ast/src/annotations/annotations.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
annotations::{AnnotationArguments, AnnotationName, AnnotationSymbol},
ast::Rule,
diff --git a/ast/src/annotations/mod.rs b/ast/src/annotations/mod.rs
index 787b15ef19..0303b71e48 100644
--- a/ast/src/annotations/mod.rs
+++ b/ast/src/annotations/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod annotations;
pub use annotations::*;
diff --git a/ast/src/ast.rs b/ast/src/ast.rs
index fd92b850cc..7906332c4d 100644
--- a/ast/src/ast.rs
+++ b/ast/src/ast.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Abstract syntax tree (ast) representation from leo.pest.
use crate::{
common::Identifier,
diff --git a/ast/src/circuits/circuit.rs b/ast/src/circuits/circuit.rs
index 011cc7066b..26bc545e00 100644
--- a/ast/src/circuits/circuit.rs
+++ b/ast/src/circuits/circuit.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, circuits::CircuitMember, common::Identifier, SpanDef};
use pest::Span;
diff --git a/ast/src/circuits/circuit_field.rs b/ast/src/circuits/circuit_field.rs
index 270d7b7308..d141ae718f 100644
--- a/ast/src/circuits/circuit_field.rs
+++ b/ast/src/circuits/circuit_field.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Identifier, expressions::Expression, SpanDef};
use pest::Span;
diff --git a/ast/src/circuits/circuit_field_definition.rs b/ast/src/circuits/circuit_field_definition.rs
index 331ff3599a..a919786a4f 100644
--- a/ast/src/circuits/circuit_field_definition.rs
+++ b/ast/src/circuits/circuit_field_definition.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Identifier, types::Type, SpanDef};
use pest::Span;
diff --git a/ast/src/circuits/circuit_function.rs b/ast/src/circuits/circuit_function.rs
index 5a10a8c818..3fdeac1d02 100644
--- a/ast/src/circuits/circuit_function.rs
+++ b/ast/src/circuits/circuit_function.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Static, functions::Function, SpanDef};
use pest::Span;
diff --git a/ast/src/circuits/circuit_member.rs b/ast/src/circuits/circuit_member.rs
index 294d619659..37c33f9689 100644
--- a/ast/src/circuits/circuit_member.rs
+++ b/ast/src/circuits/circuit_member.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
circuits::{CircuitFieldDefinition, CircuitFunction},
diff --git a/ast/src/circuits/mod.rs b/ast/src/circuits/mod.rs
index 662062be94..dcb5aae1e8 100644
--- a/ast/src/circuits/mod.rs
+++ b/ast/src/circuits/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod circuit;
pub use circuit::*;
diff --git a/ast/src/common/assignee.rs b/ast/src/common/assignee.rs
index e72b527193..4019f9d6cd 100644
--- a/ast/src/common/assignee.rs
+++ b/ast/src/common/assignee.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{access::AssigneeAccess, ast::Rule, common::Identifier, SpanDef};
use pest::Span;
diff --git a/ast/src/common/declare.rs b/ast/src/common/declare.rs
index e4c06c2097..dabc1bbfdb 100644
--- a/ast/src/common/declare.rs
+++ b/ast/src/common/declare.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/common/eoi.rs b/ast/src/common/eoi.rs
index e167d29937..610ba45329 100644
--- a/ast/src/common/eoi.rs
+++ b/ast/src/common/eoi.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/common/identifier.rs b/ast/src/common/identifier.rs
index c6adf81e56..e349a3b259 100644
--- a/ast/src/common/identifier.rs
+++ b/ast/src/common/identifier.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::{span_into_string, Rule},
SpanDef,
diff --git a/ast/src/common/line_end.rs b/ast/src/common/line_end.rs
index fec2a1432e..82b862a71f 100644
--- a/ast/src/common/line_end.rs
+++ b/ast/src/common/line_end.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/common/mod.rs b/ast/src/common/mod.rs
index f0fa036f0e..071133d57c 100644
--- a/ast/src/common/mod.rs
+++ b/ast/src/common/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod assignee;
pub use assignee::*;
diff --git a/ast/src/common/mutable.rs b/ast/src/common/mutable.rs
index 3d8b9ebbf5..e627286ce5 100644
--- a/ast/src/common/mutable.rs
+++ b/ast/src/common/mutable.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/common/range.rs b/ast/src/common/range.rs
index 8aabb966ce..602f163964 100644
--- a/ast/src/common/range.rs
+++ b/ast/src/common/range.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::Expression, SpanDef};
use pest::Span;
diff --git a/ast/src/common/range_or_expression.rs b/ast/src/common/range_or_expression.rs
index e0faf4adb5..a20934a4ae 100644
--- a/ast/src/common/range_or_expression.rs
+++ b/ast/src/common/range_or_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Range, expressions::Expression};
use pest_ast::FromPest;
diff --git a/ast/src/common/spread.rs b/ast/src/common/spread.rs
index e73b0010da..f801063345 100644
--- a/ast/src/common/spread.rs
+++ b/ast/src/common/spread.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::Expression, SpanDef};
use pest::Span;
diff --git a/ast/src/common/spread_or_expression.rs b/ast/src/common/spread_or_expression.rs
index 2065b6fd53..3dfcedb7d3 100644
--- a/ast/src/common/spread_or_expression.rs
+++ b/ast/src/common/spread_or_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Spread, expressions::Expression};
use pest_ast::FromPest;
diff --git a/ast/src/common/static_.rs b/ast/src/common/static_.rs
index 070a18664b..1f035515ce 100644
--- a/ast/src/common/static_.rs
+++ b/ast/src/common/static_.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/common/variable_name.rs b/ast/src/common/variable_name.rs
index a525b195ae..76197bb0ed 100644
--- a/ast/src/common/variable_name.rs
+++ b/ast/src/common/variable_name.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
common::{Identifier, Mutable},
diff --git a/ast/src/common/variables.rs b/ast/src/common/variables.rs
index 8e23ac2a48..2e8f3ea084 100644
--- a/ast/src/common/variables.rs
+++ b/ast/src/common/variables.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::VariableName, types::Type, SpanDef};
use pest::Span;
diff --git a/ast/src/macros/formatted_parameter.rs b/ast/src/console/console_assert.rs
similarity index 68%
rename from ast/src/macros/formatted_parameter.rs
rename to ast/src/console/console_assert.rs
index dcdb3ba055..8f96890025 100644
--- a/ast/src/macros/formatted_parameter.rs
+++ b/ast/src/console/console_assert.rs
@@ -6,16 +6,16 @@ use serde::Serialize;
use std::fmt;
#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::formatted_parameter))]
-pub struct FormattedParameter<'ast> {
+#[pest_ast(rule(Rule::console_assert))]
+pub struct ConsoleAssert<'ast> {
pub expression: Expression<'ast>,
#[pest_ast(outer())]
#[serde(with = "SpanDef")]
pub span: Span<'ast>,
}
-impl<'ast> fmt::Display for FormattedParameter<'ast> {
+impl<'ast> fmt::Display for ConsoleAssert<'ast> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}", self.expression)
+ write!(f, "assert({})", self.expression)
}
}
diff --git a/ast/src/console/console_debug.rs b/ast/src/console/console_debug.rs
new file mode 100644
index 0000000000..8debc30580
--- /dev/null
+++ b/ast/src/console/console_debug.rs
@@ -0,0 +1,37 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{ast::Rule, console::FormattedString, SpanDef};
+
+use pest::Span;
+use pest_ast::FromPest;
+use serde::Serialize;
+use std::fmt;
+
+#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
+#[pest_ast(rule(Rule::console_debug))]
+pub struct ConsoleDebug<'ast> {
+ pub string: FormattedString<'ast>,
+ #[pest_ast(outer())]
+ #[serde(with = "SpanDef")]
+ pub span: Span<'ast>,
+}
+
+impl<'ast> fmt::Display for ConsoleDebug<'ast> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "debug({})", self.string)
+ }
+}
diff --git a/ast/src/macros/print.rs b/ast/src/console/console_error.rs
similarity index 52%
rename from ast/src/macros/print.rs
rename to ast/src/console/console_error.rs
index f98b3da6e8..db7cfbd180 100644
--- a/ast/src/macros/print.rs
+++ b/ast/src/console/console_error.rs
@@ -1,4 +1,4 @@
-use crate::{ast::Rule, SpanDef};
+use crate::{ast::Rule, console::FormattedString, SpanDef};
use pest::Span;
use pest_ast::FromPest;
@@ -6,15 +6,16 @@ use serde::Serialize;
use std::fmt;
#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::print))]
-pub struct Print<'ast> {
+#[pest_ast(rule(Rule::console_error))]
+pub struct ConsoleError<'ast> {
+ pub string: FormattedString<'ast>,
#[pest_ast(outer())]
#[serde(with = "SpanDef")]
pub span: Span<'ast>,
}
-impl<'ast> fmt::Display for Print<'ast> {
+impl<'ast> fmt::Display for ConsoleError<'ast> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "print")
+ write!(f, "error({})", self.string)
}
}
diff --git a/ast/src/console/console_function.rs b/ast/src/console/console_function.rs
new file mode 100644
index 0000000000..c137c30c0d
--- /dev/null
+++ b/ast/src/console/console_function.rs
@@ -0,0 +1,28 @@
+use crate::{
+ ast::Rule,
+ console::{ConsoleAssert, ConsoleDebug, ConsoleError, ConsoleLog},
+};
+
+use pest_ast::FromPest;
+use serde::Serialize;
+use std::fmt;
+
+#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
+#[pest_ast(rule(Rule::console_function))]
+pub enum ConsoleFunction<'ast> {
+ Assert(ConsoleAssert<'ast>),
+ Debug(ConsoleDebug<'ast>),
+ Error(ConsoleError<'ast>),
+ Log(ConsoleLog<'ast>),
+}
+
+impl<'ast> fmt::Display for ConsoleFunction<'ast> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match self {
+ ConsoleFunction::Assert(assert) => write!(f, "{}", assert),
+ ConsoleFunction::Debug(debug) => write!(f, "{}", debug),
+ ConsoleFunction::Error(error) => write!(f, "{}", error),
+ ConsoleFunction::Log(log) => write!(f, "{}", log),
+ }
+ }
+}
diff --git a/ast/src/console/console_function_call.rs b/ast/src/console/console_function_call.rs
new file mode 100644
index 0000000000..f77cb329dc
--- /dev/null
+++ b/ast/src/console/console_function_call.rs
@@ -0,0 +1,28 @@
+use crate::{
+ ast::Rule,
+ common::LineEnd,
+ console::{ConsoleFunction, ConsoleKeyword},
+ SpanDef,
+};
+
+use pest::Span;
+use pest_ast::FromPest;
+use serde::Serialize;
+use std::fmt;
+
+#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
+#[pest_ast(rule(Rule::console_function_call))]
+pub struct ConsoleFunctionCall<'ast> {
+ pub keyword: ConsoleKeyword<'ast>,
+ pub function: ConsoleFunction<'ast>,
+ pub line_end: LineEnd,
+ #[pest_ast(outer())]
+ #[serde(with = "SpanDef")]
+ pub span: Span<'ast>,
+}
+
+impl<'ast> fmt::Display for ConsoleFunctionCall<'ast> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "console.{};", self.function)
+ }
+}
diff --git a/ast/src/console/console_keyword.rs b/ast/src/console/console_keyword.rs
new file mode 100644
index 0000000000..c2c3872aaf
--- /dev/null
+++ b/ast/src/console/console_keyword.rs
@@ -0,0 +1,29 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{ast::Rule, SpanDef};
+
+use pest::Span;
+use pest_ast::FromPest;
+use serde::Serialize;
+
+#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
+#[pest_ast(rule(Rule::console_keyword))]
+pub struct ConsoleKeyword<'ast> {
+ #[pest_ast(outer())]
+ #[serde(with = "SpanDef")]
+ pub span: Span<'ast>,
+}
diff --git a/ast/src/console/console_log.rs b/ast/src/console/console_log.rs
new file mode 100644
index 0000000000..26b58d58f0
--- /dev/null
+++ b/ast/src/console/console_log.rs
@@ -0,0 +1,37 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{ast::Rule, console::FormattedString, SpanDef};
+
+use pest::Span;
+use pest_ast::FromPest;
+use serde::Serialize;
+use std::fmt;
+
+#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
+#[pest_ast(rule(Rule::console_log))]
+pub struct ConsoleLog<'ast> {
+ pub string: FormattedString<'ast>,
+ #[pest_ast(outer())]
+ #[serde(with = "SpanDef")]
+ pub span: Span<'ast>,
+}
+
+impl<'ast> fmt::Display for ConsoleLog<'ast> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "log({})", self.string)
+ }
+}
diff --git a/ast/src/console/formatted_container.rs b/ast/src/console/formatted_container.rs
new file mode 100644
index 0000000000..e6234dc723
--- /dev/null
+++ b/ast/src/console/formatted_container.rs
@@ -0,0 +1,36 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{ast::Rule, SpanDef};
+
+use pest::Span;
+use pest_ast::FromPest;
+use serde::Serialize;
+use std::fmt;
+
+#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
+#[pest_ast(rule(Rule::formatted_container))]
+pub struct FormattedContainer<'ast> {
+ #[pest_ast(outer())]
+ #[serde(with = "SpanDef")]
+ pub span: Span<'ast>,
+}
+
+impl<'ast> fmt::Display for FormattedContainer<'ast> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{{}}")
+ }
+}
diff --git a/ast/src/console/formatted_parameter.rs b/ast/src/console/formatted_parameter.rs
new file mode 100644
index 0000000000..c8b8c3cbe4
--- /dev/null
+++ b/ast/src/console/formatted_parameter.rs
@@ -0,0 +1,37 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{ast::Rule, expressions::Expression, SpanDef};
+
+use pest::Span;
+use pest_ast::FromPest;
+use serde::Serialize;
+use std::fmt;
+
+#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
+#[pest_ast(rule(Rule::formatted_parameter))]
+pub struct FormattedParameter<'ast> {
+ pub expression: Expression<'ast>,
+ #[pest_ast(outer())]
+ #[serde(with = "SpanDef")]
+ pub span: Span<'ast>,
+}
+
+impl<'ast> fmt::Display for FormattedParameter<'ast> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{}", self.expression)
+ }
+}
diff --git a/ast/src/console/formatted_string.rs b/ast/src/console/formatted_string.rs
new file mode 100644
index 0000000000..d40d399f6b
--- /dev/null
+++ b/ast/src/console/formatted_string.rs
@@ -0,0 +1,44 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{
+ ast::{span_into_string, Rule},
+ console::{FormattedContainer, FormattedParameter},
+ SpanDef,
+};
+
+use pest::Span;
+use pest_ast::FromPest;
+use serde::Serialize;
+use std::fmt;
+
+#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
+#[pest_ast(rule(Rule::formatted_string))]
+pub struct FormattedString<'ast> {
+ #[pest_ast(outer(with(span_into_string)))]
+ pub string: String,
+ pub containers: Vec>,
+ pub parameters: Vec>,
+ #[pest_ast(outer())]
+ #[serde(with = "SpanDef")]
+ pub span: Span<'ast>,
+}
+
+impl<'ast> fmt::Display for FormattedString<'ast> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{}", self.string)
+ }
+}
diff --git a/ast/src/console/mod.rs b/ast/src/console/mod.rs
new file mode 100644
index 0000000000..6743e500c5
--- /dev/null
+++ b/ast/src/console/mod.rs
@@ -0,0 +1,29 @@
+pub mod console_assert;
+pub use console_assert::*;
+
+pub mod console_debug;
+pub use console_debug::*;
+
+pub mod console_error;
+pub use console_error::*;
+
+pub mod console_function;
+pub use console_function::*;
+
+pub mod console_function_call;
+pub use console_function_call::*;
+
+pub mod console_keyword;
+pub use console_keyword::*;
+
+pub mod console_log;
+pub use console_log::*;
+
+pub mod formatted_container;
+pub use formatted_container::*;
+
+pub mod formatted_parameter;
+pub use formatted_parameter::*;
+
+pub mod formatted_string;
+pub use formatted_string::*;
diff --git a/ast/src/definitions/annotated_definition.rs b/ast/src/definitions/annotated_definition.rs
index 8c3b15f6d8..20177facb9 100644
--- a/ast/src/definitions/annotated_definition.rs
+++ b/ast/src/definitions/annotated_definition.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{annotations::Annotation, ast::Rule, definitions::Definition, SpanDef};
use pest::Span;
diff --git a/ast/src/definitions/definition.rs b/ast/src/definitions/definition.rs
index c2858f4535..ee913f76d1 100644
--- a/ast/src/definitions/definition.rs
+++ b/ast/src/definitions/definition.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
circuits::Circuit,
diff --git a/ast/src/definitions/mod.rs b/ast/src/definitions/mod.rs
index 83cde009a3..923f7c5da6 100644
--- a/ast/src/definitions/mod.rs
+++ b/ast/src/definitions/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod annotated_definition;
pub use annotated_definition::*;
diff --git a/ast/src/errors/mod.rs b/ast/src/errors/mod.rs
index 9d9164fa35..c60030f31f 100644
--- a/ast/src/errors/mod.rs
+++ b/ast/src/errors/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod parser;
pub use parser::*;
diff --git a/ast/src/errors/parser.rs b/ast/src/errors/parser.rs
index df679dc62b..641b86b84f 100644
--- a/ast/src/errors/parser.rs
+++ b/ast/src/errors/parser.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, errors::SyntaxError};
use pest::error::Error;
diff --git a/ast/src/errors/syntax.rs b/ast/src/errors/syntax.rs
index 2bce3412d0..9c5a19a30b 100644
--- a/ast/src/errors/syntax.rs
+++ b/ast/src/errors/syntax.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest::error::Error;
diff --git a/ast/src/expressions/array_initializer_expression.rs b/ast/src/expressions/array_initializer_expression.rs
index 53308977a3..dd701a720b 100644
--- a/ast/src/expressions/array_initializer_expression.rs
+++ b/ast/src/expressions/array_initializer_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::SpreadOrExpression, values::PositiveNumber, SpanDef};
use pest::Span;
diff --git a/ast/src/expressions/array_inline_expression.rs b/ast/src/expressions/array_inline_expression.rs
index c43a1b0a5c..e7580c1f6d 100644
--- a/ast/src/expressions/array_inline_expression.rs
+++ b/ast/src/expressions/array_inline_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::SpreadOrExpression, SpanDef};
use pest::Span;
diff --git a/ast/src/expressions/binary_expression.rs b/ast/src/expressions/binary_expression.rs
index f04efb6c60..32861632b3 100644
--- a/ast/src/expressions/binary_expression.rs
+++ b/ast/src/expressions/binary_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{expressions::Expression, operations::BinaryOperation, SpanDef};
use pest::Span;
diff --git a/ast/src/expressions/circuit_inline_expression.rs b/ast/src/expressions/circuit_inline_expression.rs
index 7e0fb83de5..d829f66fd1 100644
--- a/ast/src/expressions/circuit_inline_expression.rs
+++ b/ast/src/expressions/circuit_inline_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, circuits::CircuitField, common::Identifier, SpanDef};
use pest::Span;
diff --git a/ast/src/expressions/expression.rs b/ast/src/expressions/expression.rs
index 307ac9de4d..47cb5d92e0 100644
--- a/ast/src/expressions/expression.rs
+++ b/ast/src/expressions/expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{common::Identifier, expressions::*, operations::BinaryOperation, values::Value};
use pest::Span;
diff --git a/ast/src/expressions/mod.rs b/ast/src/expressions/mod.rs
index d39f8b9d83..f4f5fd0e39 100644
--- a/ast/src/expressions/mod.rs
+++ b/ast/src/expressions/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod array_initializer_expression;
pub use array_initializer_expression::*;
diff --git a/ast/src/expressions/postfix_expression.rs b/ast/src/expressions/postfix_expression.rs
index d578fa0350..7dd7e2b034 100644
--- a/ast/src/expressions/postfix_expression.rs
+++ b/ast/src/expressions/postfix_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{access::Access, ast::Rule, common::Identifier, SpanDef};
use pest::Span;
diff --git a/ast/src/expressions/ternary_expression.rs b/ast/src/expressions/ternary_expression.rs
index 63ff4e62eb..395aaae7be 100644
--- a/ast/src/expressions/ternary_expression.rs
+++ b/ast/src/expressions/ternary_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::Expression, SpanDef};
use pest::Span;
diff --git a/ast/src/expressions/tuple_expression.rs b/ast/src/expressions/tuple_expression.rs
index c528f35b9b..eca27a69a6 100644
--- a/ast/src/expressions/tuple_expression.rs
+++ b/ast/src/expressions/tuple_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::Expression, SpanDef};
use pest::Span;
diff --git a/ast/src/expressions/unary_expression.rs b/ast/src/expressions/unary_expression.rs
index bc661d4067..2bda397059 100644
--- a/ast/src/expressions/unary_expression.rs
+++ b/ast/src/expressions/unary_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::Expression, operations::UnaryOperation, SpanDef};
use pest::Span;
diff --git a/ast/src/files/file.rs b/ast/src/files/file.rs
index 58dc4d3c51..ca4cd79652 100644
--- a/ast/src/files/file.rs
+++ b/ast/src/files/file.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::EOI, definitions::Definition, SpanDef};
use pest::Span;
diff --git a/ast/src/files/mod.rs b/ast/src/files/mod.rs
index de03a628a4..d61114399a 100644
--- a/ast/src/files/mod.rs
+++ b/ast/src/files/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod file;
pub use file::*;
diff --git a/ast/src/functions/function.rs b/ast/src/functions/function.rs
index cdaa9872d6..4129422ed0 100644
--- a/ast/src/functions/function.rs
+++ b/ast/src/functions/function.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Identifier, functions::input::Input, statements::Statement, types::Type, SpanDef};
use pest::Span;
diff --git a/ast/src/functions/input/function_input.rs b/ast/src/functions/input/function_input.rs
index 127bd13502..05a8da3435 100644
--- a/ast/src/functions/input/function_input.rs
+++ b/ast/src/functions/input/function_input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
common::{Identifier, Mutable},
diff --git a/ast/src/functions/input/input.rs b/ast/src/functions/input/input.rs
index 679f94239c..d3cddee215 100644
--- a/ast/src/functions/input/input.rs
+++ b/ast/src/functions/input/input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
functions::{FunctionInput, InputKeyword},
diff --git a/ast/src/functions/input/input_keyword.rs b/ast/src/functions/input/input_keyword.rs
index 2e9bc8902d..e70e43f20d 100644
--- a/ast/src/functions/input/input_keyword.rs
+++ b/ast/src/functions/input/input_keyword.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::{span_into_string, Rule},
SpanDef,
diff --git a/ast/src/functions/input/mod.rs b/ast/src/functions/input/mod.rs
index ab87f809fa..8e0a1776a4 100644
--- a/ast/src/functions/input/mod.rs
+++ b/ast/src/functions/input/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod function_input;
pub use function_input::*;
diff --git a/ast/src/functions/mod.rs b/ast/src/functions/mod.rs
index 376bb34270..bb15f47eb9 100644
--- a/ast/src/functions/mod.rs
+++ b/ast/src/functions/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod function;
pub use function::*;
diff --git a/ast/src/functions/test_function.rs b/ast/src/functions/test_function.rs
index d3f89f9df8..54222deafd 100644
--- a/ast/src/functions/test_function.rs
+++ b/ast/src/functions/test_function.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, functions::Function, SpanDef};
use pest::Span;
diff --git a/ast/src/imports/import.rs b/ast/src/imports/import.rs
index 74a8255e5e..5a8ff43b8a 100644
--- a/ast/src/imports/import.rs
+++ b/ast/src/imports/import.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::LineEnd, imports::Package, SpanDef};
use pest::Span;
diff --git a/ast/src/imports/import_symbol.rs b/ast/src/imports/import_symbol.rs
index 61f0acbc1a..619a9212aa 100644
--- a/ast/src/imports/import_symbol.rs
+++ b/ast/src/imports/import_symbol.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Identifier, SpanDef};
use pest::Span;
diff --git a/ast/src/imports/mod.rs b/ast/src/imports/mod.rs
index 696656fb9f..4a1343664a 100644
--- a/ast/src/imports/mod.rs
+++ b/ast/src/imports/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod import;
pub use import::*;
diff --git a/ast/src/imports/package.rs b/ast/src/imports/package.rs
index f8b34c4362..75a3935913 100644
--- a/ast/src/imports/package.rs
+++ b/ast/src/imports/package.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
imports::{PackageAccess, PackageName},
diff --git a/ast/src/imports/package_access.rs b/ast/src/imports/package_access.rs
index 612aa23683..0e04906152 100644
--- a/ast/src/imports/package_access.rs
+++ b/ast/src/imports/package_access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
imports::{ImportSymbol, Package, Star},
diff --git a/ast/src/imports/package_name.rs b/ast/src/imports/package_name.rs
index 610dfb5bce..a4102ab2b2 100644
--- a/ast/src/imports/package_name.rs
+++ b/ast/src/imports/package_name.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::{span_into_string, Rule},
SpanDef,
diff --git a/ast/src/imports/star.rs b/ast/src/imports/star.rs
index 962aabf7eb..bb50b3e864 100644
--- a/ast/src/imports/star.rs
+++ b/ast/src/imports/star.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, SpanDef};
use pest::Span;
diff --git a/ast/src/leo.pest b/ast/src/leo.pest
index 70ee089170..dc350cd0f4 100644
--- a/ast/src/leo.pest
+++ b/ast/src/leo.pest
@@ -25,6 +25,7 @@ protected_name = {
| "as"
| "circuit"
| "const"
+ | "console"
| "else"
| "false"
| "field"
@@ -234,7 +235,8 @@ value_boolean = { "true" | "false" }
value_field = ${ value_number ~ type_field }
// Declared in values/group_value.rs
-value_group = ${ group_tuple ~ type_group }
+value_group = ${ group_single_or_tuple ~ type_group }
+group_single_or_tuple = {value_number | group_tuple}
group_tuple = !{"(" ~ group_coordinate ~ "," ~ group_coordinate ~ ")"}
// Declared in values/group_coordinate.rs
@@ -345,18 +347,13 @@ statement = {
(statement_return
| statement_conditional
| statement_for
- | statement_macro
+ | console_function_call
| statement_definition
| statement_assign
| statement_expression
) ~ NEWLINE*
}
-// Declared in statements/macro_statement.rs
-statement_macro = {
- assert_eq
- | formatted_macro
-}
// Declared in statements/assign_statement.rs
statement_assign = { assignee ~ operation_assign ~ expression ~ LINE_END }
@@ -431,15 +428,35 @@ import_symbol = { identifier ~ ("as " ~ identifier)? }
COMMENT = _{ ("/*" ~ (!"*/" ~ ANY)* ~ "*/") | ("//" ~ (!NEWLINE ~ ANY)*) }
WHITESPACE = _{ " " | "\t" ~ (NEWLINE)* } // pest implicit whitespace keyword
-/// Macros
+/// Console Functions
-// Declared in macros/assert_eq.rs
-assert_eq = {"assert_eq!" ~ "(" ~ NEWLINE* ~ expression ~ "," ~ NEWLINE* ~ expression ~ NEWLINE* ~ ")" ~ LINE_END}
+// Declared in console/console_function_call.rs
+console_function_call = ${console_keyword ~ "." ~ console_function ~ LINE_END}
-// Declared in macros/formatted_macro.rs
-formatted_macro = { macro_name ~ macro_symbol ~ "(" ~ formatted_string? ~ ")" ~ LINE_END}
+// Declared in console/console_keyword.rs
+console_keyword = {"console"}
-// Declared in macros/formatted_string.rs
+// Declared in console/console_function.rs
+console_function = {
+ console_assert
+ | console_debug
+ | console_error
+ | console_log
+}
+
+// Declared in console/console_assert.rs
+console_assert = !{"assert(" ~ expression ~ ")"}
+
+// Declared in console/console_debug.rs
+console_debug = !{"debug(" ~ formatted_string? ~ ")"}
+
+// Declared in console/console_error.rs
+console_error = !{"error(" ~ formatted_string? ~ ")"}
+
+// Declared in console/console_log.rs
+console_log = !{"log(" ~ formatted_string? ~ ")"}
+
+// Declared in console/formatted_string.rs
formatted_string = {
"\""
~ (!"\"" ~ (formatted_container | ANY))*
@@ -447,31 +464,12 @@ formatted_string = {
~ ("," ~ formatted_parameter)*
}
-// Declared in macros/formatted_container.rs
+// Declared in console/formatted_container.rs
formatted_container = { "{" ~ "}"}
-// Declared in macros/formatted_parameter.rs
+// Declared in console/formatted_parameter.rs
formatted_parameter = { expression }
-// Declared in macros/macro_symbol.rs
-macro_symbol = {"!"}
-
-// Declared in macros/macro_name.rs
-macro_name = {
- debug
- | error
- | print
-}
-
-// Declared in macros/print.rs
-print = {"print"}
-
-// Declared in macros/debug.rs
-debug = {"debug"}
-
-// Declared in macros/error.rs
-error = {"error"}
-
/// Annotations
// Declared in annotations/annotation.rs
diff --git a/ast/src/lib.rs b/ast/src/lib.rs
index 8b11d62b33..88d9668365 100644
--- a/ast/src/lib.rs
+++ b/ast/src/lib.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
extern crate lazy_static;
#[macro_use]
@@ -11,12 +27,12 @@ pub mod access;
pub mod annotations;
pub mod circuits;
pub mod common;
+pub mod console;
pub mod definitions;
pub mod expressions;
pub mod files;
pub mod functions;
pub mod imports;
-pub mod macros;
pub mod operations;
pub mod statements;
pub mod types;
diff --git a/ast/src/macros/assert_eq.rs b/ast/src/macros/assert_eq.rs
deleted file mode 100644
index 680710d1af..0000000000
--- a/ast/src/macros/assert_eq.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-use crate::{ast::Rule, common::LineEnd, expressions::Expression, SpanDef};
-
-use pest::Span;
-use pest_ast::FromPest;
-use serde::Serialize;
-use std::fmt;
-
-#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::assert_eq))]
-pub struct AssertEq<'ast> {
- pub left: Expression<'ast>,
- pub right: Expression<'ast>,
- pub line_end: LineEnd,
- #[pest_ast(outer())]
- #[serde(with = "SpanDef")]
- pub span: Span<'ast>,
-}
-
-impl<'ast> fmt::Display for AssertEq<'ast> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "assert_eq({}, {});", self.left, self.right)
- }
-}
diff --git a/ast/src/macros/debug.rs b/ast/src/macros/debug.rs
deleted file mode 100644
index 2bfcf0e2aa..0000000000
--- a/ast/src/macros/debug.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-use crate::{ast::Rule, SpanDef};
-
-use pest::Span;
-use pest_ast::FromPest;
-use serde::Serialize;
-use std::fmt;
-
-#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::debug))]
-pub struct Debug<'ast> {
- #[pest_ast(outer())]
- #[serde(with = "SpanDef")]
- pub span: Span<'ast>,
-}
-
-impl<'ast> fmt::Display for Debug<'ast> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "debug")
- }
-}
diff --git a/ast/src/macros/error.rs b/ast/src/macros/error.rs
deleted file mode 100644
index b43205cba3..0000000000
--- a/ast/src/macros/error.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-use crate::{ast::Rule, SpanDef};
-
-use pest::Span;
-use pest_ast::FromPest;
-use serde::Serialize;
-use std::fmt;
-
-#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::error))]
-pub struct Error<'ast> {
- #[pest_ast(outer())]
- #[serde(with = "SpanDef")]
- pub span: Span<'ast>,
-}
-
-impl<'ast> fmt::Display for Error<'ast> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "error")
- }
-}
diff --git a/ast/src/macros/formatted_container.rs b/ast/src/macros/formatted_container.rs
deleted file mode 100644
index dc6565db52..0000000000
--- a/ast/src/macros/formatted_container.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-use crate::{ast::Rule, SpanDef};
-
-use pest::Span;
-use pest_ast::FromPest;
-use serde::Serialize;
-use std::fmt;
-
-#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::formatted_container))]
-pub struct FormattedContainer<'ast> {
- #[pest_ast(outer())]
- #[serde(with = "SpanDef")]
- pub span: Span<'ast>,
-}
-
-impl<'ast> fmt::Display for FormattedContainer<'ast> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{{}}")
- }
-}
diff --git a/ast/src/macros/formatted_macro.rs b/ast/src/macros/formatted_macro.rs
deleted file mode 100644
index 928aa49d4c..0000000000
--- a/ast/src/macros/formatted_macro.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-use crate::{
- ast::Rule,
- common::LineEnd,
- macros::{FormattedString, MacroName, MacroSymbol},
- SpanDef,
-};
-
-use pest::Span;
-use pest_ast::FromPest;
-use serde::Serialize;
-use std::fmt;
-
-#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::formatted_macro))]
-pub struct FormattedMacro<'ast> {
- pub name: MacroName<'ast>,
- pub symbol: MacroSymbol,
- pub string: Option>,
- pub line_end: LineEnd,
- #[pest_ast(outer())]
- #[serde(with = "SpanDef")]
- pub span: Span<'ast>,
-}
-
-impl<'ast> fmt::Display for FormattedMacro<'ast> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(
- f,
- "{}{}({}){}",
- self.name,
- self.symbol,
- self.string.as_ref().map(|s| s.to_string()).unwrap_or("".to_string()),
- self.line_end
- )
- }
-}
diff --git a/ast/src/macros/formatted_string.rs b/ast/src/macros/formatted_string.rs
deleted file mode 100644
index cfa5fddbcc..0000000000
--- a/ast/src/macros/formatted_string.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-use crate::{
- ast::{span_into_string, Rule},
- macros::{FormattedContainer, FormattedParameter},
- SpanDef,
-};
-
-use pest::Span;
-use pest_ast::FromPest;
-use serde::Serialize;
-use std::fmt;
-
-#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::formatted_string))]
-pub struct FormattedString<'ast> {
- #[pest_ast(outer(with(span_into_string)))]
- pub string: String,
- pub containers: Vec>,
- pub parameters: Vec>,
- #[pest_ast(outer())]
- #[serde(with = "SpanDef")]
- pub span: Span<'ast>,
-}
-
-impl<'ast> fmt::Display for FormattedString<'ast> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}", self.string)
- }
-}
diff --git a/ast/src/macros/macro_name.rs b/ast/src/macros/macro_name.rs
deleted file mode 100644
index 320f42b134..0000000000
--- a/ast/src/macros/macro_name.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-use crate::{
- ast::Rule,
- macros::{Debug, Error, Print},
-};
-
-use pest_ast::FromPest;
-use serde::Serialize;
-use std::fmt;
-
-#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::macro_name))]
-pub enum MacroName<'ast> {
- Debug(Debug<'ast>),
- Error(Error<'ast>),
- Print(Print<'ast>),
-}
-
-impl<'ast> fmt::Display for MacroName<'ast> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match *self {
- MacroName::Debug(ref debug) => write!(f, "{}", debug),
- MacroName::Error(ref error) => write!(f, "{}", error),
- MacroName::Print(ref print_line) => write!(f, "{}", print_line),
- }
- }
-}
diff --git a/ast/src/macros/macro_symbol.rs b/ast/src/macros/macro_symbol.rs
deleted file mode 100644
index 517bf711a2..0000000000
--- a/ast/src/macros/macro_symbol.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-use crate::ast::Rule;
-
-use pest_ast::FromPest;
-use serde::Serialize;
-use std::fmt;
-
-#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::macro_symbol))]
-pub struct MacroSymbol {}
-
-impl fmt::Display for MacroSymbol {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "!")
- }
-}
diff --git a/ast/src/macros/mod.rs b/ast/src/macros/mod.rs
deleted file mode 100644
index 8d85c1cd75..0000000000
--- a/ast/src/macros/mod.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-pub mod assert_eq;
-pub use assert_eq::*;
-
-pub mod debug;
-pub use debug::*;
-
-pub mod error;
-pub use error::*;
-
-pub mod formatted_container;
-pub use formatted_container::*;
-
-pub mod formatted_parameter;
-pub use formatted_parameter::*;
-
-pub mod formatted_string;
-pub use formatted_string::*;
-
-pub mod formatted_macro;
-pub use formatted_macro::*;
-
-pub mod macro_name;
-pub use macro_name::*;
-
-pub mod macro_symbol;
-pub use macro_symbol::*;
-
-pub mod print;
-pub use print::*;
diff --git a/ast/src/main.rs b/ast/src/main.rs
index 8a672ef403..df420eac74 100644
--- a/ast/src/main.rs
+++ b/ast/src/main.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_ast::{LeoAst, ParserError};
use std::{env, fs, path::Path};
diff --git a/ast/src/operations/assign_operation.rs b/ast/src/operations/assign_operation.rs
index da23acc91d..33c5a06ee7 100644
--- a/ast/src/operations/assign_operation.rs
+++ b/ast/src/operations/assign_operation.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/operations/binary_operation.rs b/ast/src/operations/binary_operation.rs
index 448e627dfe..31d56ffba7 100644
--- a/ast/src/operations/binary_operation.rs
+++ b/ast/src/operations/binary_operation.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/operations/mod.rs b/ast/src/operations/mod.rs
index 72c659cc03..b58e3bd651 100644
--- a/ast/src/operations/mod.rs
+++ b/ast/src/operations/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod assign_operation;
pub use assign_operation::*;
diff --git a/ast/src/operations/unary_operation.rs b/ast/src/operations/unary_operation.rs
index fa8c37baa9..2603795ecb 100644
--- a/ast/src/operations/unary_operation.rs
+++ b/ast/src/operations/unary_operation.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/span.rs b/ast/src/span.rs
index 28c35f9247..daa999d4cf 100644
--- a/ast/src/span.rs
+++ b/ast/src/span.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use pest::Span;
use serde::Serialize;
diff --git a/ast/src/statements/assign_statement.rs b/ast/src/statements/assign_statement.rs
index 1196d77c89..2a7eb29b8c 100644
--- a/ast/src/statements/assign_statement.rs
+++ b/ast/src/statements/assign_statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
common::{Assignee, LineEnd},
diff --git a/ast/src/statements/conditional_nested_or_end_statement.rs b/ast/src/statements/conditional_nested_or_end_statement.rs
index 41121f3ff9..120fc2ba7e 100644
--- a/ast/src/statements/conditional_nested_or_end_statement.rs
+++ b/ast/src/statements/conditional_nested_or_end_statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
statements::{ConditionalStatement, Statement},
diff --git a/ast/src/statements/conditional_statement.rs b/ast/src/statements/conditional_statement.rs
index b6d4c9a157..e11cab8a1c 100644
--- a/ast/src/statements/conditional_statement.rs
+++ b/ast/src/statements/conditional_statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
expressions::Expression,
diff --git a/ast/src/statements/definition_statement.rs b/ast/src/statements/definition_statement.rs
index 5f07484a30..6c78a6ffe3 100644
--- a/ast/src/statements/definition_statement.rs
+++ b/ast/src/statements/definition_statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
common::{Declare, LineEnd, Variables},
diff --git a/ast/src/statements/expression_statement.rs b/ast/src/statements/expression_statement.rs
index 2ec81401bc..e03639bb52 100644
--- a/ast/src/statements/expression_statement.rs
+++ b/ast/src/statements/expression_statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::LineEnd, expressions::Expression, SpanDef};
use pest::Span;
diff --git a/ast/src/statements/for_statement.rs b/ast/src/statements/for_statement.rs
index 49985791c5..a31ed51f0f 100644
--- a/ast/src/statements/for_statement.rs
+++ b/ast/src/statements/for_statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Identifier, expressions::Expression, statements::Statement, SpanDef};
use pest::Span;
diff --git a/ast/src/statements/macro_statement.rs b/ast/src/statements/macro_statement.rs
deleted file mode 100644
index d75a87efd6..0000000000
--- a/ast/src/statements/macro_statement.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use crate::{
- ast::Rule,
- macros::{AssertEq, FormattedMacro},
-};
-
-use pest_ast::FromPest;
-use serde::Serialize;
-use std::fmt;
-
-#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
-#[pest_ast(rule(Rule::statement_macro))]
-pub enum MacroStatement<'ast> {
- AssertEq(AssertEq<'ast>),
- Formatted(FormattedMacro<'ast>),
-}
-
-impl<'ast> fmt::Display for MacroStatement<'ast> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match *self {
- MacroStatement::AssertEq(ref assert) => write!(f, "{}", assert),
- MacroStatement::Formatted(ref formatted) => write!(f, "{}", formatted),
- }
- }
-}
diff --git a/ast/src/statements/mod.rs b/ast/src/statements/mod.rs
index 50202579e5..95978fa8af 100644
--- a/ast/src/statements/mod.rs
+++ b/ast/src/statements/mod.rs
@@ -1,5 +1,18 @@
-pub mod macro_statement;
-pub use macro_statement::*;
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
pub mod assign_statement;
pub use assign_statement::*;
diff --git a/ast/src/statements/return_statement.rs b/ast/src/statements/return_statement.rs
index aaf8ecee63..71c3800f52 100644
--- a/ast/src/statements/return_statement.rs
+++ b/ast/src/statements/return_statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::Expression, SpanDef};
use pest::Span;
diff --git a/ast/src/statements/statement.rs b/ast/src/statements/statement.rs
index d12226e5a9..602d7785fa 100644
--- a/ast/src/statements/statement.rs
+++ b/ast/src/statements/statement.rs
@@ -1,4 +1,20 @@
-use crate::{ast::Rule, statements::*};
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{ast::Rule, console::ConsoleFunctionCall, statements::*};
use pest_ast::FromPest;
use serde::Serialize;
@@ -12,7 +28,7 @@ pub enum Statement<'ast> {
Assign(AssignStatement<'ast>),
Conditional(ConditionalStatement<'ast>),
Iteration(ForStatement<'ast>),
- Assert(MacroStatement<'ast>),
+ Console(ConsoleFunctionCall<'ast>),
Expression(ExpressionStatement<'ast>),
}
@@ -24,7 +40,7 @@ impl<'ast> fmt::Display for Statement<'ast> {
Statement::Assign(ref statement) => write!(f, "{}", statement),
Statement::Conditional(ref statement) => write!(f, "{}", statement),
Statement::Iteration(ref statement) => write!(f, "{}", statement),
- Statement::Assert(ref statement) => write!(f, "{}", statement),
+ Statement::Console(ref statement) => write!(f, "{}", statement),
Statement::Expression(ref statement) => write!(f, "{}", statement.expression),
}
}
diff --git a/ast/src/types/address_type.rs b/ast/src/types/address_type.rs
index 9760d7763c..7918496c79 100644
--- a/ast/src/types/address_type.rs
+++ b/ast/src/types/address_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/types/array_type.rs b/ast/src/types/array_type.rs
index 2795020e7c..fd1176ccfd 100644
--- a/ast/src/types/array_type.rs
+++ b/ast/src/types/array_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::DataType, values::PositiveNumber, SpanDef};
use pest::Span;
diff --git a/ast/src/types/boolean_type.rs b/ast/src/types/boolean_type.rs
index 2639cf2b48..2ebc567f6f 100644
--- a/ast/src/types/boolean_type.rs
+++ b/ast/src/types/boolean_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/types/circuit_type.rs b/ast/src/types/circuit_type.rs
index 3326b7d39a..c60bee604d 100644
--- a/ast/src/types/circuit_type.rs
+++ b/ast/src/types/circuit_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Identifier, SpanDef};
use pest::Span;
diff --git a/ast/src/types/data_type.rs b/ast/src/types/data_type.rs
index 65e90e5307..e42f40c14c 100644
--- a/ast/src/types/data_type.rs
+++ b/ast/src/types/data_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
types::{AddressType, BooleanType, FieldType, GroupType, IntegerType},
diff --git a/ast/src/types/field_type.rs b/ast/src/types/field_type.rs
index 5afc41ff4c..2c8aa13061 100644
--- a/ast/src/types/field_type.rs
+++ b/ast/src/types/field_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/types/group_type.rs b/ast/src/types/group_type.rs
index c8f8397b69..9529a91058 100644
--- a/ast/src/types/group_type.rs
+++ b/ast/src/types/group_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/types/integer_type.rs b/ast/src/types/integer_type.rs
index ae915e6c94..e75785ea4e 100644
--- a/ast/src/types/integer_type.rs
+++ b/ast/src/types/integer_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
types::{SignedIntegerType, UnsignedIntegerType},
diff --git a/ast/src/types/mod.rs b/ast/src/types/mod.rs
index 3a463e4c87..3011db3449 100644
--- a/ast/src/types/mod.rs
+++ b/ast/src/types/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod address_type;
pub use address_type::*;
diff --git a/ast/src/types/self_type.rs b/ast/src/types/self_type.rs
index 53fc667c6a..beca5d7413 100644
--- a/ast/src/types/self_type.rs
+++ b/ast/src/types/self_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/types/signed_integer_type.rs b/ast/src/types/signed_integer_type.rs
index 16c516c0bb..91cde4e4b1 100644
--- a/ast/src/types/signed_integer_type.rs
+++ b/ast/src/types/signed_integer_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/types/tuple_type.rs b/ast/src/types/tuple_type.rs
index d08a7ea6c1..9547ee3fff 100644
--- a/ast/src/types/tuple_type.rs
+++ b/ast/src/types/tuple_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::Type, SpanDef};
use pest::Span;
diff --git a/ast/src/types/type_.rs b/ast/src/types/type_.rs
index f401633315..02158a3499 100644
--- a/ast/src/types/type_.rs
+++ b/ast/src/types/type_.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::*};
use pest_ast::FromPest;
diff --git a/ast/src/types/unsigned_integer_type.rs b/ast/src/types/unsigned_integer_type.rs
index 5f2fce1108..764d5030b2 100644
--- a/ast/src/types/unsigned_integer_type.rs
+++ b/ast/src/types/unsigned_integer_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/ast/src/values/address.rs b/ast/src/values/address.rs
index 34549f46f4..5ea7a60fd9 100644
--- a/ast/src/values/address.rs
+++ b/ast/src/values/address.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::{span_into_string, Rule},
SpanDef,
diff --git a/ast/src/values/address_value.rs b/ast/src/values/address_value.rs
index 7e0dd10329..94c46f9ea3 100644
--- a/ast/src/values/address_value.rs
+++ b/ast/src/values/address_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::AddressType, values::address::Address, SpanDef};
use pest::Span;
diff --git a/ast/src/values/boolean_value.rs b/ast/src/values/boolean_value.rs
index 0e65e6ebd2..ef06a9da98 100644
--- a/ast/src/values/boolean_value.rs
+++ b/ast/src/values/boolean_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::{span_into_string, Rule},
SpanDef,
diff --git a/ast/src/values/field_value.rs b/ast/src/values/field_value.rs
index b67d455ddf..d4106cb7f1 100644
--- a/ast/src/values/field_value.rs
+++ b/ast/src/values/field_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::FieldType, values::NumberValue, SpanDef};
use pest::Span;
diff --git a/ast/src/values/group_coordinate.rs b/ast/src/values/group_coordinate.rs
index 01b7fbda55..66ff4bd94e 100644
--- a/ast/src/values/group_coordinate.rs
+++ b/ast/src/values/group_coordinate.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, values::NumberValue, SpanDef};
use pest::Span;
diff --git a/ast/src/values/group_value.rs b/ast/src/values/group_value.rs
index ee9310de90..eafe115b88 100644
--- a/ast/src/values/group_value.rs
+++ b/ast/src/values/group_value.rs
@@ -1,4 +1,25 @@
-use crate::{ast::Rule, types::GroupType, values::GroupCoordinate, SpanDef};
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{
+ ast::Rule,
+ types::GroupType,
+ values::{GroupCoordinate, NumberValue},
+ SpanDef,
+};
use pest::Span;
use pest_ast::FromPest;
@@ -8,7 +29,7 @@ use std::fmt;
#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
#[pest_ast(rule(Rule::value_group))]
pub struct GroupValue<'ast> {
- pub value: GroupTuple<'ast>,
+ pub value: GroupRepresentation<'ast>,
pub type_: GroupType,
#[pest_ast(outer())]
#[serde(with = "SpanDef")]
@@ -21,6 +42,22 @@ impl<'ast> fmt::Display for GroupValue<'ast> {
}
}
+#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
+#[pest_ast(rule(Rule::group_single_or_tuple))]
+pub enum GroupRepresentation<'ast> {
+ Single(NumberValue<'ast>),
+ Tuple(GroupTuple<'ast>),
+}
+
+impl<'ast> fmt::Display for GroupRepresentation<'ast> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match self {
+ GroupRepresentation::Single(number) => write!(f, "{}", number),
+ GroupRepresentation::Tuple(tuple) => write!(f, "{}", tuple),
+ }
+ }
+}
+
#[derive(Clone, Debug, FromPest, PartialEq, Serialize)]
#[pest_ast(rule(Rule::group_tuple))]
pub struct GroupTuple<'ast> {
diff --git a/ast/src/values/integer_value.rs b/ast/src/values/integer_value.rs
index f71c4ec4b2..6605c83724 100644
--- a/ast/src/values/integer_value.rs
+++ b/ast/src/values/integer_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
values::{SignedIntegerValue, UnsignedIntegerValue},
diff --git a/ast/src/values/mod.rs b/ast/src/values/mod.rs
index e1ca123f27..d1e2114977 100644
--- a/ast/src/values/mod.rs
+++ b/ast/src/values/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod address;
pub use address_value::*;
diff --git a/ast/src/values/negative_number.rs b/ast/src/values/negative_number.rs
index 7f1951d221..7287967380 100644
--- a/ast/src/values/negative_number.rs
+++ b/ast/src/values/negative_number.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::{span_into_string, Rule},
span::SpanDef,
diff --git a/ast/src/values/number_value.rs b/ast/src/values/number_value.rs
index 9517e28919..02c5171b68 100644
--- a/ast/src/values/number_value.rs
+++ b/ast/src/values/number_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
values::{NegativeNumber, PositiveNumber},
diff --git a/ast/src/values/positive_number.rs b/ast/src/values/positive_number.rs
index 0111159eb5..1971237fe6 100644
--- a/ast/src/values/positive_number.rs
+++ b/ast/src/values/positive_number.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::{span_into_string, Rule},
span::SpanDef,
diff --git a/ast/src/values/signed_integer_value.rs b/ast/src/values/signed_integer_value.rs
index 85b5e13cdb..eadc7824ec 100644
--- a/ast/src/values/signed_integer_value.rs
+++ b/ast/src/values/signed_integer_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::SignedIntegerType, values::NumberValue, SpanDef};
use pest::Span;
diff --git a/ast/src/values/unsigned_integer_value.rs b/ast/src/values/unsigned_integer_value.rs
index 4e117c09fe..4da4fdb2da 100644
--- a/ast/src/values/unsigned_integer_value.rs
+++ b/ast/src/values/unsigned_integer_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::UnsignedIntegerType, values::PositiveNumber, SpanDef};
use pest::Span;
diff --git a/ast/src/values/value.rs b/ast/src/values/value.rs
index 18e2c42b5c..11cbd0fd2a 100644
--- a/ast/src/values/value.rs
+++ b/ast/src/values/value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
values::{AddressValue, BooleanValue, FieldValue, GroupValue, IntegerValue, NumberValue},
diff --git a/ast/tests/mod.rs b/ast/tests/mod.rs
index 1118e0b570..6698b5585a 100644
--- a/ast/tests/mod.rs
+++ b/ast/tests/mod.rs
@@ -1 +1,17 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
mod serialization;
diff --git a/ast/tests/serialization/json.rs b/ast/tests/serialization/json.rs
index f4844121e4..1fec73e112 100644
--- a/ast/tests/serialization/json.rs
+++ b/ast/tests/serialization/json.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_ast::LeoAst;
use std::path::PathBuf;
diff --git a/ast/tests/serialization/mod.rs b/ast/tests/serialization/mod.rs
index cff0e9089e..19cc88a3bf 100644
--- a/ast/tests/serialization/mod.rs
+++ b/ast/tests/serialization/mod.rs
@@ -1 +1,17 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
mod json;
diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs
index 01e68e8aff..454103676a 100644
--- a/compiler/src/compiler.rs
+++ b/compiler/src/compiler.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Compiles a Leo program from a file path.
use crate::{
diff --git a/compiler/src/console/assert.rs b/compiler/src/console/assert.rs
new file mode 100644
index 0000000000..0c7e00b2d8
--- /dev/null
+++ b/compiler/src/console/assert.rs
@@ -0,0 +1,50 @@
+//! Enforces an assert equals statement in a compiled Leo program.
+
+use crate::{errors::ConsoleError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
+use leo_typed::{Expression, Span, Type};
+
+use snarkos_models::{
+ curves::{Field, PrimeField},
+ gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
+};
+
+impl> ConstrainedProgram {
+ pub fn evaluate_console_assert>(
+ &mut self,
+ cs: &mut CS,
+ file_scope: String,
+ function_scope: String,
+ indicator: Option,
+ expression: Expression,
+ span: Span,
+ ) -> Result<(), ConsoleError> {
+ let expected_type = Some(Type::Boolean);
+ let expression_string = expression.to_string();
+
+ // Evaluate assert expression
+ let assert_expression = self.enforce_expression(cs, file_scope, function_scope, expected_type, expression)?;
+
+ // If the indicator bit is false, do not evaluate the assertion
+ // This is okay since we are not enforcing any constraints
+ let false_boolean = Boolean::Constant(false);
+
+ if let Some(indicator_bool) = indicator {
+ if indicator_bool.eq(&false_boolean) {
+ return Ok(()); // continue execution
+ }
+ }
+
+ // Unwrap assertion value and handle errors
+ let result_option = match assert_expression {
+ ConstrainedValue::Boolean(boolean) => boolean.get_value(),
+ _ => return Err(ConsoleError::assertion_must_be_boolean(expression_string, span.clone())),
+ };
+ let result_bool = result_option.ok_or(ConsoleError::assertion_depends_on_input(span.clone()))?;
+
+ if !result_bool {
+ return Err(ConsoleError::assertion_failed(expression_string, span));
+ }
+
+ Ok(())
+ }
+}
diff --git a/compiler/src/console/console.rs b/compiler/src/console/console.rs
new file mode 100644
index 0000000000..1e2f8d2acf
--- /dev/null
+++ b/compiler/src/console/console.rs
@@ -0,0 +1,62 @@
+//! Evaluates a macro in a compiled Leo program.
+
+use crate::{errors::ConsoleError, program::ConstrainedProgram, GroupType};
+use leo_typed::{ConsoleFunction, ConsoleFunctionCall};
+
+use snarkos_models::{
+ curves::{Field, PrimeField},
+ gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
+};
+
+impl> ConstrainedProgram {
+ pub fn evaluate_console_function_call>(
+ &mut self,
+ cs: &mut CS,
+ file_scope: String,
+ function_scope: String,
+ indicator: Option,
+ console: ConsoleFunctionCall,
+ ) -> Result<(), ConsoleError> {
+ match console.function {
+ ConsoleFunction::Assert(expression) => {
+ self.evaluate_console_assert(cs, file_scope, function_scope, indicator, expression, console.span)?;
+ }
+ ConsoleFunction::Debug(string) => {
+ let string = self.format(cs, file_scope, function_scope, string)?;
+
+ if unwrap_indicator_value(indicator) {
+ log::debug!("{}", string);
+ }
+ }
+ ConsoleFunction::Error(string) => {
+ let string = self.format(cs, file_scope, function_scope, string)?;
+
+ if unwrap_indicator_value(indicator) {
+ log::error!("{}", string);
+ }
+ }
+ ConsoleFunction::Log(string) => {
+ let string = self.format(cs, file_scope, function_scope, string)?;
+
+ if unwrap_indicator_value(indicator) {
+ log::info!("{}", string);
+ }
+ }
+ }
+
+ Ok(())
+ }
+}
+
+// Return the indicator boolean gadget value or true if it is None
+// This is okay since we are not enforcing any constraints
+fn unwrap_indicator_value(indicator: Option) -> bool {
+ let false_boolean = Boolean::constant(false);
+
+ if let Some(indicator_bool) = indicator {
+ if indicator_bool.eq(&false_boolean) {
+ return false;
+ }
+ }
+ true
+}
diff --git a/compiler/src/macro_/format.rs b/compiler/src/console/format.rs
similarity index 62%
rename from compiler/src/macro_/format.rs
rename to compiler/src/console/format.rs
index 6065bdedf5..a379e4cbb4 100644
--- a/compiler/src/macro_/format.rs
+++ b/compiler/src/console/format.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Evaluates a formatted string in a compiled Leo program.
-use crate::{errors::MacroError, program::ConstrainedProgram, GroupType};
+use crate::{errors::ConsoleError, program::ConstrainedProgram, GroupType};
use leo_typed::FormattedString;
use snarkos_models::{
@@ -15,10 +31,10 @@ impl> ConstrainedProgram {
file_scope: String,
function_scope: String,
formatted: FormattedString,
- ) -> Result {
+ ) -> Result {
// Check that containers and parameters match
if formatted.containers.len() != formatted.parameters.len() {
- return Err(MacroError::length(
+ return Err(ConsoleError::length(
formatted.containers.len(),
formatted.parameters.len(),
formatted.span.clone(),
diff --git a/compiler/src/console/mod.rs b/compiler/src/console/mod.rs
new file mode 100644
index 0000000000..3ed19d6067
--- /dev/null
+++ b/compiler/src/console/mod.rs
@@ -0,0 +1,8 @@
+pub mod assert;
+pub use assert::*;
+
+pub mod console;
+pub use self::console::*;
+
+pub mod format;
+pub use self::format::*;
diff --git a/compiler/src/constraints/constraints.rs b/compiler/src/constraints/constraints.rs
index 5880bdadc7..d40933a51c 100644
--- a/compiler/src/constraints/constraints.rs
+++ b/compiler/src/constraints/constraints.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Generates R1CS constraints for a compiled Leo program.
use crate::{
diff --git a/compiler/src/constraints/mod.rs b/compiler/src/constraints/mod.rs
index e9fdd65238..2146eae5e9 100644
--- a/compiler/src/constraints/mod.rs
+++ b/compiler/src/constraints/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Module containing methods to enforce constraints in an Leo program
pub mod constraints;
diff --git a/compiler/src/definition/definition.rs b/compiler/src/definition/definition.rs
index 8c6cdd5330..0b76ec2b3e 100644
--- a/compiler/src/definition/definition.rs
+++ b/compiler/src/definition/definition.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Stores all defined names in a compiled Leo program.
use crate::{
diff --git a/compiler/src/definition/definitions.rs b/compiler/src/definition/definitions.rs
index 9925340ec4..6ff9778977 100644
--- a/compiler/src/definition/definitions.rs
+++ b/compiler/src/definition/definitions.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Stores all defined names in a compiled Leo program.
use crate::{
diff --git a/compiler/src/definition/mod.rs b/compiler/src/definition/mod.rs
index b2ddecaa3a..c62d778a71 100644
--- a/compiler/src/definition/mod.rs
+++ b/compiler/src/definition/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod definition;
pub use self::definition::*;
diff --git a/compiler/src/errors/compiler.rs b/compiler/src/errors/compiler.rs
index fbb66b9f2f..e51991d6ad 100644
--- a/compiler/src/errors/compiler.rs
+++ b/compiler/src/errors/compiler.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::{FunctionError, ImportError, OutputBytesError, OutputFileError};
use leo_ast::ParserError;
use leo_input::InputParserError;
diff --git a/compiler/src/errors/console.rs b/compiler/src/errors/console.rs
new file mode 100644
index 0000000000..87a4d03970
--- /dev/null
+++ b/compiler/src/errors/console.rs
@@ -0,0 +1,53 @@
+use crate::errors::ExpressionError;
+use leo_typed::{Error as FormattedError, Span};
+
+use std::path::PathBuf;
+
+#[derive(Debug, Error)]
+pub enum ConsoleError {
+ #[error("{}", _0)]
+ Error(#[from] FormattedError),
+
+ #[error("{}", _0)]
+ Expression(#[from] ExpressionError),
+}
+
+impl ConsoleError {
+ pub fn set_path(&mut self, path: PathBuf) {
+ match self {
+ ConsoleError::Expression(error) => error.set_path(path),
+ ConsoleError::Error(error) => error.set_path(path),
+ }
+ }
+
+ fn new_from_span(message: String, span: Span) -> Self {
+ ConsoleError::Error(FormattedError::new_from_span(message, span))
+ }
+
+ pub fn length(containers: usize, parameters: usize, span: Span) -> Self {
+ let message = format!(
+ "Formatter given {} containers and found {} parameters",
+ containers, parameters
+ );
+
+ Self::new_from_span(message, span)
+ }
+
+ pub fn assertion_depends_on_input(span: Span) -> Self {
+ let message = format!("console.assert() failed to evaluate. This error is caused by empty input file values");
+
+ Self::new_from_span(message, span)
+ }
+
+ pub fn assertion_failed(expression: String, span: Span) -> Self {
+ let message = format!("Assertion `{}` failed", expression);
+
+ Self::new_from_span(message, span)
+ }
+
+ pub fn assertion_must_be_boolean(expression: String, span: Span) -> Self {
+ let message = format!("Assertion expression `{}` must evaluate to a boolean value", expression);
+
+ Self::new_from_span(message, span)
+ }
+}
diff --git a/compiler/src/errors/expression.rs b/compiler/src/errors/expression.rs
index ba82b9741b..d28382ee33 100644
--- a/compiler/src/errors/expression.rs
+++ b/compiler/src/errors/expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::{AddressError, BooleanError, FieldError, FunctionError, GroupError, IntegerError, ValueError};
use leo_typed::{Error as FormattedError, Identifier, Span};
diff --git a/compiler/src/errors/function.rs b/compiler/src/errors/function.rs
index a4d26a87cc..f002e4ddd0 100644
--- a/compiler/src/errors/function.rs
+++ b/compiler/src/errors/function.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::{
AddressError,
BooleanError,
diff --git a/compiler/src/errors/import.rs b/compiler/src/errors/import.rs
index 0a96438afe..374273114e 100644
--- a/compiler/src/errors/import.rs
+++ b/compiler/src/errors/import.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_ast::ParserError;
use leo_typed::{Error as FormattedError, Identifier, ImportSymbol, Span};
diff --git a/compiler/src/errors/macro_.rs b/compiler/src/errors/macro_.rs
deleted file mode 100644
index 83c25fe76e..0000000000
--- a/compiler/src/errors/macro_.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-use crate::errors::ExpressionError;
-use leo_typed::{Error as FormattedError, Span};
-
-use std::path::PathBuf;
-
-#[derive(Debug, Error)]
-pub enum MacroError {
- #[error("{}", _0)]
- Error(#[from] FormattedError),
-
- #[error("{}", _0)]
- Expression(#[from] ExpressionError),
-}
-
-impl MacroError {
- pub fn set_path(&mut self, path: PathBuf) {
- match self {
- MacroError::Expression(error) => error.set_path(path),
- MacroError::Error(error) => error.set_path(path),
- }
- }
-
- fn new_from_span(message: String, span: Span) -> Self {
- MacroError::Error(FormattedError::new_from_span(message, span))
- }
-
- pub fn length(containers: usize, parameters: usize, span: Span) -> Self {
- let message = format!(
- "Formatter given {} containers and found {} parameters",
- containers, parameters
- );
-
- Self::new_from_span(message, span)
- }
-}
diff --git a/compiler/src/errors/mod.rs b/compiler/src/errors/mod.rs
index 96ec87bdf4..81d3d6814e 100644
--- a/compiler/src/errors/mod.rs
+++ b/compiler/src/errors/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod compiler;
pub use self::compiler::*;
@@ -10,8 +26,8 @@ pub use self::function::*;
pub mod import;
pub use self::import::*;
-pub mod macro_;
-pub use self::macro_::*;
+pub mod console;
+pub use self::console::*;
pub mod output_file;
pub use self::output_file::*;
diff --git a/compiler/src/errors/output_bytes.rs b/compiler/src/errors/output_bytes.rs
index f50621a88f..37400bb236 100644
--- a/compiler/src/errors/output_bytes.rs
+++ b/compiler/src/errors/output_bytes.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_typed::{Error as FormattedError, Span};
use std::path::PathBuf;
diff --git a/compiler/src/errors/output_file.rs b/compiler/src/errors/output_file.rs
index 547e931819..8c4a51dd4d 100644
--- a/compiler/src/errors/output_file.rs
+++ b/compiler/src/errors/output_file.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{io, path::PathBuf};
#[derive(Debug, Error)]
diff --git a/compiler/src/errors/statement.rs b/compiler/src/errors/statement.rs
index b6e4c3d81e..84ae11c969 100644
--- a/compiler/src/errors/statement.rs
+++ b/compiler/src/errors/statement.rs
@@ -1,4 +1,20 @@
-use crate::errors::{AddressError, BooleanError, ExpressionError, IntegerError, MacroError, ValueError};
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::errors::{AddressError, BooleanError, ConsoleError, ExpressionError, IntegerError, ValueError};
use leo_typed::{Error as FormattedError, Span, Type};
use std::path::PathBuf;
@@ -21,7 +37,7 @@ pub enum StatementError {
IntegerError(#[from] IntegerError),
#[error("{}", _0)]
- MacroError(#[from] MacroError),
+ MacroError(#[from] ConsoleError),
#[error("{}", _0)]
ValueError(#[from] ValueError),
@@ -62,12 +78,6 @@ impl StatementError {
Self::new_from_span(message, span)
}
- pub fn assertion_failed(left: String, right: String, span: Span) -> Self {
- let message = format!("Assertion `{} == {}` failed", left, right);
-
- Self::new_from_span(message, span)
- }
-
pub fn conditional_boolean(actual: String, span: Span) -> Self {
let message = format!("If, else conditional must resolve to a boolean, found `{}`", actual);
diff --git a/compiler/src/errors/value/address.rs b/compiler/src/errors/value/address.rs
index 68584aaa73..29eeec73c2 100644
--- a/compiler/src/errors/value/address.rs
+++ b/compiler/src/errors/value/address.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_typed::{Error as FormattedError, Span};
use snarkos_errors::{gadgets::SynthesisError, objects::account::AccountError};
diff --git a/compiler/src/errors/value/boolean.rs b/compiler/src/errors/value/boolean.rs
index dc385c65c4..dee94702aa 100644
--- a/compiler/src/errors/value/boolean.rs
+++ b/compiler/src/errors/value/boolean.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_typed::{Error as FormattedError, Span};
use snarkos_errors::gadgets::SynthesisError;
diff --git a/compiler/src/errors/value/field.rs b/compiler/src/errors/value/field.rs
index d33d8408b8..47d06a0548 100644
--- a/compiler/src/errors/value/field.rs
+++ b/compiler/src/errors/value/field.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_typed::{Error as FormattedError, Span};
use snarkos_errors::gadgets::SynthesisError;
diff --git a/compiler/src/errors/value/group.rs b/compiler/src/errors/value/group.rs
index d09b6aefec..ecd9d6257b 100644
--- a/compiler/src/errors/value/group.rs
+++ b/compiler/src/errors/value/group.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_typed::{Error as FormattedError, Span};
use snarkos_errors::gadgets::SynthesisError;
diff --git a/compiler/src/errors/value/integer.rs b/compiler/src/errors/value/integer.rs
index c2de51c90c..6ddd228dfd 100644
--- a/compiler/src/errors/value/integer.rs
+++ b/compiler/src/errors/value/integer.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_gadgets::errors::SignedIntegerError;
use leo_typed::{error::Error as FormattedError, Span};
diff --git a/compiler/src/errors/value/mod.rs b/compiler/src/errors/value/mod.rs
index 52b6c802d1..5871cd0494 100644
--- a/compiler/src/errors/value/mod.rs
+++ b/compiler/src/errors/value/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod address;
pub use self::address::*;
diff --git a/compiler/src/errors/value/value.rs b/compiler/src/errors/value/value.rs
index 5c824f40ec..6893c53359 100644
--- a/compiler/src/errors/value/value.rs
+++ b/compiler/src/errors/value/value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::{AddressError, BooleanError, FieldError, GroupError, IntegerError};
use leo_typed::{Error as FormattedError, Span};
diff --git a/compiler/src/expression/arithmetic/add.rs b/compiler/src/expression/arithmetic/add.rs
index e7117101fe..662a235f11 100644
--- a/compiler/src/expression/arithmetic/add.rs
+++ b/compiler/src/expression/arithmetic/add.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an arithmetic `+` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/arithmetic/div.rs b/compiler/src/expression/arithmetic/div.rs
index 0545f8b229..274b1ff674 100644
--- a/compiler/src/expression/arithmetic/div.rs
+++ b/compiler/src/expression/arithmetic/div.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an arithmetic `/` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/arithmetic/mod.rs b/compiler/src/expression/arithmetic/mod.rs
index fa81b51c1a..f2805a29f2 100644
--- a/compiler/src/expression/arithmetic/mod.rs
+++ b/compiler/src/expression/arithmetic/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce arithmetic expressions in a compiled Leo program.
pub mod add;
diff --git a/compiler/src/expression/arithmetic/mul.rs b/compiler/src/expression/arithmetic/mul.rs
index f9b58aa5c0..d1f962ccfa 100644
--- a/compiler/src/expression/arithmetic/mul.rs
+++ b/compiler/src/expression/arithmetic/mul.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an arithmetic `*` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/arithmetic/negate.rs b/compiler/src/expression/arithmetic/negate.rs
index 65809e6bad..1fea24d87a 100644
--- a/compiler/src/expression/arithmetic/negate.rs
+++ b/compiler/src/expression/arithmetic/negate.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a unary negate `-` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/arithmetic/pow.rs b/compiler/src/expression/arithmetic/pow.rs
index 737fa15ffa..b5f7771f05 100644
--- a/compiler/src/expression/arithmetic/pow.rs
+++ b/compiler/src/expression/arithmetic/pow.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an arithmetic `**` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/arithmetic/sub.rs b/compiler/src/expression/arithmetic/sub.rs
index efd87a6b9e..7f68772a83 100644
--- a/compiler/src/expression/arithmetic/sub.rs
+++ b/compiler/src/expression/arithmetic/sub.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an arithmetic `-` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/array/access.rs b/compiler/src/expression/array/access.rs
index e0ff5edf92..bf2287f165 100644
--- a/compiler/src/expression/array/access.rs
+++ b/compiler/src/expression/array/access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces array access in a compiled Leo program.
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/array/array.rs b/compiler/src/expression/array/array.rs
index c8044a45e2..07ad995806 100644
--- a/compiler/src/expression/array/array.rs
+++ b/compiler/src/expression/array/array.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an array expression in a compiled Leo program.
use crate::{
diff --git a/compiler/src/expression/array/index.rs b/compiler/src/expression/array/index.rs
index 2c4f1074a6..4f7a638cbe 100644
--- a/compiler/src/expression/array/index.rs
+++ b/compiler/src/expression/array/index.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an array index expression in a compiled Leo program.
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/array/mod.rs b/compiler/src/expression/array/mod.rs
index 155fb848a8..810c212678 100644
--- a/compiler/src/expression/array/mod.rs
+++ b/compiler/src/expression/array/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce array expressions in a compiled Leo program.
pub mod array;
diff --git a/compiler/src/expression/binary/binary.rs b/compiler/src/expression/binary/binary.rs
index 06d6c8c124..b3109a3d94 100644
--- a/compiler/src/expression/binary/binary.rs
+++ b/compiler/src/expression/binary/binary.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a binary expression in a compiled Leo program.
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/binary/mod.rs b/compiler/src/expression/binary/mod.rs
index 6c773d3071..1227a562c9 100644
--- a/compiler/src/expression/binary/mod.rs
+++ b/compiler/src/expression/binary/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce binary expressions in a compiled Leo program.
pub mod binary;
diff --git a/compiler/src/expression/binary/operand.rs b/compiler/src/expression/binary/operand.rs
index f868a7e570..bc0f815ac7 100644
--- a/compiler/src/expression/binary/operand.rs
+++ b/compiler/src/expression/binary/operand.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces one operand in a binary expression in a compiled Leo program.
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/circuit/access.rs b/compiler/src/expression/circuit/access.rs
index 26802753cc..716ff73dba 100644
--- a/compiler/src/expression/circuit/access.rs
+++ b/compiler/src/expression/circuit/access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a circuit access expression in a compiled Leo program.
use crate::{
diff --git a/compiler/src/expression/circuit/circuit.rs b/compiler/src/expression/circuit/circuit.rs
index 59000c80ab..c45292ec4b 100644
--- a/compiler/src/expression/circuit/circuit.rs
+++ b/compiler/src/expression/circuit/circuit.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a circuit expression in a compiled Leo program.
use crate::{
diff --git a/compiler/src/expression/circuit/mod.rs b/compiler/src/expression/circuit/mod.rs
index ad707d8465..0f44eabce1 100644
--- a/compiler/src/expression/circuit/mod.rs
+++ b/compiler/src/expression/circuit/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce circuit expressions in a compiled Leo program.
pub mod access;
diff --git a/compiler/src/expression/circuit/static_access.rs b/compiler/src/expression/circuit/static_access.rs
index 6485713417..403de0b100 100644
--- a/compiler/src/expression/circuit/static_access.rs
+++ b/compiler/src/expression/circuit/static_access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a circuit static access expression in a compiled Leo program.
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/conditional/conditional.rs b/compiler/src/expression/conditional/conditional.rs
index 53bddff416..28dde01676 100644
--- a/compiler/src/expression/conditional/conditional.rs
+++ b/compiler/src/expression/conditional/conditional.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a conditional expression in a compiled Leo program.
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/conditional/mod.rs b/compiler/src/expression/conditional/mod.rs
index 34e4db8050..08c326f92d 100644
--- a/compiler/src/expression/conditional/mod.rs
+++ b/compiler/src/expression/conditional/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce conditional expressions in a compiled Leo program.
pub mod conditional;
diff --git a/compiler/src/expression/expression.rs b/compiler/src/expression/expression.rs
index e8b2ebaef2..0437e5540c 100644
--- a/compiler/src/expression/expression.rs
+++ b/compiler/src/expression/expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforce constraints on an expression in a compiled Leo program.
use crate::{
@@ -38,7 +54,7 @@ impl> ConstrainedProgram {
Expression::Address(address, span) => Ok(ConstrainedValue::Address(Address::new(address, span)?)),
Expression::Boolean(boolean, span) => Ok(ConstrainedValue::Boolean(new_bool_constant(boolean, span)?)),
Expression::Field(field, span) => Ok(ConstrainedValue::Field(FieldType::constant(field, span)?)),
- Expression::Group(group_affine) => Ok(ConstrainedValue::Group(G::constant(group_affine)?)),
+ Expression::Group(group_element) => Ok(ConstrainedValue::Group(G::constant(group_element)?)),
Expression::Implicit(value, span) => Ok(enforce_number_implicit(expected_type, value, span)?),
Expression::Integer(type_, integer, span) => {
Ok(ConstrainedValue::Integer(Integer::new_constant(&type_, integer, span)?))
diff --git a/compiler/src/expression/function/function.rs b/compiler/src/expression/function/function.rs
index 4c7a6bb736..a3cb52f92f 100644
--- a/compiler/src/expression/function/function.rs
+++ b/compiler/src/expression/function/function.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforce a function call expression in a compiled Leo program.
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/function/mod.rs b/compiler/src/expression/function/mod.rs
index c456ec23e3..8fa8badb89 100644
--- a/compiler/src/expression/function/mod.rs
+++ b/compiler/src/expression/function/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce function call expressions in a compiled Leo program.
pub mod function;
diff --git a/compiler/src/expression/identifier/identifier.rs b/compiler/src/expression/identifier/identifier.rs
index 9fa99aad1e..c85a74cba8 100644
--- a/compiler/src/expression/identifier/identifier.rs
+++ b/compiler/src/expression/identifier/identifier.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an identifier expression in a compiled Leo program.
use crate::{
diff --git a/compiler/src/expression/identifier/mod.rs b/compiler/src/expression/identifier/mod.rs
index 2845a35609..e7782a19b7 100644
--- a/compiler/src/expression/identifier/mod.rs
+++ b/compiler/src/expression/identifier/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce identifier expressions in a compiled Leo program.
pub mod identifier;
diff --git a/compiler/src/expression/logical/and.rs b/compiler/src/expression/logical/and.rs
index ee80c1ba1b..0f3a03004c 100644
--- a/compiler/src/expression/logical/and.rs
+++ b/compiler/src/expression/logical/and.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a logical `&&` operator in a resolved Leo program.
use crate::{errors::BooleanError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/logical/mod.rs b/compiler/src/expression/logical/mod.rs
index 004b9358c9..6edcf02686 100644
--- a/compiler/src/expression/logical/mod.rs
+++ b/compiler/src/expression/logical/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce logical expressions in a compiled Leo program.
pub mod and;
diff --git a/compiler/src/expression/logical/not.rs b/compiler/src/expression/logical/not.rs
index 9e1d63b230..7f23b4651d 100644
--- a/compiler/src/expression/logical/not.rs
+++ b/compiler/src/expression/logical/not.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a logical `!` operator in a resolved Leo program.
use crate::{errors::BooleanError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/logical/or.rs b/compiler/src/expression/logical/or.rs
index 454ba1be25..0492530ef4 100644
--- a/compiler/src/expression/logical/or.rs
+++ b/compiler/src/expression/logical/or.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a logical `||` operator in a resolved Leo program.
use crate::{errors::BooleanError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/mod.rs b/compiler/src/expression/mod.rs
index fda9ebcbad..45fcde4b00 100644
--- a/compiler/src/expression/mod.rs
+++ b/compiler/src/expression/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce expressions in a compiled Leo program.
pub mod arithmetic;
diff --git a/compiler/src/expression/relational/eq.rs b/compiler/src/expression/relational/eq.rs
index 2bc42316db..706db5bb02 100644
--- a/compiler/src/expression/relational/eq.rs
+++ b/compiler/src/expression/relational/eq.rs
@@ -1,11 +1,30 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a relational `==` operator in a resolved Leo program.
-use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
+use crate::{enforce_and, errors::ExpressionError, value::ConstrainedValue, GroupType};
use leo_typed::Span;
use snarkos_models::{
curves::{Field, PrimeField},
- gadgets::{r1cs::ConstraintSystem, utilities::eq::EvaluateEqGadget},
+ gadgets::{
+ r1cs::ConstraintSystem,
+ utilities::{boolean::Boolean, eq::EvaluateEqGadget},
+ },
};
pub fn evaluate_eq, CS: ConstraintSystem>(
@@ -14,28 +33,64 @@ pub fn evaluate_eq, CS: ConstraintSystem<
right: ConstrainedValue,
span: Span,
) -> Result, ExpressionError> {
- let mut unique_namespace = cs.ns(|| format!("evaluate {} == {} {}:{}", left, right, span.line, span.start));
+ let namespace_string = format!("evaluate {} == {} {}:{}", left, right, span.line, span.start);
let constraint_result = match (left, right) {
(ConstrainedValue::Address(address_1), ConstrainedValue::Address(address_2)) => {
+ let unique_namespace = cs.ns(|| namespace_string);
address_1.evaluate_equal(unique_namespace, &address_2)
}
(ConstrainedValue::Boolean(bool_1), ConstrainedValue::Boolean(bool_2)) => {
+ let unique_namespace = cs.ns(|| namespace_string);
bool_1.evaluate_equal(unique_namespace, &bool_2)
}
(ConstrainedValue::Integer(num_1), ConstrainedValue::Integer(num_2)) => {
+ let unique_namespace = cs.ns(|| namespace_string);
num_1.evaluate_equal(unique_namespace, &num_2)
}
(ConstrainedValue::Field(field_1), ConstrainedValue::Field(field_2)) => {
+ let unique_namespace = cs.ns(|| namespace_string);
field_1.evaluate_equal(unique_namespace, &field_2)
}
(ConstrainedValue::Group(point_1), ConstrainedValue::Group(point_2)) => {
+ let unique_namespace = cs.ns(|| namespace_string);
point_1.evaluate_equal(unique_namespace, &point_2)
}
+ (ConstrainedValue::Array(arr_1), ConstrainedValue::Array(arr_2)) => {
+ let mut current = ConstrainedValue::Boolean(Boolean::constant(true));
+ for (i, (left, right)) in arr_1.into_iter().zip(arr_2.into_iter()).enumerate() {
+ let next = evaluate_eq(&mut cs.ns(|| format!("array[{}]", i)), left, right, span.clone())?;
+
+ current = enforce_and(
+ &mut cs.ns(|| format!("array result {}", i)),
+ current,
+ next,
+ span.clone(),
+ )?;
+ }
+ return Ok(current);
+ }
+ (ConstrainedValue::Tuple(tuple_1), ConstrainedValue::Tuple(tuple_2)) => {
+ let mut current = ConstrainedValue::Boolean(Boolean::constant(true));
+
+ for (i, (left, right)) in tuple_1.into_iter().zip(tuple_2.into_iter()).enumerate() {
+ let next = evaluate_eq(&mut cs.ns(|| format!("tuple_index {}", i)), left, right, span.clone())?;
+
+ current = enforce_and(
+ &mut cs.ns(|| format!("array result {}", i)),
+ current,
+ next,
+ span.clone(),
+ )?;
+ }
+ return Ok(current);
+ }
(ConstrainedValue::Unresolved(string), val_2) => {
+ let mut unique_namespace = cs.ns(|| namespace_string);
let val_1 = ConstrainedValue::from_other(string, &val_2, span.clone())?;
return evaluate_eq(&mut unique_namespace, val_1, val_2, span);
}
(val_1, ConstrainedValue::Unresolved(string)) => {
+ let mut unique_namespace = cs.ns(|| namespace_string);
let val_2 = ConstrainedValue::from_other(string, &val_1, span.clone())?;
return evaluate_eq(&mut unique_namespace, val_1, val_2, span);
}
diff --git a/compiler/src/expression/relational/ge.rs b/compiler/src/expression/relational/ge.rs
index 1e8bb9c818..fd9dc43e04 100644
--- a/compiler/src/expression/relational/ge.rs
+++ b/compiler/src/expression/relational/ge.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a relational `>=` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/relational/gt.rs b/compiler/src/expression/relational/gt.rs
index f81874b793..57228d39e2 100644
--- a/compiler/src/expression/relational/gt.rs
+++ b/compiler/src/expression/relational/gt.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a relational `>` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/relational/le.rs b/compiler/src/expression/relational/le.rs
index ccea8ecd4d..5eca4c7656 100644
--- a/compiler/src/expression/relational/le.rs
+++ b/compiler/src/expression/relational/le.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a relational `<=` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/relational/lt.rs b/compiler/src/expression/relational/lt.rs
index ddfd432771..41b954117e 100644
--- a/compiler/src/expression/relational/lt.rs
+++ b/compiler/src/expression/relational/lt.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a relational `<` operator in a resolved Leo program.
use crate::{errors::ExpressionError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/relational/mod.rs b/compiler/src/expression/relational/mod.rs
index 2bb58dc9c7..892404cc36 100644
--- a/compiler/src/expression/relational/mod.rs
+++ b/compiler/src/expression/relational/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on relational expressions in a compiled Leo program.
pub mod eq;
diff --git a/compiler/src/expression/tuple/access.rs b/compiler/src/expression/tuple/access.rs
index 00e5ffb1ed..5eab26013b 100644
--- a/compiler/src/expression/tuple/access.rs
+++ b/compiler/src/expression/tuple/access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces array access in a compiled Leo program.
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/expression/tuple/mod.rs b/compiler/src/expression/tuple/mod.rs
index ca474dfcc7..db73733462 100644
--- a/compiler/src/expression/tuple/mod.rs
+++ b/compiler/src/expression/tuple/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce tuple expressions in a compiled Leo program.
pub mod access;
diff --git a/compiler/src/expression/tuple/tuple.rs b/compiler/src/expression/tuple/tuple.rs
index 2622a82ff7..caed61a360 100644
--- a/compiler/src/expression/tuple/tuple.rs
+++ b/compiler/src/expression/tuple/tuple.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an tuple expression in a compiled Leo program.
use crate::{errors::ExpressionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/function/function.rs b/compiler/src/function/function.rs
index d266e1fa8a..154bb0f844 100644
--- a/compiler/src/function/function.rs
+++ b/compiler/src/function/function.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces constraints on a function in a compiled Leo program.
use crate::{
diff --git a/compiler/src/function/input/array.rs b/compiler/src/function/input/array.rs
index cb6e39602b..9b988a2d14 100644
--- a/compiler/src/function/input/array.rs
+++ b/compiler/src/function/input/array.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Allocates an array as a main function input parameter in a compiled Leo program.
use crate::{
diff --git a/compiler/src/function/input/function_input.rs b/compiler/src/function/input/function_input.rs
index 8038b136df..2c377c4398 100644
--- a/compiler/src/function/input/function_input.rs
+++ b/compiler/src/function/input/function_input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a function input parameter in a compiled Leo program.
use crate::{errors::FunctionError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/function/input/input_keyword.rs b/compiler/src/function/input/input_keyword.rs
index 85e9e1a71b..3dac6509f9 100644
--- a/compiler/src/function/input/input_keyword.rs
+++ b/compiler/src/function/input/input_keyword.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{errors::FunctionError, ConstrainedCircuitMember, ConstrainedProgram, ConstrainedValue, GroupType};
use leo_typed::{Identifier, Input};
diff --git a/compiler/src/function/input/input_section.rs b/compiler/src/function/input/input_section.rs
index 2abbf7cd4c..ab0d849ce0 100644
--- a/compiler/src/function/input/input_section.rs
+++ b/compiler/src/function/input/input_section.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{errors::FunctionError, ConstrainedCircuitMember, ConstrainedProgram, ConstrainedValue, GroupType};
use leo_typed::{Identifier, InputValue, Parameter};
diff --git a/compiler/src/function/input/main_function_input.rs b/compiler/src/function/input/main_function_input.rs
index 1d27ee33a6..12b848b9a8 100644
--- a/compiler/src/function/input/main_function_input.rs
+++ b/compiler/src/function/input/main_function_input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Allocates a main function input parameter in a compiled Leo program.
use crate::{
diff --git a/compiler/src/function/input/mod.rs b/compiler/src/function/input/mod.rs
index 34d417ce4f..562a9165b0 100644
--- a/compiler/src/function/input/mod.rs
+++ b/compiler/src/function/input/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce function input variables in a compiled Leo program.
pub mod array;
diff --git a/compiler/src/function/input/tuple.rs b/compiler/src/function/input/tuple.rs
index 55a0eba022..2712f2e1db 100644
--- a/compiler/src/function/input/tuple.rs
+++ b/compiler/src/function/input/tuple.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Allocates an array as a main function input parameter in a compiled Leo program.
use crate::{
diff --git a/compiler/src/function/main_function.rs b/compiler/src/function/main_function.rs
index d8f4f9bbae..2a99ba39c2 100644
--- a/compiler/src/function/main_function.rs
+++ b/compiler/src/function/main_function.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces constraints on the main function of a compiled Leo program.
use crate::{
diff --git a/compiler/src/function/mod.rs b/compiler/src/function/mod.rs
index 97b2d3ad45..0f15a38d04 100644
--- a/compiler/src/function/mod.rs
+++ b/compiler/src/function/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on functions in a compiled Leo program.
pub mod input;
diff --git a/compiler/src/function/result/mod.rs b/compiler/src/function/result/mod.rs
index fe0fd1e0f1..1b9e990453 100644
--- a/compiler/src/function/result/mod.rs
+++ b/compiler/src/function/result/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on a function result in a compiled Leo program.
pub mod result;
diff --git a/compiler/src/function/result/result.rs b/compiler/src/function/result/result.rs
index 49fc830cfa..81fc947f04 100644
--- a/compiler/src/function/result/result.rs
+++ b/compiler/src/function/result/result.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces that one return value is produced in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/import/mod.rs b/compiler/src/import/mod.rs
index 5fbf9c88f3..1e72ba4545 100644
--- a/compiler/src/import/mod.rs
+++ b/compiler/src/import/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Imports are split up into two parts: parsing and storing
/// The import parser creates a hashmap of import program names -> import program structs
diff --git a/compiler/src/import/parser/import_parser.rs b/compiler/src/import/parser/import_parser.rs
index 9a9234f2bb..2707208d52 100644
--- a/compiler/src/import/parser/import_parser.rs
+++ b/compiler/src/import/parser/import_parser.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::ImportError;
use leo_typed::Program;
diff --git a/compiler/src/import/parser/mod.rs b/compiler/src/import/parser/mod.rs
index e7d196ee0b..a3d7851112 100644
--- a/compiler/src/import/parser/mod.rs
+++ b/compiler/src/import/parser/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
/// The import parser creates a hashmap of import program names -> import program structs
pub mod parse_symbol;
pub use self::parse_symbol::*;
diff --git a/compiler/src/import/parser/parse_package.rs b/compiler/src/import/parser/parse_package.rs
index 0a149b1adb..9ea0926820 100644
--- a/compiler/src/import/parser/parse_package.rs
+++ b/compiler/src/import/parser/parse_package.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{errors::ImportError, ImportParser};
use leo_typed::{Package, PackageAccess};
diff --git a/compiler/src/import/parser/parse_symbol.rs b/compiler/src/import/parser/parse_symbol.rs
index fc6884415e..e0b7f4e156 100644
--- a/compiler/src/import/parser/parse_symbol.rs
+++ b/compiler/src/import/parser/parse_symbol.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{errors::ImportError, ImportParser};
use leo_ast::LeoAst;
use leo_typed::{ImportSymbol, Program, Span};
diff --git a/compiler/src/import/store/import.rs b/compiler/src/import/store/import.rs
index 9833330b5e..b2adb22402 100644
--- a/compiler/src/import/store/import.rs
+++ b/compiler/src/import/store/import.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{errors::ImportError, imported_symbols::ImportedSymbols, ConstrainedProgram, GroupType, ImportParser};
use leo_typed::Import;
diff --git a/compiler/src/import/store/imported_symbols.rs b/compiler/src/import/store/imported_symbols.rs
index 71e915a35b..80545e01f4 100644
--- a/compiler/src/import/store/imported_symbols.rs
+++ b/compiler/src/import/store/imported_symbols.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_typed::{Import, ImportSymbol, Package, PackageAccess};
/// Stores the the package file name and imported symbol from an import statement
diff --git a/compiler/src/import/store/mod.rs b/compiler/src/import/store/mod.rs
index a3c71ed566..cc9702a572 100644
--- a/compiler/src/import/store/mod.rs
+++ b/compiler/src/import/store/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
/// The import store brings an imported symbol into the main program from an import program struct
pub mod import;
pub use self::import::*;
diff --git a/compiler/src/import/store/symbol.rs b/compiler/src/import/store/symbol.rs
index dd20022607..f640f05e0c 100644
--- a/compiler/src/import/store/symbol.rs
+++ b/compiler/src/import/store/symbol.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{errors::ImportError, new_scope, ConstrainedProgram, ConstrainedValue, GroupType};
use leo_typed::{ImportSymbol, Program};
diff --git a/compiler/src/lib.rs b/compiler/src/lib.rs
index 1b0cd3a006..a6a4f801ca 100644
--- a/compiler/src/lib.rs
+++ b/compiler/src/lib.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Module containing structs and types that make up a Leo program.
#[macro_use]
@@ -5,6 +21,9 @@ extern crate thiserror;
pub mod compiler;
+pub mod console;
+pub use self::console::*;
+
pub mod constraints;
pub use self::constraints::*;
@@ -21,9 +40,6 @@ pub use self::function::*;
pub mod import;
pub use self::import::*;
-pub mod macro_;
-pub use self::macro_::*;
-
pub mod output;
pub use self::output::*;
diff --git a/compiler/src/macro_/macro_.rs b/compiler/src/macro_/macro_.rs
deleted file mode 100644
index 84e406b802..0000000000
--- a/compiler/src/macro_/macro_.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-//! Evaluates a macro in a compiled Leo program.
-
-use crate::{errors::MacroError, program::ConstrainedProgram, GroupType};
-use leo_typed::{FormattedMacro, MacroName};
-
-use snarkos_models::{
- curves::{Field, PrimeField},
- gadgets::r1cs::ConstraintSystem,
-};
-
-impl> ConstrainedProgram {
- pub fn evaluate_macro>(
- &mut self,
- cs: &mut CS,
- file_scope: String,
- function_scope: String,
- macro_: FormattedMacro,
- ) -> Result<(), MacroError> {
- let string = macro_
- .string
- .map(|string| self.format(cs, file_scope, function_scope, string))
- .unwrap_or(Ok("".to_string()))?;
-
- match macro_.name {
- MacroName::Debug(_) => log::debug!("{}", string),
- MacroName::Error(_) => log::error!("{}", string),
- MacroName::Print(_) => println!("{}", string),
- }
-
- Ok(())
- }
-}
diff --git a/compiler/src/macro_/mod.rs b/compiler/src/macro_/mod.rs
deleted file mode 100644
index 5b3801059c..0000000000
--- a/compiler/src/macro_/mod.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-pub mod format;
-pub use self::format::*;
-
-pub mod macro_;
-pub use self::macro_::*;
diff --git a/compiler/src/output/mod.rs b/compiler/src/output/mod.rs
index f112f0a02b..83b6844bc7 100644
--- a/compiler/src/output/mod.rs
+++ b/compiler/src/output/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod output_file;
pub use self::output_file::*;
diff --git a/compiler/src/output/output_bytes.rs b/compiler/src/output/output_bytes.rs
index 7422ad4928..04a5723442 100644
--- a/compiler/src/output/output_bytes.rs
+++ b/compiler/src/output/output_bytes.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{errors::OutputBytesError, ConstrainedValue, GroupType, REGISTERS_VARIABLE_NAME};
use leo_typed::{Parameter, Registers, Span};
diff --git a/compiler/src/output/output_file.rs b/compiler/src/output/output_file.rs
index b495422919..b3eb0deaba 100644
--- a/compiler/src/output/output_file.rs
+++ b/compiler/src/output/output_file.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The `program.out` file.
use crate::errors::OutputFileError;
diff --git a/compiler/src/program/mod.rs b/compiler/src/program/mod.rs
index 795b72faa9..86fb38e5ab 100644
--- a/compiler/src/program/mod.rs
+++ b/compiler/src/program/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod program;
pub use self::program::*;
diff --git a/compiler/src/program/program.rs b/compiler/src/program/program.rs
index 9aa4d85657..cc9ca62f7b 100644
--- a/compiler/src/program/program.rs
+++ b/compiler/src/program/program.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! An in memory store to keep track of defined names when constraining a Leo program.
use crate::{value::ConstrainedValue, GroupType};
diff --git a/compiler/src/statement/assert/assert_eq.rs b/compiler/src/statement/assert/assert_eq.rs
deleted file mode 100644
index b7633e2289..0000000000
--- a/compiler/src/statement/assert/assert_eq.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-//! Enforces an assert equals statement in a compiled Leo program.
-
-use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
-use leo_typed::Span;
-
-use snarkos_models::{
- curves::{Field, PrimeField},
- gadgets::{
- r1cs::ConstraintSystem,
- utilities::{boolean::Boolean, eq::ConditionalEqGadget},
- },
-};
-
-impl> ConstrainedProgram {
- pub fn enforce_assert_eq_statement>(
- &mut self,
- cs: &mut CS,
- indicator: Option,
- left: &ConstrainedValue,
- right: &ConstrainedValue,
- span: Span,
- ) -> Result<(), StatementError> {
- let condition = indicator.unwrap_or(Boolean::Constant(true));
- let name_unique = format!("assert {} == {} {}:{}", left, right, span.line, span.start);
- let result = left.conditional_enforce_equal(cs.ns(|| name_unique), right, &condition);
-
- Ok(result.map_err(|_| StatementError::assertion_failed(left.to_string(), right.to_string(), span))?)
- }
-}
diff --git a/compiler/src/statement/assert/mod.rs b/compiler/src/statement/assert/mod.rs
deleted file mode 100644
index 7315daf7d8..0000000000
--- a/compiler/src/statement/assert/mod.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-//! Methods to enforce constraints on assert statements in a Leo program.
-
-pub mod assert_eq;
-pub use self::assert_eq::*;
diff --git a/compiler/src/statement/assign/array.rs b/compiler/src/statement/assign/array.rs
index 43f980e0fd..0e5e3f0542 100644
--- a/compiler/src/statement/assign/array.rs
+++ b/compiler/src/statement/assign/array.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an array assignment statement in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/statement/assign/assign.rs b/compiler/src/statement/assign/assign.rs
index b0783476a2..29a2d78dd1 100644
--- a/compiler/src/statement/assign/assign.rs
+++ b/compiler/src/statement/assign/assign.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an assign statement in a compiled Leo program.
use crate::{
diff --git a/compiler/src/statement/assign/assignee.rs b/compiler/src/statement/assign/assignee.rs
index b6ecaa8cc0..99716431ea 100644
--- a/compiler/src/statement/assign/assignee.rs
+++ b/compiler/src/statement/assign/assignee.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Resolves assignees in a compiled Leo program.
use crate::{errors::StatementError, new_scope, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/statement/assign/circuit_field.rs b/compiler/src/statement/assign/circuit_field.rs
index 21468f3591..fb11e39dd9 100644
--- a/compiler/src/statement/assign/circuit_field.rs
+++ b/compiler/src/statement/assign/circuit_field.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a circuit field assignment statement in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/statement/assign/mod.rs b/compiler/src/statement/assign/mod.rs
index be36c98174..5fbffe869c 100644
--- a/compiler/src/statement/assign/mod.rs
+++ b/compiler/src/statement/assign/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on assign statements in a compiled Leo program.
pub mod array;
diff --git a/compiler/src/statement/assign/tuple.rs b/compiler/src/statement/assign/tuple.rs
index 0038120107..a7ce8a9184 100644
--- a/compiler/src/statement/assign/tuple.rs
+++ b/compiler/src/statement/assign/tuple.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a tuple assignment statement in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/statement/branch/branch.rs b/compiler/src/statement/branch/branch.rs
index d7f769dc1a..c1e0c0488b 100644
--- a/compiler/src/statement/branch/branch.rs
+++ b/compiler/src/statement/branch/branch.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a branch of a conditional or iteration statement in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/statement/branch/mod.rs b/compiler/src/statement/branch/mod.rs
index bc95861e5b..3ebf5cbc69 100644
--- a/compiler/src/statement/branch/mod.rs
+++ b/compiler/src/statement/branch/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on a branch of a conditional or iteration statement
//! in a compiled Leo program.
diff --git a/compiler/src/statement/conditional/conditional.rs b/compiler/src/statement/conditional/conditional.rs
index 7d4ba4b537..4a0129fe48 100644
--- a/compiler/src/statement/conditional/conditional.rs
+++ b/compiler/src/statement/conditional/conditional.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on statements in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/statement/conditional/mod.rs b/compiler/src/statement/conditional/mod.rs
index 44682bd523..b70034d9a3 100644
--- a/compiler/src/statement/conditional/mod.rs
+++ b/compiler/src/statement/conditional/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on conditional statements in a compiled Leo program.
pub mod conditional;
diff --git a/compiler/src/statement/definition/definition.rs b/compiler/src/statement/definition/definition.rs
index 792bddee89..737ec4da4c 100644
--- a/compiler/src/statement/definition/definition.rs
+++ b/compiler/src/statement/definition/definition.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a definition statement in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, ConstrainedValue, GroupType};
diff --git a/compiler/src/statement/definition/mod.rs b/compiler/src/statement/definition/mod.rs
index 1a0945081a..a2ec2c8689 100644
--- a/compiler/src/statement/definition/mod.rs
+++ b/compiler/src/statement/definition/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on definition statements in a compiled Leo program.
pub mod definition;
diff --git a/compiler/src/statement/iteration/iteration.rs b/compiler/src/statement/iteration/iteration.rs
index 5f2baf38ed..fde92b2dcc 100644
--- a/compiler/src/statement/iteration/iteration.rs
+++ b/compiler/src/statement/iteration/iteration.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces an iteration statement in a compiled Leo program.
use crate::{
diff --git a/compiler/src/statement/iteration/mod.rs b/compiler/src/statement/iteration/mod.rs
index 345fa41500..fe09bd951e 100644
--- a/compiler/src/statement/iteration/mod.rs
+++ b/compiler/src/statement/iteration/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on iteration statements in a compiled Leo program.
pub mod iteration;
diff --git a/compiler/src/statement/mod.rs b/compiler/src/statement/mod.rs
index 48e762a01a..e70cab01d0 100644
--- a/compiler/src/statement/mod.rs
+++ b/compiler/src/statement/mod.rs
@@ -1,7 +1,20 @@
-//! Methods to enforce constraints on statements in a Leo program.
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
-pub mod assert;
-pub use self::assert::*;
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+//! Methods to enforce constraints on statements in a Leo program.
pub mod assign;
pub use self::assign::*;
diff --git a/compiler/src/statement/return_/mod.rs b/compiler/src/statement/return_/mod.rs
index 9cea4a7781..9e6e183dbd 100644
--- a/compiler/src/statement/return_/mod.rs
+++ b/compiler/src/statement/return_/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on return statements in a compiled Leo program.
pub mod return_;
diff --git a/compiler/src/statement/return_/return_.rs b/compiler/src/statement/return_/return_.rs
index bf1342a5df..53c2817279 100644
--- a/compiler/src/statement/return_/return_.rs
+++ b/compiler/src/statement/return_/return_.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a return statement in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/statement/statement.rs b/compiler/src/statement/statement.rs
index 31c9ec3711..5de1ec4015 100644
--- a/compiler/src/statement/statement.rs
+++ b/compiler/src/statement/statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces a statement in a compiled Leo program.
use crate::{errors::StatementError, program::ConstrainedProgram, value::ConstrainedValue, GroupType};
@@ -77,14 +93,8 @@ impl> ConstrainedProgram {
results.append(&mut result);
}
- Statement::AssertEq(left, right, span) => {
- let (resolved_left, resolved_right) =
- self.enforce_binary_expression(cs, file_scope, function_scope, None, left, right, span.clone())?;
-
- self.enforce_assert_eq_statement(cs, indicator, &resolved_left, &resolved_right, span)?;
- }
- Statement::Macro(macro_) => {
- self.evaluate_macro(cs, file_scope, function_scope, macro_)?;
+ Statement::Console(console) => {
+ self.evaluate_console_function_call(cs, file_scope, function_scope, indicator, console)?;
}
Statement::Expression(expression, span) => {
let expression_string = expression.to_string();
diff --git a/compiler/src/value/address/address.rs b/compiler/src/value/address/address.rs
index da143bcaba..65002c15f6 100644
--- a/compiler/src/value/address/address.rs
+++ b/compiler/src/value/address/address.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{errors::AddressError, ConstrainedValue, GroupType};
use leo_typed::{InputValue, Span};
@@ -54,8 +70,8 @@ impl Address {
}
impl EvaluateEqGadget for Address {
- fn evaluate_equal>(&self, _cs: CS, other: &Self) -> Result {
- Ok(Boolean::constant(self.eq(other)))
+ fn evaluate_equal>(&self, _cs: CS, _other: &Self) -> Result {
+ unimplemented!()
}
}
@@ -81,15 +97,12 @@ impl ConditionalEqGadget for Address {
if let Boolean::Constant(cond) = *condition {
cond_equal_helper(self, other, cond)
} else {
- condition
- .get_value()
- .map(|cond| cond_equal_helper(self, other, cond))
- .unwrap_or(Ok(()))
+ unimplemented!()
}
}
fn cost() -> usize {
- 0
+ unimplemented!()
}
}
@@ -107,15 +120,12 @@ impl CondSelectGadget for Address {
if let Boolean::Constant(cond) = *cond {
Ok(cond_select_helper(first, second, cond))
} else {
- Ok(cond
- .get_value()
- .map(|cond| cond_select_helper(first, second, cond))
- .unwrap_or(first.clone()))
+ unimplemented!()
}
}
fn cost() -> usize {
- 0
+ unimplemented!()
}
}
diff --git a/compiler/src/value/address/mod.rs b/compiler/src/value/address/mod.rs
index 855451c5a2..14e6d2758d 100644
--- a/compiler/src/value/address/mod.rs
+++ b/compiler/src/value/address/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! An address value in a compiled Leo program.
pub mod address;
diff --git a/compiler/src/value/boolean/input.rs b/compiler/src/value/boolean/input.rs
index 50e41cc244..6a42697b23 100644
--- a/compiler/src/value/boolean/input.rs
+++ b/compiler/src/value/boolean/input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on input boolean values in a resolved Leo program.
use crate::{errors::BooleanError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/value/boolean/mod.rs b/compiler/src/value/boolean/mod.rs
index e4178978f4..3ef6438651 100644
--- a/compiler/src/value/boolean/mod.rs
+++ b/compiler/src/value/boolean/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! A boolean value in a compiled Leo program.
pub mod input;
diff --git a/compiler/src/value/field/field_type.rs b/compiler/src/value/field/field_type.rs
index 67afc09ebc..a1f3baac1e 100644
--- a/compiler/src/value/field/field_type.rs
+++ b/compiler/src/value/field/field_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! A data type that represents a field value
use crate::errors::FieldError;
@@ -209,10 +225,17 @@ impl PartialOrd for FieldType {
}
impl EvaluateEqGadget for FieldType {
- fn evaluate_equal>(&self, _cs: CS, other: &Self) -> Result {
+ fn evaluate_equal>(&self, mut _cs: CS, other: &Self) -> Result {
match (self, other) {
(FieldType::Constant(first), FieldType::Constant(second)) => Ok(Boolean::constant(first.eq(second))),
_ => unimplemented!(),
+ // (FieldType::Allocated(first), FieldType::Allocated(second)) => first.evaluate_equal(cs, second),
+ // (FieldType::Constant(constant_value), FieldType::Allocated(allocated_value))
+ // | (FieldType::Allocated(allocated_value), FieldType::Constant(constant_value)) => {
+ // let allocated_constant_value =
+ // FpGadget::alloc(&mut cs.ns(|| format!("alloc constant for eq")), || Ok(constant_value))?;
+ // allocated_value.evaluate_equal(cs, &allocated_constant_value)
+ // }
}
}
}
diff --git a/compiler/src/value/field/input.rs b/compiler/src/value/field/input.rs
index b01044ef0f..a4f8ba9a87 100644
--- a/compiler/src/value/field/input.rs
+++ b/compiler/src/value/field/input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on input field values in a compiled Leo program.
use crate::{errors::FieldError, value::ConstrainedValue, FieldType, GroupType};
diff --git a/compiler/src/value/field/mod.rs b/compiler/src/value/field/mod.rs
index 3be1984e7e..f17f118f57 100644
--- a/compiler/src/value/field/mod.rs
+++ b/compiler/src/value/field/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! A field value in a compiled Leo program.
pub mod input;
diff --git a/compiler/src/value/group/group_type.rs b/compiler/src/value/group/group_type.rs
index fc7534e2ed..2cde923985 100644
--- a/compiler/src/value/group/group_type.rs
+++ b/compiler/src/value/group/group_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! A data type that represents members in the group formed by the set of affine points on a curve.
use crate::errors::GroupError;
diff --git a/compiler/src/value/group/input.rs b/compiler/src/value/group/input.rs
index a5df8f4112..d85b64e302 100644
--- a/compiler/src/value/group/input.rs
+++ b/compiler/src/value/group/input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on input group values in a Leo program.
use crate::{errors::GroupError, ConstrainedValue, GroupType};
diff --git a/compiler/src/value/group/mod.rs b/compiler/src/value/group/mod.rs
index 3cd18128a7..5697fe1217 100644
--- a/compiler/src/value/group/mod.rs
+++ b/compiler/src/value/group/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! A group value in a compiled Leo program.
pub mod input;
diff --git a/compiler/src/value/group/targets/edwards_bls12.rs b/compiler/src/value/group/targets/edwards_bls12.rs
index a6e20a4769..9f1e24ca89 100644
--- a/compiler/src/value/group/targets/edwards_bls12.rs
+++ b/compiler/src/value/group/targets/edwards_bls12.rs
@@ -1,5 +1,21 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{errors::GroupError, GroupType};
-use leo_typed::{GroupCoordinate, GroupValue, Span};
+use leo_typed::{GroupCoordinate, GroupTuple, GroupValue, Span};
use snarkos_curves::{
edwards_bls12::{EdwardsAffine, EdwardsParameters, Fq},
@@ -8,7 +24,7 @@ use snarkos_curves::{
use snarkos_errors::gadgets::SynthesisError;
use snarkos_gadgets::curves::edwards_bls12::EdwardsBlsGadget;
use snarkos_models::{
- curves::{AffineCurve, One, TEModelParameters},
+ curves::{AffineCurve, One, TEModelParameters, Zero},
gadgets::{
curves::{FieldGadget, FpGadget, GroupGadget},
r1cs::ConstraintSystem,
@@ -118,7 +134,24 @@ impl GroupType for EdwardsGroupType {
}
impl EdwardsGroupType {
- pub fn edwards_affine_from_value(group: GroupValue) -> Result {
+ pub fn edwards_affine_from_value(value: GroupValue) -> Result {
+ match value {
+ GroupValue::Single(number, span) => Self::edwards_affine_from_single(number, span),
+ GroupValue::Tuple(tuple) => Self::edwards_affine_from_tuple(tuple),
+ }
+ }
+
+ pub fn edwards_affine_from_single(number: String, span: Span) -> Result {
+ if number.eq("1") {
+ return Ok(edwards_affine_one());
+ } else if number.eq("0") {
+ return Ok(EdwardsAffine::zero());
+ } else {
+ Self::edwards_affine_from_x_str(number, span.clone(), None, span)
+ }
+ }
+
+ pub fn edwards_affine_from_tuple(group: GroupTuple) -> Result {
let span = group.span;
let x = group.x;
let y = group.y;
@@ -319,13 +352,49 @@ impl PartialEq for EdwardsGroupType {
impl Eq for EdwardsGroupType {}
+// fn compare_allocated_edwards_bls_gadgets>(
+// mut cs: CS,
+// first: &EdwardsBlsGadget,
+// second: &EdwardsBlsGadget,
+// ) -> Result {
+// // compare x coordinates
+// let x_first = &first.x;
+// let x_second = &second.x;
+//
+// let compare_x = x_first.evaluate_equal(&mut cs.ns(|| format!("compare x")), x_second)?;
+//
+// // compare y coordinates
+// let y_first = &first.y;
+// let y_second = &second.y;
+//
+// let compare_y = y_first.evaluate_equal(&mut cs.ns(|| format!("compare y")), y_second)?;
+//
+// Boolean::and(
+// &mut cs.ns(|| format!("compare x and y results")),
+// &compare_x,
+// &compare_y,
+// )
+// }
+
impl EvaluateEqGadget for EdwardsGroupType {
- fn evaluate_equal>(&self, _cs: CS, other: &Self) -> Result {
+ fn evaluate_equal>(&self, mut _cs: CS, other: &Self) -> Result {
match (self, other) {
(EdwardsGroupType::Constant(self_value), EdwardsGroupType::Constant(other_value)) => {
Ok(Boolean::constant(self_value.eq(other_value)))
}
_ => unimplemented!(),
+ // (EdwardsGroupType::Allocated(first), EdwardsGroupType::Allocated(second)) => {
+ // compare_allocated_edwards_bls_gadgets(cs, first, second)
+ // }
+ // (EdwardsGroupType::Constant(constant_value), EdwardsGroupType::Allocated(allocated_value))
+ // | (EdwardsGroupType::Allocated(allocated_value), EdwardsGroupType::Constant(constant_value)) => {
+ // let allocated_constant_value =
+ // , Fq>>::alloc(
+ // &mut cs.ns(|| format!("alloc constant for eq")),
+ // || Ok(constant_value),
+ // )?;
+ // compare_allocated_edwards_bls_gadgets(cs, allocated_value, &allocated_constant_value)
+ // }
}
}
}
diff --git a/compiler/src/value/group/targets/mod.rs b/compiler/src/value/group/targets/mod.rs
index 5b6bc78def..5bf08cbc54 100644
--- a/compiler/src/value/group/targets/mod.rs
+++ b/compiler/src/value/group/targets/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! implemented group targets
pub mod edwards_bls12;
diff --git a/compiler/src/value/implicit/implicit.rs b/compiler/src/value/implicit/implicit.rs
index 823591dfb6..8256471832 100644
--- a/compiler/src/value/implicit/implicit.rs
+++ b/compiler/src/value/implicit/implicit.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Enforces constraints on an implicit number in a compiled Leo program.
use crate::{errors::ValueError, value::ConstrainedValue, GroupType};
diff --git a/compiler/src/value/implicit/mod.rs b/compiler/src/value/implicit/mod.rs
index 59fbd36610..136af271f6 100644
--- a/compiler/src/value/implicit/mod.rs
+++ b/compiler/src/value/implicit/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod implicit;
pub use self::implicit::*;
diff --git a/compiler/src/value/integer/integer.rs b/compiler/src/value/integer/integer.rs
index 465f2353c1..85e84d6ba2 100644
--- a/compiler/src/value/integer/integer.rs
+++ b/compiler/src/value/integer/integer.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Conversion of integer declarations to constraints in Leo.
use crate::{errors::IntegerError, IntegerTrait};
use leo_gadgets::{
diff --git a/compiler/src/value/integer/macros.rs b/compiler/src/value/integer/macros.rs
index 71d8d54681..c63e6f9d5c 100644
--- a/compiler/src/value/integer/macros.rs
+++ b/compiler/src/value/integer/macros.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_gadgets::signed_integer::*;
use snarkos_models::gadgets::utilities::{
diff --git a/compiler/src/value/integer/mod.rs b/compiler/src/value/integer/mod.rs
index e513df2e0c..068cfceef3 100644
--- a/compiler/src/value/integer/mod.rs
+++ b/compiler/src/value/integer/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
pub mod macros;
pub use self::macros::*;
diff --git a/compiler/src/value/mod.rs b/compiler/src/value/mod.rs
index 654fa0211d..2836c9c3dd 100644
--- a/compiler/src/value/mod.rs
+++ b/compiler/src/value/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Methods to enforce constraints on values in a Leo program.
pub mod address;
diff --git a/compiler/src/value/value.rs b/compiler/src/value/value.rs
index 2fc3c0053a..fe8ba6a1b1 100644
--- a/compiler/src/value/value.rs
+++ b/compiler/src/value/value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The in memory stored value for a defined name in a compiled Leo program.
use crate::{
@@ -10,7 +26,7 @@ use crate::{
GroupType,
Integer,
};
-use leo_typed::{Circuit, Function, Identifier, Span, Type};
+use leo_typed::{Circuit, Function, GroupValue, Identifier, Span, Type};
use snarkos_errors::gadgets::SynthesisError;
use snarkos_models::{
@@ -69,7 +85,7 @@ impl> ConstrainedValue {
Type::Address => Ok(ConstrainedValue::Address(Address::new(value, span)?)),
Type::Boolean => Ok(ConstrainedValue::Boolean(new_bool_constant(value, span)?)),
Type::Field => Ok(ConstrainedValue::Field(FieldType::constant(value, span)?)),
- Type::Group => Err(ValueError::implicit_group(span)),
+ Type::Group => Ok(ConstrainedValue::Group(G::constant(GroupValue::Single(value, span))?)),
Type::IntegerType(integer_type) => Ok(ConstrainedValue::Integer(Integer::new_constant(
integer_type,
value,
diff --git a/compiler/tests/address/assert_eq_fail.leo b/compiler/tests/address/assert_fail.leo
similarity index 82%
rename from compiler/tests/address/assert_eq_fail.leo
rename to compiler/tests/address/assert_fail.leo
index cf3143bc8c..3e7a5f106d 100644
--- a/compiler/tests/address/assert_eq_fail.leo
+++ b/compiler/tests/address/assert_fail.leo
@@ -2,5 +2,5 @@ function main() {
let address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
let address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9);
- assert_eq!(address_1, address_2);
+ console.assert(address_1 == address_2);
}
\ No newline at end of file
diff --git a/compiler/tests/address/assert_eq_pass.leo b/compiler/tests/address/assert_pass.leo
similarity index 82%
rename from compiler/tests/address/assert_eq_pass.leo
rename to compiler/tests/address/assert_pass.leo
index 7e220d8936..60ea4a79cd 100644
--- a/compiler/tests/address/assert_eq_pass.leo
+++ b/compiler/tests/address/assert_pass.leo
@@ -2,5 +2,5 @@ function main() {
let address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
let address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
- assert_eq!(address_1, address_2);
+ console.assert(address_1 == address_2);
}
\ No newline at end of file
diff --git a/compiler/tests/address/equal.leo b/compiler/tests/address/equal.leo
index 704328e095..9012a8c49d 100644
--- a/compiler/tests/address/equal.leo
+++ b/compiler/tests/address/equal.leo
@@ -1,3 +1,3 @@
function main(a: address, b: address, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/address/input.leo b/compiler/tests/address/input.leo
index 191d8a254d..795deac98b 100644
--- a/compiler/tests/address/input.leo
+++ b/compiler/tests/address/input.leo
@@ -1,5 +1,5 @@
function main(owner: address) {
let sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
- assert_eq!(owner, sender);
+ console.assert(owner == sender);
}
\ No newline at end of file
diff --git a/compiler/tests/address/mod.rs b/compiler/tests/address/mod.rs
index 6c3996c30e..aace594bf6 100644
--- a/compiler/tests/address/mod.rs
+++ b/compiler/tests/address/mod.rs
@@ -1,8 +1,23 @@
-use crate::{assert_satisfied, expect_compiler_error, generate_main_input, parse_program};
-use leo_typed::InputValue;
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
-static TEST_ADDRESS_1: &'static str = "aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8";
-static TEST_ADDRESS_2: &'static str = "aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r";
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{assert_satisfied, expect_compiler_error, parse_program};
+
+// static TEST_ADDRESS_1: &'static str = "aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8";
+// static TEST_ADDRESS_2: &'static str = "aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r";
#[test]
fn test_valid() {
@@ -52,72 +67,72 @@ fn test_implicit_invalid() {
let _output = expect_compiler_error(program);
}
-#[test]
-fn test_assert_eq_pass() {
- let bytes = include_bytes!("assert_eq_pass.leo");
- let program = parse_program(bytes).unwrap();
-
- assert_satisfied(program);
-}
-
-#[test]
-fn test_assert_eq_fail() {
- let bytes = include_bytes!("assert_eq_fail.leo");
- let program = parse_program(bytes).unwrap();
-
- let _output = expect_compiler_error(program);
-}
-
-#[test]
-fn test_ternary() {
- let bytes = include_bytes!("ternary.leo");
- let mut program = parse_program(bytes).unwrap();
-
- let main_input = generate_main_input(vec![
- ("s", Some(InputValue::Boolean(true))),
- ("c", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
- ]);
-
- program.set_main_input(main_input);
-
- assert_satisfied(program);
-
- let mut program = parse_program(bytes).unwrap();
-
- let main_input = generate_main_input(vec![
- ("s", Some(InputValue::Boolean(false))),
- ("c", Some(InputValue::Address(TEST_ADDRESS_2.to_string()))),
- ]);
-
- program.set_main_input(main_input);
-
- assert_satisfied(program);
-}
-
-#[test]
-fn test_equal() {
- let bytes = include_bytes!("equal.leo");
- let mut program = parse_program(bytes).unwrap();
-
- let main_input = generate_main_input(vec![
- ("a", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
- ("b", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
- ("c", Some(InputValue::Boolean(true))),
- ]);
-
- program.set_main_input(main_input);
-
- assert_satisfied(program);
-
- let mut program = parse_program(bytes).unwrap();
-
- let main_input = generate_main_input(vec![
- ("a", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
- ("b", Some(InputValue::Address(TEST_ADDRESS_2.to_string()))),
- ("c", Some(InputValue::Boolean(false))),
- ]);
-
- program.set_main_input(main_input);
-
- assert_satisfied(program);
-}
+// #[test]
+// fn test_assert_eq_pass() {
+// let bytes = include_bytes!("assert_eq_pass.leo");
+// let program = parse_program(bytes).unwrap();
+//
+// assert_satisfied(program);
+// }
+//
+// #[test]
+// fn test_assert_eq_fail() {
+// let bytes = include_bytes!("assert_eq_fail.leo");
+// let program = parse_program(bytes).unwrap();
+//
+// let _output = expect_compiler_error(program);
+// }
+//
+// #[test]
+// fn test_ternary() {
+// let bytes = include_bytes!("ternary.leo");
+// let mut program = parse_program(bytes).unwrap();
+//
+// let main_input = generate_main_input(vec![
+// ("s", Some(InputValue::Boolean(true))),
+// ("c", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
+// ]);
+//
+// program.set_main_input(main_input);
+//
+// assert_satisfied(program);
+//
+// let mut program = parse_program(bytes).unwrap();
+//
+// let main_input = generate_main_input(vec![
+// ("s", Some(InputValue::Boolean(false))),
+// ("c", Some(InputValue::Address(TEST_ADDRESS_2.to_string()))),
+// ]);
+//
+// program.set_main_input(main_input);
+//
+// assert_satisfied(program);
+// }
+//
+// #[test]
+// fn test_equal() {
+// let bytes = include_bytes!("equal.leo");
+// let mut program = parse_program(bytes).unwrap();
+//
+// let main_input = generate_main_input(vec![
+// ("a", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
+// ("b", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
+// ("c", Some(InputValue::Boolean(true))),
+// ]);
+//
+// program.set_main_input(main_input);
+//
+// assert_satisfied(program);
+//
+// let mut program = parse_program(bytes).unwrap();
+//
+// let main_input = generate_main_input(vec![
+// ("a", Some(InputValue::Address(TEST_ADDRESS_1.to_string()))),
+// ("b", Some(InputValue::Address(TEST_ADDRESS_2.to_string()))),
+// ("c", Some(InputValue::Boolean(false))),
+// ]);
+//
+// program.set_main_input(main_input);
+//
+// assert_satisfied(program);
+// }
diff --git a/compiler/tests/address/ternary.leo b/compiler/tests/address/ternary.leo
index 9d6752791e..29ecccb918 100644
--- a/compiler/tests/address/ternary.leo
+++ b/compiler/tests/address/ternary.leo
@@ -4,5 +4,5 @@ function main(s: bool, c: address) {
let r = if s? a: b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/array/initializer.leo b/compiler/tests/array/initializer.leo
index 109c003fd3..49d5cb7e76 100644
--- a/compiler/tests/array/initializer.leo
+++ b/compiler/tests/array/initializer.leo
@@ -1,3 +1,3 @@
function main(a: u8[3]) {
- assert_eq!(a, [1u8; 3]);
+ console.assert(a == [1u8; 3]);
}
\ No newline at end of file
diff --git a/compiler/tests/array/initializer_fail.leo b/compiler/tests/array/initializer_fail.leo
index a912075c44..73809d3ac2 100644
--- a/compiler/tests/array/initializer_fail.leo
+++ b/compiler/tests/array/initializer_fail.leo
@@ -1,3 +1,3 @@
function main(a: u8[3]) {
- assert_eq!(a, [1u8; -3]);
+ console.assert(a == [1u8; -3]);
}
\ No newline at end of file
diff --git a/compiler/tests/array/inline.leo b/compiler/tests/array/inline.leo
index 649ec73262..d21b59f302 100644
--- a/compiler/tests/array/inline.leo
+++ b/compiler/tests/array/inline.leo
@@ -1,3 +1,3 @@
function main(a: u8[3]) {
- assert_eq!(a, [1u8, 1u8, 1u8]);
+ console.assert(a == [1u8, 1u8, 1u8]);
}
\ No newline at end of file
diff --git a/compiler/tests/array/mod.rs b/compiler/tests/array/mod.rs
index 63090e2bb7..d2d2dbdb54 100644
--- a/compiler/tests/array/mod.rs
+++ b/compiler/tests/array/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
expect_compiler_error,
@@ -8,14 +24,14 @@ use crate::{
};
pub fn output_ones(program: EdwardsTestCompiler) {
- let expected = include_bytes!("output_/registers_ones.out");
+ let expected = include_bytes!("output/registers_ones.out");
let actual = get_output(program);
assert!(expected.eq(actual.bytes().as_slice()));
}
pub fn output_zeros(program: EdwardsTestCompiler) {
- let expected = include_bytes!("output_/registers_zeros.out");
+ let expected = include_bytes!("output/registers_zeros.out");
let actual = get_output(program);
assert!(expected.eq(actual.bytes().as_slice()));
diff --git a/compiler/tests/array/multi.leo b/compiler/tests/array/multi.leo
index f5079b8615..37b145fa8f 100644
--- a/compiler/tests/array/multi.leo
+++ b/compiler/tests/array/multi.leo
@@ -4,5 +4,5 @@ function main() {
const b: u32[3][2] = [[0; 3]; 2]; // initializer
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/array/output_/registers_ones.out b/compiler/tests/array/output/registers_ones.out
similarity index 100%
rename from compiler/tests/array/output_/registers_ones.out
rename to compiler/tests/array/output/registers_ones.out
diff --git a/compiler/tests/array/output_/registers_zeros.out b/compiler/tests/array/output/registers_zeros.out
similarity index 100%
rename from compiler/tests/array/output_/registers_zeros.out
rename to compiler/tests/array/output/registers_zeros.out
diff --git a/compiler/tests/array/slice.leo b/compiler/tests/array/slice.leo
index eeca972e26..f238c0aca8 100644
--- a/compiler/tests/array/slice.leo
+++ b/compiler/tests/array/slice.leo
@@ -2,5 +2,5 @@
function main(a: u8[3]) {
let b = [1u8; 4];
- assert_eq!(a, b[0..3]);
+ console.assert(a == b[0..3]);
}
diff --git a/compiler/tests/array/spread.leo b/compiler/tests/array/spread.leo
index 6a7922122f..75f2b2be77 100644
--- a/compiler/tests/array/spread.leo
+++ b/compiler/tests/array/spread.leo
@@ -2,5 +2,5 @@
function main(a: u8[3]) {
let b = [1u8, 1u8];
- assert_eq!(a, [1u8, ...b]);
+ console.assert(a == [1u8, ...b]);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/all.leo b/compiler/tests/boolean/all.leo
index fc3975013a..64fe8a795a 100644
--- a/compiler/tests/boolean/all.leo
+++ b/compiler/tests/boolean/all.leo
@@ -4,5 +4,5 @@ function main() {
const b = false || a;
const c = !(true && b);
- assert_eq!(c, false);
+ console.assert(c == false);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/assert_eq_input.leo b/compiler/tests/boolean/assert_eq_input.leo
index fc0c344500..8a796e5bbd 100644
--- a/compiler/tests/boolean/assert_eq_input.leo
+++ b/compiler/tests/boolean/assert_eq_input.leo
@@ -1,3 +1,3 @@
function main(a: bool, b: bool) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/false_and_false.leo b/compiler/tests/boolean/false_and_false.leo
index 8122a47cf0..70e4b0797b 100644
--- a/compiler/tests/boolean/false_and_false.leo
+++ b/compiler/tests/boolean/false_and_false.leo
@@ -1,5 +1,5 @@
function main() {
let a = false && false;
- assert_eq!(a, false);
+ console.assert(a == false);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/false_or_false.leo b/compiler/tests/boolean/false_or_false.leo
index 939682f263..4ae820254e 100644
--- a/compiler/tests/boolean/false_or_false.leo
+++ b/compiler/tests/boolean/false_or_false.leo
@@ -1,5 +1,5 @@
function main() {
let a = false || false;
- assert_eq!(a, false);
+ console.assert(a == false);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/mod.rs b/compiler/tests/boolean/mod.rs
index b0a173e14c..72ca91f215 100644
--- a/compiler/tests/boolean/mod.rs
+++ b/compiler/tests/boolean/mod.rs
@@ -1,7 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
expect_compiler_error,
- expect_synthesis_error,
get_output,
parse_program,
parse_program_with_input,
@@ -10,14 +25,14 @@ use crate::{
use leo_compiler::errors::{BooleanError, CompilerError, ExpressionError, FunctionError, StatementError};
pub fn output_true(program: EdwardsTestCompiler) {
- let expected = include_bytes!("output_/registers_true.out");
+ let expected = include_bytes!("output/registers_true.out");
let actual = get_output(program);
assert_eq!(expected, actual.bytes().as_slice());
}
pub fn output_false(program: EdwardsTestCompiler) {
- let expected = include_bytes!("output_/registers_false.out");
+ let expected = include_bytes!("output/registers_false.out");
let actual = get_output(program);
assert_eq!(expected, actual.bytes().as_slice());
@@ -49,7 +64,7 @@ fn test_input_fail() {
let program = parse_program_with_input(program_bytes, input_bytes).unwrap();
- expect_synthesis_error(program);
+ expect_compiler_error(program);
}
#[test]
@@ -92,7 +107,7 @@ fn test_not_u32() {
let bytes = include_bytes!("not_u32.leo");
let program = parse_program(bytes).unwrap();
- fail_boolean_statement(program);
+ expect_compiler_error(program);
}
// Boolean or ||
diff --git a/compiler/tests/boolean/not_false.leo b/compiler/tests/boolean/not_false.leo
index 60b6e93c3c..796b616871 100644
--- a/compiler/tests/boolean/not_false.leo
+++ b/compiler/tests/boolean/not_false.leo
@@ -1,3 +1,3 @@
function main() {
- assert_eq!(!false, true);
+ console.assert(!false == true);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/not_true.leo b/compiler/tests/boolean/not_true.leo
index e279de5b24..8c87dffabb 100644
--- a/compiler/tests/boolean/not_true.leo
+++ b/compiler/tests/boolean/not_true.leo
@@ -1,3 +1,3 @@
function main() {
- assert_eq!(!true, false);
+ console.assert(!true == false);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/not_u32.leo b/compiler/tests/boolean/not_u32.leo
index 816642262b..44491d785b 100644
--- a/compiler/tests/boolean/not_u32.leo
+++ b/compiler/tests/boolean/not_u32.leo
@@ -1,3 +1,3 @@
function main() -> bool {
- assert_eq!(!1u32, 0u32);
+ console.assert(!1u32 == 0u32);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/output_/registers_false.out b/compiler/tests/boolean/output/registers_false.out
similarity index 100%
rename from compiler/tests/boolean/output_/registers_false.out
rename to compiler/tests/boolean/output/registers_false.out
diff --git a/compiler/tests/boolean/output_/registers_true.out b/compiler/tests/boolean/output/registers_true.out
similarity index 100%
rename from compiler/tests/boolean/output_/registers_true.out
rename to compiler/tests/boolean/output/registers_true.out
diff --git a/compiler/tests/boolean/true_and_false.leo b/compiler/tests/boolean/true_and_false.leo
index ee647a2e6a..3c7c484603 100644
--- a/compiler/tests/boolean/true_and_false.leo
+++ b/compiler/tests/boolean/true_and_false.leo
@@ -1,5 +1,5 @@
function main() {
let a = true && false;
- assert_eq!(a, false);
+ console.assert(a == false);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/true_and_true.leo b/compiler/tests/boolean/true_and_true.leo
index db767f3c40..c378e50024 100644
--- a/compiler/tests/boolean/true_and_true.leo
+++ b/compiler/tests/boolean/true_and_true.leo
@@ -1,5 +1,5 @@
function main() {
let a = true && true;
- assert_eq!(a, true);
+ console.assert(a == true);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/true_or_false.leo b/compiler/tests/boolean/true_or_false.leo
index 7499f9f183..d643a96aa1 100644
--- a/compiler/tests/boolean/true_or_false.leo
+++ b/compiler/tests/boolean/true_or_false.leo
@@ -1,5 +1,5 @@
function main() {
let a = true || false;
- assert_eq!(a, true);
+ console.assert(a == true);
}
\ No newline at end of file
diff --git a/compiler/tests/boolean/true_or_true.leo b/compiler/tests/boolean/true_or_true.leo
index 4452321e23..b8eaa91ff1 100644
--- a/compiler/tests/boolean/true_or_true.leo
+++ b/compiler/tests/boolean/true_or_true.leo
@@ -1,5 +1,5 @@
function main() {
let a = true || true;
- assert_eq!(a, true);
+ console.assert(a == true);
}
\ No newline at end of file
diff --git a/compiler/tests/circuits/member_field.leo b/compiler/tests/circuits/member_field.leo
index 60f0dea11c..0dd35f2aec 100644
--- a/compiler/tests/circuits/member_field.leo
+++ b/compiler/tests/circuits/member_field.leo
@@ -5,5 +5,5 @@ circuit Foo {
function main() {
let a = Foo { x: 1u32 };
- assert_eq!(a.x, 1u32);
+ console.assert(a.x == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/circuits/member_field_and_function.leo b/compiler/tests/circuits/member_field_and_function.leo
index 30988a2bba..35f413a361 100644
--- a/compiler/tests/circuits/member_field_and_function.leo
+++ b/compiler/tests/circuits/member_field_and_function.leo
@@ -11,5 +11,5 @@ function main() {
let b = a.foo + Foo::bar();
- assert_eq!(b, 2u32);
+ console.assert(b == 2u32);
}
diff --git a/compiler/tests/circuits/member_function.leo b/compiler/tests/circuits/member_function.leo
index cd0a4956ed..024b0d7e02 100644
--- a/compiler/tests/circuits/member_function.leo
+++ b/compiler/tests/circuits/member_function.leo
@@ -7,5 +7,5 @@ circuit Foo {
function main() {
let a = Foo { };
- assert_eq!(a.echo(1u32), 1u32);
+ console.assert(a.echo(1u32) == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/circuits/member_function_nested.leo b/compiler/tests/circuits/member_function_nested.leo
index 4531b20dca..4146ef9492 100644
--- a/compiler/tests/circuits/member_function_nested.leo
+++ b/compiler/tests/circuits/member_function_nested.leo
@@ -14,5 +14,5 @@ function main() {
let a = Foo { x: 1u32 };
let b = a.call_add_x(1u32);
- assert_eq!(b, 2u32);
+ console.assert(b == 2u32);
}
diff --git a/compiler/tests/circuits/member_static_function.leo b/compiler/tests/circuits/member_static_function.leo
index 8d08229af9..ac96c89088 100644
--- a/compiler/tests/circuits/member_static_function.leo
+++ b/compiler/tests/circuits/member_static_function.leo
@@ -7,5 +7,5 @@ circuit Foo {
function main() {
let a = Foo::echo(1u32);
- assert_eq!(a, 1u32);
+ console.assert(a == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/circuits/mod.rs b/compiler/tests/circuits/mod.rs
index 606e127ba6..deb615c99b 100644
--- a/compiler/tests/circuits/mod.rs
+++ b/compiler/tests/circuits/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{assert_satisfied, expect_compiler_error, parse_program, EdwardsTestCompiler};
use leo_compiler::errors::{CompilerError, ExpressionError, FunctionError, StatementError};
diff --git a/compiler/tests/circuits/pedersen_mock.leo b/compiler/tests/circuits/pedersen_mock.leo
index a5ded96f60..fae0c7eb5a 100644
--- a/compiler/tests/circuits/pedersen_mock.leo
+++ b/compiler/tests/circuits/pedersen_mock.leo
@@ -21,5 +21,7 @@ function main() {
let pedersen = PedersenHash::new(parameters);
let input: bool[512] = [true; 512];
- assert_eq!(pedersen.hash(input), 0u32);
+ let res = pedersen.hash(input);
+
+ console.assert(res == 0u32);
}
diff --git a/compiler/tests/circuits/self_member.leo b/compiler/tests/circuits/self_member.leo
index d543267ce3..a075894af0 100644
--- a/compiler/tests/circuits/self_member.leo
+++ b/compiler/tests/circuits/self_member.leo
@@ -10,5 +10,5 @@ function main() {
let a = Foo { f: 1u32 };
let b = a.bar();
- assert_eq!(b, 1u32);
+ console.assert(b == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/console/assert.leo b/compiler/tests/console/assert.leo
new file mode 100644
index 0000000000..ba6be77256
--- /dev/null
+++ b/compiler/tests/console/assert.leo
@@ -0,0 +1,3 @@
+function main(a: bool) {
+ console.assert(a == true);
+}
\ No newline at end of file
diff --git a/compiler/tests/console/conditional_assert.leo b/compiler/tests/console/conditional_assert.leo
new file mode 100644
index 0000000000..f2c1591e9c
--- /dev/null
+++ b/compiler/tests/console/conditional_assert.leo
@@ -0,0 +1,7 @@
+function main(a: bool) {
+ if a {
+ console.assert(a == true);
+ } else {
+ console.assert(a == false);
+ }
+}
\ No newline at end of file
diff --git a/compiler/tests/console/debug.leo b/compiler/tests/console/debug.leo
new file mode 100644
index 0000000000..54e6eb539f
--- /dev/null
+++ b/compiler/tests/console/debug.leo
@@ -0,0 +1,3 @@
+function main() {
+ console.debug("hello debug");
+}
\ No newline at end of file
diff --git a/compiler/tests/console/error.leo b/compiler/tests/console/error.leo
new file mode 100644
index 0000000000..86d13f8cee
--- /dev/null
+++ b/compiler/tests/console/error.leo
@@ -0,0 +1,3 @@
+function main() {
+ console.error("hello error");
+}
\ No newline at end of file
diff --git a/compiler/tests/console/log.leo b/compiler/tests/console/log.leo
new file mode 100644
index 0000000000..a190ca4ba9
--- /dev/null
+++ b/compiler/tests/console/log.leo
@@ -0,0 +1,3 @@
+function main() {
+ console.log("hello world");
+}
\ No newline at end of file
diff --git a/compiler/tests/console/log_fail.leo b/compiler/tests/console/log_fail.leo
new file mode 100644
index 0000000000..dafa6bea8e
--- /dev/null
+++ b/compiler/tests/console/log_fail.leo
@@ -0,0 +1,3 @@
+function main() {
+ console.log( hello );
+}
\ No newline at end of file
diff --git a/compiler/tests/console/log_input.leo b/compiler/tests/console/log_input.leo
new file mode 100644
index 0000000000..c4fd0a8b12
--- /dev/null
+++ b/compiler/tests/console/log_input.leo
@@ -0,0 +1,3 @@
+function main(a: bool) {
+ console.log("a = {}", a);
+}
\ No newline at end of file
diff --git a/compiler/tests/console/log_parameter.leo b/compiler/tests/console/log_parameter.leo
new file mode 100644
index 0000000000..ebcb931a2b
--- /dev/null
+++ b/compiler/tests/console/log_parameter.leo
@@ -0,0 +1,3 @@
+function main() {
+ console.log("{}", 1u32);
+}
\ No newline at end of file
diff --git a/compiler/tests/console/log_parameter_fail_empty.leo b/compiler/tests/console/log_parameter_fail_empty.leo
new file mode 100644
index 0000000000..81b42c0919
--- /dev/null
+++ b/compiler/tests/console/log_parameter_fail_empty.leo
@@ -0,0 +1,3 @@
+function main() {
+ console.log("{}");
+}
\ No newline at end of file
diff --git a/compiler/tests/console/log_parameter_fail_none.leo b/compiler/tests/console/log_parameter_fail_none.leo
new file mode 100644
index 0000000000..c92fdfbb2d
--- /dev/null
+++ b/compiler/tests/console/log_parameter_fail_none.leo
@@ -0,0 +1,3 @@
+function main() {
+ console.log("", 1u32);
+}
\ No newline at end of file
diff --git a/compiler/tests/console/log_parameter_fail_unknown.leo b/compiler/tests/console/log_parameter_fail_unknown.leo
new file mode 100644
index 0000000000..757f4c27c3
--- /dev/null
+++ b/compiler/tests/console/log_parameter_fail_unknown.leo
@@ -0,0 +1,3 @@
+function main() {
+ console.log("{}", a);
+}
\ No newline at end of file
diff --git a/compiler/tests/console/log_parameter_many.leo b/compiler/tests/console/log_parameter_many.leo
new file mode 100644
index 0000000000..60455ebbb0
--- /dev/null
+++ b/compiler/tests/console/log_parameter_many.leo
@@ -0,0 +1,3 @@
+function main() {
+ console.log("{} {}", 1u32, true);
+}
\ No newline at end of file
diff --git a/compiler/tests/console/mod.rs b/compiler/tests/console/mod.rs
new file mode 100644
index 0000000000..d2773c7660
--- /dev/null
+++ b/compiler/tests/console/mod.rs
@@ -0,0 +1,130 @@
+use crate::{assert_satisfied, expect_compiler_error, generate_main_input, parse_program};
+use leo_typed::InputValue;
+
+#[test]
+fn test_log() {
+ let bytes = include_bytes!("log.leo");
+ let program = parse_program(bytes).unwrap();
+
+ assert_satisfied(program);
+}
+
+#[test]
+fn test_log_fail() {
+ let bytes = include_bytes!("log_fail.leo");
+
+ assert!(parse_program(bytes).is_err());
+}
+
+#[test]
+fn test_log_parameter() {
+ let bytes = include_bytes!("log_parameter.leo");
+ let program = parse_program(bytes).unwrap();
+
+ assert_satisfied(program);
+}
+
+#[test]
+fn test_log_parameter_many() {
+ let bytes = include_bytes!("log_parameter_many.leo");
+ let program = parse_program(bytes).unwrap();
+
+ assert_satisfied(program);
+}
+
+#[test]
+fn test_log_parameter_fail_unknown() {
+ let bytes = include_bytes!("log_parameter_fail_unknown.leo");
+ let program = parse_program(bytes).unwrap();
+
+ expect_compiler_error(program);
+}
+
+#[test]
+fn test_log_parameter_fail_empty() {
+ let bytes = include_bytes!("log_parameter_fail_empty.leo");
+ let program = parse_program(bytes).unwrap();
+
+ expect_compiler_error(program);
+}
+
+#[test]
+fn test_log_parameter_fail_none() {
+ let bytes = include_bytes!("log_parameter_fail_empty.leo");
+ let program = parse_program(bytes).unwrap();
+
+ expect_compiler_error(program);
+}
+
+#[test]
+fn test_log_input() {
+ let bytes = include_bytes!("log_input.leo");
+ let mut program = parse_program(bytes).unwrap();
+
+ let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
+
+ program.set_main_input(main_input);
+
+ assert_satisfied(program);
+}
+
+// Debug
+
+#[test]
+fn test_debug() {
+ let bytes = include_bytes!("debug.leo");
+ let program = parse_program(bytes).unwrap();
+
+ assert_satisfied(program);
+}
+
+// Error
+
+#[test]
+fn test_error() {
+ let bytes = include_bytes!("error.leo");
+ let program = parse_program(bytes).unwrap();
+
+ assert_satisfied(program);
+}
+
+// Assertion
+
+#[test]
+fn test_assert() {
+ let bytes = include_bytes!("assert.leo");
+ let mut program = parse_program(bytes).unwrap();
+
+ let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
+
+ program.set_main_input(main_input);
+
+ assert_satisfied(program);
+
+ let mut program = parse_program(bytes).unwrap();
+
+ let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(false)))]);
+
+ program.set_main_input(main_input);
+
+ expect_compiler_error(program);
+}
+
+#[test]
+fn test_conditional_assert() {
+ let bytes = include_bytes!("conditional_assert.leo");
+ let mut program = parse_program(bytes).unwrap();
+
+ let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
+ program.set_main_input(main_input);
+
+ assert_satisfied(program);
+
+ let mut program = parse_program(bytes).unwrap();
+
+ let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(false)))]);
+
+ program.set_main_input(main_input);
+
+ assert_satisfied(program);
+}
diff --git a/compiler/tests/definition/mod.rs b/compiler/tests/definition/mod.rs
index 431bf7ea59..7b38d695fc 100644
--- a/compiler/tests/definition/mod.rs
+++ b/compiler/tests/definition/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{assert_satisfied, import::set_local_dir, parse_program};
#[test]
diff --git a/compiler/tests/field/add.leo b/compiler/tests/field/add.leo
index df9cdec45a..8dc2c7df4e 100644
--- a/compiler/tests/field/add.leo
+++ b/compiler/tests/field/add.leo
@@ -1,3 +1,3 @@
function main(a: field, b: field, c: field) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/field/assert_eq.leo b/compiler/tests/field/console_assert.leo
similarity index 56%
rename from compiler/tests/field/assert_eq.leo
rename to compiler/tests/field/console_assert.leo
index a5dbe51c6a..c7224bcea5 100644
--- a/compiler/tests/field/assert_eq.leo
+++ b/compiler/tests/field/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: field, b: field) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/field/div.leo b/compiler/tests/field/div.leo
index 6bb4fd4bc5..028b06fad2 100644
--- a/compiler/tests/field/div.leo
+++ b/compiler/tests/field/div.leo
@@ -1,3 +1,3 @@
function main(a: field, b: field, c: field) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/field/eq.leo b/compiler/tests/field/eq.leo
index 52699c0383..e64307d8de 100644
--- a/compiler/tests/field/eq.leo
+++ b/compiler/tests/field/eq.leo
@@ -1,3 +1,3 @@
function main(a: field, b: field, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/field/mod.rs b/compiler/tests/field/mod.rs
index 3249d3d783..a57817b2f7 100644
--- a/compiler/tests/field/mod.rs
+++ b/compiler/tests/field/mod.rs
@@ -1,4 +1,20 @@
-use crate::{assert_satisfied, expect_synthesis_error, generate_main_input, parse_program};
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{assert_satisfied, expect_compiler_error, generate_main_input, parse_program};
use leo_typed::InputValue;
use snarkos_curves::edwards_bls12::Fq;
@@ -169,7 +185,6 @@ fn test_mul() {
}
#[test]
-#[ignore]
fn test_eq() {
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
@@ -214,7 +229,7 @@ fn test_eq() {
}
#[test]
-fn test_assert_eq_pass() {
+fn test_console_assert_pass() {
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
for _ in 0..10 {
@@ -222,7 +237,7 @@ fn test_assert_eq_pass() {
let a_string = field_to_decimal_string(a);
- let bytes = include_bytes!("assert_eq.leo");
+ let bytes = include_bytes!("console_assert.leo");
let mut program = parse_program(bytes).unwrap();
let main_input = generate_main_input(vec![
@@ -237,7 +252,7 @@ fn test_assert_eq_pass() {
}
#[test]
-fn test_assert_eq_fail() {
+fn test_console_assert_fail() {
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
for _ in 0..10 {
@@ -251,7 +266,7 @@ fn test_assert_eq_fail() {
let a_string = field_to_decimal_string(a);
let b_string = field_to_decimal_string(b);
- let bytes = include_bytes!("assert_eq.leo");
+ let bytes = include_bytes!("console_assert.leo");
let mut program = parse_program(bytes).unwrap();
let main_input = generate_main_input(vec![
@@ -261,7 +276,7 @@ fn test_assert_eq_fail() {
program.set_main_input(main_input);
- expect_synthesis_error(program);
+ expect_compiler_error(program);
}
}
diff --git a/compiler/tests/field/mul.leo b/compiler/tests/field/mul.leo
index c96104aa23..7df7c83830 100644
--- a/compiler/tests/field/mul.leo
+++ b/compiler/tests/field/mul.leo
@@ -1,3 +1,3 @@
function main(a: field, b: field, c: field) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/field/negate.leo b/compiler/tests/field/negate.leo
index f7314f60a1..94c730207a 100644
--- a/compiler/tests/field/negate.leo
+++ b/compiler/tests/field/negate.leo
@@ -1,3 +1,3 @@
function main(a: field, b: field) {
- assert_eq!(-a, b);
+ console.assert(-a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/field/output_/register_one.out b/compiler/tests/field/output/register_one.out
similarity index 100%
rename from compiler/tests/field/output_/register_one.out
rename to compiler/tests/field/output/register_one.out
diff --git a/compiler/tests/field/output_/register_zero.out b/compiler/tests/field/output/register_zero.out
similarity index 100%
rename from compiler/tests/field/output_/register_zero.out
rename to compiler/tests/field/output/register_zero.out
diff --git a/compiler/tests/field/sub.leo b/compiler/tests/field/sub.leo
index 2dbca87c07..2c84b24647 100644
--- a/compiler/tests/field/sub.leo
+++ b/compiler/tests/field/sub.leo
@@ -1,3 +1,3 @@
function main(a: field, b: field, c: field) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/field/ternary.leo b/compiler/tests/field/ternary.leo
index aeb196400e..49cd6a4e62 100644
--- a/compiler/tests/field/ternary.leo
+++ b/compiler/tests/field/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: field, b: field, c: field) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/function/iteration.leo b/compiler/tests/function/iteration.leo
index 931ce78180..19af4dd9cf 100644
--- a/compiler/tests/function/iteration.leo
+++ b/compiler/tests/function/iteration.leo
@@ -9,5 +9,5 @@ function main() {
a += one();
}
- assert_eq!(a, 10u32);
+ console.assert(a == 10u32);
}
\ No newline at end of file
diff --git a/compiler/tests/function/iteration_repeated.leo b/compiler/tests/function/iteration_repeated.leo
index dcf357fe34..3694b3594a 100644
--- a/compiler/tests/function/iteration_repeated.leo
+++ b/compiler/tests/function/iteration_repeated.leo
@@ -11,5 +11,5 @@ function iteration() -> u32 {
function main() {
let total = iteration() + iteration();
- assert_eq!(total, 20);
+ console.assert(total == 20);
}
\ No newline at end of file
diff --git a/compiler/tests/function/mod.rs b/compiler/tests/function/mod.rs
index 1fe9b24e4b..43f8a39f80 100644
--- a/compiler/tests/function/mod.rs
+++ b/compiler/tests/function/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
expect_compiler_error,
@@ -47,7 +63,7 @@ fn test_newlines() {
let program_bytes = include_bytes!("newlines.leo");
let program = parse_program_with_input(program_bytes, input_bytes).unwrap();
- let expected_bytes = include_bytes!("output_/newlines.out");
+ let expected_bytes = include_bytes!("output/newlines.out");
let expected = std::str::from_utf8(expected_bytes).unwrap();
let actual_bytes = get_output(program);
let actual = std::str::from_utf8(actual_bytes.bytes().as_slice()).unwrap();
@@ -70,7 +86,7 @@ fn test_multiple_returns_main() {
let program = parse_program_with_input(program_bytes, input_bytes).unwrap();
- let expected_bytes = include_bytes!("output_/registers.out");
+ let expected_bytes = include_bytes!("output/registers.out");
let expected = std::str::from_utf8(expected_bytes).unwrap();
let actual_bytes = get_output(program);
let actual = std::str::from_utf8(actual_bytes.bytes().as_slice()).unwrap();
diff --git a/compiler/tests/function/multiple.leo b/compiler/tests/function/multiple.leo
index 0603745623..ef00a4ef47 100644
--- a/compiler/tests/function/multiple.leo
+++ b/compiler/tests/function/multiple.leo
@@ -5,6 +5,6 @@ function tuple() -> (bool, bool) {
function main() {
let (a, b) = tuple();
- assert_eq!(a, true);
- assert_eq!(b, false);
+ console.assert(a == true);
+ console.assert(b == false);
}
\ No newline at end of file
diff --git a/compiler/tests/function/output_/newlines.out b/compiler/tests/function/output/newlines.out
similarity index 100%
rename from compiler/tests/function/output_/newlines.out
rename to compiler/tests/function/output/newlines.out
diff --git a/compiler/tests/function/output_/registers.out b/compiler/tests/function/output/registers.out
similarity index 100%
rename from compiler/tests/function/output_/registers.out
rename to compiler/tests/function/output/registers.out
diff --git a/compiler/tests/function/repeated.leo b/compiler/tests/function/repeated.leo
index c8b987ff00..a2d04d55f9 100644
--- a/compiler/tests/function/repeated.leo
+++ b/compiler/tests/function/repeated.leo
@@ -5,5 +5,5 @@ function one() -> bool {
function main() {
let a = one() && one();
- assert_eq!(a, true);
+ console.assert(a == true);
}
\ No newline at end of file
diff --git a/compiler/tests/function/return.leo b/compiler/tests/function/return.leo
index 58fbd6ac95..10c7138977 100644
--- a/compiler/tests/function/return.leo
+++ b/compiler/tests/function/return.leo
@@ -3,5 +3,5 @@ function one() -> u32 {
}
function main() {
- assert_eq!(one(), 1u32);
+ console.assert(one() == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/function/value_unchanged.leo b/compiler/tests/function/value_unchanged.leo
index e61afd1e76..32dcfa62d6 100644
--- a/compiler/tests/function/value_unchanged.leo
+++ b/compiler/tests/function/value_unchanged.leo
@@ -15,5 +15,5 @@ function main() {
let a = 1u32;
bad_mutate(a);
- assert_eq!(a, 1u32); // <- value `a` is still `1u32`
+ console.assert(a == 1u32); // <- value `a` is still `1u32`
}
\ No newline at end of file
diff --git a/compiler/tests/group/add.leo b/compiler/tests/group/add.leo
index 2b8713ac94..bb84df2d6c 100644
--- a/compiler/tests/group/add.leo
+++ b/compiler/tests/group/add.leo
@@ -1,3 +1,3 @@
function main(a: group, b: group, c: group) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/group/assert_eq.leo b/compiler/tests/group/assert_eq.leo
index 0d67b938c7..3886a07bbf 100644
--- a/compiler/tests/group/assert_eq.leo
+++ b/compiler/tests/group/assert_eq.leo
@@ -1,3 +1,3 @@
function main(a: group, b: group) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/group/double_high.leo b/compiler/tests/group/both_sign_high.leo
similarity index 100%
rename from compiler/tests/group/double_high.leo
rename to compiler/tests/group/both_sign_high.leo
diff --git a/compiler/tests/group/double_inferred.leo b/compiler/tests/group/both_sign_inferred.leo
similarity index 100%
rename from compiler/tests/group/double_inferred.leo
rename to compiler/tests/group/both_sign_inferred.leo
diff --git a/compiler/tests/group/double_low.leo b/compiler/tests/group/both_sign_low.leo
similarity index 100%
rename from compiler/tests/group/double_low.leo
rename to compiler/tests/group/both_sign_low.leo
diff --git a/compiler/tests/group/eq.leo b/compiler/tests/group/eq.leo
index 07feb0b8be..89701d9c99 100644
--- a/compiler/tests/group/eq.leo
+++ b/compiler/tests/group/eq.leo
@@ -1,3 +1,3 @@
function main(a: group, b: group, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/group/input.leo b/compiler/tests/group/input.leo
index 0d67b938c7..3886a07bbf 100644
--- a/compiler/tests/group/input.leo
+++ b/compiler/tests/group/input.leo
@@ -1,3 +1,3 @@
function main(a: group, b: group) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/group/mod.rs b/compiler/tests/group/mod.rs
index 676059271f..7606a738d3 100644
--- a/compiler/tests/group/mod.rs
+++ b/compiler/tests/group/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
expect_compiler_error,
@@ -7,7 +23,7 @@ use crate::{
parse_program,
parse_program_with_input,
};
-use leo_typed::{GroupCoordinate, GroupValue, InputValue, Span};
+use leo_typed::{GroupCoordinate, GroupTuple, GroupValue, InputValue, Span};
use snarkos_curves::edwards_bls12::EdwardsAffine;
@@ -27,11 +43,27 @@ pub fn group_element_to_input_value(g: EdwardsAffine) -> GroupValue {
end: 0,
};
- GroupValue {
+ GroupValue::Tuple(GroupTuple {
x: GroupCoordinate::Number(x, fake_span.clone()),
y: GroupCoordinate::Number(y, fake_span.clone()),
span: fake_span,
- }
+ })
+}
+
+#[test]
+fn test_one() {
+ let bytes = include_bytes!("one.leo");
+ let program = parse_program(bytes).unwrap();
+
+ assert_satisfied(program);
+}
+
+#[test]
+fn test_zero() {
+ let bytes = include_bytes!("zero.leo");
+ let program = parse_program(bytes).unwrap();
+
+ assert_satisfied(program);
}
#[test]
@@ -91,8 +123,8 @@ fn test_y_sign_inferred() {
}
#[test]
-fn test_double_high() {
- let bytes = include_bytes!("double_high.leo");
+fn test_both_sign_high() {
+ let bytes = include_bytes!("both_sign_high.leo");
let program = parse_program(bytes).unwrap();
@@ -100,8 +132,8 @@ fn test_double_high() {
}
#[test]
-fn test_double_low() {
- let bytes = include_bytes!("double_low.leo");
+fn test_both_sign_low() {
+ let bytes = include_bytes!("both_sign_low.leo");
let program = parse_program(bytes).unwrap();
@@ -109,8 +141,8 @@ fn test_double_low() {
}
#[test]
-fn test_double_inferred() {
- let bytes = include_bytes!("double_inferred.leo");
+fn test_both_sign_inferred() {
+ let bytes = include_bytes!("both_sign_inferred.leo");
let program = parse_program(bytes).unwrap();
@@ -227,7 +259,7 @@ fn test_sub() {
}
#[test]
-fn test_assert_eq_pass() {
+fn test_console_assert_pass() {
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
for _ in 0..10 {
@@ -250,7 +282,7 @@ fn test_assert_eq_pass() {
}
#[test]
-fn test_assert_eq_fail() {
+fn test_console_assert_fail() {
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
for _ in 0..10 {
@@ -274,12 +306,11 @@ fn test_assert_eq_fail() {
program.set_main_input(main_input);
- expect_synthesis_error(program);
+ expect_compiler_error(program);
}
}
#[test]
-#[ignore]
fn test_eq() {
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
diff --git a/compiler/tests/group/negate.leo b/compiler/tests/group/negate.leo
index bdb93ce93f..506d8d73ce 100644
--- a/compiler/tests/group/negate.leo
+++ b/compiler/tests/group/negate.leo
@@ -1,3 +1,3 @@
function main(a: group, b: group) {
- assert_eq!(-a, b);
+ console.assert(-a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/group/one.leo b/compiler/tests/group/one.leo
new file mode 100644
index 0000000000..7be0cbbc2c
--- /dev/null
+++ b/compiler/tests/group/one.leo
@@ -0,0 +1,3 @@
+function main() {
+ let element = 1group;
+}
\ No newline at end of file
diff --git a/compiler/tests/group/sub.leo b/compiler/tests/group/sub.leo
index 982a0ed1f0..dfe82d8e31 100644
--- a/compiler/tests/group/sub.leo
+++ b/compiler/tests/group/sub.leo
@@ -1,3 +1,3 @@
function main(a: group, b: group, c: group) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/group/ternary.leo b/compiler/tests/group/ternary.leo
index fc2dd439c1..b213bb1419 100644
--- a/compiler/tests/group/ternary.leo
+++ b/compiler/tests/group/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: group, b: group, c: group) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/group/zero.leo b/compiler/tests/group/zero.leo
new file mode 100644
index 0000000000..e2c0283c21
--- /dev/null
+++ b/compiler/tests/group/zero.leo
@@ -0,0 +1,3 @@
+function main() {
+ let element = 0group;
+}
\ No newline at end of file
diff --git a/compiler/tests/import/alias.leo b/compiler/tests/import/alias.leo
index 576e5d5acb..96c65282ef 100644
--- a/compiler/tests/import/alias.leo
+++ b/compiler/tests/import/alias.leo
@@ -1,5 +1,5 @@
import test_import.foo as bar;
function main() {
- assert_eq!(bar(), 1u32);
+ console.assert(bar() == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/import/basic.leo b/compiler/tests/import/basic.leo
index 03f7d892fe..53d243efaa 100644
--- a/compiler/tests/import/basic.leo
+++ b/compiler/tests/import/basic.leo
@@ -1,5 +1,5 @@
import test-import.foo;
function main() {
- assert_eq!(foo(), 1u32);
+ console.assert(foo() == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/import/many_import.leo b/compiler/tests/import/many_import.leo
index a699229614..339700fd68 100644
--- a/compiler/tests/import/many_import.leo
+++ b/compiler/tests/import/many_import.leo
@@ -21,5 +21,5 @@ function main() {
const car = Car { c: 1u32 };
- assert_eq!(car.c, 1u32);
+ console.assert(car.c == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/import/many_import_star.leo b/compiler/tests/import/many_import_star.leo
index f27d08f991..575487a929 100644
--- a/compiler/tests/import/many_import_star.leo
+++ b/compiler/tests/import/many_import_star.leo
@@ -15,5 +15,5 @@ function main() {
const car = Car { c: 1u32 };
- assert_eq!(car.c, 1u32);
+ console.assert(car.c == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/import/mod.rs b/compiler/tests/import/mod.rs
index 765b1ff65f..d4bd578c0b 100644
--- a/compiler/tests/import/mod.rs
+++ b/compiler/tests/import/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{assert_satisfied, parse_program};
use std::env::{current_dir, set_current_dir};
diff --git a/compiler/tests/import/multiple.leo b/compiler/tests/import/multiple.leo
index 0854d6e1c8..5c89aaee0c 100644
--- a/compiler/tests/import/multiple.leo
+++ b/compiler/tests/import/multiple.leo
@@ -6,5 +6,5 @@ import test-import.(
function main() {
let a = Point { x: 1u32, y: 0u32 };
- assert_eq!(a.x, 1u32);
+ console.assert(a.x == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/import/star.leo b/compiler/tests/import/star.leo
index 4e546af535..9cd817686f 100644
--- a/compiler/tests/import/star.leo
+++ b/compiler/tests/import/star.leo
@@ -3,5 +3,5 @@ import test-import.*;
function main() {
let a = Point { x: 1u32, y: 0u32 };
- assert_eq!(foo(), 1u32);
+ console.assert(foo() == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/input_files/mod.rs b/compiler/tests/input_files/mod.rs
index 64f5dd9f32..ddfd9aa108 100644
--- a/compiler/tests/input_files/mod.rs
+++ b/compiler/tests/input_files/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
mod program_input;
mod program_input_and_program_state;
mod program_state;
diff --git a/compiler/tests/input_files/program_input/main.leo b/compiler/tests/input_files/program_input/main.leo
index 8a8ab02f28..ba6be77256 100644
--- a/compiler/tests/input_files/program_input/main.leo
+++ b/compiler/tests/input_files/program_input/main.leo
@@ -1,3 +1,3 @@
function main(a: bool) {
- assert_eq!(a, true);
+ console.assert(a == true);
}
\ No newline at end of file
diff --git a/compiler/tests/input_files/program_input/main_multiple.leo b/compiler/tests/input_files/program_input/main_multiple.leo
index 49ad704a2f..eb5ef8d1f6 100644
--- a/compiler/tests/input_files/program_input/main_multiple.leo
+++ b/compiler/tests/input_files/program_input/main_multiple.leo
@@ -1,4 +1,4 @@
function main(a: bool, b: bool) {
- assert_eq!(a, true);
- assert_eq!(b, false);
+ console.assert(a == true);
+ console.assert(b == false);
}
\ No newline at end of file
diff --git a/compiler/tests/input_files/program_input/mod.rs b/compiler/tests/input_files/program_input/mod.rs
index 0cf67e3404..830e3b8651 100644
--- a/compiler/tests/input_files/program_input/mod.rs
+++ b/compiler/tests/input_files/program_input/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{assert_satisfied, expect_compiler_error, parse_program_with_input, EdwardsTestCompiler};
use leo_compiler::errors::CompilerError;
diff --git a/compiler/tests/input_files/program_input_and_program_state/access.leo b/compiler/tests/input_files/program_input_and_program_state/access.leo
index 9a280f9a76..e5610aeb7a 100644
--- a/compiler/tests/input_files/program_input_and_program_state/access.leo
+++ b/compiler/tests/input_files/program_input_and_program_state/access.leo
@@ -1,11 +1,11 @@
function main(input, data: u8[32]) {
- assert_eq!(input.registers.value_balance, 0u64);
+ console.assert(input.registers.value_balance == 0u64);
- assert_eq!(input.state.leaf_index, 0u32);
+ console.assert(input.state.leaf_index == 0u32);
- assert_eq!(input.record.value, 5u64);
+ console.assert(input.record.value == 5u64);
- assert_eq!(input.state_leaf.network_id, 0u8);
+ console.assert(input.state_leaf.network_id == 0u8);
- assert_eq!(data, [0u8; 32]);
+ console.assert(data == [0u8; 32]);
}
\ No newline at end of file
diff --git a/compiler/tests/input_files/program_input_and_program_state/mod.rs b/compiler/tests/input_files/program_input_and_program_state/mod.rs
index ab5aa648cd..c80bd98b7b 100644
--- a/compiler/tests/input_files/program_input_and_program_state/mod.rs
+++ b/compiler/tests/input_files/program_input_and_program_state/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{assert_satisfied, parse_input_and_state, parse_program_with_input_and_state};
#[test]
diff --git a/compiler/tests/input_files/program_state/access_all.leo b/compiler/tests/input_files/program_state/access_all.leo
index ea6d5d6743..4e7cba5776 100644
--- a/compiler/tests/input_files/program_state/access_all.leo
+++ b/compiler/tests/input_files/program_state/access_all.leo
@@ -1,8 +1,8 @@
function main(input) {
- assert_eq!(input.state.root, [0u8; 32]);
+ console.assert(input.state.root == [0u8; 32]);
let expected: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
- assert_eq!(input.record.owner, expected);
+ //console.assert(input.record.owner, expected);
- assert_eq!(input.state_leaf.network_id, 0u8);
+ console.assert(input.state_leaf.network_id == 0u8);
}
\ No newline at end of file
diff --git a/compiler/tests/input_files/program_state/access_state.leo b/compiler/tests/input_files/program_state/access_state.leo
index c9cfdc22b2..0e014aec54 100644
--- a/compiler/tests/input_files/program_state/access_state.leo
+++ b/compiler/tests/input_files/program_state/access_state.leo
@@ -1,3 +1,3 @@
function main(input) {
- assert_eq!(input.state.root, [0u8; 32]);
+ console.assert(input.state.root == [0u8; 32]);
}
\ No newline at end of file
diff --git a/compiler/tests/input_files/program_state/mod.rs b/compiler/tests/input_files/program_state/mod.rs
index e7754af652..d3e46194b1 100644
--- a/compiler/tests/input_files/program_state/mod.rs
+++ b/compiler/tests/input_files/program_state/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{assert_satisfied, parse_program_with_state, parse_state};
#[test]
diff --git a/compiler/tests/integers/i128/add.leo b/compiler/tests/integers/i128/add.leo
index 868354c66a..e35648f545 100644
--- a/compiler/tests/integers/i128/add.leo
+++ b/compiler/tests/integers/i128/add.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: i128) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/assert_eq.leo b/compiler/tests/integers/i128/console_assert.leo
similarity index 55%
rename from compiler/tests/integers/i128/assert_eq.leo
rename to compiler/tests/integers/i128/console_assert.leo
index a6dc495a84..c89021f609 100644
--- a/compiler/tests/integers/i128/assert_eq.leo
+++ b/compiler/tests/integers/i128/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/div.leo b/compiler/tests/integers/i128/div.leo
index 3674db9571..ffaeae19a8 100644
--- a/compiler/tests/integers/i128/div.leo
+++ b/compiler/tests/integers/i128/div.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: i128) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/eq.leo b/compiler/tests/integers/i128/eq.leo
index c1662f7ef9..f4beddc8fc 100644
--- a/compiler/tests/integers/i128/eq.leo
+++ b/compiler/tests/integers/i128/eq.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/ge.leo b/compiler/tests/integers/i128/ge.leo
index f9b17623a9..1fbbd68073 100644
--- a/compiler/tests/integers/i128/ge.leo
+++ b/compiler/tests/integers/i128/ge.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/gt.leo b/compiler/tests/integers/i128/gt.leo
index 4c45bf6605..27849afbe8 100644
--- a/compiler/tests/integers/i128/gt.leo
+++ b/compiler/tests/integers/i128/gt.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/input.leo b/compiler/tests/integers/i128/input.leo
index a6dc495a84..c89021f609 100644
--- a/compiler/tests/integers/i128/input.leo
+++ b/compiler/tests/integers/i128/input.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/le.leo b/compiler/tests/integers/i128/le.leo
index 2f9d100793..ea0c3c9e1d 100644
--- a/compiler/tests/integers/i128/le.leo
+++ b/compiler/tests/integers/i128/le.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/lt.leo b/compiler/tests/integers/i128/lt.leo
index 766024aaac..bde4def85c 100644
--- a/compiler/tests/integers/i128/lt.leo
+++ b/compiler/tests/integers/i128/lt.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/mod.rs b/compiler/tests/integers/i128/mod.rs
index 0c3574755d..9139cd5ec4 100644
--- a/compiler/tests/integers/i128/mod.rs
+++ b/compiler/tests/integers/i128/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_computation_error, expect_parsing_error, IntegerTester},
parse_program,
@@ -108,7 +124,7 @@ fn test_i128_lt() {
#[test]
fn test_i128_assert_eq() {
- TestI128::test_assert_eq();
+ TestI128::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/i128/mul.leo b/compiler/tests/integers/i128/mul.leo
index f03ca57dd1..25b902d53c 100644
--- a/compiler/tests/integers/i128/mul.leo
+++ b/compiler/tests/integers/i128/mul.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: i128) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/ne.leo b/compiler/tests/integers/i128/ne.leo
index b97b3c2dbe..dae148b49c 100644
--- a/compiler/tests/integers/i128/ne.leo
+++ b/compiler/tests/integers/i128/ne.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/negate.leo b/compiler/tests/integers/i128/negate.leo
index a55ad8711d..437ee06390 100644
--- a/compiler/tests/integers/i128/negate.leo
+++ b/compiler/tests/integers/i128/negate.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128) {
- assert_eq!(-a, b);
+ console.assert(-a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/negate_zero.leo b/compiler/tests/integers/i128/negate_zero.leo
index c216f1d9d8..9fb0c11afe 100644
--- a/compiler/tests/integers/i128/negate_zero.leo
+++ b/compiler/tests/integers/i128/negate_zero.leo
@@ -1,5 +1,5 @@
function main() {
let a = 0i128;
- assert_eq!(-a, 0i128);
+ console.assert(-a == 0i128);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/pow.leo b/compiler/tests/integers/i128/pow.leo
index dde3d48fe7..05536aad51 100644
--- a/compiler/tests/integers/i128/pow.leo
+++ b/compiler/tests/integers/i128/pow.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: i128) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/sub.leo b/compiler/tests/integers/i128/sub.leo
index bb473336c7..3a723eec49 100644
--- a/compiler/tests/integers/i128/sub.leo
+++ b/compiler/tests/integers/i128/sub.leo
@@ -1,3 +1,3 @@
function main(a: i128, b: i128, c: i128) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i128/ternary.leo b/compiler/tests/integers/i128/ternary.leo
index a0e207d69b..5c2f199499 100644
--- a/compiler/tests/integers/i128/ternary.leo
+++ b/compiler/tests/integers/i128/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: i128, b: i128, c: i128) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/add.leo b/compiler/tests/integers/i16/add.leo
index ac0bfd8127..556ae65c3a 100644
--- a/compiler/tests/integers/i16/add.leo
+++ b/compiler/tests/integers/i16/add.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: i16) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/assert_eq.leo b/compiler/tests/integers/i16/console_assert.leo
similarity index 54%
rename from compiler/tests/integers/i16/assert_eq.leo
rename to compiler/tests/integers/i16/console_assert.leo
index 4bc5fffcad..3afb25b207 100644
--- a/compiler/tests/integers/i16/assert_eq.leo
+++ b/compiler/tests/integers/i16/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/div.leo b/compiler/tests/integers/i16/div.leo
index 7facede4fb..6d0c8f4614 100644
--- a/compiler/tests/integers/i16/div.leo
+++ b/compiler/tests/integers/i16/div.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: i16) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/eq.leo b/compiler/tests/integers/i16/eq.leo
index 7cdea269f3..338e3e50f6 100644
--- a/compiler/tests/integers/i16/eq.leo
+++ b/compiler/tests/integers/i16/eq.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/ge.leo b/compiler/tests/integers/i16/ge.leo
index b4e27b787b..68a4d40bf8 100644
--- a/compiler/tests/integers/i16/ge.leo
+++ b/compiler/tests/integers/i16/ge.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/gt.leo b/compiler/tests/integers/i16/gt.leo
index 2132a8aa6b..75d9bfb612 100644
--- a/compiler/tests/integers/i16/gt.leo
+++ b/compiler/tests/integers/i16/gt.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/input.leo b/compiler/tests/integers/i16/input.leo
index 4bc5fffcad..3afb25b207 100644
--- a/compiler/tests/integers/i16/input.leo
+++ b/compiler/tests/integers/i16/input.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/le.leo b/compiler/tests/integers/i16/le.leo
index e33b3212f1..ff112c7fbc 100644
--- a/compiler/tests/integers/i16/le.leo
+++ b/compiler/tests/integers/i16/le.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/lt.leo b/compiler/tests/integers/i16/lt.leo
index 2a93c04ae3..46c57aabe6 100644
--- a/compiler/tests/integers/i16/lt.leo
+++ b/compiler/tests/integers/i16/lt.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/mod.rs b/compiler/tests/integers/i16/mod.rs
index 7f419c37c6..9348352276 100644
--- a/compiler/tests/integers/i16/mod.rs
+++ b/compiler/tests/integers/i16/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_computation_error, expect_parsing_error, IntegerTester},
parse_program,
@@ -106,8 +122,8 @@ fn test_i16_lt() {
}
#[test]
-fn test_i16_assert_eq() {
- TestI16::test_assert_eq();
+fn test_i16_console_assert() {
+ TestI16::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/i16/mul.leo b/compiler/tests/integers/i16/mul.leo
index 314381d199..6fd19b703a 100644
--- a/compiler/tests/integers/i16/mul.leo
+++ b/compiler/tests/integers/i16/mul.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: i16) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/ne.leo b/compiler/tests/integers/i16/ne.leo
index ead2f5f3fe..f0a9472678 100644
--- a/compiler/tests/integers/i16/ne.leo
+++ b/compiler/tests/integers/i16/ne.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/negate.leo b/compiler/tests/integers/i16/negate.leo
index 19046f9cb9..1d2644dce7 100644
--- a/compiler/tests/integers/i16/negate.leo
+++ b/compiler/tests/integers/i16/negate.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16) {
- assert_eq!(-a, b);
+ console.assert(-a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/negate_zero.leo b/compiler/tests/integers/i16/negate_zero.leo
index 3edc84307b..46340c3dc5 100644
--- a/compiler/tests/integers/i16/negate_zero.leo
+++ b/compiler/tests/integers/i16/negate_zero.leo
@@ -1,5 +1,5 @@
function main() {
let a = 0i16;
- assert_eq!(-a, 0i16);
+ console.assert(-a == 0i16);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/pow.leo b/compiler/tests/integers/i16/pow.leo
index 22bd4baa5d..769d2d2fbb 100644
--- a/compiler/tests/integers/i16/pow.leo
+++ b/compiler/tests/integers/i16/pow.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: i16) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/sub.leo b/compiler/tests/integers/i16/sub.leo
index ef1143d3f5..e935935187 100644
--- a/compiler/tests/integers/i16/sub.leo
+++ b/compiler/tests/integers/i16/sub.leo
@@ -1,3 +1,3 @@
function main(a: i16, b: i16, c: i16) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i16/ternary.leo b/compiler/tests/integers/i16/ternary.leo
index 0ef5670781..ccf29bfd50 100644
--- a/compiler/tests/integers/i16/ternary.leo
+++ b/compiler/tests/integers/i16/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: i16, b: i16, c: i16) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/add.leo b/compiler/tests/integers/i32/add.leo
index d670593866..3d8fb1b1d2 100644
--- a/compiler/tests/integers/i32/add.leo
+++ b/compiler/tests/integers/i32/add.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: i32) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/assert_eq.leo b/compiler/tests/integers/i32/console_assert.leo
similarity index 54%
rename from compiler/tests/integers/i32/assert_eq.leo
rename to compiler/tests/integers/i32/console_assert.leo
index 326cca12b6..a2d6980e9a 100644
--- a/compiler/tests/integers/i32/assert_eq.leo
+++ b/compiler/tests/integers/i32/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/div.leo b/compiler/tests/integers/i32/div.leo
index c183f43ea0..3189a354f0 100644
--- a/compiler/tests/integers/i32/div.leo
+++ b/compiler/tests/integers/i32/div.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: i32) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/eq.leo b/compiler/tests/integers/i32/eq.leo
index 09a3c69f73..bac7af0be0 100644
--- a/compiler/tests/integers/i32/eq.leo
+++ b/compiler/tests/integers/i32/eq.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/ge.leo b/compiler/tests/integers/i32/ge.leo
index 99ca610acd..362521fc82 100644
--- a/compiler/tests/integers/i32/ge.leo
+++ b/compiler/tests/integers/i32/ge.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/gt.leo b/compiler/tests/integers/i32/gt.leo
index be6645354d..63ddcaa85c 100644
--- a/compiler/tests/integers/i32/gt.leo
+++ b/compiler/tests/integers/i32/gt.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/input.leo b/compiler/tests/integers/i32/input.leo
index 326cca12b6..a2d6980e9a 100644
--- a/compiler/tests/integers/i32/input.leo
+++ b/compiler/tests/integers/i32/input.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/le.leo b/compiler/tests/integers/i32/le.leo
index 37682aeda2..948c66b1fc 100644
--- a/compiler/tests/integers/i32/le.leo
+++ b/compiler/tests/integers/i32/le.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/lt.leo b/compiler/tests/integers/i32/lt.leo
index 90965ae47a..72a8fb0d53 100644
--- a/compiler/tests/integers/i32/lt.leo
+++ b/compiler/tests/integers/i32/lt.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/mod.rs b/compiler/tests/integers/i32/mod.rs
index 96c0e4abf9..73e4e4a2f5 100644
--- a/compiler/tests/integers/i32/mod.rs
+++ b/compiler/tests/integers/i32/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_computation_error, expect_parsing_error, IntegerTester},
parse_program,
@@ -106,8 +122,8 @@ fn test_i32_lt() {
}
#[test]
-fn test_i32_assert_eq() {
- TestI32::test_assert_eq();
+fn test_i32_console_assert() {
+ TestI32::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/i32/mul.leo b/compiler/tests/integers/i32/mul.leo
index 029aa60758..50ba5b4128 100644
--- a/compiler/tests/integers/i32/mul.leo
+++ b/compiler/tests/integers/i32/mul.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: i32) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/ne.leo b/compiler/tests/integers/i32/ne.leo
index 6b797872d7..dcc1a185d1 100644
--- a/compiler/tests/integers/i32/ne.leo
+++ b/compiler/tests/integers/i32/ne.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/negate.leo b/compiler/tests/integers/i32/negate.leo
index 60524c24f9..eef94c934f 100644
--- a/compiler/tests/integers/i32/negate.leo
+++ b/compiler/tests/integers/i32/negate.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32) {
- assert_eq!(-a, b);
+ console.assert(-a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/negate_zero.leo b/compiler/tests/integers/i32/negate_zero.leo
index e606ae5994..5533f575a6 100644
--- a/compiler/tests/integers/i32/negate_zero.leo
+++ b/compiler/tests/integers/i32/negate_zero.leo
@@ -1,5 +1,5 @@
function main() {
let a = 0i32;
- assert_eq!(-a, 0i32);
+ console.assert(-a == 0i32);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/pow.leo b/compiler/tests/integers/i32/pow.leo
index 65a840cf26..ebb131e30b 100644
--- a/compiler/tests/integers/i32/pow.leo
+++ b/compiler/tests/integers/i32/pow.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: i32) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/sub.leo b/compiler/tests/integers/i32/sub.leo
index 03179a547d..1f054a5ddf 100644
--- a/compiler/tests/integers/i32/sub.leo
+++ b/compiler/tests/integers/i32/sub.leo
@@ -1,3 +1,3 @@
function main(a: i32, b: i32, c: i32) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i32/ternary.leo b/compiler/tests/integers/i32/ternary.leo
index 211065cea2..3066547ae3 100644
--- a/compiler/tests/integers/i32/ternary.leo
+++ b/compiler/tests/integers/i32/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: i32, b: i32, c: i32) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/add.leo b/compiler/tests/integers/i64/add.leo
index edd5137eae..aefdbb178f 100644
--- a/compiler/tests/integers/i64/add.leo
+++ b/compiler/tests/integers/i64/add.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: i64) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/assert_eq.leo b/compiler/tests/integers/i64/console_assert.leo
similarity index 54%
rename from compiler/tests/integers/i64/assert_eq.leo
rename to compiler/tests/integers/i64/console_assert.leo
index a9e7b44750..ab9a5d6e91 100644
--- a/compiler/tests/integers/i64/assert_eq.leo
+++ b/compiler/tests/integers/i64/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/div.leo b/compiler/tests/integers/i64/div.leo
index 5fd9b5929e..142e4ab801 100644
--- a/compiler/tests/integers/i64/div.leo
+++ b/compiler/tests/integers/i64/div.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: i64) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/eq.leo b/compiler/tests/integers/i64/eq.leo
index 736b94efd2..86a234c834 100644
--- a/compiler/tests/integers/i64/eq.leo
+++ b/compiler/tests/integers/i64/eq.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/ge.leo b/compiler/tests/integers/i64/ge.leo
index 00ea4e716b..e7b453c5dc 100644
--- a/compiler/tests/integers/i64/ge.leo
+++ b/compiler/tests/integers/i64/ge.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/gt.leo b/compiler/tests/integers/i64/gt.leo
index c39799fb2c..9709bad012 100644
--- a/compiler/tests/integers/i64/gt.leo
+++ b/compiler/tests/integers/i64/gt.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/input.leo b/compiler/tests/integers/i64/input.leo
index a9e7b44750..ab9a5d6e91 100644
--- a/compiler/tests/integers/i64/input.leo
+++ b/compiler/tests/integers/i64/input.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/le.leo b/compiler/tests/integers/i64/le.leo
index e8b1f47478..3e2cfcb711 100644
--- a/compiler/tests/integers/i64/le.leo
+++ b/compiler/tests/integers/i64/le.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/lt.leo b/compiler/tests/integers/i64/lt.leo
index a908b8b0f7..ef4e38eb76 100644
--- a/compiler/tests/integers/i64/lt.leo
+++ b/compiler/tests/integers/i64/lt.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/mod.rs b/compiler/tests/integers/i64/mod.rs
index 8f18f85c09..218842b3ad 100644
--- a/compiler/tests/integers/i64/mod.rs
+++ b/compiler/tests/integers/i64/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_computation_error, expect_parsing_error, IntegerTester},
parse_program,
@@ -107,8 +123,8 @@ fn test_i64_lt() {
}
#[test]
-fn test_i64_assert_eq() {
- TestI64::test_assert_eq();
+fn test_i64_console_assert() {
+ TestI64::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/i64/mul.leo b/compiler/tests/integers/i64/mul.leo
index cbff5a9cc8..a3b8bd1da5 100644
--- a/compiler/tests/integers/i64/mul.leo
+++ b/compiler/tests/integers/i64/mul.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: i64) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/ne.leo b/compiler/tests/integers/i64/ne.leo
index e45941e8cc..a2642bb479 100644
--- a/compiler/tests/integers/i64/ne.leo
+++ b/compiler/tests/integers/i64/ne.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/negate.leo b/compiler/tests/integers/i64/negate.leo
index 036967943e..fe0cdc4d97 100644
--- a/compiler/tests/integers/i64/negate.leo
+++ b/compiler/tests/integers/i64/negate.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64) {
- assert_eq!(-a, b);
+ console.assert(-a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/negate_zero.leo b/compiler/tests/integers/i64/negate_zero.leo
index 947aa924d8..6badfe4dc7 100644
--- a/compiler/tests/integers/i64/negate_zero.leo
+++ b/compiler/tests/integers/i64/negate_zero.leo
@@ -1,5 +1,5 @@
function main() {
let a = 0i64;
- assert_eq!(-a, 0i64);
+ console.assert(-a == 0i64);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/pow.leo b/compiler/tests/integers/i64/pow.leo
index 99e71b1968..dca2dace74 100644
--- a/compiler/tests/integers/i64/pow.leo
+++ b/compiler/tests/integers/i64/pow.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: i64) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/sub.leo b/compiler/tests/integers/i64/sub.leo
index 98af2e973a..4d335e504b 100644
--- a/compiler/tests/integers/i64/sub.leo
+++ b/compiler/tests/integers/i64/sub.leo
@@ -1,3 +1,3 @@
function main(a: i64, b: i64, c: i64) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i64/ternary.leo b/compiler/tests/integers/i64/ternary.leo
index 049e1d8d4e..811c759bdf 100644
--- a/compiler/tests/integers/i64/ternary.leo
+++ b/compiler/tests/integers/i64/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: i64, b: i64, c: i64) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/add.leo b/compiler/tests/integers/i8/add.leo
index 054c46374a..dd71bc7f53 100644
--- a/compiler/tests/integers/i8/add.leo
+++ b/compiler/tests/integers/i8/add.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: i8) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/assert_eq.leo b/compiler/tests/integers/i8/console_assert.leo
similarity index 52%
rename from compiler/tests/integers/i8/assert_eq.leo
rename to compiler/tests/integers/i8/console_assert.leo
index c397ca8c07..1fc09cb57d 100644
--- a/compiler/tests/integers/i8/assert_eq.leo
+++ b/compiler/tests/integers/i8/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/div.leo b/compiler/tests/integers/i8/div.leo
index 02cbcb6ee8..a80d8e6319 100644
--- a/compiler/tests/integers/i8/div.leo
+++ b/compiler/tests/integers/i8/div.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: i8) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/eq.leo b/compiler/tests/integers/i8/eq.leo
index 6dee94580b..130cc64b89 100644
--- a/compiler/tests/integers/i8/eq.leo
+++ b/compiler/tests/integers/i8/eq.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/ge.leo b/compiler/tests/integers/i8/ge.leo
index df95a325bd..3084692c0c 100644
--- a/compiler/tests/integers/i8/ge.leo
+++ b/compiler/tests/integers/i8/ge.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/gt.leo b/compiler/tests/integers/i8/gt.leo
index 70c59e398c..d3913b8b24 100644
--- a/compiler/tests/integers/i8/gt.leo
+++ b/compiler/tests/integers/i8/gt.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/input.leo b/compiler/tests/integers/i8/input.leo
index c397ca8c07..1fc09cb57d 100644
--- a/compiler/tests/integers/i8/input.leo
+++ b/compiler/tests/integers/i8/input.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/le.leo b/compiler/tests/integers/i8/le.leo
index dba7694960..92e011f206 100644
--- a/compiler/tests/integers/i8/le.leo
+++ b/compiler/tests/integers/i8/le.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/lt.leo b/compiler/tests/integers/i8/lt.leo
index 0385ce1c49..eb34b7148e 100644
--- a/compiler/tests/integers/i8/lt.leo
+++ b/compiler/tests/integers/i8/lt.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/mod.rs b/compiler/tests/integers/i8/mod.rs
index 37dd327545..a17896c05d 100644
--- a/compiler/tests/integers/i8/mod.rs
+++ b/compiler/tests/integers/i8/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_computation_error, expect_parsing_error, IntegerTester},
parse_program,
@@ -106,8 +122,8 @@ fn test_i8_lt() {
}
#[test]
-fn test_i8_assert_eq() {
- TestI8::test_assert_eq();
+fn test_i8_console_assert() {
+ TestI8::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/i8/mul.leo b/compiler/tests/integers/i8/mul.leo
index 3542bc092c..34726fff92 100644
--- a/compiler/tests/integers/i8/mul.leo
+++ b/compiler/tests/integers/i8/mul.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: i8) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/ne.leo b/compiler/tests/integers/i8/ne.leo
index 9bbb8b3cb1..e5028d404a 100644
--- a/compiler/tests/integers/i8/ne.leo
+++ b/compiler/tests/integers/i8/ne.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/negate.leo b/compiler/tests/integers/i8/negate.leo
index 039067b6e4..2a2266bc56 100644
--- a/compiler/tests/integers/i8/negate.leo
+++ b/compiler/tests/integers/i8/negate.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8) {
- assert_eq!(-a, b);
+ console.assert(-a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/negate_zero.leo b/compiler/tests/integers/i8/negate_zero.leo
index 5c435bcd92..21fbbab675 100644
--- a/compiler/tests/integers/i8/negate_zero.leo
+++ b/compiler/tests/integers/i8/negate_zero.leo
@@ -1,5 +1,5 @@
function main() {
let a = 0i8;
- assert_eq!(-a, 0i8);
+ console.assert(-a == 0i8);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/pow.leo b/compiler/tests/integers/i8/pow.leo
index c66bb67b7a..18aeb44b46 100644
--- a/compiler/tests/integers/i8/pow.leo
+++ b/compiler/tests/integers/i8/pow.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: i8) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/sub.leo b/compiler/tests/integers/i8/sub.leo
index b4a4ad01d9..a795bed153 100644
--- a/compiler/tests/integers/i8/sub.leo
+++ b/compiler/tests/integers/i8/sub.leo
@@ -1,3 +1,3 @@
function main(a: i8, b: i8, c: i8) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/i8/ternary.leo b/compiler/tests/integers/i8/ternary.leo
index 1de75a7b99..de797c6e3b 100644
--- a/compiler/tests/integers/i8/ternary.leo
+++ b/compiler/tests/integers/i8/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: i8, b: i8, c: i8) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/int_macro.rs b/compiler/tests/integers/int_macro.rs
index 6ad1dd3b56..a074f5c420 100644
--- a/compiler/tests/integers/int_macro.rs
+++ b/compiler/tests/integers/int_macro.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
macro_rules! test_int {
($name: ident, $type_: ty, $integer_type: expr, $gadget: ty) => {
pub struct $name {}
@@ -447,12 +463,12 @@ macro_rules! test_int {
}
}
- fn test_assert_eq() {
+ fn test_console_assert() {
for _ in 0..10 {
let a: $type_ = rand::random();
// test equal
- let bytes = include_bytes!("assert_eq.leo");
+ let bytes = include_bytes!("console_assert.leo");
let mut program = parse_program(bytes).unwrap();
let main_input = generate_main_input(vec![
@@ -480,7 +496,7 @@ macro_rules! test_int {
program.set_main_input(main_input);
- expect_synthesis_error(program);
+ expect_compiler_error(program);
}
}
diff --git a/compiler/tests/integers/integer_tester.rs b/compiler/tests/integers/integer_tester.rs
index 8539798ef2..41b0d05656 100644
--- a/compiler/tests/integers/integer_tester.rs
+++ b/compiler/tests/integers/integer_tester.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{expect_compiler_error, EdwardsTestCompiler};
use leo_compiler::errors::{CompilerError, ExpressionError, FunctionError, IntegerError, StatementError, ValueError};
@@ -48,7 +64,7 @@ pub trait IntegerTester {
fn test_lt();
/// Test assert equals constraint keyword
- fn test_assert_eq();
+ fn test_console_assert();
/// Test ternary if bool ? num_1 : num_2;
fn test_ternary();
diff --git a/compiler/tests/integers/mod.rs b/compiler/tests/integers/mod.rs
index 5b76da6e08..3aa0c691c8 100644
--- a/compiler/tests/integers/mod.rs
+++ b/compiler/tests/integers/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
pub mod int_macro;
@@ -8,7 +24,7 @@ pub mod integer_tester;
pub use self::integer_tester::*;
// must be below macro definitions!
-// pub mod u128;
+pub mod u128;
pub mod u16;
pub mod u32;
pub mod u64;
diff --git a/compiler/tests/integers/u128/add.leo b/compiler/tests/integers/u128/add.leo
index d03c236d3e..6b32042fd5 100644
--- a/compiler/tests/integers/u128/add.leo
+++ b/compiler/tests/integers/u128/add.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: u128) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/assert_eq.leo b/compiler/tests/integers/u128/console_assert.leo
similarity index 55%
rename from compiler/tests/integers/u128/assert_eq.leo
rename to compiler/tests/integers/u128/console_assert.leo
index 9ee2ff0f12..adab295385 100644
--- a/compiler/tests/integers/u128/assert_eq.leo
+++ b/compiler/tests/integers/u128/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/div.leo b/compiler/tests/integers/u128/div.leo
index 04e75f6cff..0d62054eca 100644
--- a/compiler/tests/integers/u128/div.leo
+++ b/compiler/tests/integers/u128/div.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: u128) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/eq.leo b/compiler/tests/integers/u128/eq.leo
index 52821882d0..2c2acd923a 100644
--- a/compiler/tests/integers/u128/eq.leo
+++ b/compiler/tests/integers/u128/eq.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/ge.leo b/compiler/tests/integers/u128/ge.leo
index 8e18e647a8..bff7cd321b 100644
--- a/compiler/tests/integers/u128/ge.leo
+++ b/compiler/tests/integers/u128/ge.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/gt.leo b/compiler/tests/integers/u128/gt.leo
index 6c2208917c..e8aec0faf2 100644
--- a/compiler/tests/integers/u128/gt.leo
+++ b/compiler/tests/integers/u128/gt.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/input.leo b/compiler/tests/integers/u128/input.leo
index 9ee2ff0f12..adab295385 100644
--- a/compiler/tests/integers/u128/input.leo
+++ b/compiler/tests/integers/u128/input.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/le.leo b/compiler/tests/integers/u128/le.leo
index c2cd03db53..c9e4609136 100644
--- a/compiler/tests/integers/u128/le.leo
+++ b/compiler/tests/integers/u128/le.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/lt.leo b/compiler/tests/integers/u128/lt.leo
index af80c96c34..b37057c895 100644
--- a/compiler/tests/integers/u128/lt.leo
+++ b/compiler/tests/integers/u128/lt.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/mod.rs b/compiler/tests/integers/u128/mod.rs
index a0e79a6026..e5fd5f2d44 100644
--- a/compiler/tests/integers/u128/mod.rs
+++ b/compiler/tests/integers/u128/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_parsing_error, IntegerTester},
parse_program,
@@ -91,8 +107,8 @@ fn test_u128_lt() {
}
#[test]
-fn test_u128_assert_eq() {
- TestU128::test_assert_eq();
+fn test_u128_console_assert() {
+ TestU128::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/u128/mul.leo b/compiler/tests/integers/u128/mul.leo
index eb22c254e3..c7fdc1530c 100644
--- a/compiler/tests/integers/u128/mul.leo
+++ b/compiler/tests/integers/u128/mul.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: u128) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/ne.leo b/compiler/tests/integers/u128/ne.leo
index 60c104d701..da3467d01e 100644
--- a/compiler/tests/integers/u128/ne.leo
+++ b/compiler/tests/integers/u128/ne.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/pow.leo b/compiler/tests/integers/u128/pow.leo
index 4d63290922..27614bfa56 100644
--- a/compiler/tests/integers/u128/pow.leo
+++ b/compiler/tests/integers/u128/pow.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: u128) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/sub.leo b/compiler/tests/integers/u128/sub.leo
index 14b9925cbe..2374413505 100644
--- a/compiler/tests/integers/u128/sub.leo
+++ b/compiler/tests/integers/u128/sub.leo
@@ -1,3 +1,3 @@
function main(a: u128, b: u128, c: u128) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u128/ternary.leo b/compiler/tests/integers/u128/ternary.leo
index f604e6dcf6..48299fac66 100644
--- a/compiler/tests/integers/u128/ternary.leo
+++ b/compiler/tests/integers/u128/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: u128, b: u128, c: u128) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/add.leo b/compiler/tests/integers/u16/add.leo
index e693fb7075..f00701181b 100644
--- a/compiler/tests/integers/u16/add.leo
+++ b/compiler/tests/integers/u16/add.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: u16) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/assert_eq.leo b/compiler/tests/integers/u16/console_assert.leo
similarity index 54%
rename from compiler/tests/integers/u16/assert_eq.leo
rename to compiler/tests/integers/u16/console_assert.leo
index 38f850139c..761f0639d0 100644
--- a/compiler/tests/integers/u16/assert_eq.leo
+++ b/compiler/tests/integers/u16/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/div.leo b/compiler/tests/integers/u16/div.leo
index a136fd238e..f1dd3fa463 100644
--- a/compiler/tests/integers/u16/div.leo
+++ b/compiler/tests/integers/u16/div.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: u16) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/eq.leo b/compiler/tests/integers/u16/eq.leo
index d194b3a60c..a4b4e78b49 100644
--- a/compiler/tests/integers/u16/eq.leo
+++ b/compiler/tests/integers/u16/eq.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/ge.leo b/compiler/tests/integers/u16/ge.leo
index 91e03c4303..4b1da1b27b 100644
--- a/compiler/tests/integers/u16/ge.leo
+++ b/compiler/tests/integers/u16/ge.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/gt.leo b/compiler/tests/integers/u16/gt.leo
index 499d0296c3..2c5ffbe8eb 100644
--- a/compiler/tests/integers/u16/gt.leo
+++ b/compiler/tests/integers/u16/gt.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/input.leo b/compiler/tests/integers/u16/input.leo
index 38f850139c..761f0639d0 100644
--- a/compiler/tests/integers/u16/input.leo
+++ b/compiler/tests/integers/u16/input.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/le.leo b/compiler/tests/integers/u16/le.leo
index bcee775d58..49713482d0 100644
--- a/compiler/tests/integers/u16/le.leo
+++ b/compiler/tests/integers/u16/le.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/lt.leo b/compiler/tests/integers/u16/lt.leo
index 2fe4a8a37a..dae1951231 100644
--- a/compiler/tests/integers/u16/lt.leo
+++ b/compiler/tests/integers/u16/lt.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/mod.rs b/compiler/tests/integers/u16/mod.rs
index f321e5771a..1c2c45889b 100644
--- a/compiler/tests/integers/u16/mod.rs
+++ b/compiler/tests/integers/u16/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_parsing_error, IntegerTester},
parse_program,
@@ -91,8 +107,8 @@ fn test_u16_lt() {
}
#[test]
-fn test_u16_assert_eq() {
- TestU16::test_assert_eq();
+fn test_u16_console_assert() {
+ TestU16::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/u16/mul.leo b/compiler/tests/integers/u16/mul.leo
index 87fa28c5d2..f2c6f0aac8 100644
--- a/compiler/tests/integers/u16/mul.leo
+++ b/compiler/tests/integers/u16/mul.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: u16) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/ne.leo b/compiler/tests/integers/u16/ne.leo
index 1509e0874e..e90a304cfe 100644
--- a/compiler/tests/integers/u16/ne.leo
+++ b/compiler/tests/integers/u16/ne.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/pow.leo b/compiler/tests/integers/u16/pow.leo
index 2fe42e8822..564c1c51fe 100644
--- a/compiler/tests/integers/u16/pow.leo
+++ b/compiler/tests/integers/u16/pow.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: u16) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/sub.leo b/compiler/tests/integers/u16/sub.leo
index 5f60b58a52..92aae9ac2c 100644
--- a/compiler/tests/integers/u16/sub.leo
+++ b/compiler/tests/integers/u16/sub.leo
@@ -1,3 +1,3 @@
function main(a: u16, b: u16, c: u16) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u16/ternary.leo b/compiler/tests/integers/u16/ternary.leo
index 22f9f76e38..2e2752a130 100644
--- a/compiler/tests/integers/u16/ternary.leo
+++ b/compiler/tests/integers/u16/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: u16, b: u16, c: u16) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/add.leo b/compiler/tests/integers/u32/add.leo
index 6b1a19fb4e..6f6a2454b4 100644
--- a/compiler/tests/integers/u32/add.leo
+++ b/compiler/tests/integers/u32/add.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: u32) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/assert_eq.leo b/compiler/tests/integers/u32/console_assert.leo
similarity index 54%
rename from compiler/tests/integers/u32/assert_eq.leo
rename to compiler/tests/integers/u32/console_assert.leo
index b95ae3bef0..32604eb3b8 100644
--- a/compiler/tests/integers/u32/assert_eq.leo
+++ b/compiler/tests/integers/u32/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/div.leo b/compiler/tests/integers/u32/div.leo
index b9e9acea9d..ed689bd408 100644
--- a/compiler/tests/integers/u32/div.leo
+++ b/compiler/tests/integers/u32/div.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: u32) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/eq.leo b/compiler/tests/integers/u32/eq.leo
index 68f873f6e9..ca427b3c42 100644
--- a/compiler/tests/integers/u32/eq.leo
+++ b/compiler/tests/integers/u32/eq.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/ge.leo b/compiler/tests/integers/u32/ge.leo
index 99ba75da83..35c1c71829 100644
--- a/compiler/tests/integers/u32/ge.leo
+++ b/compiler/tests/integers/u32/ge.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/gt.leo b/compiler/tests/integers/u32/gt.leo
index aa5f66bf2c..f76df415c4 100644
--- a/compiler/tests/integers/u32/gt.leo
+++ b/compiler/tests/integers/u32/gt.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/input.leo b/compiler/tests/integers/u32/input.leo
index b95ae3bef0..32604eb3b8 100644
--- a/compiler/tests/integers/u32/input.leo
+++ b/compiler/tests/integers/u32/input.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/le.leo b/compiler/tests/integers/u32/le.leo
index 8d82db212d..9a802f896d 100644
--- a/compiler/tests/integers/u32/le.leo
+++ b/compiler/tests/integers/u32/le.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/lt.leo b/compiler/tests/integers/u32/lt.leo
index 6cd57df2c9..73e5654470 100644
--- a/compiler/tests/integers/u32/lt.leo
+++ b/compiler/tests/integers/u32/lt.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/mod.rs b/compiler/tests/integers/u32/mod.rs
index a7db6b97c2..3ffb792f4d 100644
--- a/compiler/tests/integers/u32/mod.rs
+++ b/compiler/tests/integers/u32/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_parsing_error, IntegerTester},
parse_program,
@@ -91,8 +107,8 @@ fn test_u32_lt() {
}
#[test]
-fn test_u32_assert_eq() {
- TestU32::test_assert_eq();
+fn test_u32_console_assert() {
+ TestU32::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/u32/mul.leo b/compiler/tests/integers/u32/mul.leo
index e2120276e7..a77a85477b 100644
--- a/compiler/tests/integers/u32/mul.leo
+++ b/compiler/tests/integers/u32/mul.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: u32) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/ne.leo b/compiler/tests/integers/u32/ne.leo
index f75c0e97d3..00ee1a9989 100644
--- a/compiler/tests/integers/u32/ne.leo
+++ b/compiler/tests/integers/u32/ne.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/pow.leo b/compiler/tests/integers/u32/pow.leo
index dc598a4d0d..b82496ff77 100644
--- a/compiler/tests/integers/u32/pow.leo
+++ b/compiler/tests/integers/u32/pow.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: u32) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/sub.leo b/compiler/tests/integers/u32/sub.leo
index 38e12009a3..54480bd4bc 100644
--- a/compiler/tests/integers/u32/sub.leo
+++ b/compiler/tests/integers/u32/sub.leo
@@ -1,3 +1,3 @@
function main(a: u32, b: u32, c: u32) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u32/ternary.leo b/compiler/tests/integers/u32/ternary.leo
index 72370f1367..fde04ac4b8 100644
--- a/compiler/tests/integers/u32/ternary.leo
+++ b/compiler/tests/integers/u32/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: u32, b: u32, c: u32) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/add.leo b/compiler/tests/integers/u64/add.leo
index eab76baebd..28abe51201 100644
--- a/compiler/tests/integers/u64/add.leo
+++ b/compiler/tests/integers/u64/add.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: u64) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/assert_eq.leo b/compiler/tests/integers/u64/console_assert.leo
similarity index 54%
rename from compiler/tests/integers/u64/assert_eq.leo
rename to compiler/tests/integers/u64/console_assert.leo
index 5ea21a4097..ac1d6d40c3 100644
--- a/compiler/tests/integers/u64/assert_eq.leo
+++ b/compiler/tests/integers/u64/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/div.leo b/compiler/tests/integers/u64/div.leo
index 4502cc7273..059da236bb 100644
--- a/compiler/tests/integers/u64/div.leo
+++ b/compiler/tests/integers/u64/div.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: u64) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/eq.leo b/compiler/tests/integers/u64/eq.leo
index afccdf875e..990b2dad2d 100644
--- a/compiler/tests/integers/u64/eq.leo
+++ b/compiler/tests/integers/u64/eq.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/ge.leo b/compiler/tests/integers/u64/ge.leo
index 000a59deca..46ba36ceff 100644
--- a/compiler/tests/integers/u64/ge.leo
+++ b/compiler/tests/integers/u64/ge.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/gt.leo b/compiler/tests/integers/u64/gt.leo
index 37629b508e..7d3032c7f5 100644
--- a/compiler/tests/integers/u64/gt.leo
+++ b/compiler/tests/integers/u64/gt.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/input.leo b/compiler/tests/integers/u64/input.leo
index 5ea21a4097..ac1d6d40c3 100644
--- a/compiler/tests/integers/u64/input.leo
+++ b/compiler/tests/integers/u64/input.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/le.leo b/compiler/tests/integers/u64/le.leo
index b27259d4ee..625b38d2d9 100644
--- a/compiler/tests/integers/u64/le.leo
+++ b/compiler/tests/integers/u64/le.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/lt.leo b/compiler/tests/integers/u64/lt.leo
index 3e95f330eb..ed379f7341 100644
--- a/compiler/tests/integers/u64/lt.leo
+++ b/compiler/tests/integers/u64/lt.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/mod.rs b/compiler/tests/integers/u64/mod.rs
index e58dd64693..06fad4baa3 100644
--- a/compiler/tests/integers/u64/mod.rs
+++ b/compiler/tests/integers/u64/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_parsing_error, IntegerTester},
parse_program,
@@ -91,8 +107,8 @@ fn test_u64_lt() {
}
#[test]
-fn test_u64_assert_eq() {
- TestU64::test_assert_eq();
+fn test_u64_console_assert() {
+ TestU64::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/u64/mul.leo b/compiler/tests/integers/u64/mul.leo
index 832142ffbf..2633e6780c 100644
--- a/compiler/tests/integers/u64/mul.leo
+++ b/compiler/tests/integers/u64/mul.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: u64) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/ne.leo b/compiler/tests/integers/u64/ne.leo
index b85cb73b34..e47acbb1de 100644
--- a/compiler/tests/integers/u64/ne.leo
+++ b/compiler/tests/integers/u64/ne.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/pow.leo b/compiler/tests/integers/u64/pow.leo
index 3fd7074871..64f0694ed1 100644
--- a/compiler/tests/integers/u64/pow.leo
+++ b/compiler/tests/integers/u64/pow.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: u64) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/sub.leo b/compiler/tests/integers/u64/sub.leo
index 820c264745..9961f0f7b7 100644
--- a/compiler/tests/integers/u64/sub.leo
+++ b/compiler/tests/integers/u64/sub.leo
@@ -1,3 +1,3 @@
function main(a: u64, b: u64, c: u64) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u64/ternary.leo b/compiler/tests/integers/u64/ternary.leo
index 8d8e9bb312..315fd7400b 100644
--- a/compiler/tests/integers/u64/ternary.leo
+++ b/compiler/tests/integers/u64/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: u64, b: u64, c: u64) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/add.leo b/compiler/tests/integers/u8/add.leo
index df22ad8c05..1b40e304d2 100644
--- a/compiler/tests/integers/u8/add.leo
+++ b/compiler/tests/integers/u8/add.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: u8) {
- assert_eq!(a + b, c);
+ console.assert(a + b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/assert_eq.leo b/compiler/tests/integers/u8/console_assert.leo
similarity index 52%
rename from compiler/tests/integers/u8/assert_eq.leo
rename to compiler/tests/integers/u8/console_assert.leo
index c4ffe7b4a0..4d99dc106c 100644
--- a/compiler/tests/integers/u8/assert_eq.leo
+++ b/compiler/tests/integers/u8/console_assert.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/div.leo b/compiler/tests/integers/u8/div.leo
index e8b85479b1..945aa94c30 100644
--- a/compiler/tests/integers/u8/div.leo
+++ b/compiler/tests/integers/u8/div.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: u8) {
- assert_eq!(a / b, c);
+ console.assert(a / b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/eq.leo b/compiler/tests/integers/u8/eq.leo
index 4421872b20..c2a487b0e7 100644
--- a/compiler/tests/integers/u8/eq.leo
+++ b/compiler/tests/integers/u8/eq.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: bool) {
- assert_eq!(a == b, c);
+ console.assert(a == b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/ge.leo b/compiler/tests/integers/u8/ge.leo
index db539a77d3..d819422276 100644
--- a/compiler/tests/integers/u8/ge.leo
+++ b/compiler/tests/integers/u8/ge.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: bool) {
- assert_eq!(a >= b, c);
+ console.assert(a >= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/gt.leo b/compiler/tests/integers/u8/gt.leo
index f26697c3ce..87843f575f 100644
--- a/compiler/tests/integers/u8/gt.leo
+++ b/compiler/tests/integers/u8/gt.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: bool) {
- assert_eq!(a > b, c);
+ console.assert(a > b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/input.leo b/compiler/tests/integers/u8/input.leo
index c4ffe7b4a0..4d99dc106c 100644
--- a/compiler/tests/integers/u8/input.leo
+++ b/compiler/tests/integers/u8/input.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8) {
- assert_eq!(a, b);
+ console.assert(a == b);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/le.leo b/compiler/tests/integers/u8/le.leo
index 09876d4175..2607b7f3d1 100644
--- a/compiler/tests/integers/u8/le.leo
+++ b/compiler/tests/integers/u8/le.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: bool) {
- assert_eq!(a <= b, c);
+ console.assert(a <= b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/lt.leo b/compiler/tests/integers/u8/lt.leo
index 8cea3ccab8..7495d0fe37 100644
--- a/compiler/tests/integers/u8/lt.leo
+++ b/compiler/tests/integers/u8/lt.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: bool) {
- assert_eq!(a < b, c);
+ console.assert(a < b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/mod.rs b/compiler/tests/integers/u8/mod.rs
index c13a63e29e..335e4146ff 100644
--- a/compiler/tests/integers/u8/mod.rs
+++ b/compiler/tests/integers/u8/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
integers::{expect_parsing_error, IntegerTester},
parse_program,
@@ -91,8 +107,8 @@ fn test_u8_lt() {
}
#[test]
-fn test_u8_assert_eq() {
- TestU8::test_assert_eq();
+fn test_u8_console_assert() {
+ TestU8::test_console_assert();
}
#[test]
diff --git a/compiler/tests/integers/u8/mul.leo b/compiler/tests/integers/u8/mul.leo
index a5d6e7664c..11acf4688b 100644
--- a/compiler/tests/integers/u8/mul.leo
+++ b/compiler/tests/integers/u8/mul.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: u8) {
- assert_eq!(a * b, c);
+ console.assert(a * b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/ne.leo b/compiler/tests/integers/u8/ne.leo
index 70864bd246..e75194a2f2 100644
--- a/compiler/tests/integers/u8/ne.leo
+++ b/compiler/tests/integers/u8/ne.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: bool) {
- assert_eq!(a != b, c);
+ console.assert(a != b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/pow.leo b/compiler/tests/integers/u8/pow.leo
index 143106b1b4..928ab73b0d 100644
--- a/compiler/tests/integers/u8/pow.leo
+++ b/compiler/tests/integers/u8/pow.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: u8) {
- assert_eq!(a ** b, c);
+ console.assert(a ** b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/sub.leo b/compiler/tests/integers/u8/sub.leo
index dedd23d2f7..1335409c29 100644
--- a/compiler/tests/integers/u8/sub.leo
+++ b/compiler/tests/integers/u8/sub.leo
@@ -1,3 +1,3 @@
function main(a: u8, b: u8, c: u8) {
- assert_eq!(a - b, c);
+ console.assert(a - b == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/u8/ternary.leo b/compiler/tests/integers/u8/ternary.leo
index 7ae0af35c1..ce868a5ec9 100644
--- a/compiler/tests/integers/u8/ternary.leo
+++ b/compiler/tests/integers/u8/ternary.leo
@@ -1,5 +1,5 @@
function main(s: bool, a: u8, b: u8, c: u8) {
let r = if s ? a : b;
- assert_eq!(r, c);
+ console.assert(r == c);
}
\ No newline at end of file
diff --git a/compiler/tests/integers/uint_macro.rs b/compiler/tests/integers/uint_macro.rs
index 3600372173..c85b6a68c4 100644
--- a/compiler/tests/integers/uint_macro.rs
+++ b/compiler/tests/integers/uint_macro.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
macro_rules! test_uint {
($name: ident, $type_: ty, $integer_type: expr, $gadget: ty) => {
pub struct $name {}
@@ -385,12 +401,12 @@ macro_rules! test_uint {
}
}
- fn test_assert_eq() {
+ fn test_console_assert() {
for _ in 0..10 {
let a: $type_ = rand::random();
// test equal
- let bytes = include_bytes!("assert_eq.leo");
+ let bytes = include_bytes!("console_assert.leo");
let mut program = parse_program(bytes).unwrap();
let main_input = generate_main_input(vec![
@@ -418,7 +434,7 @@ macro_rules! test_uint {
program.set_main_input(main_input);
- expect_synthesis_error(program);
+ expect_compiler_error(program);
}
}
diff --git a/compiler/tests/macros/debug.leo b/compiler/tests/macros/debug.leo
deleted file mode 100644
index 8093e104ab..0000000000
--- a/compiler/tests/macros/debug.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main() {
- debug!("hello debug");
-}
\ No newline at end of file
diff --git a/compiler/tests/macros/error.leo b/compiler/tests/macros/error.leo
deleted file mode 100644
index 9d9bf8e246..0000000000
--- a/compiler/tests/macros/error.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main() {
- error!("hello error");
-}
\ No newline at end of file
diff --git a/compiler/tests/macros/mod.rs b/compiler/tests/macros/mod.rs
deleted file mode 100644
index 661f8db295..0000000000
--- a/compiler/tests/macros/mod.rs
+++ /dev/null
@@ -1,85 +0,0 @@
-use crate::{assert_satisfied, expect_compiler_error, generate_main_input, parse_program};
-use leo_typed::InputValue;
-
-#[test]
-fn test_print() {
- let bytes = include_bytes!("print.leo");
- let program = parse_program(bytes).unwrap();
-
- assert_satisfied(program);
-}
-
-#[test]
-fn test_print_fail() {
- let bytes = include_bytes!("print_fail.leo");
-
- assert!(parse_program(bytes).is_err());
-}
-
-#[test]
-fn test_print_parameter() {
- let bytes = include_bytes!("print_parameter.leo");
- let program = parse_program(bytes).unwrap();
-
- assert_satisfied(program);
-}
-
-#[test]
-fn test_print_parameter_many() {
- let bytes = include_bytes!("print_parameter_many.leo");
- let program = parse_program(bytes).unwrap();
-
- assert_satisfied(program);
-}
-
-#[test]
-fn test_print_parameter_fail_unknown() {
- let bytes = include_bytes!("print_parameter_fail_unknown.leo");
- let program = parse_program(bytes).unwrap();
-
- expect_compiler_error(program);
-}
-
-#[test]
-fn test_print_parameter_fail_empty() {
- let bytes = include_bytes!("print_parameter_fail_empty.leo");
- let program = parse_program(bytes).unwrap();
-
- expect_compiler_error(program);
-}
-
-#[test]
-fn test_print_parameter_fail_none() {
- let bytes = include_bytes!("print_parameter_fail_empty.leo");
- let program = parse_program(bytes).unwrap();
-
- expect_compiler_error(program);
-}
-
-#[test]
-fn test_print_input() {
- let bytes = include_bytes!("print_input.leo");
- let mut program = parse_program(bytes).unwrap();
-
- let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
-
- program.set_main_input(main_input);
-
- assert_satisfied(program);
-}
-
-#[test]
-fn test_debug() {
- let bytes = include_bytes!("debug.leo");
- let program = parse_program(bytes).unwrap();
-
- assert_satisfied(program);
-}
-
-#[test]
-fn test_error() {
- let bytes = include_bytes!("error.leo");
- let program = parse_program(bytes).unwrap();
-
- assert_satisfied(program);
-}
diff --git a/compiler/tests/macros/print.leo b/compiler/tests/macros/print.leo
deleted file mode 100644
index 0c271a5379..0000000000
--- a/compiler/tests/macros/print.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main() {
- print!("hello world");
-}
\ No newline at end of file
diff --git a/compiler/tests/macros/print_fail.leo b/compiler/tests/macros/print_fail.leo
deleted file mode 100644
index ad3920db5e..0000000000
--- a/compiler/tests/macros/print_fail.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main() {
- print!( hello );
-}
\ No newline at end of file
diff --git a/compiler/tests/macros/print_input.leo b/compiler/tests/macros/print_input.leo
deleted file mode 100644
index fa307720ab..0000000000
--- a/compiler/tests/macros/print_input.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main(a: bool) {
- print!("a = {}", a);
-}
\ No newline at end of file
diff --git a/compiler/tests/macros/print_parameter.leo b/compiler/tests/macros/print_parameter.leo
deleted file mode 100644
index a9ffc67211..0000000000
--- a/compiler/tests/macros/print_parameter.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main() {
- print!("{}", 1u32);
-}
\ No newline at end of file
diff --git a/compiler/tests/macros/print_parameter_fail_empty.leo b/compiler/tests/macros/print_parameter_fail_empty.leo
deleted file mode 100644
index b076303442..0000000000
--- a/compiler/tests/macros/print_parameter_fail_empty.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main() {
- print!("{}");
-}
\ No newline at end of file
diff --git a/compiler/tests/macros/print_parameter_fail_none.leo b/compiler/tests/macros/print_parameter_fail_none.leo
deleted file mode 100644
index aa66cd03d8..0000000000
--- a/compiler/tests/macros/print_parameter_fail_none.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main() {
- print!("", 1u32);
-}
\ No newline at end of file
diff --git a/compiler/tests/macros/print_parameter_fail_unknown.leo b/compiler/tests/macros/print_parameter_fail_unknown.leo
deleted file mode 100644
index b6f1bb5a8c..0000000000
--- a/compiler/tests/macros/print_parameter_fail_unknown.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main() {
- print!("{}", a);
-}
\ No newline at end of file
diff --git a/compiler/tests/macros/print_parameter_many.leo b/compiler/tests/macros/print_parameter_many.leo
deleted file mode 100644
index c1fadda7c1..0000000000
--- a/compiler/tests/macros/print_parameter_many.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main() {
- print!("{} {}", 1u32, true);
-}
\ No newline at end of file
diff --git a/compiler/tests/mod.rs b/compiler/tests/mod.rs
index b58767e5d0..0b498e0ee1 100644
--- a/compiler/tests/mod.rs
+++ b/compiler/tests/mod.rs
@@ -1,15 +1,31 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod address;
pub mod array;
pub mod boolean;
pub mod circuits;
+pub mod console;
pub mod definition;
-pub mod field;
+// pub mod field;
pub mod function;
-pub mod group;
+// pub mod group;
pub mod import;
pub mod input_files;
pub mod integers;
-pub mod macros;
pub mod mutability;
pub mod statements;
pub mod syntax;
@@ -155,12 +171,12 @@ pub(crate) fn expect_compiler_error(program: EdwardsTestCompiler) -> CompilerErr
program.generate_constraints_helper(&mut cs).unwrap_err()
}
-pub(crate) fn expect_synthesis_error(program: EdwardsTestCompiler) {
- let mut cs = TestConstraintSystem::::new();
- let _output = program.generate_constraints_helper(&mut cs).unwrap();
-
- assert!(!cs.is_satisfied());
-}
+// pub(crate) fn expect_synthesis_error(program: EdwardsTestCompiler) {
+// let mut cs = TestConstraintSystem::::new();
+// let _output = program.generate_constraints_helper(&mut cs).unwrap();
+//
+// assert!(!cs.is_satisfied());
+// }
pub(crate) fn generate_main_input(input: Vec<(&str, Option)>) -> MainInput {
let mut main_input = MainInput::new();
diff --git a/compiler/tests/mutability/array_mut.leo b/compiler/tests/mutability/array_mut.leo
index 9df3503777..1b86bac80f 100644
--- a/compiler/tests/mutability/array_mut.leo
+++ b/compiler/tests/mutability/array_mut.leo
@@ -3,5 +3,5 @@ function main() {
let mut a = [1u32];
a[0] = 0;
- assert_eq!(a[0], 0u32);
+ console.assert(a[0] == 0u32);
}
\ No newline at end of file
diff --git a/compiler/tests/mutability/circuit_mut.leo b/compiler/tests/mutability/circuit_mut.leo
index cc3fbb2f9b..27bd6109b2 100644
--- a/compiler/tests/mutability/circuit_mut.leo
+++ b/compiler/tests/mutability/circuit_mut.leo
@@ -7,5 +7,5 @@ function main() {
let mut a = Foo { x: 1 };
a.x = 0;
- assert_eq!(a.x, 0u32);
+ console.assert(a.x == 0u32);
}
\ No newline at end of file
diff --git a/compiler/tests/mutability/function_input_mut.leo b/compiler/tests/mutability/function_input_mut.leo
index 631e2ff57e..2df24b227c 100644
--- a/compiler/tests/mutability/function_input_mut.leo
+++ b/compiler/tests/mutability/function_input_mut.leo
@@ -2,5 +2,5 @@
function main(mut a: bool) {
a = true;
- assert_eq!(a, true);
+ console.assert(a == true);
}
\ No newline at end of file
diff --git a/compiler/tests/mutability/let_mut.leo b/compiler/tests/mutability/let_mut.leo
index 756729cad5..5766d144d3 100644
--- a/compiler/tests/mutability/let_mut.leo
+++ b/compiler/tests/mutability/let_mut.leo
@@ -3,5 +3,5 @@ function main() {
let mut a = 1u32;
a = 0;
- assert_eq!(a, 0u32);
+ console.assert(a == 0u32);
}
\ No newline at end of file
diff --git a/compiler/tests/mutability/mod.rs b/compiler/tests/mutability/mod.rs
index 460f8a0565..3c00bab145 100644
--- a/compiler/tests/mutability/mod.rs
+++ b/compiler/tests/mutability/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{assert_satisfied, expect_compiler_error, generate_main_input, parse_program};
use leo_typed::InputValue;
diff --git a/compiler/tests/statements/assertion_basic.leo b/compiler/tests/statements/assertion_basic.leo
deleted file mode 100644
index 8a8ab02f28..0000000000
--- a/compiler/tests/statements/assertion_basic.leo
+++ /dev/null
@@ -1,3 +0,0 @@
-function main(a: bool) {
- assert_eq!(a, true);
-}
\ No newline at end of file
diff --git a/compiler/tests/statements/conditional/assert.leo b/compiler/tests/statements/conditional/assert.leo
index c6025b26de..f3d20b461d 100644
--- a/compiler/tests/statements/conditional/assert.leo
+++ b/compiler/tests/statements/conditional/assert.leo
@@ -1,7 +1,7 @@
function main(a: u32) {
if a == 1 {
- assert_eq!(a, 1);
+ console.assert(a == 1);
} else {
- assert_eq!(a, 0);
+ console.assert(a == 0);
}
}
diff --git a/compiler/tests/statements/conditional/chain.leo b/compiler/tests/statements/conditional/chain.leo
index 6b789fb1c1..dbc0e1f38c 100644
--- a/compiler/tests/statements/conditional/chain.leo
+++ b/compiler/tests/statements/conditional/chain.leo
@@ -9,5 +9,5 @@ function main(a: u32, b: u32) {
c = 3;
}
- assert_eq!(c, b);
+ console.assert(c == b);
}
\ No newline at end of file
diff --git a/compiler/tests/statements/conditional/for_loop.leo b/compiler/tests/statements/conditional/for_loop.leo
index 3c123e6fe4..060d27d965 100644
--- a/compiler/tests/statements/conditional/for_loop.leo
+++ b/compiler/tests/statements/conditional/for_loop.leo
@@ -9,5 +9,5 @@ function main(a: bool) {
let r: u32 = if a ? 6 : 0;
- assert_eq!(r, b);
+ console.assert(r == b);
}
diff --git a/compiler/tests/statements/conditional/mod.rs b/compiler/tests/statements/conditional/mod.rs
index f071239761..532dbbff7d 100644
--- a/compiler/tests/statements/conditional/mod.rs
+++ b/compiler/tests/statements/conditional/mod.rs
@@ -1,6 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
assert_satisfied,
- expect_synthesis_error,
+ expect_compiler_error,
generate_main_input,
generate_test_input_u32,
get_output,
@@ -39,7 +55,7 @@ fn test_assert() {
program_2_fail.set_main_input(main_input);
- expect_synthesis_error(program_2_fail);
+ expect_compiler_error(program_2_fail);
}
#[test]
diff --git a/compiler/tests/statements/conditional/mutate.leo b/compiler/tests/statements/conditional/mutate.leo
index 3bb7cb1839..458d3d0d60 100644
--- a/compiler/tests/statements/conditional/mutate.leo
+++ b/compiler/tests/statements/conditional/mutate.leo
@@ -8,8 +8,8 @@ function main(a: u32) {
}
if a == 1 {
- assert_eq!(b, 1);
+ console.assert(b == 1);
} else {
- assert_eq!(b, 0);
+ console.assert(b == 0);
}
}
diff --git a/compiler/tests/statements/conditional/nested.leo b/compiler/tests/statements/conditional/nested.leo
index b903aad345..3596f889d1 100644
--- a/compiler/tests/statements/conditional/nested.leo
+++ b/compiler/tests/statements/conditional/nested.leo
@@ -8,5 +8,5 @@ function main(a: bool, b: bool, c: u32) {
}
}
- assert_eq!(d, c);
+ console.assert(d == c);
}
\ No newline at end of file
diff --git a/compiler/tests/statements/iteration_basic.leo b/compiler/tests/statements/iteration_basic.leo
index 3dae3d3761..103c9abb9e 100644
--- a/compiler/tests/statements/iteration_basic.leo
+++ b/compiler/tests/statements/iteration_basic.leo
@@ -4,5 +4,5 @@ function main() {
x -= 1;
}
- assert_eq!(x, 1u32);
+ console.assert(x == 1u32);
}
\ No newline at end of file
diff --git a/compiler/tests/statements/mod.rs b/compiler/tests/statements/mod.rs
index b4c98b9f3a..3180c6fa30 100644
--- a/compiler/tests/statements/mod.rs
+++ b/compiler/tests/statements/mod.rs
@@ -1,4 +1,20 @@
-use crate::{assert_satisfied, expect_compiler_error, expect_synthesis_error, generate_main_input, parse_program};
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{assert_satisfied, expect_compiler_error, generate_main_input, parse_program};
use leo_typed::InputValue;
pub mod conditional;
@@ -41,28 +57,6 @@ fn test_iteration_basic() {
assert_satisfied(program);
}
-// Assertion
-
-#[test]
-fn test_assertion_basic() {
- let bytes = include_bytes!("assertion_basic.leo");
- let mut program = parse_program(bytes).unwrap();
-
- let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(true)))]);
-
- program.set_main_input(main_input);
-
- assert_satisfied(program);
-
- let mut program = parse_program(bytes).unwrap();
-
- let main_input = generate_main_input(vec![("a", Some(InputValue::Boolean(false)))]);
-
- program.set_main_input(main_input);
-
- expect_synthesis_error(program);
-}
-
#[test]
fn test_num_returns_fail() {
let bytes = include_bytes!("num_returns_fail.leo");
diff --git a/compiler/tests/statements/ternary_basic.leo b/compiler/tests/statements/ternary_basic.leo
index 8ba6a71283..89158a3e78 100644
--- a/compiler/tests/statements/ternary_basic.leo
+++ b/compiler/tests/statements/ternary_basic.leo
@@ -1,5 +1,5 @@
function main(a: bool, b: bool) {
let c = if a ? true : false;
- assert_eq!(c, b);
+ const a = c == b;
}
\ No newline at end of file
diff --git a/compiler/tests/syntax/mod.rs b/compiler/tests/syntax/mod.rs
index 8eb71ed403..7bba90206b 100644
--- a/compiler/tests/syntax/mod.rs
+++ b/compiler/tests/syntax/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{expect_compiler_error, parse_input, parse_program};
use leo_ast::ParserError;
use leo_compiler::errors::{CompilerError, ExpressionError, FunctionError, StatementError};
diff --git a/compiler/tests/tuples/access.leo b/compiler/tests/tuples/access.leo
index 353b31353b..196e9d058c 100644
--- a/compiler/tests/tuples/access.leo
+++ b/compiler/tests/tuples/access.leo
@@ -1,6 +1,6 @@
function main() {
let a = (true, false);
- assert_eq!(a.0, true);
- assert_eq!(a.1, false);
+ console.assert(a.0 == true);
+ console.assert(a.1 == false);
}
\ No newline at end of file
diff --git a/compiler/tests/tuples/function.leo b/compiler/tests/tuples/function.leo
index b58b92c016..b318348813 100644
--- a/compiler/tests/tuples/function.leo
+++ b/compiler/tests/tuples/function.leo
@@ -5,6 +5,6 @@ function foo() -> (bool, bool) {
function main() {
let a = foo();
- assert_eq!(a.0, true);
- assert_eq!(a.1, false);
+ console.assert(a.0 == true);
+ console.assert(a.1 == false);
}
\ No newline at end of file
diff --git a/compiler/tests/tuples/function_multiple.leo b/compiler/tests/tuples/function_multiple.leo
index 12c2e0fb04..39848377c6 100644
--- a/compiler/tests/tuples/function_multiple.leo
+++ b/compiler/tests/tuples/function_multiple.leo
@@ -5,6 +5,6 @@ function foo() -> (bool, bool) {
function main() {
let (a, b) = foo();
- assert_eq!(a, true);
- assert_eq!(b, false);
+ console.assert(a == true);
+ console.assert(b == false);
}
\ No newline at end of file
diff --git a/compiler/tests/tuples/function_typed.leo b/compiler/tests/tuples/function_typed.leo
index c874fd6485..8af2c907ca 100644
--- a/compiler/tests/tuples/function_typed.leo
+++ b/compiler/tests/tuples/function_typed.leo
@@ -5,6 +5,6 @@ function foo() -> (bool, bool) {
function main() {
let a: (bool, bool) = foo();
- assert_eq!(a.0, true);
- assert_eq!(a.1, false);
+ console.assert(a.0 == true);
+ console.assert(a.1 == false);
}
\ No newline at end of file
diff --git a/compiler/tests/tuples/mod.rs b/compiler/tests/tuples/mod.rs
index f1556ba94c..9c52764c5f 100644
--- a/compiler/tests/tuples/mod.rs
+++ b/compiler/tests/tuples/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{assert_satisfied, parse_program};
#[test]
diff --git a/compiler/tests/tuples/multiple.leo b/compiler/tests/tuples/multiple.leo
index b052ce0e66..b7627dad2a 100644
--- a/compiler/tests/tuples/multiple.leo
+++ b/compiler/tests/tuples/multiple.leo
@@ -1,6 +1,6 @@
function main() {
let (a, b) = (true, false);
- assert_eq!(a, true);
- assert_eq!(b, false);
+ console.assert(a == true);
+ console.assert(b == false);
}
\ No newline at end of file
diff --git a/compiler/tests/tuples/multiple_typed.leo b/compiler/tests/tuples/multiple_typed.leo
index c39f026f20..29fc7ef877 100644
--- a/compiler/tests/tuples/multiple_typed.leo
+++ b/compiler/tests/tuples/multiple_typed.leo
@@ -1,6 +1,6 @@
function main() {
let (a, b): (bool, bool) = (true, false);
- assert_eq!(a, true);
- assert_eq!(b, false);
+ console.assert(a == true);
+ console.assert(b == false);
}
\ No newline at end of file
diff --git a/compiler/tests/tuples/nested_access.leo b/compiler/tests/tuples/nested_access.leo
index 7633cbcd83..5edba64e24 100644
--- a/compiler/tests/tuples/nested_access.leo
+++ b/compiler/tests/tuples/nested_access.leo
@@ -2,7 +2,7 @@ function main() {
let a = (true, false);
let b = (true, a);
- assert_eq!(b.0, true);
- assert_eq!(b.1.0, true);
- assert_eq!(b.1.1, false);
+ console.assert(b.0 == true);
+ console.assert(b.1.0 == true);
+ console.assert(b.1.1 == false);
}
\ No newline at end of file
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..5cd23178f9
--- /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 94%
rename from examples/pedersen_hash/src/main.leo
rename to examples/pedersen-hash/src/main.leo
index da62f8ebd5..bb93ab0158 100644
--- a/examples/pedersen_hash/src/main.leo
+++ b/examples/pedersen-hash/src/main.leo
@@ -17,7 +17,7 @@ circuit PedersenHash {
}
}
-// The 'pedersen_hash' main function.
+// The 'pedersen-hash' main function.
function main() -> group {
const parameters = [1group; 256];
const pedersen = PedersenHash::new(parameters);
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..5d69e2e375
--- /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/gadgets/src/arithmetic/add.rs b/gadgets/src/arithmetic/add.rs
index 522da0819b..28adc4d650 100644
--- a/gadgets/src/arithmetic/add.rs
+++ b/gadgets/src/arithmetic/add.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_errors::gadgets::SynthesisError;
use snarkos_models::{
curves::{Field, PrimeField},
diff --git a/gadgets/src/arithmetic/div.rs b/gadgets/src/arithmetic/div.rs
index 097ae5962e..505701c71e 100644
--- a/gadgets/src/arithmetic/div.rs
+++ b/gadgets/src/arithmetic/div.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_models::{curves::Field, gadgets::r1cs::ConstraintSystem};
/// Returns division of `self` / `other` in the constraint system.
diff --git a/gadgets/src/arithmetic/mod.rs b/gadgets/src/arithmetic/mod.rs
index 20cae8f65a..084aeb03a5 100644
--- a/gadgets/src/arithmetic/mod.rs
+++ b/gadgets/src/arithmetic/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod add;
pub use self::add::*;
diff --git a/gadgets/src/arithmetic/mul.rs b/gadgets/src/arithmetic/mul.rs
index 207fa8b212..80c53d7392 100644
--- a/gadgets/src/arithmetic/mul.rs
+++ b/gadgets/src/arithmetic/mul.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_models::{curves::Field, gadgets::r1cs::ConstraintSystem};
/// Returns multiplication of `self` * `other` in the constraint system.
diff --git a/gadgets/src/arithmetic/neg.rs b/gadgets/src/arithmetic/neg.rs
index 9eabb4d83f..4ac569ce96 100644
--- a/gadgets/src/arithmetic/neg.rs
+++ b/gadgets/src/arithmetic/neg.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::bits::RippleCarryAdder;
use snarkos_errors::gadgets::SynthesisError;
diff --git a/gadgets/src/arithmetic/pow.rs b/gadgets/src/arithmetic/pow.rs
index 9cb07f95b1..58d56a451c 100644
--- a/gadgets/src/arithmetic/pow.rs
+++ b/gadgets/src/arithmetic/pow.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_models::{curves::Field, gadgets::r1cs::ConstraintSystem};
/// Returns exponentiation of `self` ** `other` in the constraint system.
diff --git a/gadgets/src/arithmetic/sub.rs b/gadgets/src/arithmetic/sub.rs
index 370b375908..3709e0df4f 100644
--- a/gadgets/src/arithmetic/sub.rs
+++ b/gadgets/src/arithmetic/sub.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_models::{curves::Field, gadgets::r1cs::ConstraintSystem};
/// Returns subtraction of `self` - `other` in the constraint system.
diff --git a/gadgets/src/bits/adder.rs b/gadgets/src/bits/adder.rs
index 5461c9cb7e..91a2524f2e 100644
--- a/gadgets/src/bits/adder.rs
+++ b/gadgets/src/bits/adder.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_errors::gadgets::SynthesisError;
use snarkos_models::{
curves::Field,
diff --git a/gadgets/src/bits/comparator.rs b/gadgets/src/bits/comparator.rs
index 1af89900a0..df48fe10ce 100644
--- a/gadgets/src/bits/comparator.rs
+++ b/gadgets/src/bits/comparator.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_errors::gadgets::SynthesisError;
use snarkos_models::{
curves::{Field, PrimeField},
diff --git a/gadgets/src/bits/mod.rs b/gadgets/src/bits/mod.rs
index 6e55c89964..cec0d61008 100644
--- a/gadgets/src/bits/mod.rs
+++ b/gadgets/src/bits/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
pub mod adder;
pub use self::adder::*;
diff --git a/gadgets/src/bits/rca.rs b/gadgets/src/bits/rca.rs
index 72c24d03a2..785b0962c2 100644
--- a/gadgets/src/bits/rca.rs
+++ b/gadgets/src/bits/rca.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{bits::FullAdder, signed_integer::*};
use snarkos_errors::gadgets::SynthesisError;
diff --git a/gadgets/src/bits/sign_extend.rs b/gadgets/src/bits/sign_extend.rs
index 63a8777904..7c44047bce 100644
--- a/gadgets/src/bits/sign_extend.rs
+++ b/gadgets/src/bits/sign_extend.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_models::gadgets::utilities::boolean::Boolean;
/// Sign extends an array of bits to the desired length.
diff --git a/gadgets/src/errors/mod.rs b/gadgets/src/errors/mod.rs
index 3a4d43aad7..0b8e578304 100644
--- a/gadgets/src/errors/mod.rs
+++ b/gadgets/src/errors/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod signed_integer;
pub use self::signed_integer::*;
diff --git a/gadgets/src/errors/signed_integer.rs b/gadgets/src/errors/signed_integer.rs
index 759661435c..0fef69fba7 100644
--- a/gadgets/src/errors/signed_integer.rs
+++ b/gadgets/src/errors/signed_integer.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_errors::gadgets::SynthesisError;
#[derive(Debug, Error)]
diff --git a/gadgets/src/lib.rs b/gadgets/src/lib.rs
index 6d7eacfe77..87bfd4dfad 100644
--- a/gadgets/src/lib.rs
+++ b/gadgets/src/lib.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
extern crate thiserror;
diff --git a/gadgets/src/signed_integer/arithmetic/add.rs b/gadgets/src/signed_integer/arithmetic/add.rs
index 2d3c83a6f7..4f25997ffd 100644
--- a/gadgets/src/signed_integer/arithmetic/add.rs
+++ b/gadgets/src/signed_integer/arithmetic/add.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
arithmetic::Add,
bits::RippleCarryAdder,
diff --git a/gadgets/src/signed_integer/arithmetic/div.rs b/gadgets/src/signed_integer/arithmetic/div.rs
index d834c5ac11..80cbddeba6 100644
--- a/gadgets/src/signed_integer/arithmetic/div.rs
+++ b/gadgets/src/signed_integer/arithmetic/div.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
arithmetic::{Add, Div, Neg, Sub},
bits::ComparatorGadget,
diff --git a/gadgets/src/signed_integer/arithmetic/mod.rs b/gadgets/src/signed_integer/arithmetic/mod.rs
index 8ddd2e086e..6ce2d7f4ef 100644
--- a/gadgets/src/signed_integer/arithmetic/mod.rs
+++ b/gadgets/src/signed_integer/arithmetic/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
pub mod add;
pub use self::add::*;
diff --git a/gadgets/src/signed_integer/arithmetic/mul.rs b/gadgets/src/signed_integer/arithmetic/mul.rs
index 1a18bab4af..a5abcbf6cc 100644
--- a/gadgets/src/signed_integer/arithmetic/mul.rs
+++ b/gadgets/src/signed_integer/arithmetic/mul.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
arithmetic::Mul,
bits::{RippleCarryAdder, SignExtend},
diff --git a/gadgets/src/signed_integer/arithmetic/neg.rs b/gadgets/src/signed_integer/arithmetic/neg.rs
index a5124d251f..c81daa7baa 100644
--- a/gadgets/src/signed_integer/arithmetic/neg.rs
+++ b/gadgets/src/signed_integer/arithmetic/neg.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{arithmetic::Neg, errors::SignedIntegerError, signed_integer::*};
use snarkos_models::{curves::PrimeField, gadgets::r1cs::ConstraintSystem};
diff --git a/gadgets/src/signed_integer/arithmetic/pow.rs b/gadgets/src/signed_integer/arithmetic/pow.rs
index aa5b69af90..25e4aa8d48 100644
--- a/gadgets/src/signed_integer/arithmetic/pow.rs
+++ b/gadgets/src/signed_integer/arithmetic/pow.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
arithmetic::{Mul, Pow},
errors::SignedIntegerError,
diff --git a/gadgets/src/signed_integer/arithmetic/sub.rs b/gadgets/src/signed_integer/arithmetic/sub.rs
index cbc7af9aed..cc1bf41139 100644
--- a/gadgets/src/signed_integer/arithmetic/sub.rs
+++ b/gadgets/src/signed_integer/arithmetic/sub.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
arithmetic::{Add, Neg, Sub},
errors::SignedIntegerError,
diff --git a/gadgets/src/signed_integer/int_impl.rs b/gadgets/src/signed_integer/int_impl.rs
index 97173b6987..074723cfee 100644
--- a/gadgets/src/signed_integer/int_impl.rs
+++ b/gadgets/src/signed_integer/int_impl.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_models::gadgets::utilities::boolean::Boolean;
use std::fmt::Debug;
diff --git a/gadgets/src/signed_integer/mod.rs b/gadgets/src/signed_integer/mod.rs
index 99a2192182..8fb0bd56b9 100644
--- a/gadgets/src/signed_integer/mod.rs
+++ b/gadgets/src/signed_integer/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
pub mod arithmetic;
diff --git a/gadgets/src/signed_integer/relational/cmp.rs b/gadgets/src/signed_integer/relational/cmp.rs
index 57fae96f0e..1d02ec166d 100644
--- a/gadgets/src/signed_integer/relational/cmp.rs
+++ b/gadgets/src/signed_integer/relational/cmp.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
bits::{ComparatorGadget, EvaluateLtGadget},
Int128,
diff --git a/gadgets/src/signed_integer/relational/eq.rs b/gadgets/src/signed_integer/relational/eq.rs
index b1047a7114..0deb39d145 100644
--- a/gadgets/src/signed_integer/relational/eq.rs
+++ b/gadgets/src/signed_integer/relational/eq.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Int, Int128, Int16, Int32, Int64, Int8};
use snarkos_errors::gadgets::SynthesisError;
diff --git a/gadgets/src/signed_integer/relational/mod.rs b/gadgets/src/signed_integer/relational/mod.rs
index 977eaccd49..b88c46fc2f 100644
--- a/gadgets/src/signed_integer/relational/mod.rs
+++ b/gadgets/src/signed_integer/relational/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
pub mod eq;
pub use self::eq::*;
diff --git a/gadgets/src/signed_integer/utilities/alloc.rs b/gadgets/src/signed_integer/utilities/alloc.rs
index 6958fd58b0..442abd7b6e 100644
--- a/gadgets/src/signed_integer/utilities/alloc.rs
+++ b/gadgets/src/signed_integer/utilities/alloc.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Int, Int128, Int16, Int32, Int64, Int8};
use core::borrow::Borrow;
diff --git a/gadgets/src/signed_integer/utilities/eq.rs b/gadgets/src/signed_integer/utilities/eq.rs
index 594c495788..9a854819c5 100644
--- a/gadgets/src/signed_integer/utilities/eq.rs
+++ b/gadgets/src/signed_integer/utilities/eq.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::signed_integer::*;
use snarkos_errors::gadgets::SynthesisError;
diff --git a/gadgets/src/signed_integer/utilities/mod.rs b/gadgets/src/signed_integer/utilities/mod.rs
index 8bc79c27f7..4bdf1730db 100644
--- a/gadgets/src/signed_integer/utilities/mod.rs
+++ b/gadgets/src/signed_integer/utilities/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
pub mod alloc;
pub use self::alloc::*;
diff --git a/gadgets/src/signed_integer/utilities/select.rs b/gadgets/src/signed_integer/utilities/select.rs
index de93156fbb..81d36531fb 100644
--- a/gadgets/src/signed_integer/utilities/select.rs
+++ b/gadgets/src/signed_integer/utilities/select.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::signed_integer::*;
use snarkos_errors::gadgets::SynthesisError;
diff --git a/gadgets/tests/mod.rs b/gadgets/tests/mod.rs
index 3a4d43aad7..0b8e578304 100644
--- a/gadgets/tests/mod.rs
+++ b/gadgets/tests/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod signed_integer;
pub use self::signed_integer::*;
diff --git a/gadgets/tests/signed_integer/i128.rs b/gadgets/tests/signed_integer/i128.rs
index ce1a7bd74e..4ab475567f 100644
--- a/gadgets/tests/signed_integer/i128.rs
+++ b/gadgets/tests/signed_integer/i128.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_gadgets::{arithmetic::*, Int128};
use snarkos_models::{
diff --git a/gadgets/tests/signed_integer/i16.rs b/gadgets/tests/signed_integer/i16.rs
index ea4c917d7d..f628c2aae8 100644
--- a/gadgets/tests/signed_integer/i16.rs
+++ b/gadgets/tests/signed_integer/i16.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_gadgets::{arithmetic::*, Int16};
use snarkos_models::{
diff --git a/gadgets/tests/signed_integer/i32.rs b/gadgets/tests/signed_integer/i32.rs
index 2bd9d93702..ec5570009e 100644
--- a/gadgets/tests/signed_integer/i32.rs
+++ b/gadgets/tests/signed_integer/i32.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_gadgets::{arithmetic::*, Int32};
use snarkos_models::{
diff --git a/gadgets/tests/signed_integer/i64.rs b/gadgets/tests/signed_integer/i64.rs
index 7a6a0d9811..8ce9141a01 100644
--- a/gadgets/tests/signed_integer/i64.rs
+++ b/gadgets/tests/signed_integer/i64.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_gadgets::{arithmetic::*, Int64};
use snarkos_models::{
diff --git a/gadgets/tests/signed_integer/i8.rs b/gadgets/tests/signed_integer/i8.rs
index 4158d146d3..1d8af1b154 100644
--- a/gadgets/tests/signed_integer/i8.rs
+++ b/gadgets/tests/signed_integer/i8.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_gadgets::{arithmetic::*, Int8};
use snarkos_models::{
diff --git a/gadgets/tests/signed_integer/mod.rs b/gadgets/tests/signed_integer/mod.rs
index 7b46643728..67bf1c0b4b 100644
--- a/gadgets/tests/signed_integer/mod.rs
+++ b/gadgets/tests/signed_integer/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod i128;
pub mod i16;
pub mod i32;
diff --git a/input/src/ast.rs b/input/src/ast.rs
index 56d279cf6d..26be6946f9 100644
--- a/input/src/ast.rs
+++ b/input/src/ast.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! Abstract syntax tree (ast) representation from leo-input.pest.
use pest::{error::Error, iterators::Pairs, Parser, Span};
diff --git a/input/src/common/eoi.rs b/input/src/common/eoi.rs
index 1293320f1a..615d0fd49f 100644
--- a/input/src/common/eoi.rs
+++ b/input/src/common/eoi.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/input/src/common/identifier.rs b/input/src/common/identifier.rs
index 35c74e30be..226e7fd9c7 100644
--- a/input/src/common/identifier.rs
+++ b/input/src/common/identifier.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::{span_into_string, Rule};
use pest::Span;
diff --git a/input/src/common/line_end.rs b/input/src/common/line_end.rs
index ee34060bd6..45c4f29e99 100644
--- a/input/src/common/line_end.rs
+++ b/input/src/common/line_end.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/input/src/common/mod.rs b/input/src/common/mod.rs
index b284ece1f8..feca4d8fe4 100644
--- a/input/src/common/mod.rs
+++ b/input/src/common/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod eoi;
pub use eoi::*;
diff --git a/input/src/definitions/definition.rs b/input/src/definitions/definition.rs
index 7f33591ba9..72a1bfb7d2 100644
--- a/input/src/definitions/definition.rs
+++ b/input/src/definitions/definition.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::LineEnd, expressions::Expression, parameters::Parameter};
use pest::Span;
diff --git a/input/src/definitions/mod.rs b/input/src/definitions/mod.rs
index c4cce58786..8e4bb3d9ce 100644
--- a/input/src/definitions/mod.rs
+++ b/input/src/definitions/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod definition;
pub use definition::*;
diff --git a/input/src/errors/mod.rs b/input/src/errors/mod.rs
index 9d9164fa35..c60030f31f 100644
--- a/input/src/errors/mod.rs
+++ b/input/src/errors/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod parser;
pub use parser::*;
diff --git a/input/src/errors/parser.rs b/input/src/errors/parser.rs
index d5ae505ae8..654bb8cee9 100644
--- a/input/src/errors/parser.rs
+++ b/input/src/errors/parser.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
errors::SyntaxError as InputSyntaxError,
diff --git a/input/src/errors/syntax.rs b/input/src/errors/syntax.rs
index 4bca70f5f6..ffcb97723c 100644
--- a/input/src/errors/syntax.rs
+++ b/input/src/errors/syntax.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest::error::Error;
diff --git a/input/src/expressions/array_initializer_expression.rs b/input/src/expressions/array_initializer_expression.rs
index 392afd1b49..b8ba714780 100644
--- a/input/src/expressions/array_initializer_expression.rs
+++ b/input/src/expressions/array_initializer_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::Expression, values::PositiveNumber};
use pest::Span;
diff --git a/input/src/expressions/array_inline_expression.rs b/input/src/expressions/array_inline_expression.rs
index bb25e12721..daec4d1694 100644
--- a/input/src/expressions/array_inline_expression.rs
+++ b/input/src/expressions/array_inline_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::Expression};
use pest::Span;
diff --git a/input/src/expressions/expression.rs b/input/src/expressions/expression.rs
index 798c70fec9..e533ffc93c 100644
--- a/input/src/expressions/expression.rs
+++ b/input/src/expressions/expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::*, values::Value};
use pest::Span;
diff --git a/input/src/expressions/mod.rs b/input/src/expressions/mod.rs
index aa2a7723fe..1caedd92a3 100644
--- a/input/src/expressions/mod.rs
+++ b/input/src/expressions/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod array_initializer_expression;
pub use array_initializer_expression::*;
diff --git a/input/src/expressions/tuple_expression.rs b/input/src/expressions/tuple_expression.rs
index 04ae9f0d82..7de1345d69 100644
--- a/input/src/expressions/tuple_expression.rs
+++ b/input/src/expressions/tuple_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, expressions::Expression};
use pest::Span;
diff --git a/input/src/files/file.rs b/input/src/files/file.rs
index 8d2fdfa3bc..7032da4aa9 100644
--- a/input/src/files/file.rs
+++ b/input/src/files/file.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::EOI, files::TableOrSection};
use pest::Span;
diff --git a/input/src/files/mod.rs b/input/src/files/mod.rs
index 1638d8b176..5c80e428e0 100644
--- a/input/src/files/mod.rs
+++ b/input/src/files/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod file;
pub use file::*;
diff --git a/input/src/files/table_or_section.rs b/input/src/files/table_or_section.rs
index 071fa3e790..1c24b8fedf 100644
--- a/input/src/files/table_or_section.rs
+++ b/input/src/files/table_or_section.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, sections::Section, tables::Table};
use pest_ast::FromPest;
diff --git a/input/src/leo-input.pest b/input/src/leo-input.pest
index 2c9469317e..5e4b967d80 100644
--- a/input/src/leo-input.pest
+++ b/input/src/leo-input.pest
@@ -131,7 +131,8 @@ value_boolean = { "true" | "false" }
value_field = ${ value_number ~ type_field }
// Declared in values/group_value.rs
-value_group = ${ group_tuple ~ type_group }
+value_group = ${ group_single_or_tuple ~ type_group }
+group_single_or_tuple = {value_number | group_tuple}
group_tuple = !{"(" ~ group_coordinate ~ "," ~ group_coordinate ~ ")"}
// Declared in values/group_coordinate.rs
diff --git a/input/src/lib.rs b/input/src/lib.rs
index 1deab65147..827f97c239 100644
--- a/input/src/lib.rs
+++ b/input/src/lib.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
extern crate pest_derive;
#[macro_use]
diff --git a/input/src/parameters/mod.rs b/input/src/parameters/mod.rs
index cf55dbc6dd..c1ae3fad35 100644
--- a/input/src/parameters/mod.rs
+++ b/input/src/parameters/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod parameter;
pub use parameter::*;
diff --git a/input/src/parameters/parameter.rs b/input/src/parameters/parameter.rs
index 5b7be8046c..b04fe2e57c 100644
--- a/input/src/parameters/parameter.rs
+++ b/input/src/parameters/parameter.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, common::Identifier, types::Type};
use pest::Span;
diff --git a/input/src/sections/header.rs b/input/src/sections/header.rs
index d5aa339251..c374691f2d 100644
--- a/input/src/sections/header.rs
+++ b/input/src/sections/header.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
common::Identifier,
diff --git a/input/src/sections/main_.rs b/input/src/sections/main_.rs
index 9f52418153..af2400b2d8 100644
--- a/input/src/sections/main_.rs
+++ b/input/src/sections/main_.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest::Span;
diff --git a/input/src/sections/mod.rs b/input/src/sections/mod.rs
index 8fd04e6ba3..f9dbbc8913 100644
--- a/input/src/sections/mod.rs
+++ b/input/src/sections/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod header;
pub use header::*;
diff --git a/input/src/sections/record.rs b/input/src/sections/record.rs
index 2f67290130..e742061136 100644
--- a/input/src/sections/record.rs
+++ b/input/src/sections/record.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest::Span;
diff --git a/input/src/sections/registers.rs b/input/src/sections/registers.rs
index 8e11fde122..15a923b387 100644
--- a/input/src/sections/registers.rs
+++ b/input/src/sections/registers.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest::Span;
diff --git a/input/src/sections/section.rs b/input/src/sections/section.rs
index 0e43dd9778..d91089cca4 100644
--- a/input/src/sections/section.rs
+++ b/input/src/sections/section.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, definitions::Definition, sections::Header};
use pest::Span;
diff --git a/input/src/sections/state.rs b/input/src/sections/state.rs
index 8063e4f8a9..c3dc5313c8 100644
--- a/input/src/sections/state.rs
+++ b/input/src/sections/state.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest::Span;
diff --git a/input/src/sections/state_leaf.rs b/input/src/sections/state_leaf.rs
index 932203f24c..4ad6c2aa3e 100644
--- a/input/src/sections/state_leaf.rs
+++ b/input/src/sections/state_leaf.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest::Span;
diff --git a/input/src/tables/mod.rs b/input/src/tables/mod.rs
index 089015621f..d2b77b3f3c 100644
--- a/input/src/tables/mod.rs
+++ b/input/src/tables/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod private;
pub use private::*;
diff --git a/input/src/tables/private.rs b/input/src/tables/private.rs
index 1c1c86d44b..34593f5ce5 100644
--- a/input/src/tables/private.rs
+++ b/input/src/tables/private.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest::Span;
diff --git a/input/src/tables/public.rs b/input/src/tables/public.rs
index a16e567914..dc675e7ec7 100644
--- a/input/src/tables/public.rs
+++ b/input/src/tables/public.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest::Span;
diff --git a/input/src/tables/table.rs b/input/src/tables/table.rs
index e115c237ea..1aa3863aa7 100644
--- a/input/src/tables/table.rs
+++ b/input/src/tables/table.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, sections::Section, tables::Visibility};
use pest::Span;
diff --git a/input/src/tables/visibility.rs b/input/src/tables/visibility.rs
index af2c93e2e4..dd8e7ef928 100644
--- a/input/src/tables/visibility.rs
+++ b/input/src/tables/visibility.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
tables::{Private, Public},
diff --git a/input/src/types/address_type.rs b/input/src/types/address_type.rs
index badbf38c10..d45fe1fe3e 100644
--- a/input/src/types/address_type.rs
+++ b/input/src/types/address_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/input/src/types/array_type.rs b/input/src/types/array_type.rs
index bf621ebd02..872656c3fc 100644
--- a/input/src/types/array_type.rs
+++ b/input/src/types/array_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::DataType, values::PositiveNumber};
use pest::Span;
diff --git a/input/src/types/boolean_type.rs b/input/src/types/boolean_type.rs
index ce338e0447..0799f41acc 100644
--- a/input/src/types/boolean_type.rs
+++ b/input/src/types/boolean_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/input/src/types/data_type.rs b/input/src/types/data_type.rs
index d2694934e8..cfb96d5b6b 100644
--- a/input/src/types/data_type.rs
+++ b/input/src/types/data_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
types::{BooleanType, FieldType, GroupType, IntegerType},
diff --git a/input/src/types/field_type.rs b/input/src/types/field_type.rs
index 17fc1082ff..52bb665e79 100644
--- a/input/src/types/field_type.rs
+++ b/input/src/types/field_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/input/src/types/group_type.rs b/input/src/types/group_type.rs
index 6ffe8956fb..e73432a4b6 100644
--- a/input/src/types/group_type.rs
+++ b/input/src/types/group_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/input/src/types/integer_type.rs b/input/src/types/integer_type.rs
index 75ffdd2a62..876b1405ec 100644
--- a/input/src/types/integer_type.rs
+++ b/input/src/types/integer_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
types::{SignedIntegerType, UnsignedIntegerType},
diff --git a/input/src/types/mod.rs b/input/src/types/mod.rs
index 6a247be42b..4f6332590e 100644
--- a/input/src/types/mod.rs
+++ b/input/src/types/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod address_type;
pub use address_type::*;
diff --git a/input/src/types/signed_integer_type.rs b/input/src/types/signed_integer_type.rs
index 03d6f36038..9273586fd7 100644
--- a/input/src/types/signed_integer_type.rs
+++ b/input/src/types/signed_integer_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/input/src/types/tuple_type.rs b/input/src/types/tuple_type.rs
index 6daad6cb1e..feca7e830a 100644
--- a/input/src/types/tuple_type.rs
+++ b/input/src/types/tuple_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::Type};
use pest::Span;
diff --git a/input/src/types/type_.rs b/input/src/types/type_.rs
index d7ea2779e0..691d178f03 100644
--- a/input/src/types/type_.rs
+++ b/input/src/types/type_.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::*};
use pest_ast::FromPest;
diff --git a/input/src/types/unsigned_integer_type.rs b/input/src/types/unsigned_integer_type.rs
index b50e1ff88e..1860b4a85b 100644
--- a/input/src/types/unsigned_integer_type.rs
+++ b/input/src/types/unsigned_integer_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::Rule;
use pest_ast::FromPest;
diff --git a/input/src/values/address.rs b/input/src/values/address.rs
index 9e981b31b0..78b56ea02f 100644
--- a/input/src/values/address.rs
+++ b/input/src/values/address.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::{span_into_string, Rule};
use pest::Span;
diff --git a/input/src/values/address_typed.rs b/input/src/values/address_typed.rs
index cbfb4b5100..ed987e10d9 100644
--- a/input/src/values/address_typed.rs
+++ b/input/src/values/address_typed.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::AddressType, values::address::Address};
use pest::Span;
diff --git a/input/src/values/address_value.rs b/input/src/values/address_value.rs
index 05a3645945..694173d97f 100644
--- a/input/src/values/address_value.rs
+++ b/input/src/values/address_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
values::{Address, AddressTyped},
diff --git a/input/src/values/boolean_value.rs b/input/src/values/boolean_value.rs
index 4ca294b8c7..8a0b3d1a7d 100644
--- a/input/src/values/boolean_value.rs
+++ b/input/src/values/boolean_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::{span_into_string, Rule};
use pest::Span;
diff --git a/input/src/values/field_value.rs b/input/src/values/field_value.rs
index a8f6b39337..6e0ecd6f48 100644
--- a/input/src/values/field_value.rs
+++ b/input/src/values/field_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::FieldType, values::NumberValue};
use pest::Span;
diff --git a/input/src/values/group_coordinate.rs b/input/src/values/group_coordinate.rs
index 1592ad9fd8..b021547e11 100644
--- a/input/src/values/group_coordinate.rs
+++ b/input/src/values/group_coordinate.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, values::NumberValue};
use pest::Span;
diff --git a/input/src/values/group_value.rs b/input/src/values/group_value.rs
index c37de3ffd5..bd8ee5a625 100644
--- a/input/src/values/group_value.rs
+++ b/input/src/values/group_value.rs
@@ -1,4 +1,24 @@
-use crate::{ast::Rule, types::GroupType, values::GroupCoordinate};
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{
+ ast::Rule,
+ types::GroupType,
+ values::{GroupCoordinate, NumberValue},
+};
use pest::Span;
use pest_ast::FromPest;
@@ -7,7 +27,7 @@ use std::fmt;
#[derive(Clone, Debug, FromPest, PartialEq, Eq)]
#[pest_ast(rule(Rule::value_group))]
pub struct GroupValue<'ast> {
- pub value: GroupTuple<'ast>,
+ pub value: GroupRepresentation<'ast>,
pub type_: GroupType,
#[pest_ast(outer())]
pub span: Span<'ast>,
@@ -19,6 +39,22 @@ impl<'ast> fmt::Display for GroupValue<'ast> {
}
}
+#[derive(Clone, Debug, FromPest, PartialEq, Eq)]
+#[pest_ast(rule(Rule::group_single_or_tuple))]
+pub enum GroupRepresentation<'ast> {
+ Single(NumberValue<'ast>),
+ Tuple(GroupTuple<'ast>),
+}
+
+impl<'ast> fmt::Display for GroupRepresentation<'ast> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match self {
+ GroupRepresentation::Single(number) => write!(f, "{}", number),
+ GroupRepresentation::Tuple(tuple) => write!(f, "{}", tuple),
+ }
+ }
+}
+
#[derive(Clone, Debug, FromPest, PartialEq, Eq)]
#[pest_ast(rule(Rule::group_tuple))]
pub struct GroupTuple<'ast> {
diff --git a/input/src/values/integer_value.rs b/input/src/values/integer_value.rs
index 08ff98e8b3..3a81dad4fd 100644
--- a/input/src/values/integer_value.rs
+++ b/input/src/values/integer_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
values::{SignedIntegerValue, UnsignedIntegerValue},
diff --git a/input/src/values/mod.rs b/input/src/values/mod.rs
index f8ded05f4e..74bc4e00d5 100644
--- a/input/src/values/mod.rs
+++ b/input/src/values/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod address;
pub use address::*;
diff --git a/input/src/values/negative_number.rs b/input/src/values/negative_number.rs
index 98d51c40a6..9d87d258f8 100644
--- a/input/src/values/negative_number.rs
+++ b/input/src/values/negative_number.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::{span_into_string, Rule};
use pest::Span;
diff --git a/input/src/values/number_value.rs b/input/src/values/number_value.rs
index 89438c0471..b498bc5606 100644
--- a/input/src/values/number_value.rs
+++ b/input/src/values/number_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
values::{NegativeNumber, PositiveNumber},
diff --git a/input/src/values/positive_number.rs b/input/src/values/positive_number.rs
index e104eccc83..7477049cce 100644
--- a/input/src/values/positive_number.rs
+++ b/input/src/values/positive_number.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::ast::{span_into_string, Rule};
use pest::Span;
diff --git a/input/src/values/signed_integer_value.rs b/input/src/values/signed_integer_value.rs
index ffa5c3bc7d..298b6d1c6b 100644
--- a/input/src/values/signed_integer_value.rs
+++ b/input/src/values/signed_integer_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::SignedIntegerType, values::NumberValue};
use pest::Span;
diff --git a/input/src/values/unsigned_integer_value.rs b/input/src/values/unsigned_integer_value.rs
index 170ca087e6..50ff67ca9f 100644
--- a/input/src/values/unsigned_integer_value.rs
+++ b/input/src/values/unsigned_integer_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ast::Rule, types::UnsignedIntegerType, values::PositiveNumber};
use pest::Span;
diff --git a/input/src/values/value.rs b/input/src/values/value.rs
index 482867305d..a46886ac12 100644
--- a/input/src/values/value.rs
+++ b/input/src/values/value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
ast::Rule,
values::{BooleanValue, FieldValue, GroupValue, IntegerValue, NumberValue},
diff --git a/leo/cli.rs b/leo/cli.rs
index 0966689948..42f9b4683b 100644
--- a/leo/cli.rs
+++ b/leo/cli.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{cli_types::*, errors::CLIError, logger};
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
diff --git a/leo/cli_types.rs b/leo/cli_types.rs
index f5a22a6d2e..da7521e8d8 100644
--- a/leo/cli_types.rs
+++ b/leo/cli_types.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use clap::AppSettings;
pub type NameType = &'static str;
diff --git a/leo/commands/add.rs b/leo/commands/add.rs
index 7a2ef9a4e8..d6adc0a461 100644
--- a/leo/commands/add.rs
+++ b/leo/commands/add.rs
@@ -1,57 +1,162 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+//
+// Usage:
+//
+// leo add -a author -p package_name -v version
+// leo add -a author -p package_name
+//
+
use crate::{
- cli::*,
+ cli::CLI,
cli_types::*,
- commands::BuildCommand,
- errors::{CLIError, RunError},
+ credentials::*,
+ errors::{AddError::*, CLIError::AddError},
};
use leo_package::{
+ imports::{ImportsDirectory, IMPORTS_DIRECTORY_NAME},
root::Manifest,
- source::{MAIN_FILE_NAME, SOURCE_DIRECTORY_NAME},
};
-use clap::ArgMatches;
-use std::{convert::TryFrom, env::current_dir};
+use std::{
+ collections::HashMap,
+ convert::TryFrom,
+ env::current_dir,
+ fs::{create_dir_all, File},
+ io::{Read, Write},
+};
+
+pub const ADD_URL: &str = "api/package/fetch";
#[derive(Debug)]
pub struct AddCommand;
impl CLI for AddCommand {
- type Options = ();
+ // Format: author, package_name, version
+ type Options = (Option, Option, Option);
type Output = ();
- const ABOUT: AboutType = "Install a package from the package manager (*)";
+ const ABOUT: AboutType = "Install a package from the package manager";
const ARGUMENTS: &'static [ArgumentType] = &[];
const FLAGS: &'static [FlagType] = &[];
const NAME: NameType = "add";
- const OPTIONS: &'static [OptionType] = &[];
+ const OPTIONS: &'static [OptionType] = &[
+ // (argument, conflicts, possible_values, requires)
+ ("[author] -a --author= 'Specify a package author'", &[], &[], &[
+ "package_name",
+ ]),
+ (
+ "[package_name] -p --package_name= 'Specify a package name'",
+ &[],
+ &[],
+ &["author"],
+ ),
+ (
+ "[version] -v --version=[version] 'Specify a package version'",
+ &[],
+ &[],
+ &["author", "package_name"],
+ ),
+ ];
const SUBCOMMANDS: &'static [SubCommandType] = &[];
- #[cfg_attr(tarpaulin, skip)]
- fn parse(_arguments: &ArgMatches) -> Result {
- Ok(())
- }
-
- #[cfg_attr(tarpaulin, skip)]
- fn output(options: Self::Options) -> Result {
- let path = current_dir()?;
- match BuildCommand::output(options)? {
- Some((_program, _checksum_differs)) => {
- // Get the package name
- let _package_name = Manifest::try_from(&path)?.get_package_name();
-
- log::info!("Unimplemented - `leo add`");
-
- Ok(())
- }
- None => {
- let mut main_file_path = path.clone();
- main_file_path.push(SOURCE_DIRECTORY_NAME);
- main_file_path.push(MAIN_FILE_NAME);
-
- Err(CLIError::RunError(RunError::MainFileDoesNotExist(
- main_file_path.into_os_string(),
- )))
- }
+ fn parse(arguments: &clap::ArgMatches) -> Result {
+ // TODO update to new package manager API without an author field
+ if arguments.is_present("author") && arguments.is_present("package_name") {
+ return Ok((
+ arguments.value_of("author").map(|s| s.to_string()),
+ arguments.value_of("package_name").map(|s| s.to_string()),
+ arguments.value_of("version").map(|s| s.to_string()),
+ ));
+ } else {
+ return Ok((None, None, None));
}
}
+
+ fn output(options: Self::Options) -> Result {
+ let token = read_token()?;
+
+ let path = current_dir()?;
+ // Enforce that the current directory is a leo package
+ Manifest::try_from(&path)?;
+
+ let (response, package_name) = match options {
+ (Some(author), Some(package_name), version) => {
+ let client = reqwest::blocking::Client::new();
+ let url = format!("{}{}", PACKAGE_MANAGER_URL, ADD_URL);
+
+ let mut json = HashMap::new();
+ json.insert("author", author);
+ json.insert("package_name", package_name.clone());
+
+ if let Some(version) = version {
+ json.insert("version", version);
+ }
+
+ match client.post(&url).bearer_auth(token).json(&json).send() {
+ Ok(response) => (response, package_name),
+ //Cannot connect to the server
+ Err(_error) => {
+ return Err(AddError(ConnectionUnavailable(
+ "Could not connect to the package manager".into(),
+ )));
+ }
+ }
+ }
+ _ => return Err(AddError(MissingAuthorOrPackageName)),
+ };
+
+ let mut path = current_dir()?;
+ ImportsDirectory::create(&path)?;
+ path.push(IMPORTS_DIRECTORY_NAME);
+ path.push(package_name);
+ create_dir_all(&path)?;
+
+ let bytes = response.bytes()?;
+ let reader = std::io::Cursor::new(bytes);
+
+ let mut zip_arhive = match zip::ZipArchive::new(reader) {
+ Ok(zip) => zip,
+ Err(error) => return Err(AddError(ZipError(error.to_string().into()))),
+ };
+
+ for i in 0..zip_arhive.len() {
+ let file = match zip_arhive.by_index(i) {
+ Ok(file) => file,
+ Err(error) => return Err(AddError(ZipError(error.to_string().into()))),
+ };
+
+ let file_name = file.name();
+
+ let mut file_path = path.clone();
+ file_path.push(file_name);
+
+ if file_name.ends_with("/") {
+ create_dir_all(file_path)?;
+ } else {
+ if let Some(parent_directory) = path.parent() {
+ create_dir_all(parent_directory)?;
+ }
+
+ File::create(file_path)?.write_all(&file.bytes().map(|e| e.unwrap()).collect::>())?;
+ }
+ }
+
+ log::info!("Successfully added a package");
+ Ok(())
+ }
}
diff --git a/leo/commands/build.rs b/leo/commands/build.rs
index a0ff73bd38..e557563b52 100644
--- a/leo/commands/build.rs
+++ b/leo/commands/build.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
cli::*,
cli_types::*,
diff --git a/leo/commands/clean.rs b/leo/commands/clean.rs
index 990db1ad3a..4722993965 100644
--- a/leo/commands/clean.rs
+++ b/leo/commands/clean.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{cli::*, cli_types::*, errors::CLIError};
use leo_package::{
outputs::{ChecksumFile, ProofFile, ProvingKeyFile, VerificationKeyFile},
diff --git a/leo/commands/deploy.rs b/leo/commands/deploy.rs
index 9c051bf609..1522590ec2 100644
--- a/leo/commands/deploy.rs
+++ b/leo/commands/deploy.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
cli::*,
cli_types::*,
diff --git a/leo/commands/init.rs b/leo/commands/init.rs
index edd5081119..92086bba40 100644
--- a/leo/commands/init.rs
+++ b/leo/commands/init.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
cli::*,
cli_types::*,
@@ -5,7 +21,7 @@ use crate::{
};
use leo_package::{
inputs::*,
- root::{Gitignore, Manifest},
+ root::{Gitignore, Manifest, README},
source::{LibFile, MainFile, SourceDirectory},
};
@@ -58,6 +74,9 @@ impl CLI for InitCommand {
// Create the .gitignore file
Gitignore::new().write_to(&path)?;
+ // Create the README.md file
+ README::new(&package_name).write_to(&path)?;
+
// Create the source directory
SourceDirectory::create(&path)?;
diff --git a/leo/commands/lint.rs b/leo/commands/lint.rs
index 971281be45..f055bdd0cb 100644
--- a/leo/commands/lint.rs
+++ b/leo/commands/lint.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
cli::*,
cli_types::*,
diff --git a/leo/commands/login.rs b/leo/commands/login.rs
index ec19137e07..396334b27a 100644
--- a/leo/commands/login.rs
+++ b/leo/commands/login.rs
@@ -1,49 +1,43 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//
// Usage:
//
// leo login
// leo login -u username -p password
-// leo login // not yet implemented
//
-use crate::{cli::CLI, cli_types::*, errors::LoginError};
-use lazy_static::lazy_static;
-use std::{
- collections::HashMap,
- fs::{create_dir, File},
- io,
- io::prelude::*,
- path::Path,
+use crate::{
+ cli::CLI,
+ cli_types::*,
+ credentials::*,
+ errors::{
+ CLIError::LoginError,
+ LoginError::{CannotGetToken, NoConnectionFound, NoCredentialsProvided, WrongLoginOrPassword},
+ },
};
-const PACKAGE_MANAGER_URL: &str = "https://apm-backend-dev.herokuapp.com/";
-const LOGIN_URL: &str = "api/account/login";
+use std::collections::HashMap;
-const LEO_CREDENTIALS_DIR: &str = ".leo";
-const LEO_CREDENTIALS_FILE: &str = "credentials";
-
-lazy_static! {
- static ref LEO_CREDENTIALS_PATH: String = format!("{}/{}", LEO_CREDENTIALS_DIR, LEO_CREDENTIALS_FILE);
-}
+pub const LOGIN_URL: &str = "api/account/authenticate";
#[derive(Debug)]
pub struct LoginCommand;
-impl LoginCommand {
- fn write_token(token: &str) -> Result<(), io::Error> {
- let mut credentials = File::create(LEO_CREDENTIALS_PATH.as_str())?;
- credentials.write_all(&token.as_bytes())?;
- Ok(())
- }
-
- pub fn read_token() -> Result {
- let mut credentials = File::open(LEO_CREDENTIALS_PATH.as_str())?;
- let mut buf = String::new();
- credentials.read_to_string(&mut buf)?;
- Ok(buf)
- }
-}
-
impl CLI for LoginCommand {
// Format: token, username, password
type Options = (Option, Option, Option);
@@ -79,10 +73,7 @@ impl CLI for LoginCommand {
match arguments.value_of("NAME") {
Some(name) => Ok((Some(name.to_string()), None, None)),
- None => {
- // TODO implement JWT
- Ok((None, None, None))
- }
+ None => Ok((None, None, None)),
}
}
@@ -105,40 +96,33 @@ impl CLI for LoginCommand {
Ok(json) => json,
Err(_error) => {
log::error!("Wrong login or password");
- return Err(LoginError::WrongLoginOrPassword("Wrong login or password".into()).into());
+ return Err(WrongLoginOrPassword("Wrong login or password".into()).into());
}
},
//Cannot connect to the server
Err(_error) => {
- return Err(
- LoginError::NoConnectionFound("Could not connect to the package manager".into()).into(),
- );
+ return Err(LoginError(NoConnectionFound(
+ "Could not connect to the package manager".into(),
+ )));
}
};
match response.get("token") {
Some(token) => Some(token.clone()),
None => {
- return Err(LoginError::CannotGetToken("No token was provided in the response".into()).into());
+ return Err(CannotGetToken("No token was provided in the response".into()).into());
}
}
}
- // Login using JWT
- (_, _, _) => {
- // TODO JWT
- None
- }
+ // Login using stored JWT credentials.
+ // TODO (raychu86) Package manager re-authentication from token
+ (_, _, _) => Some(read_token()?),
};
match token {
Some(token) => {
- // Create Leo credentials directory if it not exists
- if !Path::new(LEO_CREDENTIALS_DIR).exists() {
- create_dir(LEO_CREDENTIALS_DIR)?;
- }
-
- LoginCommand::write_token(token.as_str())?;
+ write_token(token.as_str())?;
log::info!("Login successful.");
@@ -147,7 +131,7 @@ impl CLI for LoginCommand {
_ => {
log::error!("Failed to login. Please run `leo login -h` for help.");
- Err(LoginError::NoCredentialsProvided.into())
+ Err(NoCredentialsProvided.into())
}
}
}
diff --git a/leo/commands/mod.rs b/leo/commands/mod.rs
index 2a3e109f8a..b5c14e8b99 100644
--- a/leo/commands/mod.rs
+++ b/leo/commands/mod.rs
@@ -1,3 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+pub mod add;
+pub use self::add::*;
+
pub mod build;
pub use self::build::*;
@@ -13,9 +32,6 @@ pub use self::init::*;
pub mod lint;
pub use self::lint::*;
-pub mod add;
-pub use self::add::*;
-
pub mod login;
pub use self::login::*;
diff --git a/leo/commands/new.rs b/leo/commands/new.rs
index ffaa725b15..6880e85eb3 100644
--- a/leo/commands/new.rs
+++ b/leo/commands/new.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
cli::*,
cli_types::*,
diff --git a/leo/commands/prove.rs b/leo/commands/prove.rs
index 2ffd75beec..eebb39347e 100644
--- a/leo/commands/prove.rs
+++ b/leo/commands/prove.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{cli::*, cli_types::*, commands::SetupCommand, errors::CLIError};
use leo_package::{outputs::ProofFile, root::Manifest};
diff --git a/leo/commands/publish.rs b/leo/commands/publish.rs
index ec3925f942..7f7c50e82e 100644
--- a/leo/commands/publish.rs
+++ b/leo/commands/publish.rs
@@ -1,11 +1,29 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
cli::*,
cli_types::*,
- commands::LoginCommand,
+ commands::{BuildCommand, LoginCommand},
+ credentials::{read_token, PACKAGE_MANAGER_URL},
errors::{
commands::PublishError::{ConnectionUnavalaible, PackageNotPublished},
CLIError,
CLIError::PublishError,
+ PublishError::{MissingPackageDescription, MissingPackageLicense, MissingPackageRemote},
},
};
use leo_package::{
@@ -21,13 +39,11 @@ use reqwest::{
use serde::Deserialize;
use std::{convert::TryFrom, env::current_dir};
-const PACKAGE_MANAGER_URL: &str = "https://apm-backend-dev.herokuapp.com/";
const PUBLISH_URL: &str = "api/package/publish";
#[derive(Deserialize)]
struct ResponseJson {
package_id: String,
- _success: bool,
}
#[derive(Debug)]
@@ -52,12 +68,27 @@ impl CLI for PublishCommand {
#[cfg_attr(tarpaulin, skip)]
fn output(_options: Self::Options) -> Result {
// Build all program files.
- // let _output = BuildCommand::output(options)?;
+ let _output = BuildCommand::output(())?;
- // Get the package name
+ // Get the package manifest
let path = current_dir()?;
- let package_name = Manifest::try_from(&path)?.get_package_name();
- let package_version = Manifest::try_from(&path)?.get_package_version();
+ let package_manifest = Manifest::try_from(&path)?;
+
+ let package_name = package_manifest.get_package_name();
+ let package_version = package_manifest.get_package_version();
+
+ if package_manifest.get_package_description().is_none() {
+ return Err(PublishError(MissingPackageDescription));
+ }
+
+ if package_manifest.get_package_license().is_none() {
+ return Err(PublishError(MissingPackageLicense));
+ }
+
+ let package_remote = match package_manifest.get_package_remote() {
+ Some(remote) => remote,
+ None => return Err(PublishError(MissingPackageRemote)),
+ };
// Create the output directory
OutputsDirectory::create(&path)?;
@@ -68,12 +99,13 @@ impl CLI for PublishCommand {
log::debug!("Existing package zip file found. Clearing it to regenerate.");
// Remove the existing package zip file
ZipFile::new(&package_name).remove(&path)?;
- } else {
- zip_file.write(&path)?;
}
+ zip_file.write(&path)?;
+
let form_data = Form::new()
.text("name", package_name)
+ .text("remote", package_remote)
.text("version", package_version)
.file("file", zip_file.get_file_path(&path))?;
@@ -81,12 +113,12 @@ impl CLI for PublishCommand {
let client = Client::new();
// Get token to make an authorized request
- let token = match LoginCommand::read_token() {
+ let token = match read_token() {
Ok(token) => token,
// If not logged in, then try logging in using JWT.
Err(_error) => {
- log::warn!("You should be logged before publish the package");
+ log::warn!("You should be logged in before attempting to publish a package");
log::info!("Trying to log in using JWT...");
let options = (None, None, None);
@@ -123,7 +155,7 @@ impl CLI for PublishCommand {
}
};
- log::info!("Package published successfully");
+ log::info!("Package published successfully with id: {}", result.package_id);
Ok(Some(result.package_id))
}
}
diff --git a/leo/commands/remove.rs b/leo/commands/remove.rs
index 9ae66b64f1..7abdbbbaa3 100644
--- a/leo/commands/remove.rs
+++ b/leo/commands/remove.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
cli::*,
cli_types::*,
diff --git a/leo/commands/run.rs b/leo/commands/run.rs
index c0fbb5977a..a3931d77b2 100644
--- a/leo/commands/run.rs
+++ b/leo/commands/run.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{cli::*, cli_types::*, commands::ProveCommand, errors::CLIError};
use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType};
diff --git a/leo/commands/setup.rs b/leo/commands/setup.rs
index 0de60a0d7a..634374f7b2 100644
--- a/leo/commands/setup.rs
+++ b/leo/commands/setup.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
cli::*,
cli_types::*,
diff --git a/leo/commands/test.rs b/leo/commands/test.rs
index ec998675b2..1b8e9a5168 100644
--- a/leo/commands/test.rs
+++ b/leo/commands/test.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
cli::*,
cli_types::*,
diff --git a/leo/commands/watch.rs b/leo/commands/watch.rs
index dfb079bf87..f4c07e298d 100644
--- a/leo/commands/watch.rs
+++ b/leo/commands/watch.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{cli::CLI, cli_types::*, commands::BuildCommand, errors::CLIError};
use clap::ArgMatches;
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
diff --git a/leo/credentials.rs b/leo/credentials.rs
new file mode 100644
index 0000000000..e9d59faece
--- /dev/null
+++ b/leo/credentials.rs
@@ -0,0 +1,59 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use dirs::home_dir;
+use lazy_static::lazy_static;
+use std::{
+ fs::{create_dir_all, File},
+ io,
+ io::prelude::*,
+ path::{Path, PathBuf},
+};
+
+pub const PACKAGE_MANAGER_URL: &str = "https://apm-backend-prod.herokuapp.com/";
+
+pub const LEO_CREDENTIALS_FILE: &str = "credentials";
+
+lazy_static! {
+ pub static ref LEO_CREDENTIALS_DIR: PathBuf = {
+ let mut path = home_dir().expect("Invalid home directory");
+ path.push(".leo");
+ path
+ };
+ pub static ref LEO_CREDENTIALS_PATH: PathBuf = {
+ let mut path = LEO_CREDENTIALS_DIR.to_path_buf();
+ path.push(LEO_CREDENTIALS_FILE);
+ path
+ };
+}
+
+pub fn write_token(token: &str) -> Result<(), io::Error> {
+ // Create Leo credentials directory if it not exists
+ if !Path::new(&LEO_CREDENTIALS_DIR.to_path_buf()).exists() {
+ create_dir_all(&LEO_CREDENTIALS_DIR.to_path_buf())?;
+ }
+
+ let mut credentials = File::create(&LEO_CREDENTIALS_PATH.to_path_buf())?;
+ credentials.write_all(&token.as_bytes())?;
+ Ok(())
+}
+
+pub fn read_token() -> Result {
+ let mut credentials = File::open(&LEO_CREDENTIALS_PATH.to_path_buf())?;
+ let mut buf = String::new();
+ credentials.read_to_string(&mut buf)?;
+ Ok(buf)
+}
diff --git a/leo/errors/cli.rs b/leo/errors/cli.rs
index 1e751c866a..8cc8783ebd 100644
--- a/leo/errors/cli.rs
+++ b/leo/errors/cli.rs
@@ -1,8 +1,27 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::*;
use leo_package::errors::*;
#[derive(Debug, Error)]
pub enum CLIError {
+ #[error("{}", _0)]
+ AddError(AddError),
+
#[error("{}", _0)]
BuildError(BuildError),
@@ -24,6 +43,9 @@ pub enum CLIError {
#[error("{}", _0)]
InitError(InitError),
+ #[error("{}", _0)]
+ ImportsDirectoryError(ImportsDirectoryError),
+
#[error("{}", _0)]
InputDirectoryError(InputsDirectoryError),
@@ -57,6 +79,9 @@ pub enum CLIError {
#[error("{}", _0)]
PublishError(PublishError),
+ #[error("{}", _0)]
+ READMEError(READMEError),
+
#[error("{}", _0)]
RunError(RunError),
@@ -90,6 +115,13 @@ impl From for CLIError {
}
}
+impl From for CLIError {
+ fn from(error: AddError) -> Self {
+ log::error!("{}\n", error);
+ CLIError::AddError(error)
+ }
+}
+
impl From for CLIError {
fn from(error: ChecksumFileError) -> Self {
log::error!("{}\n", error);
@@ -118,6 +150,13 @@ impl From for CLIError {
}
}
+impl From for CLIError {
+ fn from(error: ImportsDirectoryError) -> Self {
+ log::error!("{}\n", error);
+ CLIError::ImportsDirectoryError(error)
+ }
+}
+
impl From for CLIError {
fn from(error: InputsDirectoryError) -> Self {
log::error!("{}\n", error);
@@ -195,6 +234,13 @@ impl From for CLIError {
}
}
+impl From for CLIError {
+ fn from(error: READMEError) -> Self {
+ log::error!("{}\n", error);
+ CLIError::READMEError(error)
+ }
+}
+
impl From for CLIError {
fn from(error: RunError) -> Self {
log::error!("{}\n", error);
@@ -244,6 +290,13 @@ impl From for CLIError {
}
}
+impl From for CLIError {
+ fn from(error: reqwest::Error) -> Self {
+ log::error!("{}\n", error);
+ CLIError::Crate("rewquest", format!("{}", error))
+ }
+}
+
impl From for CLIError {
fn from(error: snarkos_errors::algorithms::snark::SNARKError) -> Self {
log::error!("{}\n", error);
diff --git a/leo/errors/commands/add.rs b/leo/errors/commands/add.rs
new file mode 100644
index 0000000000..64d0309436
--- /dev/null
+++ b/leo/errors/commands/add.rs
@@ -0,0 +1,29 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use std::ffi::OsString;
+
+#[derive(Debug, Error)]
+pub enum AddError {
+ #[error("connection unavailable {:?}", _0)]
+ ConnectionUnavailable(OsString),
+
+ #[error("missing author or package name")]
+ MissingAuthorOrPackageName,
+
+ #[error("{:?}", _0)]
+ ZipError(OsString),
+}
diff --git a/leo/errors/commands/build.rs b/leo/errors/commands/build.rs
index 55958bd49d..0c7fbb39e0 100644
--- a/leo/errors/commands/build.rs
+++ b/leo/errors/commands/build.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_package::errors::ManifestError;
use std::ffi::OsString;
diff --git a/leo/errors/commands/init.rs b/leo/errors/commands/init.rs
index dca7e3f569..95552cb02e 100644
--- a/leo/errors/commands/init.rs
+++ b/leo/errors/commands/init.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_package::errors::ManifestError;
use std::{ffi::OsString, io};
diff --git a/leo/errors/commands/login.rs b/leo/errors/commands/login.rs
index 7db339c843..4cc57315af 100644
--- a/leo/errors/commands/login.rs
+++ b/leo/errors/commands/login.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::ffi::OsString;
#[derive(Debug, Error)]
diff --git a/leo/errors/commands/mod.rs b/leo/errors/commands/mod.rs
index 0f5a5a0f30..dba067d1bc 100644
--- a/leo/errors/commands/mod.rs
+++ b/leo/errors/commands/mod.rs
@@ -1,3 +1,22 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+pub mod add;
+pub use self::add::*;
+
pub mod build;
pub use self::build::*;
diff --git a/leo/errors/commands/new.rs b/leo/errors/commands/new.rs
index f97b21a198..fd816f75db 100644
--- a/leo/errors/commands/new.rs
+++ b/leo/errors/commands/new.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_package::errors::ManifestError;
use std::{ffi::OsString, io};
diff --git a/leo/errors/commands/publish.rs b/leo/errors/commands/publish.rs
index ed98ba2d98..cd67e7fc0e 100644
--- a/leo/errors/commands/publish.rs
+++ b/leo/errors/commands/publish.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::ffi::OsString;
#[derive(Debug, Error)]
@@ -5,6 +21,15 @@ pub enum PublishError {
#[error("connection unavailable {:?}", _0)]
ConnectionUnavalaible(OsString),
+ #[error("package toml file is missing a description")]
+ MissingPackageDescription,
+
+ #[error("package toml file is missing a license")]
+ MissingPackageLicense,
+
+ #[error("package toml file is missing a remote")]
+ MissingPackageRemote,
+
#[error("package not published {:?}", _0)]
PackageNotPublished(OsString),
}
diff --git a/leo/errors/commands/run.rs b/leo/errors/commands/run.rs
index 345857a0bd..385f29c34d 100644
--- a/leo/errors/commands/run.rs
+++ b/leo/errors/commands/run.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_package::errors::ManifestError;
use std::ffi::OsString;
diff --git a/leo/errors/commands/test.rs b/leo/errors/commands/test.rs
index 64761d43e3..cd293013ed 100644
--- a/leo/errors/commands/test.rs
+++ b/leo/errors/commands/test.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_package::errors::ManifestError;
use std::ffi::OsString;
diff --git a/leo/errors/mod.rs b/leo/errors/mod.rs
index 6bc9bfbad5..bc7859ca5d 100644
--- a/leo/errors/mod.rs
+++ b/leo/errors/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod cli;
pub use self::cli::*;
diff --git a/leo/lib.rs b/leo/lib.rs
index a492f4990d..801cd357a5 100644
--- a/leo/lib.rs
+++ b/leo/lib.rs
@@ -1,10 +1,27 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
extern crate thiserror;
-#[cfg_attr(tarpaulin, skip)]
pub mod cli;
pub mod cli_types;
pub mod commands;
+#[cfg_attr(tarpaulin, skip)]
+pub mod credentials;
pub mod errors;
pub mod logger;
pub mod synthesizer;
diff --git a/leo/logger.rs b/leo/logger.rs
index 98c48c34d7..421cb35c33 100644
--- a/leo/logger.rs
+++ b/leo/logger.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use colored::Colorize;
use std::io::Write;
diff --git a/leo/main.rs b/leo/main.rs
index 7cbab7f433..27a08d90da 100644
--- a/leo/main.rs
+++ b/leo/main.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo::{cli::*, commands::*, errors::CLIError};
use clap::{App, AppSettings, Arg};
diff --git a/leo/synthesizer/circuit_synthesizer.rs b/leo/synthesizer/circuit_synthesizer.rs
index 6ab1e18cbe..0bdd6e7897 100644
--- a/leo/synthesizer/circuit_synthesizer.rs
+++ b/leo/synthesizer/circuit_synthesizer.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_errors::gadgets::SynthesisError;
use snarkos_models::{
curves::{Field, PairingEngine},
diff --git a/leo/synthesizer/mod.rs b/leo/synthesizer/mod.rs
index c4174cc275..a86b333e7f 100644
--- a/leo/synthesizer/mod.rs
+++ b/leo/synthesizer/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod circuit_synthesizer;
pub use self::circuit_synthesizer::*;
diff --git a/leo/synthesizer/serialized_circuit.rs b/leo/synthesizer/serialized_circuit.rs
index 55c9bd9c13..ae1293d191 100644
--- a/leo/synthesizer/serialized_circuit.rs
+++ b/leo/synthesizer/serialized_circuit.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::synthesizer::{CircuitSynthesizer, SerializedField, SerializedIndex};
use snarkos_curves::bls12_377::Bls12_377;
diff --git a/leo/synthesizer/serialized_field.rs b/leo/synthesizer/serialized_field.rs
index 9ed3a91e27..80c25d8471 100644
--- a/leo/synthesizer/serialized_field.rs
+++ b/leo/synthesizer/serialized_field.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_errors::curves::FieldError;
use snarkos_models::curves::{Field, Fp256, Fp256Parameters};
diff --git a/leo/synthesizer/serialized_index.rs b/leo/synthesizer/serialized_index.rs
index c77586ce6c..88138c3e5b 100644
--- a/leo/synthesizer/serialized_index.rs
+++ b/leo/synthesizer/serialized_index.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use snarkos_models::gadgets::r1cs::Index;
use serde::{Deserialize, Serialize};
diff --git a/linter/src/main.rs b/linter/src/main.rs
index e7a11a969c..b40b180fce 100644
--- a/linter/src/main.rs
+++ b/linter/src/main.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
fn main() {
println!("Hello, world!");
}
diff --git a/package/src/errors/imports/directory.rs b/package/src/errors/imports/directory.rs
index 7dd2114fc0..8d1f8ded19 100644
--- a/package/src/errors/imports/directory.rs
+++ b/package/src/errors/imports/directory.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{ffi::OsString, fs::FileType, io};
#[derive(Debug, Error)]
diff --git a/package/src/errors/imports/mod.rs b/package/src/errors/imports/mod.rs
index c578ea2ef7..e2aec2333d 100644
--- a/package/src/errors/imports/mod.rs
+++ b/package/src/errors/imports/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod directory;
pub use directory::*;
diff --git a/package/src/errors/inputs/directory.rs b/package/src/errors/inputs/directory.rs
index b18f1f1292..b54c091243 100644
--- a/package/src/errors/inputs/directory.rs
+++ b/package/src/errors/inputs/directory.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{InputFileError, StateFileError};
use std::{ffi::OsString, fs::FileType, io};
diff --git a/package/src/errors/inputs/input.rs b/package/src/errors/inputs/input.rs
index 82f51e4592..93ff2e44d1 100644
--- a/package/src/errors/inputs/input.rs
+++ b/package/src/errors/inputs/input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{io, path::PathBuf};
#[derive(Debug, Error)]
diff --git a/package/src/errors/inputs/mod.rs b/package/src/errors/inputs/mod.rs
index 504289bc48..93d930fa71 100644
--- a/package/src/errors/inputs/mod.rs
+++ b/package/src/errors/inputs/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod directory;
pub use directory::*;
diff --git a/package/src/errors/inputs/state.rs b/package/src/errors/inputs/state.rs
index a0cd41d28a..ea372555a9 100644
--- a/package/src/errors/inputs/state.rs
+++ b/package/src/errors/inputs/state.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{io, path::PathBuf};
#[derive(Debug, Error)]
diff --git a/package/src/errors/mod.rs b/package/src/errors/mod.rs
index 51521e4ed4..84b6620f73 100644
--- a/package/src/errors/mod.rs
+++ b/package/src/errors/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod imports;
pub use imports::*;
diff --git a/package/src/errors/outputs/checksum.rs b/package/src/errors/outputs/checksum.rs
index 65fe78c9e6..d3bd8c5dfc 100644
--- a/package/src/errors/outputs/checksum.rs
+++ b/package/src/errors/outputs/checksum.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{io, path::PathBuf};
#[derive(Debug, Error)]
diff --git a/package/src/errors/outputs/circuit.rs b/package/src/errors/outputs/circuit.rs
index 75287299f0..19fd1553e3 100644
--- a/package/src/errors/outputs/circuit.rs
+++ b/package/src/errors/outputs/circuit.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{io, path::PathBuf};
#[derive(Debug, Error)]
diff --git a/package/src/errors/outputs/directory.rs b/package/src/errors/outputs/directory.rs
index 7742fff615..8fecb31e15 100644
--- a/package/src/errors/outputs/directory.rs
+++ b/package/src/errors/outputs/directory.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{ffi::OsString, fs::FileType, io};
#[derive(Debug, Error)]
diff --git a/package/src/errors/outputs/mod.rs b/package/src/errors/outputs/mod.rs
index 022e413f2a..6a6d806842 100644
--- a/package/src/errors/outputs/mod.rs
+++ b/package/src/errors/outputs/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod circuit;
pub use circuit::*;
diff --git a/package/src/errors/outputs/proof.rs b/package/src/errors/outputs/proof.rs
index e0e8b1b022..7dad60fdcc 100644
--- a/package/src/errors/outputs/proof.rs
+++ b/package/src/errors/outputs/proof.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{io, path::PathBuf};
#[derive(Debug, Error)]
diff --git a/package/src/errors/outputs/proving_key.rs b/package/src/errors/outputs/proving_key.rs
index ef9481551a..d8643bc683 100644
--- a/package/src/errors/outputs/proving_key.rs
+++ b/package/src/errors/outputs/proving_key.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{io, path::PathBuf};
#[derive(Debug, Error)]
diff --git a/package/src/errors/outputs/verification_key.rs b/package/src/errors/outputs/verification_key.rs
index ffa3d34a61..7a824496c7 100644
--- a/package/src/errors/outputs/verification_key.rs
+++ b/package/src/errors/outputs/verification_key.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{io, path::PathBuf};
#[derive(Debug, Error)]
diff --git a/package/src/errors/root/gitignore.rs b/package/src/errors/root/gitignore.rs
index 4b1da2af73..449ce0f7ce 100644
--- a/package/src/errors/root/gitignore.rs
+++ b/package/src/errors/root/gitignore.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::io;
#[derive(Debug, Error)]
diff --git a/package/src/errors/root/manifest.rs b/package/src/errors/root/manifest.rs
index 6ffe9d4a8d..10c0a5fd8f 100644
--- a/package/src/errors/root/manifest.rs
+++ b/package/src/errors/root/manifest.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::io;
#[derive(Debug, Error)]
diff --git a/package/src/errors/root/mod.rs b/package/src/errors/root/mod.rs
index 8769ea2e5c..6ed3f4bc07 100644
--- a/package/src/errors/root/mod.rs
+++ b/package/src/errors/root/mod.rs
@@ -1,8 +1,27 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod gitignore;
pub use self::gitignore::*;
pub mod manifest;
pub use self::manifest::*;
+pub mod readme;
+pub use self::readme::*;
+
pub mod zip;
pub use self::zip::*;
diff --git a/package/src/errors/root/readme.rs b/package/src/errors/root/readme.rs
new file mode 100644
index 0000000000..c2fc7c4e37
--- /dev/null
+++ b/package/src/errors/root/readme.rs
@@ -0,0 +1,35 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use std::io;
+
+#[derive(Debug, Error)]
+pub enum READMEError {
+ #[error("{}: {}", _0, _1)]
+ Crate(&'static str, String),
+
+ #[error("creating: {}", _0)]
+ Creating(io::Error),
+
+ #[error("writing: {}", _0)]
+ Writing(io::Error),
+}
+
+impl From for READMEError {
+ fn from(error: std::io::Error) -> Self {
+ READMEError::Crate("std::io", format!("{}", error))
+ }
+}
diff --git a/package/src/errors/root/zip.rs b/package/src/errors/root/zip.rs
index 1cf20e984b..c3c8c5c7c2 100644
--- a/package/src/errors/root/zip.rs
+++ b/package/src/errors/root/zip.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{io, path::PathBuf};
use walkdir::Error as WalkDirError;
use zip::result::ZipError;
diff --git a/package/src/errors/source/directory.rs b/package/src/errors/source/directory.rs
index 984969e1cc..2913162223 100644
--- a/package/src/errors/source/directory.rs
+++ b/package/src/errors/source/directory.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::{ffi::OsString, fs::FileType, io};
#[derive(Debug, Error)]
diff --git a/package/src/errors/source/lib.rs b/package/src/errors/source/lib.rs
index a95bc98075..2560ae4d8e 100644
--- a/package/src/errors/source/lib.rs
+++ b/package/src/errors/source/lib.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::io;
#[derive(Debug, Error)]
diff --git a/package/src/errors/source/main.rs b/package/src/errors/source/main.rs
index b11527bf95..816a2b01a8 100644
--- a/package/src/errors/source/main.rs
+++ b/package/src/errors/source/main.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::io;
#[derive(Debug, Error)]
diff --git a/package/src/errors/source/mod.rs b/package/src/errors/source/mod.rs
index e1c58a866b..35f5b284ac 100644
--- a/package/src/errors/source/mod.rs
+++ b/package/src/errors/source/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod directory;
pub use directory::*;
diff --git a/package/src/imports/directory.rs b/package/src/imports/directory.rs
index 17bc311e06..d9f5be5868 100644
--- a/package/src/imports/directory.rs
+++ b/package/src/imports/directory.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::ImportsDirectoryError;
use std::{fs, path::PathBuf};
diff --git a/package/src/imports/mod.rs b/package/src/imports/mod.rs
index c578ea2ef7..e2aec2333d 100644
--- a/package/src/imports/mod.rs
+++ b/package/src/imports/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod directory;
pub use directory::*;
diff --git a/package/src/inputs/directory.rs b/package/src/inputs/directory.rs
index 4dc70b9e28..dd588a51a5 100644
--- a/package/src/inputs/directory.rs
+++ b/package/src/inputs/directory.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::InputsDirectoryError;
use std::{fs, fs::ReadDir, path::PathBuf};
diff --git a/package/src/inputs/input.rs b/package/src/inputs/input.rs
index ebd4d993e7..06415b0e51 100644
--- a/package/src/inputs/input.rs
+++ b/package/src/inputs/input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The `program.in` file.
use crate::{errors::InputFileError, inputs::INPUTS_DIRECTORY_NAME};
diff --git a/package/src/inputs/mod.rs b/package/src/inputs/mod.rs
index befb73256e..963f0e1e22 100644
--- a/package/src/inputs/mod.rs
+++ b/package/src/inputs/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod directory;
pub use directory::*;
diff --git a/package/src/inputs/pairs.rs b/package/src/inputs/pairs.rs
index b41947cc46..6c05ddcccb 100644
--- a/package/src/inputs/pairs.rs
+++ b/package/src/inputs/pairs.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{
inputs::{InputFile, InputsDirectory, StateFile, INPUT_FILE_EXTENSION, STATE_FILE_EXTENSION},
InputsDirectoryError,
diff --git a/package/src/inputs/state.rs b/package/src/inputs/state.rs
index 29e55e993c..ea2fa40f8f 100644
--- a/package/src/inputs/state.rs
+++ b/package/src/inputs/state.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The `program.state` file.
use crate::{errors::StateFileError, inputs::INPUTS_DIRECTORY_NAME};
diff --git a/package/src/lib.rs b/package/src/lib.rs
index 6b6920ce7a..01b7a4d290 100644
--- a/package/src/lib.rs
+++ b/package/src/lib.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
extern crate thiserror;
diff --git a/package/src/outputs/checksum.rs b/package/src/outputs/checksum.rs
index e55982f4ac..021078162d 100644
--- a/package/src/outputs/checksum.rs
+++ b/package/src/outputs/checksum.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The build checksum file.
use crate::{errors::ChecksumFileError, outputs::OUTPUTS_DIRECTORY_NAME};
diff --git a/package/src/outputs/circuit.rs b/package/src/outputs/circuit.rs
index 00d4312877..b32aee442f 100644
--- a/package/src/outputs/circuit.rs
+++ b/package/src/outputs/circuit.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The serialized circuit output file.
use crate::{errors::CircuitFileError, outputs::OUTPUTS_DIRECTORY_NAME};
diff --git a/package/src/outputs/directory.rs b/package/src/outputs/directory.rs
index 575132bd0e..f54c12bf70 100644
--- a/package/src/outputs/directory.rs
+++ b/package/src/outputs/directory.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::OutputsDirectoryError;
use std::{fs, path::PathBuf};
diff --git a/package/src/outputs/mod.rs b/package/src/outputs/mod.rs
index 30bd5d58d1..7dccb07d83 100644
--- a/package/src/outputs/mod.rs
+++ b/package/src/outputs/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod circuit;
pub use self::circuit::*;
diff --git a/package/src/outputs/proof.rs b/package/src/outputs/proof.rs
index 0095ef1c67..4d0a41482f 100644
--- a/package/src/outputs/proof.rs
+++ b/package/src/outputs/proof.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The proof file.
use crate::{errors::ProofFileError, outputs::OUTPUTS_DIRECTORY_NAME};
diff --git a/package/src/outputs/proving_key.rs b/package/src/outputs/proving_key.rs
index 2914479785..03fd71f157 100644
--- a/package/src/outputs/proving_key.rs
+++ b/package/src/outputs/proving_key.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The proving key file.
use crate::{errors::ProvingKeyFileError, outputs::OUTPUTS_DIRECTORY_NAME};
diff --git a/package/src/outputs/verification_key.rs b/package/src/outputs/verification_key.rs
index 52fc83f9a9..83c9913b56 100644
--- a/package/src/outputs/verification_key.rs
+++ b/package/src/outputs/verification_key.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The verification key file.
use crate::{errors::VerificationKeyFileError, outputs::OUTPUTS_DIRECTORY_NAME};
diff --git a/package/src/root/gitignore.rs b/package/src/root/gitignore.rs
index ae9be67cfd..9ecb3f7adc 100644
--- a/package/src/root/gitignore.rs
+++ b/package/src/root/gitignore.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The `.gitignore` file.
use crate::errors::GitignoreError;
diff --git a/package/src/root/manifest.rs b/package/src/root/manifest.rs
index a439e1d31c..f18c98b30b 100644
--- a/package/src/root/manifest.rs
+++ b/package/src/root/manifest.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::ManifestError;
use serde::Deserialize;
@@ -14,6 +30,9 @@ pub const MANIFEST_FILE_NAME: &str = "Leo.toml";
pub struct Package {
pub name: String,
pub version: String,
+ pub description: Option,
+ pub license: Option,
+ pub remote: Option,
}
#[derive(Deserialize)]
@@ -27,6 +46,9 @@ impl Manifest {
package: Package {
name: package_name.to_owned(),
version: "0.1.0".to_owned(),
+ description: None,
+ license: None,
+ remote: None,
},
}
}
@@ -47,6 +69,18 @@ impl Manifest {
self.package.version.clone()
}
+ pub fn get_package_description(&self) -> Option {
+ self.package.description.clone()
+ }
+
+ pub fn get_package_license(&self) -> Option {
+ self.package.license.clone()
+ }
+
+ pub fn get_package_remote(&self) -> Option {
+ self.package.remote.clone()
+ }
+
pub fn write_to(self, path: &PathBuf) -> Result<(), ManifestError> {
let mut path = path.to_owned();
if path.is_dir() {
@@ -61,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
)
}
}
diff --git a/package/src/root/mod.rs b/package/src/root/mod.rs
index 8769ea2e5c..6ed3f4bc07 100644
--- a/package/src/root/mod.rs
+++ b/package/src/root/mod.rs
@@ -1,8 +1,27 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod gitignore;
pub use self::gitignore::*;
pub mod manifest;
pub use self::manifest::*;
+pub mod readme;
+pub use self::readme::*;
+
pub mod zip;
pub use self::zip::*;
diff --git a/package/src/root/readme.rs b/package/src/root/readme.rs
new file mode 100644
index 0000000000..f59adfaafd
--- /dev/null
+++ b/package/src/root/readme.rs
@@ -0,0 +1,63 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+//! The `README.md` file.
+
+use crate::errors::READMEError;
+
+use serde::Deserialize;
+use std::{fs::File, io::Write, path::PathBuf};
+
+pub static README_FILE_NAME: &str = "README.md";
+
+#[derive(Deserialize)]
+pub struct README {
+ pub package_name: String,
+}
+
+impl README {
+ pub fn new(package_name: &str) -> Self {
+ Self {
+ package_name: package_name.to_string(),
+ }
+ }
+
+ pub fn package_name(&self) -> String {
+ self.package_name.clone()
+ }
+
+ pub fn exists_at(path: &PathBuf) -> bool {
+ let mut path = path.to_owned();
+ if path.is_dir() {
+ path.push(PathBuf::from(README_FILE_NAME));
+ }
+ path.exists()
+ }
+
+ pub fn write_to(self, path: &PathBuf) -> Result<(), READMEError> {
+ let mut path = path.to_owned();
+ if path.is_dir() {
+ path.push(PathBuf::from(README_FILE_NAME));
+ }
+
+ let mut file = File::create(&path)?;
+ Ok(file.write_all(self.template().as_bytes())?)
+ }
+
+ fn template(&self) -> String {
+ format!("# {}\n", self.package_name)
+ }
+}
diff --git a/package/src/root/zip.rs b/package/src/root/zip.rs
index 30acdf3d4e..2cda680d26 100644
--- a/package/src/root/zip.rs
+++ b/package/src/root/zip.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The program package zip file.
use crate::{
diff --git a/package/src/source/directory.rs b/package/src/source/directory.rs
index 197adff93d..2c79018270 100644
--- a/package/src/source/directory.rs
+++ b/package/src/source/directory.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::errors::SourceDirectoryError;
use std::{fs, path::PathBuf};
diff --git a/package/src/source/lib.rs b/package/src/source/lib.rs
index 1a43c2c0b9..426822a4f9 100644
--- a/package/src/source/lib.rs
+++ b/package/src/source/lib.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The `lib.leo` file.
use crate::{errors::LibFileError, source::directory::SOURCE_DIRECTORY_NAME};
diff --git a/package/src/source/main.rs b/package/src/source/main.rs
index 88046c3e7a..2fd5faf6e9 100644
--- a/package/src/source/main.rs
+++ b/package/src/source/main.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The `main.leo` file.
use crate::{errors::MainFileError, source::directory::SOURCE_DIRECTORY_NAME};
diff --git a/package/src/source/mod.rs b/package/src/source/mod.rs
index e1c58a866b..35f5b284ac 100644
--- a/package/src/source/mod.rs
+++ b/package/src/source/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod directory;
pub use directory::*;
diff --git a/state/src/errors/dpc_record_values.rs b/state/src/errors/dpc_record_values.rs
index f659b134b0..39aa9c558e 100644
--- a/state/src/errors/dpc_record_values.rs
+++ b/state/src/errors/dpc_record_values.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::InputValueError;
use snarkos_errors::objects::account::AccountError;
diff --git a/state/src/errors/input_value.rs b/state/src/errors/input_value.rs
index 1504d0ebef..2b91fa921a 100644
--- a/state/src/errors/input_value.rs
+++ b/state/src/errors/input_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use std::num::ParseIntError;
#[derive(Debug, Error)]
diff --git a/state/src/errors/local_data_commitment.rs b/state/src/errors/local_data_commitment.rs
index ecdc2b8c18..6f3c954cb1 100644
--- a/state/src/errors/local_data_commitment.rs
+++ b/state/src/errors/local_data_commitment.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{RecordVerificationError, StateLeafValuesError, StateValuesError};
use snarkos_errors::algorithms::{CommitmentError, MerkleError};
diff --git a/state/src/errors/mod.rs b/state/src/errors/mod.rs
index fd5b2ade5a..f9a717fc71 100644
--- a/state/src/errors/mod.rs
+++ b/state/src/errors/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod dpc_record_values;
pub use self::dpc_record_values::*;
diff --git a/state/src/errors/record_commitment.rs b/state/src/errors/record_commitment.rs
index a00bb8eead..3ca813f277 100644
--- a/state/src/errors/record_commitment.rs
+++ b/state/src/errors/record_commitment.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::DPCRecordValuesError;
use snarkos_errors::algorithms::CommitmentError;
diff --git a/state/src/errors/state_leaf_values.rs b/state/src/errors/state_leaf_values.rs
index b14620eb89..75f19797f8 100644
--- a/state/src/errors/state_leaf_values.rs
+++ b/state/src/errors/state_leaf_values.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::InputValueError;
use std::{num::ParseIntError, str::ParseBoolError};
diff --git a/state/src/errors/state_values.rs b/state/src/errors/state_values.rs
index 72b47c51bc..8f29ed9968 100644
--- a/state/src/errors/state_values.rs
+++ b/state/src/errors/state_values.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::InputValueError;
use std::{num::ParseIntError, str::ParseBoolError};
diff --git a/state/src/lib.rs b/state/src/lib.rs
index 40cfd206e8..639457e0f3 100644
--- a/state/src/lib.rs
+++ b/state/src/lib.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
extern crate thiserror;
diff --git a/state/src/local_data_commitment/local_data_commitment.rs b/state/src/local_data_commitment/local_data_commitment.rs
index 53a84b8149..6a8f2906b3 100644
--- a/state/src/local_data_commitment/local_data_commitment.rs
+++ b/state/src/local_data_commitment/local_data_commitment.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{verify_record_commitment, LocalDataVerificationError, StateLeafValues, StateValues};
use leo_typed::Input as TypedInput;
diff --git a/state/src/local_data_commitment/mod.rs b/state/src/local_data_commitment/mod.rs
index 77a5949d51..4c6f19230d 100644
--- a/state/src/local_data_commitment/mod.rs
+++ b/state/src/local_data_commitment/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod state_values;
pub use self::state_values::*;
diff --git a/state/src/local_data_commitment/state_leaf_values.rs b/state/src/local_data_commitment/state_leaf_values.rs
index b52badd1da..f7ca617ba4 100644
--- a/state/src/local_data_commitment/state_leaf_values.rs
+++ b/state/src/local_data_commitment/state_leaf_values.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{find_input, input_to_integer_string, input_to_u8_vec, StateLeafValuesError};
use leo_typed::StateLeaf as TypedStateLeaf;
diff --git a/state/src/local_data_commitment/state_values.rs b/state/src/local_data_commitment/state_values.rs
index 5a71e19395..7fbba3dd6e 100644
--- a/state/src/local_data_commitment/state_values.rs
+++ b/state/src/local_data_commitment/state_values.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{find_input, input_to_integer_string, input_to_u8_vec, StateValuesError};
use leo_typed::State as TypedState;
diff --git a/state/src/record_commitment/dpc_record_values.rs b/state/src/record_commitment/dpc_record_values.rs
index 986eaee90d..a29e69414a 100644
--- a/state/src/record_commitment/dpc_record_values.rs
+++ b/state/src/record_commitment/dpc_record_values.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{utilities::*, DPCRecordValuesError};
use leo_typed::Record as TypedRecord;
diff --git a/state/src/record_commitment/mod.rs b/state/src/record_commitment/mod.rs
index 9d2f688f6e..69adaa0da6 100644
--- a/state/src/record_commitment/mod.rs
+++ b/state/src/record_commitment/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod dpc_record_values;
pub use self::dpc_record_values::*;
diff --git a/state/src/record_commitment/record_commitment.rs b/state/src/record_commitment/record_commitment.rs
index 55493e874f..1908c5a3da 100644
--- a/state/src/record_commitment/record_commitment.rs
+++ b/state/src/record_commitment/record_commitment.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{DPCRecordValues, RecordVerificationError};
use leo_typed::Record as TypedRecord;
diff --git a/state/src/utilities/input_value.rs b/state/src/utilities/input_value.rs
index e453093d8f..c734a47824 100644
--- a/state/src/utilities/input_value.rs
+++ b/state/src/utilities/input_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::InputValueError;
use leo_typed::{InputValue, Parameter};
diff --git a/state/src/utilities/mod.rs b/state/src/utilities/mod.rs
index 5166631852..e4668829a0 100644
--- a/state/src/utilities/mod.rs
+++ b/state/src/utilities/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod input_value;
pub use self::input_value::*;
diff --git a/state/tests/mod.rs b/state/tests/mod.rs
index 3f3fd2339d..5ecc95c701 100644
--- a/state/tests/mod.rs
+++ b/state/tests/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
mod test_verify_local_data_commitment;
mod test_verify_record_commitment;
diff --git a/state/tests/test_verify_local_data_commitment.rs b/state/tests/test_verify_local_data_commitment.rs
index 5a42e77865..6f15ae7c6c 100644
--- a/state/tests/test_verify_local_data_commitment.rs
+++ b/state/tests/test_verify_local_data_commitment.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_input::LeoInputParser;
use leo_state::verify_local_data_commitment;
use leo_typed::Input;
diff --git a/state/tests/test_verify_record_commitment.rs b/state/tests/test_verify_record_commitment.rs
index e7bde411eb..6c031a5b75 100644
--- a/state/tests/test_verify_record_commitment.rs
+++ b/state/tests/test_verify_record_commitment.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_input::LeoInputParser;
use leo_state::verify_record_commitment;
use leo_typed::Input;
diff --git a/typed/benches/typed_ast.rs b/typed/benches/typed_ast.rs
index 6086f9594f..a38aa47238 100644
--- a/typed/benches/typed_ast.rs
+++ b/typed/benches/typed_ast.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_ast::{errors::ParserError, files::File, LeoAst};
use leo_typed::LeoTypedAst;
diff --git a/typed/src/annotation.rs b/typed/src/annotation.rs
index 761dea19e3..3c1b66ee39 100644
--- a/typed/src/annotation.rs
+++ b/typed/src/annotation.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Circuit, Function, Identifier, Import, InputVariable, TestFunction};
use leo_ast::{
annotations::{Annotation, AnnotationArguments, AnnotationName},
diff --git a/typed/src/circuits/circuit.rs b/typed/src/circuits/circuit.rs
index d49d7de5e4..512feaa491 100644
--- a/typed/src/circuits/circuit.rs
+++ b/typed/src/circuits/circuit.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{CircuitMember, Identifier};
use leo_ast::circuits::Circuit as AstCircuit;
diff --git a/typed/src/circuits/circuit_field_definition.rs b/typed/src/circuits/circuit_field_definition.rs
index 38582efef2..ffd99236a6 100644
--- a/typed/src/circuits/circuit_field_definition.rs
+++ b/typed/src/circuits/circuit_field_definition.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Expression, Identifier};
use leo_ast::circuits::CircuitField;
diff --git a/typed/src/circuits/circuit_member.rs b/typed/src/circuits/circuit_member.rs
index dda39dd3ee..54d170be33 100644
--- a/typed/src/circuits/circuit_member.rs
+++ b/typed/src/circuits/circuit_member.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Function, Identifier, Type};
use leo_ast::circuits::{
CircuitFieldDefinition as AstCircuitFieldDefinition,
diff --git a/typed/src/circuits/mod.rs b/typed/src/circuits/mod.rs
index 7531150186..f191d6485c 100644
--- a/typed/src/circuits/mod.rs
+++ b/typed/src/circuits/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod circuit;
pub use circuit::*;
diff --git a/typed/src/common/assignee.rs b/typed/src/common/assignee.rs
index 05f7b97a2e..8ac62bd713 100644
--- a/typed/src/common/assignee.rs
+++ b/typed/src/common/assignee.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Expression, Identifier, RangeOrExpression};
use leo_ast::{
access::AssigneeAccess as AstAssigneeAccess,
diff --git a/typed/src/common/declare.rs b/typed/src/common/declare.rs
index 12930d32d6..4fb9d28d85 100644
--- a/typed/src/common/declare.rs
+++ b/typed/src/common/declare.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_ast::common::Declare as AstDeclare;
use serde::{Deserialize, Serialize};
diff --git a/typed/src/common/identifier.rs b/typed/src/common/identifier.rs
index 777e404a4d..79412e8f95 100644
--- a/typed/src/common/identifier.rs
+++ b/typed/src/common/identifier.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::Span;
use leo_ast::{
annotations::AnnotationArgument,
diff --git a/typed/src/common/mod.rs b/typed/src/common/mod.rs
index 50bb761460..9187f2e653 100644
--- a/typed/src/common/mod.rs
+++ b/typed/src/common/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod assignee;
pub use assignee::*;
diff --git a/typed/src/common/range_or_expression.rs b/typed/src/common/range_or_expression.rs
index 0b78855705..3f3d8b998f 100644
--- a/typed/src/common/range_or_expression.rs
+++ b/typed/src/common/range_or_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::Expression;
use leo_ast::common::RangeOrExpression as AstRangeOrExpression;
diff --git a/typed/src/common/span.rs b/typed/src/common/span.rs
index cc62e32796..a97510fe91 100644
--- a/typed/src/common/span.rs
+++ b/typed/src/common/span.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use pest::{Position, Span as AstSpan};
use serde::{Deserialize, Serialize};
diff --git a/typed/src/common/spread_or_expression.rs b/typed/src/common/spread_or_expression.rs
index 79dd1c2dda..dd8fb3bc67 100644
--- a/typed/src/common/spread_or_expression.rs
+++ b/typed/src/common/spread_or_expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::Expression;
use leo_ast::common::SpreadOrExpression as AstSpreadOrExpression;
diff --git a/typed/src/common/variable_name.rs b/typed/src/common/variable_name.rs
index 228a24091e..ac93f2dc60 100644
--- a/typed/src/common/variable_name.rs
+++ b/typed/src/common/variable_name.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::common::{Identifier, Span};
use leo_ast::common::VariableName as AstVariableName;
diff --git a/typed/src/common/variables.rs b/typed/src/common/variables.rs
index 13fdbc9c64..2f9d877358 100644
--- a/typed/src/common/variables.rs
+++ b/typed/src/common/variables.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Type, VariableName};
use leo_ast::common::Variables as AstVariables;
diff --git a/typed/src/console/console_function.rs b/typed/src/console/console_function.rs
new file mode 100644
index 0000000000..ca1faf5efa
--- /dev/null
+++ b/typed/src/console/console_function.rs
@@ -0,0 +1,65 @@
+use crate::{Expression, FormattedString};
+use leo_ast::console::{
+ ConsoleAssert as AstConsoleAssert,
+ ConsoleDebug as AstConsoleDebug,
+ ConsoleError as AstConsoleError,
+ ConsoleFunction as AstConsoleFunction,
+ ConsoleLog as AstConsoleLog,
+};
+
+use serde::{Deserialize, Serialize};
+use std::fmt;
+
+#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
+pub enum ConsoleFunction {
+ Assert(Expression),
+ Debug(FormattedString),
+ Error(FormattedString),
+ Log(FormattedString),
+}
+
+impl<'ast> From> for ConsoleFunction {
+ fn from(console_function: AstConsoleFunction<'ast>) -> Self {
+ match console_function {
+ AstConsoleFunction::Assert(assert) => ConsoleFunction::from(assert),
+ AstConsoleFunction::Debug(debug) => ConsoleFunction::from(debug),
+ AstConsoleFunction::Error(error) => ConsoleFunction::from(error),
+ AstConsoleFunction::Log(log) => ConsoleFunction::from(log),
+ }
+ }
+}
+
+impl<'ast> From> for ConsoleFunction {
+ fn from(assert: AstConsoleAssert<'ast>) -> Self {
+ ConsoleFunction::Assert(Expression::from(assert.expression))
+ }
+}
+
+impl<'ast> From> for ConsoleFunction {
+ fn from(debug: AstConsoleDebug<'ast>) -> Self {
+ ConsoleFunction::Debug(FormattedString::from(debug.string))
+ }
+}
+
+impl<'ast> From> for ConsoleFunction {
+ fn from(error: AstConsoleError<'ast>) -> Self {
+ ConsoleFunction::Error(FormattedString::from(error.string))
+ }
+}
+
+impl<'ast> From> for ConsoleFunction {
+ fn from(log: AstConsoleLog<'ast>) -> Self {
+ ConsoleFunction::Log(FormattedString::from(log.string))
+ }
+}
+
+impl fmt::Display for ConsoleFunction {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match self {
+ ConsoleFunction::Assert(assert) => write!(f, "assert({})", assert),
+ ConsoleFunction::Debug(debug) => write!(f, "debug({})", debug),
+ ConsoleFunction::Error(error) => write!(f, "error{})", error),
+ ConsoleFunction::Log(log) => write!(f, "log({})", log),
+ }
+ }
+}
diff --git a/typed/src/console/console_function_call.rs b/typed/src/console/console_function_call.rs
new file mode 100644
index 0000000000..0c74685b14
--- /dev/null
+++ b/typed/src/console/console_function_call.rs
@@ -0,0 +1,26 @@
+use crate::{ConsoleFunction, Span};
+use leo_ast::console::ConsoleFunctionCall as AstConsoleFunctionCall;
+
+use serde::{Deserialize, Serialize};
+use std::fmt;
+
+#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
+pub struct ConsoleFunctionCall {
+ pub function: ConsoleFunction,
+ pub span: Span,
+}
+
+impl<'ast> From> for ConsoleFunctionCall {
+ fn from(console: AstConsoleFunctionCall<'ast>) -> Self {
+ ConsoleFunctionCall {
+ function: ConsoleFunction::from(console.function),
+ span: Span::from(console.span),
+ }
+ }
+}
+
+impl fmt::Display for ConsoleFunctionCall {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "console.{};", self.function)
+ }
+}
diff --git a/typed/src/console/formatted_container.rs b/typed/src/console/formatted_container.rs
new file mode 100644
index 0000000000..5e2ce9e0b9
--- /dev/null
+++ b/typed/src/console/formatted_container.rs
@@ -0,0 +1,40 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::Span;
+use leo_ast::console::FormattedContainer as AstFormattedContainer;
+
+use serde::{Deserialize, Serialize};
+use std::fmt;
+
+#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
+pub struct FormattedContainer {
+ pub span: Span,
+}
+
+impl<'ast> From> for FormattedContainer {
+ fn from(container: AstFormattedContainer<'ast>) -> Self {
+ Self {
+ span: Span::from(container.span),
+ }
+ }
+}
+
+impl fmt::Display for FormattedContainer {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{{}}")
+ }
+}
diff --git a/typed/src/console/formatted_parameter.rs b/typed/src/console/formatted_parameter.rs
new file mode 100644
index 0000000000..79249e5fbc
--- /dev/null
+++ b/typed/src/console/formatted_parameter.rs
@@ -0,0 +1,42 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{Expression, Span};
+use leo_ast::console::FormattedParameter as AstFormattedParameter;
+
+use serde::{Deserialize, Serialize};
+use std::fmt;
+
+#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
+pub struct FormattedParameter {
+ pub expression: Expression,
+ pub span: Span,
+}
+
+impl<'ast> From> for FormattedParameter {
+ fn from(parameter: AstFormattedParameter<'ast>) -> Self {
+ Self {
+ expression: Expression::from(parameter.expression),
+ span: Span::from(parameter.span),
+ }
+ }
+}
+
+impl fmt::Display for FormattedParameter {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{}", self.expression)
+ }
+}
diff --git a/typed/src/macros/formatted_string.rs b/typed/src/console/formatted_string.rs
similarity index 59%
rename from typed/src/macros/formatted_string.rs
rename to typed/src/console/formatted_string.rs
index 61bb48e8ec..86d08492ce 100644
--- a/typed/src/macros/formatted_string.rs
+++ b/typed/src/console/formatted_string.rs
@@ -1,5 +1,21 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{FormattedContainer, FormattedParameter, Span};
-use leo_ast::macros::FormattedString as AstFormattedString;
+use leo_ast::console::FormattedString as AstFormattedString;
use serde::{Deserialize, Serialize};
use std::fmt;
diff --git a/typed/src/console/mod.rs b/typed/src/console/mod.rs
new file mode 100644
index 0000000000..81b012e896
--- /dev/null
+++ b/typed/src/console/mod.rs
@@ -0,0 +1,14 @@
+pub mod console_function;
+pub use console_function::*;
+
+pub mod console_function_call;
+pub use console_function_call::*;
+
+pub mod formatted_container;
+pub use formatted_container::*;
+
+pub mod formatted_parameter;
+pub use formatted_parameter::*;
+
+pub mod formatted_string;
+pub use formatted_string::*;
diff --git a/typed/src/errors/error.rs b/typed/src/errors/error.rs
index 6cc33969b4..31b575b9af 100644
--- a/typed/src/errors/error.rs
+++ b/typed/src/errors/error.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::Span;
use std::{fmt, path::PathBuf};
diff --git a/typed/src/errors/mod.rs b/typed/src/errors/mod.rs
index 954dc9fe34..d76128b38a 100644
--- a/typed/src/errors/mod.rs
+++ b/typed/src/errors/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod error;
pub use error::*;
diff --git a/typed/src/expression.rs b/typed/src/expression.rs
index beed6ee8b5..09edc78460 100644
--- a/typed/src/expression.rs
+++ b/typed/src/expression.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{CircuitFieldDefinition, GroupValue, Identifier, IntegerType, RangeOrExpression, Span, SpreadOrExpression};
use leo_ast::{
access::{Access, AssigneeAccess},
@@ -86,7 +102,7 @@ impl Expression {
pub fn set_span(&mut self, new_span: &Span) {
match self {
Expression::Field(_, old_span) => *old_span = new_span.clone(),
- Expression::Group(value) => value.span = new_span.clone(),
+ Expression::Group(value) => value.set_span(new_span),
Expression::Add(_, _, old_span) => *old_span = new_span.clone(),
Expression::Sub(_, _, old_span) => *old_span = new_span.clone(),
diff --git a/typed/src/functions/function.rs b/typed/src/functions/function.rs
index 964058e152..4f52da175d 100644
--- a/typed/src/functions/function.rs
+++ b/typed/src/functions/function.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Identifier, InputVariable, Span, Statement, Type};
use leo_ast::functions::Function as AstFunction;
diff --git a/typed/src/functions/input/function_input.rs b/typed/src/functions/input/function_input.rs
index e2f49cad21..6f60906d59 100644
--- a/typed/src/functions/input/function_input.rs
+++ b/typed/src/functions/input/function_input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Identifier, Span, Type};
use leo_ast::functions::FunctionInput as AstFunctionInput;
diff --git a/typed/src/functions/input/input_variable.rs b/typed/src/functions/input/input_variable.rs
index 956dcae727..b3032d8b1b 100644
--- a/typed/src/functions/input/input_variable.rs
+++ b/typed/src/functions/input/input_variable.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{FunctionInput, Identifier, Span};
use leo_ast::functions::input::Input as AstInput;
diff --git a/typed/src/functions/input/mod.rs b/typed/src/functions/input/mod.rs
index 0a3a8455f7..d673bea746 100644
--- a/typed/src/functions/input/mod.rs
+++ b/typed/src/functions/input/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod function_input;
pub use function_input::*;
diff --git a/typed/src/functions/mod.rs b/typed/src/functions/mod.rs
index 376bb34270..bb15f47eb9 100644
--- a/typed/src/functions/mod.rs
+++ b/typed/src/functions/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod function;
pub use function::*;
diff --git a/typed/src/functions/test_function.rs b/typed/src/functions/test_function.rs
index f82344afc2..d4d2fec220 100644
--- a/typed/src/functions/test_function.rs
+++ b/typed/src/functions/test_function.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Function, Identifier};
use leo_ast::functions::TestFunction as AstTestFunction;
diff --git a/typed/src/groups/group_coordinate.rs b/typed/src/groups/group_coordinate.rs
index 9475a7c4eb..8b84d950e2 100644
--- a/typed/src/groups/group_coordinate.rs
+++ b/typed/src/groups/group_coordinate.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::common::span::Span;
use leo_ast::values::{
GroupCoordinate as AstGroupCoordinate,
diff --git a/typed/src/groups/group_value.rs b/typed/src/groups/group_value.rs
index 8c54ef4939..01ef67253d 100644
--- a/typed/src/groups/group_value.rs
+++ b/typed/src/groups/group_value.rs
@@ -1,44 +1,114 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{common::span::Span, groups::GroupCoordinate};
-use leo_ast::values::GroupValue as AstGroupValue;
-use leo_input::values::GroupValue as InputGroupValue;
+use leo_ast::values::{
+ GroupRepresentation as AstGroupRepresentation,
+ GroupTuple as AstGroupTuple,
+ GroupValue as AstGroupValue,
+};
+use leo_input::values::{
+ GroupRepresentation as InputGroupRepresentation,
+ GroupTuple as InputGroupTuple,
+ GroupValue as InputGroupValue,
+};
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct GroupValue {
- pub x: GroupCoordinate,
- pub y: GroupCoordinate,
- pub span: Span,
+pub enum GroupValue {
+ Single(String, Span),
+ Tuple(GroupTuple),
+}
+
+impl GroupValue {
+ pub fn set_span(&mut self, new_span: &Span) {
+ match self {
+ GroupValue::Single(_, old_span) => *old_span = new_span.clone(),
+ GroupValue::Tuple(tuple) => tuple.span = new_span.clone(),
+ }
+ }
}
impl<'ast> From> for GroupValue {
- fn from(ast_group: AstGroupValue<'ast>) -> Self {
- let ast_x = ast_group.value.x;
- let ast_y = ast_group.value.y;
+ fn from(ast_group: AstGroupValue) -> Self {
+ let span = Span::from(ast_group.span);
- Self {
- x: GroupCoordinate::from(ast_x),
- y: GroupCoordinate::from(ast_y),
- span: Span::from(ast_group.span),
+ match ast_group.value {
+ AstGroupRepresentation::Single(number) => GroupValue::Single(number.to_string(), span),
+ AstGroupRepresentation::Tuple(tuple) => GroupValue::Tuple(GroupTuple::from(tuple)),
}
}
}
impl<'ast> From> for GroupValue {
- fn from(ast_group: InputGroupValue<'ast>) -> Self {
- let ast_x = ast_group.value.x;
- let ast_y = ast_group.value.y;
+ fn from(ast_group: InputGroupValue) -> Self {
+ let span = Span::from(ast_group.span);
- Self {
- x: GroupCoordinate::from(ast_x),
- y: GroupCoordinate::from(ast_y),
- span: Span::from(ast_group.span),
+ match ast_group.value {
+ InputGroupRepresentation::Single(number) => GroupValue::Single(number.to_string(), span),
+ InputGroupRepresentation::Tuple(tuple) => GroupValue::Tuple(GroupTuple::from(tuple)),
}
}
}
impl fmt::Display for GroupValue {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match self {
+ GroupValue::Single(string, _) => write!(f, "{}", string),
+ GroupValue::Tuple(tuple) => write!(f, "{}", tuple),
+ }
+ }
+}
+
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+pub struct GroupTuple {
+ pub x: GroupCoordinate,
+ pub y: GroupCoordinate,
+ pub span: Span,
+}
+
+impl<'ast> From> for GroupTuple {
+ fn from(ast_group: AstGroupTuple<'ast>) -> Self {
+ let ast_x = ast_group.x;
+ let ast_y = ast_group.y;
+
+ Self {
+ x: GroupCoordinate::from(ast_x),
+ y: GroupCoordinate::from(ast_y),
+ span: Span::from(ast_group.span),
+ }
+ }
+}
+
+impl<'ast> From> for GroupTuple {
+ fn from(ast_group: InputGroupTuple<'ast>) -> Self {
+ let ast_x = ast_group.x;
+ let ast_y = ast_group.y;
+
+ Self {
+ x: GroupCoordinate::from(ast_x),
+ y: GroupCoordinate::from(ast_y),
+ span: Span::from(ast_group.span),
+ }
+ }
+}
+
+impl fmt::Display for GroupTuple {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "({}, {})", self.x, self.y)
}
diff --git a/typed/src/groups/mod.rs b/typed/src/groups/mod.rs
index 98533d2893..d7746a5b86 100644
--- a/typed/src/groups/mod.rs
+++ b/typed/src/groups/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod group_coordinate;
pub use self::group_coordinate::*;
diff --git a/typed/src/imports/import.rs b/typed/src/imports/import.rs
index c049b60928..aeac7f0d3b 100644
--- a/typed/src/imports/import.rs
+++ b/typed/src/imports/import.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! The import type for a Leo program.
use crate::{Package, Span};
diff --git a/typed/src/imports/import_symbol.rs b/typed/src/imports/import_symbol.rs
index 2a5668b244..efaf600807 100644
--- a/typed/src/imports/import_symbol.rs
+++ b/typed/src/imports/import_symbol.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Identifier, Span};
use leo_ast::imports::ImportSymbol as AstImportSymbol;
diff --git a/typed/src/imports/mod.rs b/typed/src/imports/mod.rs
index 09c4d143f2..faffbb0afe 100644
--- a/typed/src/imports/mod.rs
+++ b/typed/src/imports/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod import;
pub use import::*;
diff --git a/typed/src/imports/package.rs b/typed/src/imports/package.rs
index 16776a2b97..d67cde967f 100644
--- a/typed/src/imports/package.rs
+++ b/typed/src/imports/package.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{common::Identifier, PackageAccess, Span};
use leo_ast::imports::Package as AstPackage;
diff --git a/typed/src/imports/package_access.rs b/typed/src/imports/package_access.rs
index d019b12534..437319f541 100644
--- a/typed/src/imports/package_access.rs
+++ b/typed/src/imports/package_access.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ImportSymbol, Package, Span};
use leo_ast::imports::PackageAccess as AstPackageAccess;
diff --git a/typed/src/input/input.rs b/typed/src/input/input.rs
index 8f1dd54bfc..0ed2bdbf1c 100644
--- a/typed/src/input/input.rs
+++ b/typed/src/input/input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{InputValue, MainInput, ProgramInput, ProgramState, Record, Registers, State, StateLeaf};
use leo_input::{
files::{File, TableOrSection},
diff --git a/typed/src/input/input_value.rs b/typed/src/input/input_value.rs
index 4d064e728c..ba2c4288bc 100644
--- a/typed/src/input/input_value.rs
+++ b/typed/src/input/input_value.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::GroupValue;
use leo_input::{
errors::InputParserError,
diff --git a/typed/src/input/macros.rs b/typed/src/input/macros.rs
index e8156f128c..565236ad30 100644
--- a/typed/src/input/macros.rs
+++ b/typed/src/input/macros.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_export]
macro_rules! input_section_impl {
($($name: ident), *) => ($(
diff --git a/typed/src/input/mod.rs b/typed/src/input/mod.rs
index 59838e374f..8dee75b92b 100644
--- a/typed/src/input/mod.rs
+++ b/typed/src/input/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
#[macro_use]
pub mod macros;
pub use macros::*;
diff --git a/typed/src/input/parameters/mod.rs b/typed/src/input/parameters/mod.rs
index cf55dbc6dd..c1ae3fad35 100644
--- a/typed/src/input/parameters/mod.rs
+++ b/typed/src/input/parameters/mod.rs
@@ -1,2 +1,18 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod parameter;
pub use parameter::*;
diff --git a/typed/src/input/parameters/parameter.rs b/typed/src/input/parameters/parameter.rs
index 931a293d65..709cd38daa 100644
--- a/typed/src/input/parameters/parameter.rs
+++ b/typed/src/input/parameters/parameter.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Identifier, Span, Type};
use leo_input::parameters::Parameter as AstParameter;
diff --git a/typed/src/input/program_input/main_input.rs b/typed/src/input/program_input/main_input.rs
index 42355f1b4b..61f7a3fc67 100644
--- a/typed/src/input/program_input/main_input.rs
+++ b/typed/src/input/program_input/main_input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::InputValue;
use leo_input::{definitions::Definition, InputParserError};
use std::collections::HashMap;
diff --git a/typed/src/input/program_input/mod.rs b/typed/src/input/program_input/mod.rs
index cf453d57d8..ee0af204ed 100644
--- a/typed/src/input/program_input/mod.rs
+++ b/typed/src/input/program_input/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod main_input;
pub use main_input::*;
diff --git a/typed/src/input/program_input/program_input.rs b/typed/src/input/program_input/program_input.rs
index 9734f51575..ba823d784c 100644
--- a/typed/src/input/program_input/program_input.rs
+++ b/typed/src/input/program_input/program_input.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{InputValue, MainInput, Registers};
use leo_input::{
sections::{Header, Section},
diff --git a/typed/src/input/program_input/registers.rs b/typed/src/input/program_input/registers.rs
index 29a5a5ad79..e3d7217d4c 100644
--- a/typed/src/input/program_input/registers.rs
+++ b/typed/src/input/program_input/registers.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{InputValue, Parameter};
use leo_input::{definitions::Definition, InputParserError};
diff --git a/typed/src/input/program_state/mod.rs b/typed/src/input/program_state/mod.rs
index cb46f6ba9c..a1f50fd915 100644
--- a/typed/src/input/program_state/mod.rs
+++ b/typed/src/input/program_state/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod private_state;
pub use private_state::*;
diff --git a/typed/src/input/program_state/private_state/mod.rs b/typed/src/input/program_state/private_state/mod.rs
index 2dafb8f530..39b3a4b8f3 100644
--- a/typed/src/input/program_state/private_state/mod.rs
+++ b/typed/src/input/program_state/private_state/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod private_state;
pub use private_state::*;
diff --git a/typed/src/input/program_state/private_state/private_state.rs b/typed/src/input/program_state/private_state/private_state.rs
index 600b7a5411..28ad9070ff 100644
--- a/typed/src/input/program_state/private_state/private_state.rs
+++ b/typed/src/input/program_state/private_state/private_state.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Record, StateLeaf};
use leo_input::{
sections::{Header, Section},
diff --git a/typed/src/input/program_state/private_state/record.rs b/typed/src/input/program_state/private_state/record.rs
index 2694bc6724..f2e1645449 100644
--- a/typed/src/input/program_state/private_state/record.rs
+++ b/typed/src/input/program_state/private_state/record.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{InputValue, Parameter};
use leo_input::{definitions::Definition, InputParserError};
diff --git a/typed/src/input/program_state/private_state/state_leaf.rs b/typed/src/input/program_state/private_state/state_leaf.rs
index 678bd5d2d3..e66c51f0ab 100644
--- a/typed/src/input/program_state/private_state/state_leaf.rs
+++ b/typed/src/input/program_state/private_state/state_leaf.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{InputValue, Parameter};
use leo_input::{definitions::Definition, InputParserError};
diff --git a/typed/src/input/program_state/program_state.rs b/typed/src/input/program_state/program_state.rs
index 74df026916..8e1fbf1309 100644
--- a/typed/src/input/program_state/program_state.rs
+++ b/typed/src/input/program_state/program_state.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{PrivateState, PublicState, Record, State, StateLeaf};
use leo_input::{
tables::{Table, Visibility},
diff --git a/typed/src/input/program_state/public_state/mod.rs b/typed/src/input/program_state/public_state/mod.rs
index 227bc30313..125d1ff5ac 100644
--- a/typed/src/input/program_state/public_state/mod.rs
+++ b/typed/src/input/program_state/public_state/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod public_state;
pub use public_state::*;
diff --git a/typed/src/input/program_state/public_state/public_state.rs b/typed/src/input/program_state/public_state/public_state.rs
index feb8675f2a..403eb48c89 100644
--- a/typed/src/input/program_state/public_state/public_state.rs
+++ b/typed/src/input/program_state/public_state/public_state.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::State;
use leo_input::{
sections::{Header, Section},
diff --git a/typed/src/input/program_state/public_state/state.rs b/typed/src/input/program_state/public_state/state.rs
index d9dd896256..e6afcb7d6e 100644
--- a/typed/src/input/program_state/public_state/state.rs
+++ b/typed/src/input/program_state/public_state/state.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{InputValue, Parameter};
use leo_input::{definitions::Definition, InputParserError};
diff --git a/typed/src/lib.rs b/typed/src/lib.rs
index 290550c657..5a02f4f98f 100644
--- a/typed/src/lib.rs
+++ b/typed/src/lib.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! A typed syntax tree is represented as a `Program` and consists of import, circuit, and function definitions.
//! Each defined type consists of typed statements and expressions.
@@ -10,6 +26,9 @@ pub use self::circuits::*;
pub mod common;
pub use self::common::*;
+pub mod console;
+pub use self::console::*;
+
pub mod errors;
pub use self::errors::*;
@@ -28,9 +47,6 @@ pub use self::imports::*;
pub mod input;
pub use self::input::*;
-pub mod macros;
-pub use self::macros::*;
-
pub mod program;
pub use self::program::*;
diff --git a/typed/src/macros/debug.rs b/typed/src/macros/debug.rs
deleted file mode 100644
index acda9bfed5..0000000000
--- a/typed/src/macros/debug.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-use leo_ast::macros::Debug as AstDebug;
-
-use serde::{Deserialize, Serialize};
-use std::fmt;
-
-#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct Debug {}
-
-impl<'ast> From> for Debug {
- fn from(_debug: AstDebug<'ast>) -> Self {
- Self {}
- }
-}
-
-impl fmt::Display for Debug {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "debug")
- }
-}
diff --git a/typed/src/macros/error_macro.rs b/typed/src/macros/error_macro.rs
deleted file mode 100644
index 54d92666ce..0000000000
--- a/typed/src/macros/error_macro.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-use leo_ast::macros::Error as AstError;
-
-use serde::{Deserialize, Serialize};
-use std::fmt;
-
-#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct ErrorMacro {}
-
-impl<'ast> From> for ErrorMacro {
- fn from(_error: AstError<'ast>) -> Self {
- Self {}
- }
-}
-
-impl fmt::Display for ErrorMacro {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "error")
- }
-}
diff --git a/typed/src/macros/formatted_container.rs b/typed/src/macros/formatted_container.rs
deleted file mode 100644
index 7be6537ac9..0000000000
--- a/typed/src/macros/formatted_container.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use crate::Span;
-use leo_ast::macros::FormattedContainer as AstFormattedContainer;
-
-use serde::{Deserialize, Serialize};
-use std::fmt;
-
-#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct FormattedContainer {
- pub span: Span,
-}
-
-impl<'ast> From> for FormattedContainer {
- fn from(container: AstFormattedContainer<'ast>) -> Self {
- Self {
- span: Span::from(container.span),
- }
- }
-}
-
-impl fmt::Display for FormattedContainer {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{{}}")
- }
-}
diff --git a/typed/src/macros/formatted_macro.rs b/typed/src/macros/formatted_macro.rs
deleted file mode 100644
index c66e118cf0..0000000000
--- a/typed/src/macros/formatted_macro.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-use crate::{FormattedString, MacroName, Span};
-use leo_ast::macros::FormattedMacro as AstFormattedMacro;
-
-use serde::{Deserialize, Serialize};
-use std::fmt;
-
-#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct FormattedMacro {
- pub name: MacroName,
- pub string: Option,
- pub span: Span,
-}
-
-impl<'ast> From> for FormattedMacro {
- fn from(formatted: AstFormattedMacro<'ast>) -> Self {
- Self {
- name: MacroName::from(formatted.name),
- string: formatted.string.map(|string| FormattedString::from(string)),
- span: Span::from(formatted.span),
- }
- }
-}
-
-impl fmt::Display for FormattedMacro {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(
- f,
- "{}!({});",
- self.name,
- self.string.as_ref().map(|s| s.to_string()).unwrap_or("".to_string()),
- )
- }
-}
diff --git a/typed/src/macros/formatted_parameter.rs b/typed/src/macros/formatted_parameter.rs
deleted file mode 100644
index baa192b8ba..0000000000
--- a/typed/src/macros/formatted_parameter.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-use crate::{Expression, Span};
-use leo_ast::macros::FormattedParameter as AstFormattedParameter;
-
-use serde::{Deserialize, Serialize};
-use std::fmt;
-
-#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct FormattedParameter {
- pub expression: Expression,
- pub span: Span,
-}
-
-impl<'ast> From> for FormattedParameter {
- fn from(parameter: AstFormattedParameter<'ast>) -> Self {
- Self {
- expression: Expression::from(parameter.expression),
- span: Span::from(parameter.span),
- }
- }
-}
-
-impl fmt::Display for FormattedParameter {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}", self.expression)
- }
-}
diff --git a/typed/src/macros/macro_name.rs b/typed/src/macros/macro_name.rs
deleted file mode 100644
index 89b8af041f..0000000000
--- a/typed/src/macros/macro_name.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-use crate::{Debug, ErrorMacro, Print};
-use leo_ast::macros::MacroName as AstMacroName;
-
-use serde::{Deserialize, Serialize};
-use std::fmt;
-
-#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub enum MacroName {
- Debug(Debug),
- Error(ErrorMacro),
- Print(Print),
-}
-
-impl<'ast> From> for MacroName {
- fn from(name: AstMacroName<'ast>) -> Self {
- match name {
- AstMacroName::Debug(debug) => MacroName::Debug(Debug::from(debug)),
- AstMacroName::Error(error) => MacroName::Error(ErrorMacro::from(error)),
- AstMacroName::Print(print_line) => MacroName::Print(Print::from(print_line)),
- }
- }
-}
-
-impl fmt::Display for MacroName {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match *self {
- MacroName::Debug(ref debug) => write!(f, "{}", debug),
- MacroName::Error(ref error) => write!(f, "{}", error),
- MacroName::Print(ref print_line) => write!(f, "{}", print_line),
- }
- }
-}
diff --git a/typed/src/macros/mod.rs b/typed/src/macros/mod.rs
deleted file mode 100644
index 9c636c29a0..0000000000
--- a/typed/src/macros/mod.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-pub mod debug;
-pub use debug::*;
-
-pub mod formatted_container;
-pub use formatted_container::*;
-
-pub mod error_macro;
-pub use error_macro::*;
-
-pub mod formatted_macro;
-pub use formatted_macro::*;
-
-pub mod formatted_string;
-pub use formatted_string::*;
-
-pub mod formatted_parameter;
-pub use formatted_parameter::*;
-
-pub mod macro_name;
-pub use macro_name::*;
-
-pub mod print;
-pub use print::*;
diff --git a/typed/src/macros/print.rs b/typed/src/macros/print.rs
deleted file mode 100644
index 950c8a0d35..0000000000
--- a/typed/src/macros/print.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-use leo_ast::macros::Print as AstPrint;
-
-use serde::{Deserialize, Serialize};
-use std::fmt;
-
-#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
-pub struct Print {}
-
-impl<'ast> From> for Print {
- fn from(_print: AstPrint<'ast>) -> Self {
- Self {}
- }
-}
-
-impl fmt::Display for Print {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "print")
- }
-}
diff --git a/typed/src/main.rs b/typed/src/main.rs
index 0ed3c23384..38b928785c 100644
--- a/typed/src/main.rs
+++ b/typed/src/main.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_ast::{LeoAst, ParserError};
use leo_typed::LeoTypedAst;
use std::{env, fs, path::Path};
diff --git a/typed/src/program.rs b/typed/src/program.rs
index abe5cb8bf0..8cc8b4f3ad 100644
--- a/typed/src/program.rs
+++ b/typed/src/program.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
//! A typed Leo program consists of import, circuit, and function definitions.
//! Each defined type consists of typed statements and expressions.
diff --git a/typed/src/statements/conditional_nested_or_end_statement.rs b/typed/src/statements/conditional_nested_or_end_statement.rs
index 9b2f01a6db..151ec816ac 100644
--- a/typed/src/statements/conditional_nested_or_end_statement.rs
+++ b/typed/src/statements/conditional_nested_or_end_statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ConditionalStatement, Statement};
use leo_ast::statements::ConditionalNestedOrEndStatement as AstConditionalNestedOrEndStatement;
diff --git a/typed/src/statements/conditional_statement.rs b/typed/src/statements/conditional_statement.rs
index 1e3d82316f..019e22f5ed 100644
--- a/typed/src/statements/conditional_statement.rs
+++ b/typed/src/statements/conditional_statement.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{ConditionalNestedOrEndStatement, Expression, Statement};
use leo_ast::statements::ConditionalStatement as AstConditionalStatement;
diff --git a/typed/src/statements/mod.rs b/typed/src/statements/mod.rs
index 8860efeb3f..8fcd2b997e 100644
--- a/typed/src/statements/mod.rs
+++ b/typed/src/statements/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod conditional_nested_or_end_statement;
pub use conditional_nested_or_end_statement::*;
diff --git a/typed/src/statements/statement.rs b/typed/src/statements/statement.rs
index edc6b4d944..b56defbc27 100644
--- a/typed/src/statements/statement.rs
+++ b/typed/src/statements/statement.rs
@@ -1,12 +1,28 @@
-use crate::{Assignee, ConditionalStatement, Declare, Expression, FormattedMacro, Identifier, Span, Variables};
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
+use crate::{Assignee, ConditionalStatement, ConsoleFunctionCall, Declare, Expression, Identifier, Span, Variables};
use leo_ast::{
+ console::ConsoleFunctionCall as AstConsoleFunctionCall,
operations::AssignOperation,
statements::{
AssignStatement,
DefinitionStatement,
ExpressionStatement,
ForStatement,
- MacroStatement,
ReturnStatement,
Statement as AstStatement,
},
@@ -23,8 +39,7 @@ pub enum Statement {
Assign(Assignee, Expression, Span),
Conditional(ConditionalStatement, Span),
Iteration(Identifier, Expression, Expression, Vec, Span),
- AssertEq(Expression, Expression, Span),
- Macro(FormattedMacro),
+ Console(ConsoleFunctionCall),
Expression(Expression, Span),
}
@@ -139,16 +154,9 @@ impl<'ast> From> for Statement {
}
}
-impl<'ast> From> for Statement {
- fn from(statement: MacroStatement<'ast>) -> Self {
- match statement {
- MacroStatement::AssertEq(assert_eq) => Statement::AssertEq(
- Expression::from(assert_eq.left),
- Expression::from(assert_eq.right),
- Span::from(assert_eq.span),
- ),
- MacroStatement::Formatted(formatted) => Statement::Macro(FormattedMacro::from(formatted)),
- }
+impl<'ast> From> for Statement {
+ fn from(function_call: AstConsoleFunctionCall<'ast>) -> Self {
+ Statement::Console(ConsoleFunctionCall::from(function_call))
}
}
@@ -174,7 +182,7 @@ impl<'ast> From> for Statement {
Statement::Conditional(ConditionalStatement::from(statement), span)
}
AstStatement::Iteration(statement) => Statement::from(statement),
- AstStatement::Assert(statement) => Statement::from(statement),
+ AstStatement::Console(console) => Statement::from(console),
AstStatement::Expression(statement) => Statement::from(statement),
}
}
@@ -202,8 +210,7 @@ impl fmt::Display for Statement {
}
write!(f, "\t}}")
}
- Statement::AssertEq(ref left, ref right, ref _span) => write!(f, "assert_eq({}, {});", left, right),
- Statement::Macro(ref macro_) => write!(f, "{}", macro_),
+ Statement::Console(ref console) => write!(f, "{}", console),
Statement::Expression(ref expression, ref _span) => write!(f, "{};", expression),
}
}
diff --git a/typed/src/types/integer_type.rs b/typed/src/types/integer_type.rs
index 7323dac50a..e766c65168 100644
--- a/typed/src/types/integer_type.rs
+++ b/typed/src/types/integer_type.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_ast::types::{
IntegerType as AstIntegerType,
SignedIntegerType as AstSignedIntegerType,
diff --git a/typed/src/types/mod.rs b/typed/src/types/mod.rs
index 44962bfb67..9d9ca5aa82 100644
--- a/typed/src/types/mod.rs
+++ b/typed/src/types/mod.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
pub mod integer_type;
pub use integer_type::*;
diff --git a/typed/src/types/type_.rs b/typed/src/types/type_.rs
index ea7c9b2b19..e8688ebc9a 100644
--- a/typed/src/types/type_.rs
+++ b/typed/src/types/type_.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use crate::{Expression, Identifier, IntegerType};
use leo_ast::types::{ArrayType, CircuitType, DataType, TupleType, Type as AstType};
use leo_input::types::{
diff --git a/typed/tests/mod.rs b/typed/tests/mod.rs
index 1118e0b570..6698b5585a 100644
--- a/typed/tests/mod.rs
+++ b/typed/tests/mod.rs
@@ -1 +1,17 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
mod serialization;
diff --git a/typed/tests/serialization/json.rs b/typed/tests/serialization/json.rs
index bd985ae308..772e857a7a 100644
--- a/typed/tests/serialization/json.rs
+++ b/typed/tests/serialization/json.rs
@@ -1,3 +1,19 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
use leo_ast::LeoAst;
use leo_typed::LeoTypedAst;
diff --git a/typed/tests/serialization/mod.rs b/typed/tests/serialization/mod.rs
index cff0e9089e..19cc88a3bf 100644
--- a/typed/tests/serialization/mod.rs
+++ b/typed/tests/serialization/mod.rs
@@ -1 +1,17 @@
+// Copyright (C) 2019-2020 Aleo Systems Inc.
+// This file is part of the Leo library.
+
+// The Leo library is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// The Leo library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with the Leo library. If not, see .
+
mod json;