Skip to content

Commit 3b32546

Browse files
committed
Allow address to stay the same during shrinking
The current shrinking implementation has a bug/limitation: it always tries to shrink the sender. In other words, if a transaction has a sender that is not minimal, Echidna will try to reduce it. However, the transaction might require a different sender to still cause the assertion failure, and the fact that Echidna will unconditionally try to lower it might cause the shrinking to get 'stuck'. This allows the sender shrinker to keep the transaction source the same with some probability, allowing the shrinking to proceed in such cases.
1 parent e1d1b42 commit 3b32546

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Echidna/Shrink.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ shrinkSender x = do
128128
let orderedSenders = List.sort $ Set.toList senderSet
129129
case List.elemIndex x.src orderedSenders of
130130
Just i | i > 0 -> do
131-
sender <- uniform (take i orderedSenders)
131+
sender <- uniform (take (i+1) orderedSenders)
132132
pure x{src = sender}
133133
_ -> pure x

0 commit comments

Comments
 (0)