argotorg / argotorg/fe

Add wrapping type to allow opt-out from safety checks

Closed
#316 0 comments 0 reactions 0 assignees View on GitHub
effort: E2 days prio: p4 nice to have type: feature type: performance type: security
Dominant language
Rust
Stars
1.7k
Forks
218
Avg merge
1d 4h
Merged PRs (30d)
8

Description

### What is wrong?

Now that #153 landed Fe performs various safety checks for arithmetic operations by default. This also means that currently one can not write code that deliberately relies on over or underflow.

Long term it would be good to allow people to opt-out from these safety guarantees as long as it is very explicit.

### How can it be fixed

Preferably do what Rust is doing with the [Wrapping](https://doc.rust-lang.org/std/num/struct.Wrapping.html) type.

Example:

```
def add_with_overflow(val1: u256, val2: u256) -> u256:
return wrapping(val1) + wrapping(val2)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the arithmetic safety checks introduced by #153 and the linked Rust Wrapping type documentation. The issue provides no Fe files or tests to begin with; done would mean an explicit wrapping type or equivalent syntax that allows deliberate overflow and underflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.