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

Test - Empty Beneficiaries on Withdraw #16

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

gnumonik
Copy link

@gnumonik gnumonik commented Dec 13, 2022

Description

The tests generated in this PR result from modifying the Happy path test generator such that a single (arbitrarily chosen) withdrawal transaction in the generated Tx sequence is submitted with an empty list in the redeemer, yet is otherwise valid.

The relevant functions used to implement these tests are located in Generators.hs:

-- modifies a random element then removes the subsequent elements, 
-- used to ensure the cause of the error is in the modified withdrawal configuration object 
overRandomElemCut :: (a -> a) -> [a] -> Gen [a]
overRandomElemCut f as = do
  i <- chooseInt (0,length as - 1)
  let a  = as !! i
      a' = f a
  pure . take (i+1) $ set (ix i) a' as

overRandomWithdrawConfigCut :: (WithdrawConfig -> WithdrawConfig) -> TestConfig -> Gen TestConfig
overRandomWithdrawConfigCut f (d,ws) = overRandomElemCut f ws >>= \ws' -> pure (d,ws')

emptySignersInWithdrawals :: TestConfig -> Gen TestConfig
emptySignersInWithdrawals = overRandomWithdrawConfigCut $ \w -> w {signers = []}

As expected, each generated Tx sequence fails with a New Beneficiaries are empty error.

These tests support our hypothesis that funds cannot be locked forever at the script address by submitting a transaction with a redeemer containing an empty list of PubKeyHashs.

Conclusion

The above hypothesis proves to hold - therefore no vulnerability was found.

@cstml cstml added the audit label Dec 13, 2022
This was referenced Dec 13, 2022
@cstml cstml changed the title Empty beneficiaries on withdraw Test - Empty Beneficiaries on Withdraw Dec 14, 2022
@cstml cstml mentioned this pull request Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants