leo
leo copied to clipboard
[Bug] "Proof is invalid"
🐛 Bug Report
Creating an issue by @acoglio's request: I'm trying to run a simple program to test out circuits in Leo but running into a verification error. The proof seems to be generated without any issue, but the verification step fails.
Steps to Reproduce
Code snippet to reproduce
// main.leo
// The 'hello-world' main function.
circuit Rectangle {
width: u32,
height: u32,
function area(self) -> u32 {
return self.width * self.height;
}
}
function main(a: u32, b: u32) -> u32 {
let rect1 = Rectangle {
width: a,
height: b,
};
let area = rect1.area();
console.log("Rectangle area: {} square pixels", area);
return area;
}
// hello-world.in
// The program input for hello-world/src/main.leo
[main]
a: u32 = 1;
b: u32 = 5;
[registers]
r0: u32 = 0;
Stack trace & error message
> Executing task: /Users/bryan/.aleo-studio/binaries/leo run <
Build Starting...
Build Compiling main program... ("/Users/bryan/Aleo Studio/hello-world/src/main.leo")
Build Rectangle area: 5 square pixels
Build Number of constraints - 4294
Build Complete
Done Finished in 37 milliseconds
Setup Detected saved setup
Setup Loading proving key...
Setup Complete
Setup Loading verification key...
Setup Complete
Done Finished in 174 milliseconds
Proving Starting...
Proving Rectangle area: 5 square pixels
Proving Saving proof... ("/Users/bryan/Aleo Studio/hello-world/outputs/hello-world.proof")
Done Finished in 45 milliseconds
Verifying Starting...
Verifying Proof is invalid
Done Finished in 3 milliseconds
I'm also getting another warning when I declare the circuit.
`main` function is missing
Expected Behavior
Verification should be successful.
Your Environment
- leo 1.5.3
- rustc 1.59.0 (9d1b2106e 2022-02-23)
- macOS Monterey 12.0.1
After further conversion on Discord, it looks like the problem may go away after doing a leo clean
. I've seen this issue as well. Still, arguably it shouldn't necessary to clean.
After further conversion on Discord, it looks like the problem may go away after doing a
leo clean
. I've seen this issue as well. Still, arguably it shouldn't necessary to clean.
ive seen this before as well. i brought it up when i first started here and was also told to just run leo clean between compilations. this definitely should be looked at though yeah
Leo v1.6.2 translated program file:
program rectangle.aleo {
struct Rectangle {
width: u32,
height: u32,
}
function area(r: Rectangle) -> u32 {
return r.width * r.height;
}
transition main(a: u32, b: u32) -> u32 {
let rect1: Rectangle = Rectangle {
width: a,
height: b,
};
let area1: u32 = area(rect1);
return area1;
}
}
This program should now compile and run @bryanhpchiang We also removed the requirement on a "main" function so the previous error message should not appear anymore.
I'm going to close this issue as resolved for now but feel free to reopen if you hit it again somehow.