NEWTON
Asked
6 months ago
77
views
0
I try to implement the function abs_value
of the package starkware.cairo.common.math
but i have this error
AssertionError: Expected main to contain the following arguments (in this order): ['range_check_ptr_ptr']. Found: ['range_check_ptr'].
I dont understand the error.
Can someone explain the error to me, why it happens ?
I am doing the challenge #17daysOfCairo of the day 3
Full code
%builtins range_check_ptr
from starkware.cairo.common.math import abs_value
func main{range_check_ptr}() {
let x = abs_value(-1);
return ();
}
1
Accepted answer
You actually don't need to import the range_check_ptr
but actually the range_check
built-in (check this link). Change your code to
%builtins range_check
from starkware.cairo.common.math import abs_value
func main{range_check_ptr}() {
let x = abs_value(-1);
return ();
}
and it should compile and run.
answered
6 months ago
How to divide felt in Cairo Lang using unsigned_div_rem?
Cairo Lang / StarkNet: What are Revoked references? What is alloc_locals?
How to use get_fp_and_pc in Cairo Lang?
What is the difference between tempvar/let in Cairo Lang? How to use allow_locals and local?
How to use Hints in Cairo Lang?
How to make recursive function in Cairo Lang?
How to make Bitwise operations in Cairo Lang using %builtins bitwise, bitwise_xor?
How do I run a Pathfinder node?
Invalid response while using `ec.getKeyPair("copy
Does Account Abstraction (StarkNet) support bundling multiple operations at once?
What will the bundler ecosystem look like in Account Abstraction?
What if my solidity contract contains Assembly or special EVM calls ?
Are there rewards for running a Pathfinder node?
How to use Hints in Cairo Lang?