NEWTON

NEWTON


Popular tags

    Is uint256 math operators like uint256_le safe? Why do I need to use uint256_check?

    Asked

    2 months ago

    65

    views


    1

    This question has a bounty of $0.00 in testnet ETH. Answers to this question are eligible to win that bounty.

    These are testnet contracts. Not real ETH.

    $0.00

    Hey, I'm curious if uint256 variables are safe to use? They are using 2x128 bits, while a native felt uses only 252 bits.

    Can anyone explain?

      cairosecurityuint256felt

    vargastartup

    asked

    2 months ago


    1 answers

    1

    Accepted answer

    they are safe if used correctly.

    this means specifically that every time there is a Uint256 input to a function (especially if that is not a privileged function and any user can call it), you must call uint256_check() on it first. if you do that, you'll be safe and you don't have to worry about Uint256's security issues.

    to understand specifically why that is and how the Uint256 functions work, you can refer to an article we wrote on the topic: https://twitter.com/ggballas/status/1591119157034090513

    if you're looking to go to mainnet with your dapp, you're welcome to consult with us for free about any security issues. we specialize in starknet: https://gingersec.xyz/

    ggballas

    answered

    2 months ago

    Answer is not submitted on chain

    Your answer

    NEWTON

    NEWTON