-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ScriptContext test #6959
base: master
Are you sure you want to change the base?
Add ScriptContext test #6959
Conversation
This reverts commit 717d93f.
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
{-# LANGUAGE TypeApplications #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why Data-backed Marlowe is slightly faster now. The only relationship I can think of is that maybe it uses code from this module and adding these two extensions somehow made the compiler generate code which is slightly more optimal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After talking to @zliu41, and seeing that other tests have also been impacted, it's most likely from the two member'
and insert'
functions being exported, but it remains to be seen what exactly is going on with the Haskell Core. Anyway, we're lucky that the performance changes work in our favor.
@@ -139,3 +192,34 @@ mkScriptContextEqualityOverheadCode sc = | |||
in $$(PlutusTx.compile [|| scriptContextEqualityOverhead ||]) | |||
`PlutusTx.unsafeApplyCode` PlutusTx.liftCodeDef sc | |||
`PlutusTx.unsafeApplyCode` PlutusTx.liftCodeDef d | |||
|
|||
forwardWithStakeTrick :: BuiltinData -> BuiltinData -> () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some comments - it's hard to tell from the name - forwardWithStakeTrick - what it does.
error {Unit}) | ||
{all dead. dead}) | ||
{all dead. dead}) | ||
(Constr 0 [Constr 0 [B #736f6d6543726564656e7469616c]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't include the script context in the golden files - it serves no purpose.
|| PlutusTx.equalsData obsScriptCred wdrlAtOne | ||
then () | ||
else | ||
if Map.member' obsScriptCred rest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need member'
here - you can use PlutusTx.Data.List.elem
(or something very similar).
Even if you do need to expose member'
, it should be exposed from the List module (since it has nothing to do with Map), and it should have Haddock.
Fixes https://github.com/IntersectMBO/plutus-private/issues/1479
The
AsData
version is actually slightly better (in script size) than the manually optimised version! I am not entirely sure why, since I tried multiple versions of the manually optimised one, and this was the best one.