Skip to content

Commit

Permalink
Malformed fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Dec 20, 2024
1 parent a6a7ced commit ff80d8b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/unit/test/unit/Cardano/Wallet/Api/Malformed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,18 @@ instance Wellformed (PathParam ApiDRepSpecifier) where
wellformed = PathParam <$>
[ "abstain"
, "no_confidence"
, payloadKeyHashWith22HexByte
, payloadScriptHashWith23HexByte
, payloadKeyHashCredentialWith22HexByte
, payloadScriptHashCredentialWith23HexByte
, payloadDeprecated
, drepVerKeyHash
, drepScriptHash
]
where
payloadKeyHashWith22HexByte = "drep1ytje8qacj9dyua6esh86rdjqpdactf8wph05gdd72u46axcvy952y"
payloadScriptHashWith23HexByte = "drep1y0je8qacj9dyua6esh86rdjqpdactf8wph05gdd72u46axcvk492r"
payloadKeyHashCredentialWith22HexByte = "drep1ytje8qacj9dyua6esh86rdjqpdactf8wph05gdd72u46axcvy952y"
payloadScriptHashCredentialWith23HexByte = "drep1y0je8qacj9dyua6esh86rdjqpdactf8wph05gdd72u46axcvk492r"
payloadDeprecated = "drep15k6929drl7xt0spvudgcxndryn4kmlzpk4meed0xhqe25nle07s"
drepVerKeyHash = "drep_vkh15k6929drl7xt0spvudgcxndryn4kmlzpk4meed0xhqe254czjh2"
drepScriptHash = "drep_script16pjhzfkm7rqntfezfkgu5p50t0mkntmdruwlp089zu8v29l95rg"

instance Malformed (PathParam ApiDRepSpecifier) where
malformed = first PathParam <$>
Expand All @@ -229,14 +235,12 @@ instance Malformed (PathParam ApiDRepSpecifier) where
, (T.replicate 65 "1", msg1)
, ("something", msg1)
, ("no-confidence", msg1)
, (payloadWithoutCorrectBytePrefixCorrectHrp, msg2)
, (payloadWithWrongBytePrefixCorrectHrp, msg2)
, (payloadWithCorrectBytePrefixWrondHrp, msg1)
]
where
msg1 = "Invalid DRep key hash: expecting a Bech32 encoded value with human readable part of 'drep'."
msg2 = "Invalid DRep metadata: expecting a byte '00100010' value for key hash or a byte '0b00100011' value for script hash."
payloadWithoutCorrectBytePrefixCorrectHrp = "drep15k6929drl7xt0spvudgcxndryn4kmlzpk4meed0xhqe25nle07s"
msg1 = "Invalid DRep key/script hash: expecting a Bech32 encoded value with human readable part of 'drep', 'drep_vkh' or 'drep_script'."
msg2 = "Invalid DRep credential: expecting a first byte '0b00100010' value for key hash or a first byte '0b00100011' value for script hash."
payloadWithWrongBytePrefixCorrectHrp = "drep1xhje8qacj9dyua6esh86rdjqpdactf8wph05gdd72u46axc9fjca3"
payloadWithCorrectBytePrefixWrondHrp = "drepp1ytje8qacj9dyua6esh86rdjqpdactf8wph05gdd72u46axcp60l06"

Expand Down

0 comments on commit ff80d8b

Please sign in to comment.