NEWTON
Asked
8 months ago
81
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
8 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?
CairoLang error: `GatewayError: {'contract_address': ['Expected hex string, got:
How can I send a Uint256 amount of ERC20 tokens from L1 to starknet? And how should I build my payload for "sendMessageToL2" to match the Uint256 format of Cairo?
Is Kakarot zkEVM a blockchain?
What is Kakarot, the zkEVM written in Cairo?
Does anyone have an example of a positional request to `starknet_addInvokeTransaction` on devnet that is working?
When you run warp deploy or warp invoke, which account is paying for the tx fees on the Goerli testnet?
Hey, is there anyway to debug Cairo contracts in hardhat environment? Something like hardhat console in solidity