Skip to content

Commit

Permalink
feat(detectors): CellOverflow->CellBounds
Browse files Browse the repository at this point in the history
  • Loading branch information
jubnzv committed Nov 21, 2024
1 parent 15a5bcd commit b7edcd7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/detectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ title: Detectors Overview
| 1 | [ArgCopyMutation](./detectors/ArgCopyMutation.md) | High | ||
| 2 | [AsmIsUsed](./detectors/AsmIsUsed.md) | Info | | |
| 3 | [BranchDuplicate](./detectors/BranchDuplicate.md) | High | ||
| 4 | [CellOverflow](./detectors/CellOverflow.md) | Critical | ||
| 4 | [CellBounds](./detectors/CellBounds.md) | Critical | ||
| 5 | [ConstantAddress](./detectors/ConstantAddress.md) | Info | | |
| 6 | [DivideBeforeMultiply](./detectors/DivideBeforeMultiply.md) | High |||
| 7 | [DumpIsUsed](./detectors/DumpIsUsed.md) | Info | | |
Expand Down
13 changes: 9 additions & 4 deletions docs/detectors/CellOverflow.md → docs/detectors/CellBounds.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# CellOverflow
A detector that identifies cell overflow problems.
# CellBounds
A detector that identifies cell overflow and underflow problems.

## Why is it bad?
Cell overflow is an issue specific to the TON blockchain. TON stores data in
cells, which are low-level data structures used for serialization and deserialization.
Cell overflow and underflow are issues specific to the TON blockchain. TON
stores data in cells, which are low-level data structures used for serialization
and deserialization.

The overflow issue occurs when the user attempts to store more data in a cell
than it supports. The current limitation is 1023 bits and 4 references to other
cells. When these limits are exceeded, the contract throws an error with the
exit code `8` during the compute phase.

The underflow issue occurs when the user attempts to get more data from a
structure than it supports. cells. When it happens, the contract throws an
error with the exit code `9` during the compute phase.

## Example
```tact
// Bad: storeRef is used more than 4 times
Expand Down
4 changes: 2 additions & 2 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ const sidebars: SidebarsConfig = {
},
{
type: 'doc',
id: 'detectors/CellOverflow',
label: 'CellOverflow',
id: 'detectors/CellBounds',
label: 'CellBounds',
},
{
type: 'doc',
Expand Down

0 comments on commit b7edcd7

Please sign in to comment.