argotorg / argotorg/fe

An assert that is given a string message should fail with Panic(string) not Error(string)

Open
#516 2 comments 0 reactions 0 assignees View on GitHub
comp: compiler
Dominant language
Rust
Stars
1.7k
Forks
218
Avg merge
1d 7h
Merged PRs (30d)
6

Description

### What is wrong?

There are two ways to use the `assert` statement at the moment.

1. `assert` without message:

```
assert some_condition
```

2. `assert` with message

```
assert some_condition, "some message"
```

The first one causes a revert with `Panic(0x01)` whereas the second causes an `Error(string)`

Formal verification tools expect failed assertions to always be encoded as `Panic(..)` so encoding it as `Error(string)` as we do in the second case will have a bad effect on the ability to perform reliable formal verification of Fe code.

### How can it be fixed

Encode failed assertions with messages as `Panic(string)` not `Error(string)`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the assert statement is compiled when it has a message, then compare its failure encoding with the message-less assert case. Confirm that the resulting failure uses Panic(string) rather than Error(string), while preserving the existing Panic(0x01) behavior for assertions without messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.