Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ggrieco-tob opened this issue Dec 6, 2020 · 1 comment

Comments

@ggrieco-tob
Copy link
Member

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

@ggrieco-tob ggrieco-tob changed the title Value generation can fail in multi-abi mode, since the function hash is not enough Value generation can fail in multi-abi mode, since the function hash is not precise enough Apr 30, 2021
@ggrieco-tob
Copy link
Member Author

Already fixed in 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant