Open ProgramCrafter opened 1 year ago
However, the most interesting thing is that 12 PUSHINT
is handled correctly. This can be seen on https://tonscan.org/address/EQA-dgYSkIiw2J-MJ-0shgp1pzcmnoWo_vfd_240X7VDKuhf#source.
This is related to incorrect handling of short ints.
According to TVM instructions, short PUSHINT
Pushes integer x into the stack. -5 <= x <= 10. Here i equals four lower-order bits of x (i=x mod 16).
https://github.com/ton-community/disassembler/blob/510270efc8c8ea66f4691954a59ba8a1655a9cb4/src/codepages/cp0.manual.ts#L60 And instruction handler just loads 4-bit int.
PUSHINT 10
is shown as-6 PUSHINT
.Example contract: https://tonscan.org/address/EQArNPVIjXw_ffWPuGp_61zWtIH3tzBTBnHe9ToZ4m8OkoNf#source Code displayed on tonscan:
Code displayed on dton.io:
The relevant part of contract code uses only 10 and not -6: