Open ignaciodopazo opened 1 month ago
Agreed, theres a change in approach with new aiken validators, altough, the policies and validators are different uplc, they are less independent from each other if I have undertood them correctly. Still similar pattern solving the dame issue, no?
Exactly, both solve the issue. Even though the forwarding MP pattern keeps the two validators separated meaning they are different scripts, one depends on the other by parameter. So having them separated has no advantages I can think of. Even more, in the forwarding pattern, the MP has access to the spend script hash because of the parameter, but not the other way around, whereas in the multivalidator pattern the "access" is bidirectional. This bidirectionality has been useful when developing on-chain code for me.
https://github.com/Vortecsmaster/EA_BuidlNOW_Crowdfunding/blob/c217353aa0db6b08d86689d95dfa675da61debd8/crowdfunding_v03/validators/campaingmanagementv03.ak#L46 While Plutus Haskell lib had a pretty cool abstraction for handling this use case, in Aiken there isn't an analogous one (as far as I know, of course!). Anyway, in the wild, I saw that the multivalidator pattern is favored for this kind of use case (minting policy and spend into the same validator), which has other handy properties as well. Even more, at least a brief lesson about the usage of multivalidators could be interesting for the course IMO. The only part of the Aiken doc that this is mentioned briefly is here, but in the Language Tour -> Validators section of the doc tackles it seamlessly.