crytic / tealer

Static Analyzer for Teal
GNU Affero General Public License v3.0
62 stars 14 forks source link

Use intcblock, bytecblock information for intc*, bytec* instructions #127

Closed S3v3ru5 closed 1 year ago

S3v3ru5 commented 1 year ago

Intcblock, bytecblock instructions are used as a way to reduce contract size. Executing a Intcblock/bytecblock instruction fills constant's storage with the values given in the immediate arguments. This constant values can then referred using intc/bytec instructions.

intcblock 11 12 13 14 15 16 ...              // fills the constant's storage with values (11, 12, 13, 14, 15, ...)
intc_0                     // results in value `11` at runtime: value at 0th index in constant's storage that is filled by above ins
intc_1                     // results in value `12`
intc_2                     // 13
intc_3                     // 14
intc 5                     // 16

This PR adds support for calculating the information from intcblock/bytecblock instructions and using that information during analyses. Information from intcblock/bytecblock is calculated if and only if:

Partly fixes #86 https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#constants