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

Different behaviour between vms #1368

Closed
daphneherlambda opened this issue Aug 10, 2023 · 0 comments · Fixed by #1387
Closed

Different behaviour between vms #1368

daphneherlambda opened this issue Aug 10, 2023 · 0 comments · Fixed by #1387
Assignees
Labels
bug Something isn't working

Comments

@daphneherlambda
Copy link
Contributor

daphneherlambda commented Aug 10, 2023

Different behaviour between vms
Running a cairo compiled program doesn´t return any error while running in the original python implementation of the vm returns an AssertionError.

To Reproduce
Steps to reproduce the behavior:

  1. Compile the following .cairo program
func main() {
	let MAX_HIGH =1;
	let MAX_LOW =1;
	let value =1;
	hint_func(MAX_HIGH, MAX_LOW, value);
	return();
}
func hint_func(MAX_HIGH: felt, MAX_LOW: felt, value: felt) -> (felt, felt) {
	alloc_locals;
	local low: felt;
	local high: felt;
%{
from starkware.cairo.common.math_utils import assert_integer
assert ids.MAX_HIGH < 2**128 and ids.MAX_LOW < 2**128
assert PRIME - 1 == ids.MAX_HIGH * 2**128 + ids.MAX_LOW
assert_integer(ids.value)
ids.low = ids.value & ((1 << 128) - 1)
ids.high = ids.value >> 128
%}
	return(low, high);
}
  1. Run the program with the original python implementation using the command cairo-run --program 0x0.json
  2. Run the program with the current implementation using the command /target/release/cairo-vm-cli 0x0.json
  3. See the difference between the results

Expected behavior
Both implementations should return the same result, in this case, the AssertionError

What version/commit are you on?
v0.8.5

@daphneherlambda daphneherlambda added the bug Something isn't working label Aug 10, 2023
@fmoletta fmoletta self-assigned this Aug 17, 2023
@fmoletta fmoletta linked a pull request Aug 17, 2023 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants