SRI-CSL / solidity

This is solc-verify, a modular verifier for Solidity.
https://github.com/SRI-CSL/solidity/blob/boogie/SOLC-VERIFY-README.md
GNU General Public License v3.0
50 stars 14 forks source link

undeclared identifier: __verifier_idx_uint error with --arithmetic mod option #168

Closed nelaturuk closed 3 years ago

nelaturuk commented 3 years ago
pragma solidity >=0.5.0;

/// @notice invariant __verifier_sum_uint(items[__verifier_idx_uint]) >= total
contract C {
    uint total;
    uint[] items;

    function add(uint item) public {
        items.push(item);
        total += item;
    }
}

Command: solc-verify.py test.sol --arithmetic mod

image

hajduakos commented 3 years ago

Hi @nelaturuk,

Can you try /// @notice invariant __verifier_sum_uint(items) >= total? If the array contains integers __verifier_idx_uint is not needed. It is only required if your array/mapping contains structs, and you want to pick some field of the struct, see example.

nelaturuk commented 3 years ago

That works. Thank you.