tweag / cooked-validators

MIT License
39 stars 11 forks source link

Mismatch between `SpendsScript` and `PaysScript` constraints and the data we store in `MockChainSt` #178

Closed carlhammann closed 1 year ago

carlhammann commented 1 year ago

The SpendsScript and PaysScript constraints both have as their first argument a TypedValidator. There are different reason for the presence of that argument in the two cases:

On the other side, the information we store in MockChainSt only contains a mappings between addresses to the UTxOs they own (which we can access using functions like utxosSuchThisAndThat, for example). This means that the information we can extract from the current state of the MockChain is not enough to construct a PaysScript or SpendsScript constraint; any application (say, when formulating a double satisfaction attack) that wants to look at the state of the MockChain and generate a transaction involving such constraints will need extra information, which might be hard to come by.

There are two obvious solutions:

carlhammann commented 1 year ago

Concerning the first option I proposed above: The Contract monad already has functionalities like this, which means that we could even make them a feature of MonadBlockChain.