-
Notifications
You must be signed in to change notification settings - Fork 484
Benchmark: Linear Vesting #7166
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
base: master
Are you sure you want to change the base?
Conversation
|
8c04d25
to
cd09aca
Compare
cd09aca
to
407e11a
Compare
407e11a
to
705b58c
Compare
705b58c
to
7e83383
Compare
For the reference, this script is from https://github.com/Anastasia-Labs/linear-vesting/blob/main/src/LinearVesting.hs |
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.
Script looks good.
About running tests, do we want to pursue some unified format? For me, I made it so that script will be exported and save to validation/data
so that it can be run by the existing "test runner".
validatorCodeFullyApplied = | ||
validatorCode `unsafeApplyCode` liftCodeDef (toBuiltinData testScriptContext) | ||
|
||
testScriptContext :: ScriptContext |
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.
Let's have this as an another file.
traceError "Unlock not permitted until firstUnlockPossibleAfter time" | ||
| newRemainingQty <= 0 -> | ||
traceError "Zero remaining assets not allowed" | ||
| newRemainingQty > oldRemainingQty -> |
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.
newRemainingQty >= oldRemainingQty
?
It doesn't really matter though
addressCredential (beneficiary vestingDatum) | ||
in | ||
if | ||
| not (txSignedBy txInfo beneficiaryHash) -> |
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.
Generally, using not
is not preferable. I'm not sure our optimizer or GHC deal with this like
if not predicate then A else B
to
if predicate then B then A
Closes https://github.com/IntersectMBO/plutus-private/issues/1617
After switching to the
Data
-backedScriptContext
: