mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-27 02:24:15 +03:00
fix error spacing
This commit is contained in:
commit
c728fb4b19
@ -171,18 +171,18 @@ jobs:
|
||||
export LEO=/home/circleci/project/project/bin/leo
|
||||
./project/.circleci/leo-login-logout.sh
|
||||
|
||||
leo-clone:
|
||||
docker:
|
||||
- image: cimg/rust:1.51.0
|
||||
resource_class: xlarge
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: /home/circleci/project/
|
||||
- run:
|
||||
name: leo clone
|
||||
command: |
|
||||
export LEO=/home/circleci/project/project/bin/leo
|
||||
./project/.circleci/leo-clone.sh
|
||||
# leo-clone:
|
||||
# docker:
|
||||
# - image: cimg/rust:1.51.0
|
||||
# resource_class: xlarge
|
||||
# steps:
|
||||
# - attach_workspace:
|
||||
# at: /home/circleci/project/
|
||||
# - run:
|
||||
# name: leo clone
|
||||
# command: |
|
||||
# export LEO=/home/circleci/project/project/bin/leo
|
||||
# ./project/.circleci/leo-clone.sh
|
||||
|
||||
leo-publish:
|
||||
docker:
|
||||
@ -222,9 +222,9 @@ workflows:
|
||||
- leo-login-logout:
|
||||
requires:
|
||||
- leo-executable
|
||||
- leo-clone:
|
||||
requires:
|
||||
- leo-executable
|
||||
# - leo-clone:
|
||||
# requires:
|
||||
# - leo-executable
|
||||
- leo-publish:
|
||||
requires:
|
||||
- leo-executable
|
||||
|
@ -1,7 +1,15 @@
|
||||
# leo login & logout
|
||||
|
||||
$LEO new my-app && cd my-app || exit 1
|
||||
$LEO login -u "$ALEO_PM_USERNAME" -p "$ALEO_PM_PASSWORD"
|
||||
$LEO new my-app && cd my-app || exit 1
|
||||
|
||||
cat Leo.toml
|
||||
|
||||
# verify that in Leo.toml there's no line with [AUTHOR];
|
||||
# since CI does not allow showing credentials, we won't see it in the file;
|
||||
# so the only way to test is to make sure that there's just no [AUTHOR] there
|
||||
[[ $(cat Leo.toml | grep "\[AUTHOR\]" | wc -l) -eq 0 ]] || exit 1
|
||||
|
||||
$LEO add howard/silly-sudoku
|
||||
$LEO remove silly-sudoku
|
||||
$LEO logout
|
||||
|
@ -1,4 +1,9 @@
|
||||
$LEO new hello-world
|
||||
ls -la
|
||||
cd hello-world && ls -la
|
||||
|
||||
# verify that in Leo.toml there's a placeholder for author
|
||||
# because at the time of calling `leo new` user is not logged in
|
||||
[[ $(cat Leo.toml | grep "\[AUTHOR\]" | wc -l) -eq 1 ]] || exit 1
|
||||
|
||||
$LEO run
|
||||
|
0
.circleci/r
Normal file
0
.circleci/r
Normal file
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -4,9 +4,9 @@ version = 3
|
||||
|
||||
[[package]]
|
||||
name = "abnf"
|
||||
version = "0.10.2"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd8863e7db43447ad50376e19b0549343b72ad45cbd394b3fc8fe3ede961facc"
|
||||
checksum = "96e669320c520d87931e752d603dd442b4709c73b1b8b1fcba838f9c5acc1791"
|
||||
dependencies = [
|
||||
"abnf-core",
|
||||
"nom 6.1.2",
|
||||
@ -1738,9 +1738,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "4.0.15"
|
||||
version = "4.0.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd"
|
||||
checksum = "2599080e87c9bd051ddb11b10074f4da7b1223298df65d4c2ec5bcf309af1533"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"filetime",
|
||||
|
@ -111,7 +111,7 @@ version = "0.3.1"
|
||||
version = "1.4.0"
|
||||
|
||||
[dependencies.notify]
|
||||
version = "4.0.15"
|
||||
version = "4.0.16"
|
||||
|
||||
[dependencies.rand]
|
||||
version = "0.8"
|
||||
|
@ -92,7 +92,7 @@ impl<'a> MonoidalReducerStatement<'a, BoolAnd> for ReturnPathReducer {
|
||||
if_true.append(if_false.unwrap_or(BoolAnd(false)))
|
||||
}
|
||||
|
||||
fn reduce_formatted_string(&mut self, input: &FormattedString, parameters: Vec<BoolAnd>) -> BoolAnd {
|
||||
fn reduce_formatted_string(&mut self, input: &FormatString, parameters: Vec<BoolAnd>) -> BoolAnd {
|
||||
BoolAnd(false)
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ impl<'a> ExpressionNode<'a> for CallExpression<'a> {
|
||||
}
|
||||
|
||||
fn is_mut_ref(&self) -> bool {
|
||||
false
|
||||
true
|
||||
}
|
||||
|
||||
fn const_value(&self) -> Option<ConstValue> {
|
||||
|
@ -137,13 +137,6 @@ impl<'a> FromAst<'a, leo_ast::Identifier> for &'a Expression<'a> {
|
||||
expected_type: Option<PartialType<'a>>,
|
||||
) -> Result<&'a Expression<'a>, AsgConvertError> {
|
||||
let variable = if value.name.as_ref() == "input" {
|
||||
if let Some(function) = scope.resolve_current_function() {
|
||||
if !function.has_input {
|
||||
return Err(AsgConvertError::unresolved_reference(&value.name, &value.span));
|
||||
}
|
||||
} else {
|
||||
return Err(AsgConvertError::unresolved_reference(&value.name, &value.span));
|
||||
}
|
||||
if let Some(input) = scope.resolve_input() {
|
||||
input.container
|
||||
} else {
|
||||
|
@ -29,7 +29,7 @@ pub fn resolve_core_module<'a>(context: AsgContext<'a>, module: &str) -> Result<
|
||||
r#"
|
||||
circuit Blake2s {
|
||||
function hash(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] {
|
||||
return [0; 32]
|
||||
return [0; 32];
|
||||
}
|
||||
}
|
||||
"#,
|
||||
|
@ -47,7 +47,6 @@ pub struct Function<'a> {
|
||||
pub id: u32,
|
||||
pub name: RefCell<Identifier>,
|
||||
pub output: Type<'a>,
|
||||
pub has_input: bool,
|
||||
pub arguments: IndexMap<String, Cell<&'a Variable<'a>>>,
|
||||
pub circuit: Cell<Option<&'a Circuit<'a>>>,
|
||||
pub span: Option<Span>,
|
||||
@ -77,16 +76,12 @@ impl<'a> Function<'a> {
|
||||
.transpose()?
|
||||
.unwrap_or_else(|| Type::Tuple(vec![]));
|
||||
let mut qualifier = FunctionQualifier::Static;
|
||||
let mut has_input = false;
|
||||
let new_scope = scope.make_subscope();
|
||||
|
||||
let mut arguments = IndexMap::new();
|
||||
{
|
||||
for input in value.input.iter() {
|
||||
match input {
|
||||
FunctionInput::InputKeyword(_) => {
|
||||
has_input = true;
|
||||
}
|
||||
FunctionInput::SelfKeyword(_) => {
|
||||
qualifier = FunctionQualifier::SelfRef;
|
||||
}
|
||||
@ -125,7 +120,6 @@ impl<'a> Function<'a> {
|
||||
id: scope.context.get_id(),
|
||||
name: RefCell::new(value.identifier.clone()),
|
||||
output,
|
||||
has_input,
|
||||
arguments,
|
||||
circuit: Cell::new(None),
|
||||
body: Cell::new(None),
|
||||
|
@ -225,7 +225,7 @@ impl<'a, T: Monoid, R: MonoidalReducerStatement<'a, T>> MonoidalDirector<'a, T,
|
||||
.reduce_conditional_statement(input, condition, if_true, if_false)
|
||||
}
|
||||
|
||||
pub fn reduce_formatted_string(&mut self, input: &FormattedString<'a>) -> T {
|
||||
pub fn reduce_formatted_string(&mut self, input: &FormatString<'a>) -> T {
|
||||
let parameters = input
|
||||
.parameters
|
||||
.iter()
|
||||
|
@ -118,7 +118,7 @@ pub trait MonoidalReducerStatement<'a, T: Monoid>: MonoidalReducerExpression<'a,
|
||||
condition.append(if_true).append_option(if_false)
|
||||
}
|
||||
|
||||
fn reduce_formatted_string(&mut self, input: &FormattedString<'a>, parameters: Vec<T>) -> T {
|
||||
fn reduce_formatted_string(&mut self, input: &FormatString<'a>, parameters: Vec<T>) -> T {
|
||||
T::default().append_all(parameters.into_iter())
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ impl<'a, R: ReconstructingReducerStatement<'a>> ReconstructingDirector<'a, R> {
|
||||
.reduce_conditional_statement(input, condition, if_true, if_false)
|
||||
}
|
||||
|
||||
pub fn reduce_formatted_string(&mut self, input: FormattedString<'a>) -> FormattedString<'a> {
|
||||
pub fn reduce_formatted_string(&mut self, input: FormatString<'a>) -> FormatString<'a> {
|
||||
let parameters = input
|
||||
.parameters
|
||||
.iter()
|
||||
|
@ -274,10 +274,10 @@ pub trait ReconstructingReducerStatement<'a>: ReconstructingReducerExpression<'a
|
||||
|
||||
fn reduce_formatted_string(
|
||||
&mut self,
|
||||
input: FormattedString<'a>,
|
||||
input: FormatString<'a>,
|
||||
parameters: Vec<&'a Expression<'a>>,
|
||||
) -> FormattedString<'a> {
|
||||
FormattedString {
|
||||
) -> FormatString<'a> {
|
||||
FormatString {
|
||||
span: input.span,
|
||||
parts: input.parts,
|
||||
parameters: parameters.into_iter().map(Cell::new).collect(),
|
||||
@ -293,7 +293,7 @@ pub trait ReconstructingReducerStatement<'a>: ReconstructingReducerExpression<'a
|
||||
})
|
||||
}
|
||||
|
||||
fn reduce_console_log(&mut self, input: ConsoleStatement<'a>, argument: FormattedString<'a>) -> Statement<'a> {
|
||||
fn reduce_console_log(&mut self, input: ConsoleStatement<'a>, argument: FormatString<'a>) -> Statement<'a> {
|
||||
assert!(!matches!(input.function, ConsoleFunction::Assert(_)));
|
||||
Statement::Console(ConsoleStatement {
|
||||
parent: input.parent,
|
||||
|
@ -120,7 +120,7 @@ pub trait StatementVisitor<'a>: ExpressionVisitor<'a> {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
fn visit_formatted_string(&mut self, input: &FormattedString<'a>) -> VisitResult {
|
||||
fn visit_formatted_string(&mut self, input: &FormatString<'a>) -> VisitResult {
|
||||
Default::default()
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ impl<'a, R: StatementVisitor<'a>> VisitorDirector<'a, R> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn visit_formatted_string(&mut self, input: &FormattedString<'a>) -> ConcreteVisitResult {
|
||||
pub fn visit_formatted_string(&mut self, input: &FormatString<'a>) -> ConcreteVisitResult {
|
||||
match self.visitor.visit_formatted_string(input) {
|
||||
VisitResult::VisitChildren => {
|
||||
for parameter in input.parameters.iter() {
|
||||
|
@ -70,13 +70,6 @@ impl<'a> FromAst<'a, leo_ast::AssignStatement> for &'a Statement<'a> {
|
||||
let (name, span) = (&statement.assignee.identifier.name, &statement.assignee.identifier.span);
|
||||
|
||||
let variable = if name.as_ref() == "input" {
|
||||
if let Some(function) = scope.resolve_current_function() {
|
||||
if !function.has_input {
|
||||
return Err(AsgConvertError::unresolved_reference(name, &span));
|
||||
}
|
||||
} else {
|
||||
return Err(AsgConvertError::unresolved_reference(name, &span));
|
||||
}
|
||||
if let Some(input) = scope.resolve_input() {
|
||||
input.container
|
||||
} else {
|
||||
|
@ -15,14 +15,14 @@
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{AsgConvertError, Expression, FromAst, Node, PartialType, Scope, Span, Statement, Type};
|
||||
use leo_ast::{ConsoleFunction as AstConsoleFunction, FormattedStringPart};
|
||||
use leo_ast::{ConsoleFunction as AstConsoleFunction, FormatStringPart};
|
||||
|
||||
use std::cell::Cell;
|
||||
|
||||
// TODO (protryon): Refactor to not require/depend on span
|
||||
#[derive(Clone)]
|
||||
pub struct FormattedString<'a> {
|
||||
pub parts: Vec<FormattedStringPart>,
|
||||
pub struct FormatString<'a> {
|
||||
pub parts: Vec<FormatStringPart>,
|
||||
pub parameters: Vec<Cell<&'a Expression<'a>>>,
|
||||
pub span: Span,
|
||||
}
|
||||
@ -30,9 +30,9 @@ pub struct FormattedString<'a> {
|
||||
#[derive(Clone)]
|
||||
pub enum ConsoleFunction<'a> {
|
||||
Assert(Cell<&'a Expression<'a>>),
|
||||
Debug(FormattedString<'a>),
|
||||
Error(FormattedString<'a>),
|
||||
Log(FormattedString<'a>),
|
||||
Debug(FormatString<'a>),
|
||||
Error(FormatString<'a>),
|
||||
Log(FormatString<'a>),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@ -48,16 +48,16 @@ impl<'a> Node for ConsoleStatement<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> {
|
||||
impl<'a> FromAst<'a, leo_ast::FormatString> for FormatString<'a> {
|
||||
fn from_ast(
|
||||
scope: &'a Scope<'a>,
|
||||
value: &leo_ast::FormattedString,
|
||||
value: &leo_ast::FormatString,
|
||||
_expected_type: Option<PartialType<'a>>,
|
||||
) -> Result<Self, AsgConvertError> {
|
||||
let expected_param_len = value
|
||||
.parts
|
||||
.iter()
|
||||
.filter(|x| matches!(x, FormattedStringPart::Container))
|
||||
.filter(|x| matches!(x, FormatStringPart::Container))
|
||||
.count();
|
||||
if value.parameters.len() != expected_param_len {
|
||||
// + 1 for formatting string as to not confuse user
|
||||
@ -71,7 +71,7 @@ impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> {
|
||||
for parameter in value.parameters.iter() {
|
||||
parameters.push(Cell::new(<&Expression<'a>>::from_ast(scope, parameter, None)?));
|
||||
}
|
||||
Ok(FormattedString {
|
||||
Ok(FormatString {
|
||||
parts: value.parts.clone(),
|
||||
parameters,
|
||||
span: value.span.clone(),
|
||||
@ -79,9 +79,9 @@ impl<'a> FromAst<'a, leo_ast::FormattedString> for FormattedString<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Into<leo_ast::FormattedString> for &FormattedString<'a> {
|
||||
fn into(self) -> leo_ast::FormattedString {
|
||||
leo_ast::FormattedString {
|
||||
impl<'a> Into<leo_ast::FormatString> for &FormatString<'a> {
|
||||
fn into(self) -> leo_ast::FormatString {
|
||||
leo_ast::FormatString {
|
||||
parts: self.parts.clone(),
|
||||
parameters: self.parameters.iter().map(|e| e.get().into()).collect(),
|
||||
span: self.span.clone(),
|
||||
@ -103,13 +103,13 @@ impl<'a> FromAst<'a, leo_ast::ConsoleStatement> for ConsoleStatement<'a> {
|
||||
<&Expression<'a>>::from_ast(scope, expression, Some(Type::Boolean.into()))?,
|
||||
)),
|
||||
AstConsoleFunction::Debug(formatted_string) => {
|
||||
ConsoleFunction::Debug(FormattedString::from_ast(scope, formatted_string, None)?)
|
||||
ConsoleFunction::Debug(FormatString::from_ast(scope, formatted_string, None)?)
|
||||
}
|
||||
AstConsoleFunction::Error(formatted_string) => {
|
||||
ConsoleFunction::Error(FormattedString::from_ast(scope, formatted_string, None)?)
|
||||
ConsoleFunction::Error(FormatString::from_ast(scope, formatted_string, None)?)
|
||||
}
|
||||
AstConsoleFunction::Log(formatted_string) => {
|
||||
ConsoleFunction::Log(FormattedString::from_ast(scope, formatted_string, None)?)
|
||||
ConsoleFunction::Log(FormatString::from_ast(scope, formatted_string, None)?)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
@ -54,7 +54,7 @@ impl<'a> FromAst<'a, leo_ast::IterationStatement> for &'a Statement<'a> {
|
||||
statement: &leo_ast::IterationStatement,
|
||||
_expected_type: Option<PartialType<'a>>,
|
||||
) -> Result<Self, AsgConvertError> {
|
||||
let expected_index_type = Some(PartialType::Integer(None, Some(IntegerType::U32)));
|
||||
let expected_index_type = Some(PartialType::Integer(Some(IntegerType::U32), None));
|
||||
let start = <&Expression<'a>>::from_ast(scope, &statement.start, expected_index_type.clone())?;
|
||||
let stop = <&Expression<'a>>::from_ast(scope, &statement.stop, expected_index_type)?;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ fn test_mut_member_function_fail() {
|
||||
let program_string = r#"
|
||||
circuit Foo {
|
||||
function echo(mut self, x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
f: u32,
|
||||
|
||||
function bar() -> u32 {
|
||||
return f
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function bar() -> u32 {
|
||||
return self.f
|
||||
return self.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
function main () -> i8 {
|
||||
if true {
|
||||
return 1i8 //ignored
|
||||
return 1i8; //ignored
|
||||
}
|
||||
return 2i8 //ignored
|
||||
return 3i8 //returns
|
||||
return 2i8; //ignored
|
||||
return 3i8; //returns
|
||||
}
|
@ -2,8 +2,8 @@ function main () -> u16 {
|
||||
if false {
|
||||
const a = 1u16;
|
||||
const b = a + 1u16;
|
||||
return b
|
||||
return b;
|
||||
} else if false {
|
||||
return 0u16
|
||||
return 0u16;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
function main(input) -> u32 {
|
||||
if input.registers.a == 0 {
|
||||
return 0u32
|
||||
return 0u32;
|
||||
} else {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function foo() -> field {
|
||||
return myGlobal
|
||||
return myGlobal;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main() -> (bool, bool) {
|
||||
return true
|
||||
return true;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
function main() {
|
||||
const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
||||
console.assert(address_1 == address_2);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function main(owner: address) {
|
||||
const sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const sender = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
||||
console.assert(owner == sender);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
function main(s: bool, c: address) {
|
||||
const a = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const b = address(aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r);
|
||||
const a = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
const b = aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r;
|
||||
|
||||
const r = s? a: b;
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main(input) -> [u8; 3] {
|
||||
return input.registers.r
|
||||
function main() -> [u8; 3] {
|
||||
return input.registers.r;
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main(input) -> bool {
|
||||
return input.registers.r
|
||||
function main() -> bool {
|
||||
return input.registers.r;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(self, x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,11 @@ circuit Foo {
|
||||
x: u32,
|
||||
|
||||
function add_x(self, y: u32) -> u32 {
|
||||
return self.x + y
|
||||
return self.x + y;
|
||||
}
|
||||
|
||||
function call_add_x(self, y: u32) -> u32 {
|
||||
return self.add_x(y)
|
||||
return self.add_x(y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
foo: u32,
|
||||
|
||||
function bar() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ fn test_mut_member_function() {
|
||||
let program_string = r#"
|
||||
circuit Foo {
|
||||
function echo(mut self, x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit PedersenHash {
|
||||
parameters: [u32; 512]
|
||||
|
||||
function new(parameters: [u32; 512]) -> Self {
|
||||
return Self { parameters: parameters }
|
||||
return Self { parameters: parameters };
|
||||
}
|
||||
|
||||
function hash(self, bits: [bool; 512]) -> u32 {
|
||||
@ -11,7 +11,7 @@ circuit PedersenHash {
|
||||
const base = bits[i] ? self.parameters[i] : 0u32;
|
||||
digest += base;
|
||||
}
|
||||
return digest
|
||||
return digest;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
static function new() -> Self {
|
||||
return Self { }
|
||||
return Self { };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
f: u32,
|
||||
|
||||
function bar(self) -> u32 {
|
||||
return self.f
|
||||
return self.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import core.unstable.blake2s.Blake2s;
|
||||
|
||||
function main(seed: [u8; 32], message: [u8; 32]) -> [u8; 32] {
|
||||
return Blake2s::hash(seed, message)
|
||||
return Blake2s::hash(seed, message);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ fn test_function_rename() {
|
||||
a += 1;
|
||||
}
|
||||
|
||||
return a
|
||||
return a;
|
||||
}
|
||||
|
||||
function main() {
|
||||
@ -63,7 +63,7 @@ fn test_imports() {
|
||||
}
|
||||
|
||||
function foo() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
"#;
|
||||
imports
|
||||
|
@ -1,5 +1,5 @@
|
||||
function one() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -5,7 +5,7 @@ function iteration() -> u32 {
|
||||
a += 1;
|
||||
}
|
||||
|
||||
return a
|
||||
return a;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -32,7 +32,7 @@ fn test_iteration() {
|
||||
fn test_const_args() {
|
||||
let program_string = r#"
|
||||
function one(const value: u32) -> u32 {
|
||||
return value + 1
|
||||
return value + 1;
|
||||
}
|
||||
|
||||
function main() {
|
||||
@ -52,7 +52,7 @@ fn test_const_args() {
|
||||
fn test_const_args_used() {
|
||||
let program_string = r#"
|
||||
function index(arr: [u8; 3], const value: u32) -> u8 {
|
||||
return arr[value]
|
||||
return arr[value];
|
||||
}
|
||||
|
||||
function main() {
|
||||
@ -73,7 +73,7 @@ fn test_const_args_used() {
|
||||
fn test_const_args_fail() {
|
||||
let program_string = r#"
|
||||
function index(arr: [u8; 3], const value: u32) -> u8 {
|
||||
return arr[value]
|
||||
return arr[value];
|
||||
}
|
||||
|
||||
function main(x_value: u32) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
function tuple() -> (bool, bool) {
|
||||
return (true, false)
|
||||
return (true, false);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main(input) -> (bool, bool) {
|
||||
return (input.registers.a, input.registers.b)
|
||||
function main() -> (bool, bool) {
|
||||
return (input.registers.a, input.registers.b);
|
||||
}
|
@ -5,5 +5,5 @@ function main(
|
||||
u32,
|
||||
u32,
|
||||
) {
|
||||
return (a, b)
|
||||
return (a, b);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function one() -> bool {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
function one() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,9 +1,9 @@
|
||||
function array_3x2_nested() -> [[u8; 2]; 3] {
|
||||
return [[0u8; 2]; 3]
|
||||
return [[0u8; 2]; 3];
|
||||
}
|
||||
|
||||
function array_3x2_tuple() -> [[u8; 2]; 3] {
|
||||
return [0u8; (3, 2)]
|
||||
return [0u8; (3, 2)];
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,9 +1,9 @@
|
||||
function array_3x2_nested() -> [u8; (3, 2)] {
|
||||
return [[0u8; 2]; 3]
|
||||
return [[0u8; 2]; 3];
|
||||
}
|
||||
|
||||
function array_3x2_tuple() -> [u8; (3, 2)] {
|
||||
return [0u8; (3, 2)]
|
||||
return [0u8; (3, 2)];
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -3,7 +3,7 @@ function tuples() -> ((u8, u8), u32) {
|
||||
const a: (u8, u8) = (1, 2);
|
||||
const b: u32 = 3;
|
||||
|
||||
return (a, b)
|
||||
return (a, b);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -4,9 +4,9 @@ function tuple_conditional () -> (
|
||||
i64
|
||||
) {
|
||||
if true {
|
||||
return (1, 1)
|
||||
return (1, 1);
|
||||
} else {
|
||||
return (2, 2)
|
||||
return (2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,5 +4,5 @@ circuit Point {
|
||||
}
|
||||
|
||||
function foo() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
function main(input, data: [u8; 32]) {
|
||||
function main(data: [u8; 32]) {
|
||||
console.assert(input.registers.value_balance == 0u64);
|
||||
|
||||
console.assert(input.state.leaf_index == 0u32);
|
||||
|
@ -1,4 +1,4 @@
|
||||
function main(input) {
|
||||
function main() {
|
||||
console.assert(input.state.root == [0u8; 32]);
|
||||
|
||||
const expected: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main(input) {
|
||||
function main() {
|
||||
console.assert(input.state.root == [0u8; 32]);
|
||||
}
|
@ -3,7 +3,7 @@ function swap(a: [u32; 2], const i: u32, const j: u32) -> [u32; 2] {
|
||||
const t = a[i];
|
||||
a[i] = a[j];
|
||||
a[j] = t;
|
||||
return a
|
||||
return a;
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
function main(input) -> u32 {
|
||||
function main() -> u32 {
|
||||
if input.registers.a == 0u32 {
|
||||
return 0u32
|
||||
return 0u32;
|
||||
} else {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function foo() -> (bool, bool) {
|
||||
return (true, false)
|
||||
return (true, false);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
function foo() -> (bool, bool) {
|
||||
return (true, false)
|
||||
return (true, false);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
function foo() -> (bool, bool) {
|
||||
return (true, false)
|
||||
return (true, false);
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
@ -1,44 +0,0 @@
|
||||
// Copyright (C) 2019-2021 Aleo Systems Inc.
|
||||
// This file is part of the Leo library.
|
||||
|
||||
// The Leo library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// The Leo library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Identifier, Node, Span};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
|
||||
/// The `input` keyword can view program register, record, and state values.
|
||||
/// Values cannot be modified. The `input` keyword cannot be made mutable.
|
||||
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
|
||||
#[serde(transparent)]
|
||||
pub struct InputKeyword {
|
||||
pub identifier: Identifier,
|
||||
}
|
||||
|
||||
impl fmt::Display for InputKeyword {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "input")
|
||||
}
|
||||
}
|
||||
|
||||
impl Node for InputKeyword {
|
||||
fn span(&self) -> &Span {
|
||||
&self.identifier.span
|
||||
}
|
||||
|
||||
fn set_span(&mut self, span: Span) {
|
||||
self.identifier.span = span;
|
||||
}
|
||||
}
|
@ -23,9 +23,6 @@ pub use const_self_keyword::*;
|
||||
pub mod identifier;
|
||||
pub use identifier::*;
|
||||
|
||||
pub mod input_keyword;
|
||||
pub use input_keyword::*;
|
||||
|
||||
pub mod mut_self_keyword;
|
||||
pub use mut_self_keyword::*;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{ConstSelfKeyword, FunctionInputVariable, InputKeyword, MutSelfKeyword, Node, SelfKeyword, Span};
|
||||
use crate::{ConstSelfKeyword, FunctionInputVariable, MutSelfKeyword, Node, SelfKeyword, Span};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
@ -22,7 +22,6 @@ use std::fmt;
|
||||
/// Enumerates the possible inputs to a function.
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub enum FunctionInput {
|
||||
InputKeyword(InputKeyword),
|
||||
SelfKeyword(SelfKeyword),
|
||||
ConstSelfKeyword(ConstSelfKeyword),
|
||||
MutSelfKeyword(MutSelfKeyword),
|
||||
@ -36,7 +35,6 @@ impl FunctionInput {
|
||||
///
|
||||
pub fn is_self(&self) -> bool {
|
||||
match self {
|
||||
FunctionInput::InputKeyword(_) => false,
|
||||
FunctionInput::SelfKeyword(_) => true,
|
||||
FunctionInput::ConstSelfKeyword(_) => true,
|
||||
FunctionInput::MutSelfKeyword(_) => true,
|
||||
@ -50,7 +48,6 @@ impl FunctionInput {
|
||||
///
|
||||
pub fn is_const_self(&self) -> bool {
|
||||
match self {
|
||||
FunctionInput::InputKeyword(_) => false,
|
||||
FunctionInput::SelfKeyword(_) => false,
|
||||
FunctionInput::ConstSelfKeyword(_) => true,
|
||||
FunctionInput::MutSelfKeyword(_) => false,
|
||||
@ -64,7 +61,6 @@ impl FunctionInput {
|
||||
///
|
||||
pub fn is_mut_self(&self) -> bool {
|
||||
match self {
|
||||
FunctionInput::InputKeyword(_) => false,
|
||||
FunctionInput::SelfKeyword(_) => false,
|
||||
FunctionInput::ConstSelfKeyword(_) => false,
|
||||
FunctionInput::MutSelfKeyword(_) => true,
|
||||
@ -74,7 +70,6 @@ impl FunctionInput {
|
||||
|
||||
fn format(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
FunctionInput::InputKeyword(keyword) => write!(f, "{}", keyword),
|
||||
FunctionInput::SelfKeyword(keyword) => write!(f, "{}", keyword),
|
||||
FunctionInput::ConstSelfKeyword(keyword) => write!(f, "{}", keyword),
|
||||
FunctionInput::MutSelfKeyword(keyword) => write!(f, "{}", keyword),
|
||||
@ -99,7 +94,6 @@ impl PartialEq for FunctionInput {
|
||||
/// Returns true if `self == other`. Does not compare spans.
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(FunctionInput::InputKeyword(_), FunctionInput::InputKeyword(_)) => true,
|
||||
(FunctionInput::SelfKeyword(_), FunctionInput::SelfKeyword(_)) => true,
|
||||
(FunctionInput::ConstSelfKeyword(_), FunctionInput::ConstSelfKeyword(_)) => true,
|
||||
(FunctionInput::MutSelfKeyword(_), FunctionInput::MutSelfKeyword(_)) => true,
|
||||
@ -115,7 +109,6 @@ impl Node for FunctionInput {
|
||||
fn span(&self) -> &Span {
|
||||
use FunctionInput::*;
|
||||
match self {
|
||||
InputKeyword(keyword) => &keyword.identifier.span,
|
||||
SelfKeyword(keyword) => &keyword.identifier.span,
|
||||
ConstSelfKeyword(keyword) => &keyword.identifier.span,
|
||||
MutSelfKeyword(keyword) => &keyword.identifier.span,
|
||||
@ -126,7 +119,6 @@ impl Node for FunctionInput {
|
||||
fn set_span(&mut self, span: Span) {
|
||||
use FunctionInput::*;
|
||||
match self {
|
||||
InputKeyword(keyword) => keyword.identifier.span = span,
|
||||
SelfKeyword(keyword) => keyword.identifier.span = span,
|
||||
ConstSelfKeyword(keyword) => keyword.identifier.span = span,
|
||||
MutSelfKeyword(keyword) => keyword.identifier.span = span,
|
||||
|
@ -324,7 +324,7 @@ impl Canonicalizer {
|
||||
.map(|parameter| self.canonicalize_expression(parameter))
|
||||
.collect();
|
||||
|
||||
let formatted = FormattedString {
|
||||
let formatted = FormatString {
|
||||
parts: format.parts.clone(),
|
||||
parameters,
|
||||
span: format.span.clone(),
|
||||
|
@ -418,7 +418,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
|
||||
parameters.push(self.reduce_expression(parameter)?);
|
||||
}
|
||||
|
||||
let formatted = FormattedString {
|
||||
let formatted = FormatString {
|
||||
parts: format.parts.clone(),
|
||||
parameters,
|
||||
span: format.span.clone(),
|
||||
|
@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{Expression, FormattedString, Node, Span};
|
||||
use crate::{Expression, FormatString, Node, Span};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
@ -22,9 +22,9 @@ use std::fmt;
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
pub enum ConsoleFunction {
|
||||
Assert(Expression),
|
||||
Debug(FormattedString),
|
||||
Error(FormattedString),
|
||||
Log(FormattedString),
|
||||
Debug(FormatString),
|
||||
Error(FormatString),
|
||||
Log(FormatString),
|
||||
}
|
||||
|
||||
impl fmt::Display for ConsoleFunction {
|
||||
|
@ -21,19 +21,19 @@ use std::fmt;
|
||||
use tendril::StrTendril;
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
pub enum FormattedStringPart {
|
||||
pub enum FormatStringPart {
|
||||
Const(#[serde(with = "crate::common::tendril_json")] StrTendril),
|
||||
Container,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||
pub struct FormattedString {
|
||||
pub parts: Vec<FormattedStringPart>,
|
||||
pub struct FormatString {
|
||||
pub parts: Vec<FormatStringPart>,
|
||||
pub parameters: Vec<Expression>,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl fmt::Display for FormattedString {
|
||||
impl fmt::Display for FormatString {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
@ -41,8 +41,8 @@ impl fmt::Display for FormattedString {
|
||||
self.parts
|
||||
.iter()
|
||||
.map(|x| match x {
|
||||
FormattedStringPart::Const(x) => x,
|
||||
FormattedStringPart::Container => "{}",
|
||||
FormatStringPart::Const(x) => x,
|
||||
FormatStringPart::Container => "{}",
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("")
|
||||
@ -50,7 +50,7 @@ impl fmt::Display for FormattedString {
|
||||
}
|
||||
}
|
||||
|
||||
impl Node for FormattedString {
|
||||
impl Node for FormatString {
|
||||
fn span(&self) -> &Span {
|
||||
&self.span
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
//! Evaluates a formatted string in a compiled Leo program.
|
||||
|
||||
use crate::{errors::ConsoleError, program::ConstrainedProgram, GroupType};
|
||||
use leo_asg::FormattedString;
|
||||
use leo_ast::FormattedStringPart;
|
||||
use leo_asg::FormatString;
|
||||
use leo_ast::FormatStringPart;
|
||||
use snarkvm_fields::PrimeField;
|
||||
use snarkvm_r1cs::ConstraintSystem;
|
||||
|
||||
@ -26,13 +26,13 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
pub fn format<CS: ConstraintSystem<F>>(
|
||||
&mut self,
|
||||
cs: &mut CS,
|
||||
formatted: &FormattedString<'a>,
|
||||
formatted: &FormatString<'a>,
|
||||
) -> Result<String, ConsoleError> {
|
||||
// Check that containers and parameters match
|
||||
let container_count = formatted
|
||||
.parts
|
||||
.iter()
|
||||
.filter(|x| matches!(x, FormattedStringPart::Container))
|
||||
.filter(|x| matches!(x, FormatStringPart::Container))
|
||||
.count();
|
||||
if container_count != formatted.parameters.len() {
|
||||
return Err(ConsoleError::length(
|
||||
@ -51,8 +51,8 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
let mut parameters = executed_containers.iter();
|
||||
for part in formatted.parts.iter() {
|
||||
match part {
|
||||
FormattedStringPart::Const(c) => out.push(&**c),
|
||||
FormattedStringPart::Container => out.push(&**parameters.next().unwrap()),
|
||||
FormatStringPart::Const(c) => out.push(&**c),
|
||||
FormatStringPart::Container => out.push(&**parameters.next().unwrap()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,13 +35,9 @@ impl<'a, F: PrimeField, G: GroupType<F>> ConstrainedProgram<'a, F, G> {
|
||||
let registers = input.get_registers();
|
||||
|
||||
// Iterate over main function input variables and allocate new values
|
||||
if function.has_input {
|
||||
// let input_var = function.scope.
|
||||
let asg_input = function
|
||||
.scope
|
||||
.resolve_input()
|
||||
.expect("no input variable in scope when function is qualified");
|
||||
let asg_input = function.scope.resolve_input();
|
||||
|
||||
if let Some(asg_input) = asg_input {
|
||||
let value =
|
||||
self.allocate_input_keyword(cs, &function.name.borrow().span, &asg_input.container_circuit, input)?;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
function main() {
|
||||
const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9);
|
||||
const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j9;
|
||||
|
||||
console.assert(address_1 == address_2);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
function main() {
|
||||
const address_1 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const address_2 = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const address_1 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
const address_2 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
||||
console.assert(address_1 == address_2);
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
function main(owner: address) {
|
||||
const sender = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const sender = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
|
||||
console.assert(owner == sender);
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88);
|
||||
const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j88;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
function main(s: bool, c: address) {
|
||||
const a = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const b = address(aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r);
|
||||
const a = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
const b = aleo18qgam03qe483tdrcc3fkqwpp38ehff4a2xma6lu7hams6lfpgcpq3dq05r;
|
||||
|
||||
const r = s? a: b;
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
function main() {
|
||||
const public_key_string = address(aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8);
|
||||
const public_key_string = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main(input) -> [u8; 3] {
|
||||
return input.registers.r
|
||||
function main() -> [u8; 3] {
|
||||
return input.registers.r;
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
function main(input) -> bool {
|
||||
return input.registers.r
|
||||
function main() -> bool {
|
||||
return input.registers.r;
|
||||
}
|
@ -6,7 +6,7 @@ circuit Foo {
|
||||
x: 1u32
|
||||
};
|
||||
|
||||
return new
|
||||
return new;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ circuit Foo {
|
||||
x: 1u32
|
||||
};
|
||||
|
||||
return new
|
||||
return new;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ circuit Foo {
|
||||
|
||||
function z (mut self) -> u16 {
|
||||
self.y.0 += 1u8;
|
||||
return 1u16
|
||||
return 1u16;
|
||||
}
|
||||
}
|
||||
function main() {
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
a: u8,
|
||||
|
||||
function use_a(const self) -> u8 {
|
||||
return self.a + 1
|
||||
return self.a + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Bar {
|
||||
b2: u32
|
||||
|
||||
function add_five(z:u32) -> u32 {
|
||||
return z+5u32
|
||||
return z+5u32;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
x: u8
|
||||
|
||||
function new(x: u8) -> Self {
|
||||
return Self { x }
|
||||
return Self { x };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
x: u32,
|
||||
|
||||
function echo(self) -> u32 {
|
||||
return self.x
|
||||
return self.x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,11 +2,11 @@ circuit Foo {
|
||||
x: u32,
|
||||
|
||||
function add_x(self, y: u32) -> u32 {
|
||||
return self.x + y
|
||||
return self.x + y;
|
||||
}
|
||||
|
||||
function call_add_x(self, y: u32) -> u32 {
|
||||
return self.add_x(y)
|
||||
return self.add_x(y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
circuit Foo {
|
||||
function echo(x: u32) -> u32 {
|
||||
return x
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ circuit Foo {
|
||||
foo: u32,
|
||||
|
||||
function bar() -> u32 {
|
||||
return 1u32
|
||||
return 1u32;
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user