NEWTON

NEWTON


Popular tags

    Cairo Error: 'range_check_ptr' cannot be used as an implicit return value. Consider using a 'with' statement.

    Asked

    4 months ago

    12

    views


    0

    How can I resolve this issue?

    I'm trying to prove that the left uint is smaller than the right uint using this function:

    func main(syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_check_ptr):

    let zero = Uint256(0, 0)

    let one = Uint256(1, 0)

    let (result) = uint256_signed_lt(zero, one)

    end

    This question was originally posted on Triality

      cairocairo-lang

    1 answers

    0

    You can solve it one of the following two ways:

    1. declare main like this

    main{syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_check_ptr}()

    1. add a with statement inside your function:

    with range_check_ptr:

    let (result) = uint256_signed_lt(zero, one)

    end

    The first one is the most logical answer as it is less management and less code to resolve and can be reused in any other functions that need implicit range_check_ptr

    This answer was originally posted on Triality

    answered

    4 months ago

    Your answer

    NEWTON

    NEWTON