From b7edcd7b729dbaa7c5a5a5b85d522f528550affa Mon Sep 17 00:00:00 2001 From: Georgiy Komarov Date: Thu, 21 Nov 2024 11:24:09 +0000 Subject: [PATCH] feat(detectors): `CellOverflow`->`CellBounds` --- docs/detectors.md | 2 +- docs/detectors/{CellOverflow.md => CellBounds.md} | 13 +++++++++---- sidebars.ts | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) rename docs/detectors/{CellOverflow.md => CellBounds.md} (68%) diff --git a/docs/detectors.md b/docs/detectors.md index ed5f9611a..a873df467 100644 --- a/docs/detectors.md +++ b/docs/detectors.md @@ -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 | | | diff --git a/docs/detectors/CellOverflow.md b/docs/detectors/CellBounds.md similarity index 68% rename from docs/detectors/CellOverflow.md rename to docs/detectors/CellBounds.md index 9ece5b6e0..c1d616207 100644 --- a/docs/detectors/CellOverflow.md +++ b/docs/detectors/CellBounds.md @@ -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 diff --git a/sidebars.ts b/sidebars.ts index 21b8877ec..ec05d2ce4 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -72,8 +72,8 @@ const sidebars: SidebarsConfig = { }, { type: 'doc', - id: 'detectors/CellOverflow', - label: 'CellOverflow', + id: 'detectors/CellBounds', + label: 'CellBounds', }, { type: 'doc',