question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Oveflow and paranoid checks should be enabled by default for Rust contracts

See original GitHub issue

Rust 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:

https://stackoverflow.com/q/64129432/315168

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
frolcommented, Oct 6, 2020

@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.

0reactions
chadohcommented, Oct 11, 2020

Updated all examples and merged #502; thanks for the ideas @miohtama and the help @frol

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found