Michelson Analysis

Factori offers some analysis capabilities on Michelson contracts. This feature is in a beta state.

Analysis

The factori analysis currently handles the following:

  • Unused storage variables detection: It can happen that a field in the storage of a contract is unused, which leads to unnecessary costs;
  • Use of set, list, map in storage: This might be dangerous as these data structures are unbounded and will be fully deserialized every time the contract is called. If they become too big, deserialization gas limits might be hit, preventing any future call to the smart contract.
  • ABS detection: The ABS instruction can break a contract's logic if it is (mis)used to convert integers to natural numbers without checking if the integer is negative. IS_NAT should be preferred to handle the failing case explicitly.
  • Reentrancy detection: To prevent reentrancy, the analysis returns a warning if it detects potential reentrancy with the TRANSFER_TOKENS Michelson instruction.
  • Permission analysis: Factori detects the conditions which lead to a failure, and then prints them for each entrypoint.