tweag / cooked-validators

MIT License
39 stars 11 forks source link

List attacks #140

Closed carlhammann closed 2 years ago

carlhammann commented 2 years ago

This PR closes #128, defining a blanket double satisfaction attack. In order to achieve this, I had to change the implementation of the attack language. There should be no changes in the user-facing behaviour of anything that existed previously, though.

All substantial changes stem from the fact that we now have

type Attack = MockChainSt -> TxSkel -> [TxSkel]

with the intended meaning that an attack looks at the current state of the MockChain and the transaction to be validated, returning a (possibly empty) list of modified transactions. This necessary for the double satisfaction attack, because that attack needs to look at the currently available UTxOs belonging to the script we want to attack and then try to reddem each of these, each possibly with a number of different redeemers.

A few remarks:

I think that this PR still needs some more explanatory comments and tests, but nonetheless wanted to open the discussion before nailing things down too hard.