Skip to content

Commit

Permalink
feat(docs): describe the limit for deeply nested expressions (#1101)
Browse files Browse the repository at this point in the history
This addresses issue #7 of Trail of Bits security audit (2024)
  • Loading branch information
novusnota authored Nov 28, 2024
1 parent 3ab15e8 commit 229ce26
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Utility for logging errors in code that was supposed to be unreachable: PR [#991](https://github.com/tact-lang/tact/pull/991)
- Docs: `preloadRef` method for the `Slice` type: PR [#1044](https://github.com/tact-lang/tact/pull/1044)
- Docs: added DeDust cookbook: PR [#954](https://github.com/tact-lang/tact/pull/954)
- Docs: described the limit for deeply nested expressions: PR [#1101](https://github.com/tact-lang/tact/pull/1101)

### Changed

Expand Down
19 changes: 19 additions & 0 deletions docs/src/content/docs/book/expressions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ description: "This page lists all the expressions in Tact"

Every operator in Tact forms an expression, but there's much more to uncover as Tact offers a wide range of expressive options to choose from.

:::note

The current maximum allowed nesting level of expressions is $83$. An attempt to write a deeper expression will result in a compilation error:

```tact
fun elegantWeaponsForCivilizedAge(): Int {
return
((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((((
(((((((((((((((((((( // 84 parens, compilation error!
42
))))))))))))))))))))
))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))));
}
```

:::

## Literals

Literals represent values in Tact. These are fixed values—not variables—that you _literally_ provide in your code. All literals in Tact are expressions themselves.
Expand Down
19 changes: 19 additions & 0 deletions docs/src/content/docs/book/operators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,25 @@ Parentheses (also can be called round brackets, `(){:tact}`) are more of a punct
5 * (5 - 2); // 15
```

:::note

The current maximum allowed nesting level of expressions is $83$. An attempt to write a deeper expression will result in a compilation error:

```tact
fun elegantWeaponsForCivilizedAge(): Int {
return
((((((((((((((((((((((((((((((((
((((((((((((((((((((((((((((((((
(((((((((((((((((((( // 84 parens, compilation error!
42
))))))))))))))))))))
))))))))))))))))))))))))))))))))
))))))))))))))))))))))))))))))));
}
```

:::

## Unary

Unary here means that they are applied only to one operand of the given expression. All unary operators, except for the [non-null assertion](#unary-non-null-assert), are of the same [precedence](#precedence).
Expand Down
2 changes: 0 additions & 2 deletions docs/src/content/docs/cookbook/dexes/stonfi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ sidebar:
order: 2
---

# STON.fi

[STON.fi](https://ston.fi) is a decentralized automated market maker (AMM) built on [TON blockchain](https://ton.org) providing virtually zero fees, low slippage, an extremely easy interface, and direct integration with TON wallets.

:::caution
Expand Down

0 comments on commit 229ce26

Please sign in to comment.