Move On Aptos Compiler (beta)
The Move on Aptos compiler (codename ‘compiler v2’) is a new tool which translates Move source code into Move bytecode. It unifies the architectures of the Move compiler and the Move Prover, enabling faster innovation in the Move language. It also offers new tools for defining code optimizations which can be leveraged to generate more gas efficient code for Move programs.
Beta Testing
Compiler v2 (version 2.0-unstable
) is currently in beta testing and the developer community is encouraged to try it. However, the code produced by this version of the compiler can NOT be deployed on mainnet
. Using it for unit tests or for local nodes, devnet
, and testnet
is fine. This page will be updated once this changes.
Note that compiler v2 is not yet applying many code optimizations. As a result, the generated code is slightly less gas efficient than compiler v1. We expect this to change once the new compiler reaches production readiness.
Bug Bounty
We award a bounty for each unique semantic bug identified in the compiler. Bugs need to surface as a difference of execution outcome of the v1 and v2 compilers, as demonstrated by a Move unit test. Try your existing Move tests with the new compiler, it is as easy as calling aptos move test --compiler-version=2
! Not all differences in the compiler behavior count for the program, head over here for details of the bounty program. Even if a difference in behavior does not qualify for a bounty, we encourage you to open an issue using the link below.
Reporting an Issue
If you run into issues, please use this link to create a github issue. If you are able to provide a small piece of Move code which reproduces the issue, debugging and fixing it will be easier for us.
Using Compiler v2
Ensure to have installed the latest version of the Aptos CLI:
aptos update aptos # on supported OS
brew upgrade aptos # on MacOS
To run compiler v2, pass the flag --compiler-version=2
to the Aptos CLI. Examples:
aptos move compile --compiler-version=2
aptos move test --compiler-version=2
aptos move prove --compiler-version=2
Using Move 2
Compiler v2 implements some first features of Move 2, the new edition of Move on Aptos. The scope of Move 2 is described in the blog The Future of Move at Aptos. The growing list of new features is documented below and will be extended as new features are added:
- Receiver style function calls (see the Move Book for more details)
One must currently explicitly opt-in to use Move 2 with the flag --language-version=2
:
aptos move compile --compiler-version=2 --language-version=2