Fe Development Update #7

It's been a couple months since our last update. In this time, we've merged a total of 40 pull requests from 8 different contributors. Here are some highlights.

We shipped three more releases

Improved error handling

Support for custom errors:

We added support for revert <expression> statements, where <expression> must be a struct type. The revert data is encoded as specified in EIP-838.

Example:

struct MyError:
    msg: u256
    val: bool
    
pub def revert_custom_error():
    revert MyError(msg=100, val=true)

Added in #464.

Added builtin panic codes:

Runtime checks now revert with the same panic codes used in Solidity. These codes can be found here.

Added in #476.

Better diagnostic messages:

Errors found during static analysis are now printed using codespan. This makes it easier to understand and fix invalid code.

Example:

error: value must be copied to memory
  ┌─ foo.fe:5:14
  │
5 │     self.baz(self.my_array)
  │              ^^^^^^^^^^^^^ this value is in storage
  │
  = Hint: values located in storage can be copied to memory using the `to_mem` function.
  = Example: `self.my_array.to_mem()`

Added in #398.

ABI data checks

ABI encoded data is now checked to be well-formed before decoding. If the data being decoded is found to be ill-formed, the transaction will revert.

Added in #440. See the PR discussion for more info.

Other features and bugfixes

  • Make duplicate function definitons a fatal error #455
  • Fix ICE when accessing an invalid attribute on a type #445
  • __init__ must be pub #435
  • Add support for pragma statement #426
  • Add tutorial that deploys and uses Guestbook on Görli #420
  • Make --optimize the default #449
  • Capitalize Map type name #431
  • Implement tuple destructuring #428
  • Basic type inference of int literals and empty arrays #429
  • Move tuple and list expr collection to lowering pass; support lowering of nested tuples #459
  • Fix ICE #469 #484
  • Fix ICE #450 #462

What's next

Our goal of shipping a non-alpha release this year still stands. Over the next few months, we will continue hardening the compiler, improving documentation, and polishing off existing features.


Stay tuned for more monthly updates and releases.