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.
Copy file name to clipboardExpand all lines: apps/nextra/pages/en/build/smart-contracts/linter.mdx
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -59,6 +59,16 @@ It is a common Move pattern to provide inline specifications in conditions, espe
59
59
60
60
Note that an `assert!` is translated to a conditional abort, so blocks in `assert!` condition also are reported by this lint.
61
61
62
+
### `known_to_abort`
63
+
64
+
Checks for expressions that will always abort at runtime due to known constant values that violate runtime constraints. This lint helps identify code that will deterministically fail before it reaches production.
65
+
66
+
The following cases are detected:
67
+
68
+
-**Bit shifts with excessive shift amounts**: `x << n` or `x >> n` where `n` is a constant that is greater than or equal to the bit width of `x`'s type. For example, `value << 64` when `value` is of type `u64` will always abort.
69
+
-**Division or modulo by zero**: `x / 0` or `x % 0` operations will always abort at runtime.
70
+
-**Out-of-range type casting**: `constant as type` where the `constant` value is outside the representable range of the target `type`. For example, `300 as u8` will abort since `u8` can only represent values 0-255.
71
+
62
72
### `needless_bool`
63
73
64
74
Checks for patterns of the form (where `x` is any arbitrary boolean expression):
0 commit comments