-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cellUnderflow): Support storing local builders/slices
- Loading branch information
Showing
3 changed files
with
122 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,49 @@ | ||
[CRITICAL] CellUnderflow: Reference count might go below 0 | ||
test/detectors/CellUnderflow.tact:2:9: | ||
1 | fun refs_num_bad(c: Cell) { | ||
> 2 | let s1 = beginCell().storeRef(c).endCell().asSlice(); | ||
> 2 | let s1 = beginCell() | ||
^ | ||
3 | let ref1 = s1.loadRef(); // OK | ||
3 | .storeRef(c) | ||
The possible number of references stored (1) is less than loaded (2) | ||
Help: Remove extra .loadRef operations or store more refs first | ||
See: https://nowarp.io/tools/misti/docs/detectors/CellUnderflow | ||
|
||
[CRITICAL] CellUnderflow: Reference count might go below 0 | ||
test/detectors/CellUnderflow.tact:4:9: | ||
3 | let ref1 = s1.loadRef(); // OK | ||
> 4 | let ref2 = s1.loadRef(); // Bad: Cell Underflow | ||
test/detectors/CellUnderflow.tact:7:9: | ||
6 | let ref1 = s1.loadRef(); // OK | ||
> 7 | let ref2 = s1.loadRef(); // Bad: Cell Underflow | ||
^ | ||
5 | | ||
8 | | ||
The possible number of references stored (1) is less than loaded (2) | ||
Help: Remove extra .loadRef operations or store more refs first | ||
See: https://nowarp.io/tools/misti/docs/detectors/CellUnderflow | ||
|
||
[CRITICAL] CellUnderflow: Reference count might go below 0 | ||
test/detectors/CellUnderflow.tact:7:5: | ||
6 | // Bad: Cell Underflow | ||
> 7 | beginCell() | ||
^ | ||
8 | .endCell() | ||
test/detectors/CellUnderflow.tact:9:5: | ||
8 | | ||
> 9 | beginCell() | ||
^ | ||
10 | .endCell() | ||
The possible number of references stored (0) is less than loaded (1) | ||
Help: Remove extra .loadRef operations or store more refs first | ||
See: https://nowarp.io/tools/misti/docs/detectors/CellUnderflow | ||
|
||
[CRITICAL] CellUnderflow: Reference count might go below 0 | ||
test/detectors/CellUnderflow.tact:15:5: | ||
14 | // Cell Overflow when storing a known local builder | ||
> 15 | let b1 = beginCell() | ||
^ | ||
16 | .storeRef(c) | ||
The possible number of references stored (0) is less than loaded (1) | ||
Help: Remove extra .loadRef operations or store more refs first | ||
See: https://nowarp.io/tools/misti/docs/detectors/CellUnderflow | ||
|
||
[CRITICAL] CellUnderflow: Reference count might go below 0 | ||
test/detectors/CellUnderflow.tact:20:5: | ||
19 | .storeRef(c); // OK: Builder storing 4 references | ||
> 20 | let c1 = beginCell() | ||
^ | ||
21 | .storeBuilder(b1) | ||
The possible number of references stored (0) is less than loaded (1) | ||
Help: Remove extra .loadRef operations or store more refs first | ||
See: https://nowarp.io/tools/misti/docs/detectors/CellUnderflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
fun refs_num_bad(c: Cell) { | ||
let s1 = beginCell().storeRef(c).endCell().asSlice(); | ||
let s1 = beginCell() | ||
.storeRef(c) | ||
.endCell() | ||
.asSlice(); | ||
let ref1 = s1.loadRef(); // OK | ||
let ref2 = s1.loadRef(); // Bad: Cell Underflow | ||
|
||
// Bad: Cell Underflow | ||
beginCell() | ||
.endCell() | ||
.asSlice() | ||
.loadRef(); | ||
.loadRef(); // Bad: Cell Underflow | ||
|
||
// Cell Overflow when storing a known local builder | ||
let b1 = beginCell() | ||
.storeRef(c) | ||
.storeRef(c) | ||
.storeRef(c) | ||
.storeRef(c); // OK: Builder storing 4 references | ||
let c1 = beginCell() | ||
.storeBuilder(b1) | ||
.storeRef(c) // Bad: We got 5 references | ||
.endCell(); | ||
} |