crytic/echidna

Value generation can fail in multi-abi mode, since the function hash is not precise enough

ggrieco-tob opened this issue · 1 comments

genValue :: MonadRandom m => Word -> [Integer] -> [FunctionHash] -> SolCall -> m Word
genValue mv ds ps sc =
if sig `elem` ps then do
let ds' = map (`mod` (fromIntegral mv + 1)) ds
g <- oftenUsually randValue $ rElem (0 NE.:| ds')
fromIntegral <$> g
else do
g <- usuallyRarely (pure 0) randValue -- once in a while, this will generate value in a non-payable function
fromIntegral <$> g
where randValue = getRandomR (1 :: Integer, fromIntegral mv)
sig = (hashSig . encodeSig . signatureCall) sc

Already fixed in 2.0.0