-
Notifications
You must be signed in to change notification settings - Fork 63
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
Flesh out Plutarch.Api, port utilities #652
Conversation
use it on test suite
V1 plutus-ledger-api is no longer supported as of this PR. It is because there's no reason for users to develop and maintain script on older ledger API. V2 is strict superset of V1(and V3 is likely to be strict superset of V2) and therefore, nothing incentivizes using V1 ledger API over V2. For existing codebase that is using V1(and V2, after V3 lands), they would need to bump their codebase, adapting to new api library. Since smart contract scripts are rather static objects, meaning they are hard to change easily nor frequently, discontinuation of old ledger API on Plutarch will not break existing and deployed onchain scripts. When replacing a old script, ledger version of the new script does not need to match that of old script; therefore, new ledger api can be used to build replacement script. |
Woohooo staging! |
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.
Thanks folks!
`Plutrach.LedgerApi` for better consistency
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.
There are very few instances of commented out ledger api test cases, but we will eventually get better and separated test cases for ledger repo itself.
LGTM
Closes #636. This is a fairly major set of changes: a lot of identifiers have moved, some have vanished altogether, and a few bits still remain outstanding. Every change has been logged, but a few are a bit more 'invisible'.
Guide to migration
Essentially, a lot of stuff that used to be in
plutarch-extra
is now part ofplutarch-api
. Specifically,Plutarch.Extra.Map
,Plutarch.Extra.Interval
,Plutarch.Extra.Api
have been wholesale ported intoplutarch-api
(either a submodule, orPlutarch.Api
itself), and any part ofPlutarch.Extra.Maybe
to do withPMaybeData
is now inPlutarch.Api
as well. Furthermore,Plutarch.Api.*
from the main Plutarch repo is now gone: everything that was there was moved toplutarch-api
.Most notable change is that now, the API is V2 only. V1 stuff is gone, and all data types and functionality that differed between V1 and V2 now defaults to V2. This is a temporary measure, as we're moving to V3 in short order. This may mean some data types have changed a bit: if your old data types or functions were V1, you need to migrate to their V2 versions.
A few things have been removed altogether, as they either have no V1 equivalents, weren't useful (or covered by tests), or are otherwise no longer required:
pnever
(no V2 equivalent)PTuple
(type
synonym,PTuple a b
is identical toPBuiltinPair (PAsData a) (PAsData b)
)MergeHandler
s (hidden for now unless someone wants it, pending a full rethink)ptuple
,ptupleFromBuiltin
,pbuiltinPairFromTuple
(no-ops anyway, now useless withPTuple
being gone)PValidator
,PMintingPolicy
,PStakingValidator
(alltype
s, just use their equivalents, which arePData :--> PData :--> PScriptContext :--> POpaque
,PData :--> PScriptContext :--> POpaque
andPData :--> PScriptContext :--> POpaque
respectively)IsList
instances forPMap
(were broken and a bad idea to begin with, usepunsortedMapFromFoldable
orpsortedMapFromFoldable
instead offromList
)It is possible some functionality for
PMap
orPValue
slipped by us: if you need it, please let us know and we'll do our best to restore it!Outstanding tasks
In light of this PR landing, there are some remaining things to do:
PMap
functionality that used to be inplutarch-extra
) has no test coverage. This should be dealt with, either with or without more broad test revisions.plutarch-extra
needs to be subsumed into Plutarch itself, and the entire sublibrary needs to be eliminated.plutarch-api
is quite lacklustre, and needs improvement. This is particularly important for stuff coming from the Plutus side (such as data types), as this is a known confusion point. Examples of its use would also help drastically.type
must be killed with fire. While efforts have been made to makeplutarch-api
free of that terrible idea, the rest of Plutarch still has rather a lot of it.