Page tree
Skip to end of metadata
Go to start of metadata
Project Title

Solang Solidity Compiler optimizations and error handling

Status

COMPLETED

Difficulty

  HIGH

Description 

Solang is a Solidity compiler that targets several blockchains, including Solana, Substrate and ewasm. The mentorship project consists of three goals that can provide mentees with a broad knowledge of a compiler's inner-workings. The three tasks are in different stages of the compiler.

  1. Solang’s parser analysis halts compilation entirely when there is any invalid expression or function declaration. This should be improved so that it continues parsing the Solidity contract after encountering an error, providing better diagnostics (warnings and errors) to the developer. The parser utilizes Lalrpop and the mentee would be using its error handling capabilities to implement a solution.
  2. Often the length of a dynamically allocated array is known at compile time as the allocation happens with a constant. When the length is required at some later point (e.g. for bounds checks for array indexing), the length is retrieved again. Mentees will add an optimization to make the length a compile time constant.
  3. Solang has an implementation of multiplication of integers of 256 and 128 bit. This does not have overflow detection. This requires improving the multiplication in the solang stdlib.

Additional Information

Solang github repository: https://github.com/hyperledger-labs/solang

Solang documentation: https://solang.readthedocs.io/en/latest/

Link to Lalrpop documentation: http://lalrpop.github.io/lalrpop/index.html

Learning Objectives

The mentorship was designed to provide mentees with a broad view of compilers, so we expect them to learn parsing and optimizations techniques, as well as low level code generation. This provides the basis for new entrants to engage in open source compilers. In addition to the technical skills, the mentee will be introduced to the open source community and collaboration tools. As the Solang ecosystem is growing, the mentee will have many networking opportunities and the ability to ask for career guidance.

Expected Outcome

We hope that the mentee will be able to produce at least three pull requests to Solang’s Github repository. These PRs should contain the code, tests and documentation of the chosen implementation.

The main deliverables would be:

  • Improved error handling for Solang’s parser
  • Array length optimization
  • Multiply/divide overflow detection

Relation to Hyperledger 

Solang is part of the Hyperledger Labs.

Education Level

There is no minimum requirement for education. We expect, though, the mentee to have basic knowledge of compilers, algorithms and data structures.

Skills

Basic knowledge of compilers is necessary to easily understand how Solang works and what the project involves doing. Algorithms and data structures is a nice-to-have knowledge. Exposure to the rust language is desirable.

Future plans

We hope graduating mentees will engage in the open-source community, not only continuing developing features for Solang and fixing bugs but also acquire more self-confidence to get involved in other projects the mentees are interested in.

Preferred Hours and Length of Internship

We accept applications for both full-time and part-time mentees.

Mentor(s) Names and Contact Info

Sean Young sean@mess.org

Lucas Steuernagel lucas.tnagel@gmail.com

You can reach us at the Discord server (Solang channel under Labs): https://discord.gg/hyperledger