Oveflow and paranoid checks should be enabled by default for Rust contracts
See original GitHub issueRust supports overflow checks for integer arithmetics, however they are disabled by default for optimised builds.
These checks are important because of an attack vector when dealing with user balances.
Checks should be enabled in the generated Cargo.toml by default
https://github.com/near/create-near-app/blob/master/common/contracts/rust/Cargo.toml
More information here:
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
NEAR and safe math on unsigned integers - Stack Overflow
By default, Rust has overflow checks enabled for debug builds, but disabled in optimized ... NEAR core contracts opt-into the paranoid mode.
Read more >Understanding arithmetic overflow/underflows in Rust and ...
Note: The overflow-checks in Rust can be enabled in release mode ... How to prevent arithmetic errors in Solana smart contracts.
Read more >Check for Integer Overflow by Default · Issue #47739 - GitHub
I am aware that there are checked operations and compiler flags to keep overflow checks in release builds but the defaults are important...
Read more >Thought: switch the default on overflow checking and provide ...
Having participated in a long discussion on users.rust-lang.org I've learned how Rust currently handles overflow in (plain) integer ...
Read more >Chapter 4 - Reliable Request-Reply Patterns - ZeroMQ guide
This chapter looks at the general question of reliability and builds a set of reliable messaging patterns on top of ZeroMQ's core request-reply...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@chadoh Is it the only place where the Cargo.toml needs to be updated to reflect all the examples? I think we also need to go over our example contracts in Rust and update those.
Updated all examples and merged #502; thanks for the ideas @miohtama and the help @frol