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

Add overflow and underflow checks for all operations #45

Closed
loredanacirstea opened this issue Apr 25, 2018 · 0 comments · Fixed by #64
Closed

Add overflow and underflow checks for all operations #45

loredanacirstea opened this issue Apr 25, 2018 · 0 comments · Fixed by #64
Milestone

Comments

@loredanacirstea
Copy link
Contributor

loredanacirstea commented Apr 25, 2018

Make sure we have asserts for all smart contracts operations (e.g. +, -, *)

E.g. for settleChannel , getSettleTransferAmounts

        total_deposit_available = (
            participant1_deposit +
            participant2_deposit -
            participant1_locked_amount -
            participant2_locked_amount
        );

        // Overflow and underflow checks
        require(total_deposit_available <= (participant1_deposit + participant2_deposit));
        require(total_deposit_available > 0);

        participant1_amount = (
            participant1_deposit +
            participant2_transferred_amount -
            participant1_transferred_amount
        );

        // Overflow and underflow checks
        require(participant1_amount <= participant1_deposit + participant2_transferred_amount);
        require(participant1_amount > ?);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant