tweag / cooked-validators

MIT License
39 stars 11 forks source link

Check minAda for initial payments #418

Open mmontin opened 3 weeks ago

mmontin commented 3 weeks ago

While initial payments in initial distribution are part of a transaction that is not properly validated, we should still ensure that the resulting utxos have the required minimal amount of ada, otherwise we can work with a mockchain state that would not be correct.

florentc commented 2 weeks ago
  1. I agree this should fail, we should not allow to generate an initial state that violates the min ada invariant.
  2. I am not sure there should be a silent autofix by default on intitial distributions. I think it is interesting that you get an error because there might be something unintended (a typo or copypasting accident) in your initial distribution that is worth getting your attention as a user, while a silent correction would make it unnoticed.
  3. I think we could provide an optional autofix (that adds lovelace in UTxOs where they miss) in a dedicated function to compose over the inititial distribution, or dedicated smart constructor, for cases where the user knows everything is right or doesn't care about lovalaces, but is just lazy.
  4. Or maybe by default but with a warning when the autofix is triggered.