Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong output of function log inside loop #1324

Open
beriarue opened this issue Jun 10, 2023 · 0 comments
Open

Wrong output of function log inside loop #1324

beriarue opened this issue Jun 10, 2023 · 0 comments
Assignees

Comments

@beriarue
Copy link

beriarue commented Jun 10, 2023

Description

In the code below, the function log should be executed for 5 times, and the sentence res is "0x00000000" should be printed for 5 times. However, such sentence is only printed once during the runtime.

def main() -> u32 {
    u32 res = 0;
    for u32 i in 0..5 {
        log("res is {}", res);
    }
    return res;
}

Expected result:

...
res is "0x00000000"
res is "0x00000000"
res is "0x00000000"
res is "0x00000000"
res is "0x00000000"
...

Environment

  • Compiler version: 0.8.7
  • Operating system: Ubuntu 22.04

Steps to Reproduce

Save the buggy code into buggy.zok. Run the following commands from CLI:

# compile
zokrates compile --debug -i buggy.zok
zokrates setup
zokrates compute-witness
zokrates generate-proof
zokrates verify

You would see the following output, which is different from the expected result shown before.

...
res is "0x00000000"
...
@dark64 dark64 self-assigned this Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants