From 0d0c59874846cd5b5913def1706c145fce14c8b2 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Mon, 30 Oct 2023 10:39:33 -0400 Subject: [PATCH] Update examples --- .circleci/test-examples.sh | 38 ++++++++++++------------ examples/message/inputs/message.in | 5 +++- examples/simple_token/inputs/transfer.in | 8 ++++- examples/tictactoe/inputs/tictactoe.in | 9 +++++- examples/vote/build/main.aleo | 12 +++----- examples/vote/inputs/agree.in | 6 +++- examples/vote/inputs/disagree.in | 6 +++- examples/vote/inputs/propose.in | 6 +++- 8 files changed, 57 insertions(+), 33 deletions(-) diff --git a/.circleci/test-examples.sh b/.circleci/test-examples.sh index 526152fcf6..5c9326db78 100755 --- a/.circleci/test-examples.sh +++ b/.circleci/test-examples.sh @@ -57,7 +57,7 @@ fi echo "Building and running the \`bubblesort\` program..." ( cd $EXAMPLES/bubblesort || exit - cat $EXAMPLES/bubblesort/inputs/bubblesort.in | xargs $LEO run bubble_sort || exit + $LEO run bubble_sort --file $EXAMPLES/bubblesort/inputs/bubblesort.in || exit ) # Check that the bubblesort program ran successfully. EXITCODE=$? @@ -70,7 +70,7 @@ fi echo "Building and running the \`core\` program..." ( cd $EXAMPLES/core || exit - cat $EXAMPLES/core/inputs/core.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/core/inputs/core.in || exit ) # Check that the core program ran successfully. EXITCODE=$? @@ -83,7 +83,7 @@ fi echo "Building and running the \`groups\` program..." ( cd $EXAMPLES/groups || exit - cat $EXAMPLES/groups/inputs/groups.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/groups/inputs/groups.in || exit ) # Check that the groups program ran successfully. EXITCODE=$? @@ -96,7 +96,7 @@ fi echo "Building and running the \`hackers-delight/ntzdebruijn\` program..." ( cd $EXAMPLES/hackers-delight/ntzdebruijn || exit - cat $EXAMPLES/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in || exit ) # Check that the hackers-delight/ntzdebruijn program ran successfully. EXITCODE=$? @@ -109,7 +109,7 @@ fi echo "Building and running the \`hackers-delight/ntzgaudet\` program..." ( cd $EXAMPLES/hackers-delight/ntzgaudet || exit - cat $EXAMPLES/hackers-delight/ntzgaudet/inputs/ntzgaudet.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzgaudet/inputs/ntzgaudet.in || exit ) # Check that the hackers-delight/ntzgaudet program ran successfully. EXITCODE=$? @@ -122,7 +122,7 @@ fi echo "Building and running the \`hackers-delight/ntzloops\` program..." ( cd $EXAMPLES/hackers-delight/ntzloops || exit - cat $EXAMPLES/hackers-delight/ntzloops/inputs/ntzloops.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzloops/inputs/ntzloops.in || exit ) # Check that the hackers-delight/ntzloops program ran successfully. EXITCODE=$? @@ -135,7 +135,7 @@ fi echo "Building and running the \`hackers-delight/ntzmasks\` program..." ( cd $EXAMPLES/hackers-delight/ntzmasks || exit - cat $EXAMPLES/hackers-delight/ntzmasks/inputs/ntzmasks.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzmasks/inputs/ntzmasks.in || exit ) # Check that the hackers-delight/ntzmasks program ran successfully. EXITCODE=$? @@ -148,7 +148,7 @@ fi echo "Building and running the \`hackers-delight/ntzreisers\` program..." ( cd $EXAMPLES/hackers-delight/ntzreisers || exit - cat $EXAMPLES/hackers-delight/ntzreisers/inputs/ntzreisers.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzreisers/inputs/ntzreisers.in || exit ) # Check that the hackers-delight/ntzreisers program ran successfully. EXITCODE=$? @@ -161,7 +161,7 @@ fi echo "Building and running the \`hackers-delight/ntzseals\` program..." ( cd $EXAMPLES/hackers-delight/ntzseals || exit - cat $EXAMPLES/hackers-delight/ntzseals/inputs/ntzseals.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzseals/inputs/ntzseals.in || exit ) # Check that the hackers-delight/ntzseals program ran successfully. EXITCODE=$? @@ -174,7 +174,7 @@ fi echo "Building and running the \`hackers-delight/ntzsearchtree\` program..." ( cd $EXAMPLES/hackers-delight/ntzsearchtree || exit - cat $EXAMPLES/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in || exit ) # Check that the hackers-delight/ntzsearchtree program ran successfully. EXITCODE=$? @@ -187,7 +187,7 @@ fi echo "Building and running the \`hackers-delight/ntzsmallvals\` program..." ( cd $EXAMPLES/hackers-delight/ntzsmallvals || exit - cat $EXAMPLES/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in || exit ) # Check that the hackers-delight/ntzsmallvals program ran successfully. EXITCODE=$? @@ -200,7 +200,7 @@ fi echo "Building and running the \`helloworld\` program..." ( cd $EXAMPLES/helloworld || exit - cat $EXAMPLES/helloworld/inputs/helloworld.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/helloworld/inputs/helloworld.in || exit ) # Check that the helloworld program ran successfully. EXITCODE=$? @@ -216,10 +216,10 @@ echo "Building and running the \`interest\` programs..." cd $EXAMPLES/interest || exit # Run the fixed period interest program. - cat $EXAMPLES/interest/inputs/fixed.in | xargs $LEO run fixed_iteration_interest || exit + $LEO run fixed_iteration_interest --file $EXAMPLES/interest/inputs/fixed.in || exit # Run the bounded period interest program. - cat $EXAMPLES/interest/inputs/bounded.in | xargs $LEO run bounded_iteration_interest || exit + $LEO run bounded_iteration_interest --file $EXAMPLES/interest/inputs/bounded.in || exit ) # Check that the interest programs ran successfully. EXITCODE=$? @@ -232,7 +232,7 @@ fi echo "Building and running the \`message\` program..." ( cd $EXAMPLES/message || exit - cat $EXAMPLES/message/inputs/message.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/message/inputs/message.in || exit ) # Check that the message program ran successfully. EXITCODE=$? @@ -246,7 +246,7 @@ echo "Building and running the \`tictactoe\` program..." ( cd $EXAMPLES/tictactoe || exit $LEO run new || exit - cat $EXAMPLES/tictactoe/inputs/tictactoe.in | xargs $LEO run make_move || exit + $LEO run make_move --file $EXAMPLES/tictactoe/inputs/tictactoe.in || exit chmod +x $EXAMPLES/tictactoe/run.sh || exit export -f leo @@ -265,10 +265,10 @@ echo "Building and running the \`simple_token\` programs..." cd $EXAMPLES/simple_token || exit # Run the mint program. - cat $EXAMPLES/simple_token/inputs/mint.in | xargs $LEO run mint || exit + $LEO run mint --file $EXAMPLES/simple_token/inputs/mint.in || exit # Run the transfer program. - cat $EXAMPLES/simple_token/inputs/transfer.in | xargs $LEO run transfer || exit + $LEO run transfer --file $EXAMPLES/simple_token/inputs/transfer.in || exit ) # Check that the simple token programs ran successfully. EXITCODE=$? @@ -297,7 +297,7 @@ fi echo "Building and running the \`twoadicity\` program..." ( cd $EXAMPLES/twoadicity || exit - cat $EXAMPLES/twoadicity/inputs/twoadicity.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/twoadicity/inputs/twoadicity.in || exit ) # Check that the two-adicity program ran successfully. EXITCODE=$? diff --git a/examples/message/inputs/message.in b/examples/message/inputs/message.in index c5c26e2850..1f0ce50e2e 100644 --- a/examples/message/inputs/message.in +++ b/examples/message/inputs/message.in @@ -1 +1,4 @@ -"{ first: 2field, second: 3field }" +{ + first: 2field, + second: 3field +} diff --git a/examples/simple_token/inputs/transfer.in b/examples/simple_token/inputs/transfer.in index a36dc2af97..d62ac71bac 100644 --- a/examples/simple_token/inputs/transfer.in +++ b/examples/simple_token/inputs/transfer.in @@ -1 +1,7 @@ -"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, amount: 100u64.private, _nonce: 0group.public }" aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 50u64 +{ + owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, + amount: 100u64.private, + _nonce: 0group.public +} +aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau +50u64 diff --git a/examples/tictactoe/inputs/tictactoe.in b/examples/tictactoe/inputs/tictactoe.in index d42512d6b8..5f799d5991 100644 --- a/examples/tictactoe/inputs/tictactoe.in +++ b/examples/tictactoe/inputs/tictactoe.in @@ -1 +1,8 @@ -1u8 1u8 1u8 "{ r1: { c1: 0u8, c2: 0u8, c3: 0u8 }, r2: { c1: 0u8, c2: 0u8, c3: 0u8 }, r3: { c1: 0u8, c2: 0u8, c3: 0u8 } }" +1u8 +1u8 +1u8 +{ + r1: { c1: 0u8, c2: 0u8, c3: 0u8 }, + r2: { c1: 0u8, c2: 0u8, c3: 0u8 }, + r3: { c1: 0u8, c2: 0u8, c3: 0u8 } +} diff --git a/examples/vote/build/main.aleo b/examples/vote/build/main.aleo index 57d566d206..82cfdf4cf0 100644 --- a/examples/vote/build/main.aleo +++ b/examples/vote/build/main.aleo @@ -39,8 +39,7 @@ function propose: assert.eq self.caller r0.proposer; hash.bhp256 r0.title into r1 as field; cast self.caller r1 r0 into r2 as Proposal.record; - async propose r1 into r3; - output r2 as Proposal.record; + async propose r1 into r3; output r2 as Proposal.record; output r3 as vote.aleo/propose.future; finalize propose: @@ -52,8 +51,7 @@ function new_ticket: input r0 as field.public; input r1 as address.public; cast r1 r0 into r2 as Ticket.record; - async new_ticket r0 into r3; - output r2 as Ticket.record; + async new_ticket r0 into r3; output r2 as Ticket.record; output r3 as vote.aleo/new_ticket.future; finalize new_ticket: @@ -65,8 +63,7 @@ finalize new_ticket: function agree: input r0 as Ticket.record; - async agree r0.pid into r1; - output r1 as vote.aleo/agree.future; + async agree r0.pid into r1; output r1 as vote.aleo/agree.future; finalize agree: input r0 as field.public; @@ -77,8 +74,7 @@ finalize agree: function disagree: input r0 as Ticket.record; - async disagree r0.pid into r1; - output r1 as vote.aleo/disagree.future; + async disagree r0.pid into r1; output r1 as vote.aleo/disagree.future; finalize disagree: input r0 as field.public; diff --git a/examples/vote/inputs/agree.in b/examples/vote/inputs/agree.in index 487d82267c..24364799d1 100644 --- a/examples/vote/inputs/agree.in +++ b/examples/vote/inputs/agree.in @@ -1 +1,5 @@ -"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public }" +{ + owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, + pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, + _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public +} diff --git a/examples/vote/inputs/disagree.in b/examples/vote/inputs/disagree.in index 487d82267c..24364799d1 100644 --- a/examples/vote/inputs/disagree.in +++ b/examples/vote/inputs/disagree.in @@ -1 +1,5 @@ -"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public }" +{ + owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, + pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, + _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public +} diff --git a/examples/vote/inputs/propose.in b/examples/vote/inputs/propose.in index fd3ab41af7..73b06c1914 100644 --- a/examples/vote/inputs/propose.in +++ b/examples/vote/inputs/propose.in @@ -1 +1,5 @@ -"{ title: 2077160157502449938194577302446444field, content: 1452374294790018907888397545906607852827800436field, proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2 }" +{ + title: 2077160157502449938194577302446444field, + content: 1452374294790018907888397545906607852827800436field, + proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2 +}