ethereum / act

Smart contract specification language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SMT backend env vars type constraints

leonardoalt opened this issue · comments

commented
constructor of AllEnvVars
interface constructor()

creates
	uint value := CALLVALUE

invariants
	value >= 0

I would expect that to be always true based on value's type, but:

$ ./result/bin/act prove --file tests/invariants/pass/all_env_vars.act 

============

Invariant "(AllEnvVars.value >= 0)" of "AllEnvVars": 

Counter example found!

SMTModel {modelObjectives = [], modelBindings = Nothing, modelAssocs = [("AllEnvVars_init_value",0 :: Integer),("AllEnvVars_init_value_post",-1 :: Integer),("AllEnvVars_init_CALLER",0 :: Integer),("AllEnvVars_init_CALLVALUE",-1 :: Integer),("AllEnvVars_init_CALLDEPTH",0 :: Integer),("AllEnvVars_init_ORIGIN",0 :: Integer),("AllEnvVars_init_BLOCKHASH","" :: String),("AllEnvVars_init_BLOCKNUMBER",0 :: Integer),("AllEnvVars_init_DIFFICULTY",0 :: Integer),("AllEnvVars_init_CHAINID",0 :: Integer),("AllEnvVars_init_GASLIMIT",0 :: Integer),("AllEnvVars_init_COINBASE",0 :: Integer),("AllEnvVars_init_TIMESTAMP",0 :: Integer),("AllEnvVars_init_THIS",0 :: Integer),("AllEnvVars_init_NONCE",0 :: Integer)], modelUIFuns = []}
commented
constructor of AllEnvVars
interface constructor()

creates
	uint value := 5

invariants
	value >= 0

This holds, so I guess it's the env vars that are missing the type constraints.