-
Notifications
You must be signed in to change notification settings - Fork 22
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 JSON schema checking functionality for DRep and Gov action metadata #713
base: master
Are you sure you want to change the base?
Conversation
c2d6579
to
4c6424e
Compare
4c6424e
to
4168561
Compare
But the CIPs 0119 and 0108 are in proposed state. Shouldn't we wait till they get accepted? |
cardano-api/internal/Cardano/Api/Governance/Metadata/DrepRegistration.hs
Fixed
Show fixed
Hide fixed
b7ef81c
to
554a65c
Compare
554a65c
to
a447f80
Compare
a447f80
to
504575e
Compare
|
||
import Data.Aeson (FromJSON, eitherDecodeStrict) | ||
import Data.ByteString (ByteString) | ||
import Data.Either.Combinators (mapRight) | ||
|
||
data family GovActionMetadata cip | ||
data GovActionMetadata cip |
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.
👍
@@ -76,7 +77,7 @@ prop_given_name_too_long_drep_registration_json = propertyOnce $ do | |||
:: File DRepMetadata In | |||
) | |||
value <- H.evalEither eitherValue | |||
validateGovActionAnchorData CIP119 value | |||
validateGovActionAnchorData DrepRegistrationMetadata value |
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 think this is way more informative
<*> v .:? "sha256" | ||
|
||
-- DoNotList Enum | ||
data DoNotList = DoNotListTrue | DoNotListFalse |
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.
What does DoNotList
refer to?
Changelog
Context
The objective is addressing this issue: IntersectMBO/cardano-cli#906
This PR adds 3 functions to the API that should be the only ones needed by the
cardano-cli
in order to implement this functionality:isDRepRegOrUpdateCert
- Checks whether a certificate is for DRep registration or DRep update.validateDRepAnchorData
- Checks whether aByteString
is valid JSON and conforms to CIP-0119.validateGovActionAnchorData
- Checks whether aByteString
is valid JSON and conforms to CIP-0108This PR is a requirement from PR #995 that implements the checking in
cardano-cli
and is based of the version ofcardano-api
in this PR.Related PRs in
CIPs
repo:@
beforetype
field nameCIP-0008
is in capital lettersHow to trust this PR
Tests should give some assurance. They are taken from the CIPs repo, with some adaptations that I have already created PRs in
CIPs
repo for (see above).The main thing to check here is the accuracy of the checks (are they enough, are they too much, are they right).
Could be useful to check the
cardano-cli
PR together with this one.Checklist