You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 30, 2025. It is now read-only.
In the naive api, you only get to specify one entry function to invoke for one transaction. An advanced builder might want to be able to invoke multiple **public** Move functions inside one transaction. This is now enabled by the new `scriptComposer` api provided in the transaction builder.
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.
7
+
The Move on Aptos compiler (codename 'compiler v2') 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.
8
8
9
-
The new compiler supports Move 2, the latest revision of the Move language. Head over to the [release page in the book](book/move-2.mdx) to learn more about the new features in Move 2. Starting at Aptos CLI v6.0.0, this language version and the new compiler are the default.
9
+
The Move on Aptos compiler supports Move 2, the latest revision of the Move language. Head over to the [release page in the book](book/move-2.mdx) to learn more about the new features in Move 2. Starting at Aptos CLI v6.0.0, this language version and the Move on Aptos compiler are the default. Note that Move 2 is generally backwards compatible with Move 1.
10
10
11
-
## Compiler v2 Release State
11
+
## Move on Aptos Release State
12
12
13
-
Compiler v2 is now the default.
14
-
15
-
## Bug Bounty
16
-
17
-
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. Not all differences in the compiler behavior count for the program, [head over here](https://hackenproof.com/programs/move-on-aptos-compiler) 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.
13
+
Move on Aptos is in production and is now the default compiler, with Move 2 being the default language version.
18
14
19
15
## Reporting an Issue
20
16
21
17
If you run into issues, please use [this link to create a github issue][bug]. 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.
Ensure to have installed the latest version of the Aptos CLI:
28
24
@@ -31,21 +27,10 @@ aptos update aptos # on supported OS
31
27
brew upgrade aptos # on MacOS
32
28
```
33
29
34
-
Compiler v2 and Move 2 are now the default, requiring no changes to your usage. Examples:
30
+
Move on Aptos compiler and Move 2 are now the default, requiring no changes to your usage. Examples:
35
31
36
32
```bash filename="Terminal"
37
33
aptos move compile
38
34
aptos move test
39
35
aptos move prove
40
36
```
41
-
42
-
## Using Compiler v1
43
-
44
-
Compiler v1 (i.e., the old compiler) is expected to be sunset soon, as it does not support any of the Move 2 features, and is thus not recommended for use. However, if you still want to use compiler v1 before it is sunset, on your project that does not use any Move 2 features, you can do so with the `--move-1` flag (eg., `aptos move compile --move-1` or `aptos move test --move-1`). You may need to specify the `aptos-release-v1.25` version of the Aptos framework in the dependencies (this is the last version of the Aptos framework that does not use any Move 2 features), as shown below.
Copy file name to clipboardExpand all lines: apps/nextra/pages/en/build/smart-contracts/linter.mdx
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,10 +8,15 @@ The "Aptos Move Lint" tool runs on a Move package to find and warn about common
8
8
9
9
You can run it with the aptos CLI command: `aptos move lint`.
10
10
11
-
This tool is currently in beta, so please try it out and submit [bugs and feedback](https://github.com/aptos-labs/aptos-core/issues/new?title=%5Blinter%5D%20%3CDescriptive%20Title%3E&body=%3CDetailed%20description%20of%20the%20issue%20or%20feature%20request%3E&labels=move-linter&projects=aptos-labs/16). Also, we are tracking ideas and prioritization requests for new lint rules [here](https://github.com/aptos-labs/aptos-core/issues/15221), we welcome your contributions.
11
+
If you find any issues, please submit [bugs and feedback](https://github.com/aptos-labs/aptos-core/issues/new?title=%5Blinter%5D%20%3CDescriptive%20Title%3E&body=%3CDetailed%20description%20of%20the%20issue%20or%20feature%20request%3E&labels=move-linter&projects=aptos-labs/16). Also, we are tracking ideas and prioritization requests for new lint rules [here](https://github.com/aptos-labs/aptos-core/issues/15221), we welcome your contributions.
12
12
13
13
14
14
## Lint Checks
15
+
### `almost_swapped`
16
+
Checks for expression patterns that look like a failed swap attempt and notifies the user. These patterns are likely erroneous code. This currently only detects simple access patterns such as assignments to a variable or a field of a struct. Examples include:
17
+
-`a = b; b = a;` which can be correctly swapped with `(a, b) = (b, a);`
18
+
-`a.x = b.x; b.x = a.x;` which can be correctly swapped with `(a.x, b.x) = (b.x, a.x);`
19
+
15
20
### `avoid_copy_on_identity_comparison`
16
21
17
22
Checks for identity comparisons (`==` or `!=`) between copied values of type `vector` or `struct` (i.e., types for which copy can be expensive). It instead suggests to use reference-based identity comparison instead (i.e., use `&x == &y` instead of `x == y`, when the above mentioned conditions meet).
@@ -89,6 +94,13 @@ Check for boolean expressions that can be simplified when a boolean literal (eit
89
94
Does NOT consider side-effects/short-circuiting in the recommended simplifications. Example:
90
95
-`1/0 || true` is logically equivalent to `true`, but applying this simplification affects program semantics.
91
96
97
+
### `self_assignment`
98
+
99
+
Checks for patterns where a variable or a field of a struct is assigned to itself and suggests removing the assignment. These assignments do not affect the state of the program. Examples include:
100
+
-`let x = x;`
101
+
-`x = x;`
102
+
-`a.x = a.x;`
103
+
92
104
### `simpler_numeric_expression`
93
105
94
106
Checks for various patterns where a simpler numeric expression can be used instead. In all these cases, the code must already type check, and `x` can be any numeric expression.
0 commit comments