You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
The secret of Plutarch's efficiency comes down to two simple rules:
don't generate ridiculous code, and
postpone Data decoding as long as possible.
There's not much PlutusTx users can do about the former, though Shrinker can help. The second technique, on the other hand, can be translated to PlutusTx thus:
Introduce AsData type constructor to correspond with Plutarch's PAsData, along with
safeFromData :: UnsafeFromData x => AsData x -> x
safeToData :: ToData x => x -> AsData x
unsafeInjectData :: BuiltinData -> AsData x
forgetData :: AsData x -> BuiltinData
inefficientMapData :: (UnsafeFromData x, ToData y) => (x -> y) -> AsData x -> AsData y
mkTypedValidator :: CompiledCode (AsData (DatumType a) -> AsData (RedeemerType a) -> AsData ScriptContext -> Bool)
-> CompiledCode (ValidatorType a -> WrappedValidatorType) -> TypedValidator a
Provide a family of functions that map the AsData ScriptContext to its fields, and same for all the product types it contains. For example
The secret of Plutarch's efficiency comes down to two simple rules:
Datadecoding as long as possible.There's not much PlutusTx users can do about the former, though Shrinker can help. The second technique, on the other hand, can be translated to PlutusTx thus:
AsDatatype constructor to correspond with Plutarch'sPAsData, along withAsData ScriptContextto its fields, and same for all the product types it contains. For exampleWe should be able to generate all of these functions using either
Generics.SOPor Template Haskell.ScriptContext, such as