{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Test.Cardano.Ledger.ShelleyMA.Serialisation.Golden.Encoding (goldenEncodingTests) where
import Cardano.Ledger.Address (Addr (..), RewardAccount (..))
import Cardano.Ledger.Allegra (Allegra)
import Cardano.Ledger.Allegra.Scripts (
AllegraEraScript,
Timelock (..),
pattern RequireTimeExpire,
pattern RequireTimeStart,
)
import Cardano.Ledger.Allegra.TxAuxData (pattern AllegraTxAuxData)
import Cardano.Ledger.Allegra.TxBody (AllegraTxBody (..))
import Cardano.Ledger.BaseTypes (Network (..), StrictMaybe (..))
import Cardano.Ledger.Binary (ToCBOR)
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Credential (Credential (..), StakeReference (..))
import Cardano.Ledger.Crypto (Crypto, StandardCrypto)
import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..), hashKey)
import Cardano.Ledger.Mary (Mary)
import Cardano.Ledger.Mary.Core
import Cardano.Ledger.Mary.TxBody (MaryTxBody (..))
import Cardano.Ledger.Mary.Value (AssetName (..), MaryValue (..), MultiAsset (..), PolicyID (..))
import Cardano.Ledger.Shelley.PParams (
Update,
pattern ProposedPPUpdates,
pattern Update,
)
import Cardano.Ledger.Shelley.Scripts (
ShelleyEraScript,
pattern RequireAllOf,
pattern RequireAnyOf,
pattern RequireMOf,
pattern RequireSignature,
)
import qualified Cardano.Ledger.Shelley.TxAuxData as TxAuxData
import Cardano.Ledger.Shelley.TxOut (ShelleyTxOut (..))
import Cardano.Ledger.Slot (EpochNo (..), SlotNo (..))
import Cardano.Ledger.TxIn (mkTxInPartial)
import qualified Cardano.Ledger.Val as Val
import Codec.CBOR.Encoding (Tokens (..))
import qualified Data.ByteString.Short as SBS
import qualified Data.Map.Strict as Map
import qualified Data.Sequence.Strict as StrictSeq
import qualified Data.Set as Set
import Lens.Micro
import Test.Cardano.Ledger.Binary.RoundTrip (roundTripCborRangeFailureExpectation)
import Test.Cardano.Ledger.Shelley.Generator.EraGen (genesisId)
import Test.Cardano.Ledger.Shelley.Serialisation.GoldenUtils (
ToTokens (..),
checkEncodingCBOR,
checkEncodingCBORAnnotated,
checkEncodingCBORDecodeFailure,
)
import Test.Cardano.Ledger.Shelley.Utils (RawSeed (..), mkGenKey, mkKeyPair)
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.HUnit (Assertion, testCase)
policy1 :: ShelleyEraScript era => NativeScript era
policy1 :: forall era. ShelleyEraScript era => NativeScript era
policy1 = forall era.
ShelleyEraScript era =>
StrictSeq (NativeScript era) -> NativeScript era
RequireAnyOf forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> StrictSeq a
StrictSeq.fromList forall a b. (a -> b) -> a -> b
$ []
policyID1 :: PolicyID StandardCrypto
policyID1 :: PolicyID StandardCrypto
policyID1 = forall c. ScriptHash c -> PolicyID c
PolicyID forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall era.
EraScript era =>
Script era -> ScriptHash (EraCrypto era)
hashScript @Allegra) forall a b. (a -> b) -> a -> b
$ forall era. ShelleyEraScript era => NativeScript era
policy1
policyID2 :: PolicyID StandardCrypto
policyID2 :: PolicyID StandardCrypto
policyID2 = forall c. ScriptHash c -> PolicyID c
PolicyID forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall era.
EraScript era =>
Script era -> ScriptHash (EraCrypto era)
hashScript @Allegra) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era.
ShelleyEraScript era =>
StrictSeq (NativeScript era) -> NativeScript era
RequireAllOf forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. [a] -> StrictSeq a
StrictSeq.fromList forall a b. (a -> b) -> a -> b
$ []
assetName1 :: SBS.ShortByteString
assetName1 :: ShortByteString
assetName1 = ShortByteString
"a1"
assetName2 :: SBS.ShortByteString
assetName2 :: ShortByteString
assetName2 = ShortByteString
"a2"
assetName3 :: SBS.ShortByteString
assetName3 :: ShortByteString
assetName3 = ShortByteString
"a3"
testGKeyHash :: Crypto c => KeyHash 'Genesis c
testGKeyHash :: forall c. Crypto c => KeyHash 'Genesis c
testGKeyHash = forall c (kd :: KeyRole). Crypto c => VKey kd c -> KeyHash kd c
hashKey forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c (kd :: KeyRole).
DSIGNAlgorithm (DSIGN c) =>
RawSeed -> (SignKeyDSIGN (DSIGN c), VKey kd c)
mkGenKey forall a b. (a -> b) -> a -> b
$ Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RawSeed
RawSeed Word64
0 Word64
0 Word64
0 Word64
0 Word64
0
testAddrE :: Addr StandardCrypto
testAddrE :: Addr StandardCrypto
testAddrE =
forall c.
Network -> PaymentCredential c -> StakeReference c -> Addr c
Addr
Network
Testnet
(forall (kr :: KeyRole) c. KeyHash kr c -> Credential kr c
KeyHashObj forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c (kd :: KeyRole). Crypto c => VKey kd c -> KeyHash kd c
hashKey forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ forall c (kd :: KeyRole).
DSIGNAlgorithm (DSIGN c) =>
RawSeed -> (SignKeyDSIGN (DSIGN c), VKey kd c)
mkKeyPair (Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RawSeed
RawSeed Word64
0 Word64
0 Word64
0 Word64
0 Word64
1))
forall c. StakeReference c
StakeRefNull
testKeyHash :: KeyHash 'Staking StandardCrypto
testKeyHash :: KeyHash 'Staking StandardCrypto
testKeyHash = forall c (kd :: KeyRole). Crypto c => VKey kd c -> KeyHash kd c
hashKey forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ forall c (kd :: KeyRole).
DSIGNAlgorithm (DSIGN c) =>
RawSeed -> (SignKeyDSIGN (DSIGN c), VKey kd c)
mkKeyPair (Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RawSeed
RawSeed Word64
0 Word64
0 Word64
0 Word64
0 Word64
2)
testStakeCred :: Credential 'Staking StandardCrypto
testStakeCred :: Credential 'Staking StandardCrypto
testStakeCred = forall (kr :: KeyRole) c. KeyHash kr c -> Credential kr c
KeyHashObj forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c (kd :: KeyRole). Crypto c => VKey kd c -> KeyHash kd c
hashKey forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall a b. (a -> b) -> a -> b
$ forall c (kd :: KeyRole).
DSIGNAlgorithm (DSIGN c) =>
RawSeed -> (SignKeyDSIGN (DSIGN c), VKey kd c)
mkKeyPair (Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RawSeed
RawSeed Word64
0 Word64
0 Word64
0 Word64
0 Word64
3)
testUpdate ::
forall era.
EraPParams era =>
Update era
testUpdate :: forall era. EraPParams era => Update era
testUpdate =
forall era. ProposedPPUpdates era -> EpochNo -> Update era
Update
( forall era.
Map (KeyHash 'Genesis (EraCrypto era)) (PParamsUpdate era)
-> ProposedPPUpdates era
ProposedPPUpdates
( forall k a. k -> a -> Map k a
Map.singleton
forall c. Crypto c => KeyHash 'Genesis c
testGKeyHash
(forall era. EraPParams era => PParamsUpdate era
emptyPParamsUpdate forall a b. a -> (a -> b) -> b
& forall era.
EraPParams era =>
Lens' (PParamsUpdate era) (StrictMaybe Natural)
ppuNOptL forall s t a b. ASetter s t a b -> b -> s -> t
.~ forall a. a -> StrictMaybe a
SJust Natural
100)
)
)
(Word64 -> EpochNo
EpochNo Word64
0)
scriptGoldenTest :: forall era. (AllegraEraScript era, ToCBOR (NativeScript era)) => TestTree
scriptGoldenTest :: forall era.
(AllegraEraScript era, ToCBOR (NativeScript era)) =>
TestTree
scriptGoldenTest =
let kh0 :: KeyHash 'Witness (EraCrypto era)
kh0 = forall c (kd :: KeyRole). Crypto c => VKey kd c -> KeyHash kd c
hashKey forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c (kd :: KeyRole).
DSIGNAlgorithm (DSIGN c) =>
RawSeed -> (SignKeyDSIGN (DSIGN c), VKey kd c)
mkGenKey forall a b. (a -> b) -> a -> b
$ Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RawSeed
RawSeed Word64
0 Word64
0 Word64
0 Word64
0 Word64
0 :: KeyHash 'Witness (EraCrypto era)
kh1 :: KeyHash 'Witness (EraCrypto era)
kh1 = forall c (kd :: KeyRole). Crypto c => VKey kd c -> KeyHash kd c
hashKey forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a, b) -> b
snd forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c (kd :: KeyRole).
DSIGNAlgorithm (DSIGN c) =>
RawSeed -> (SignKeyDSIGN (DSIGN c), VKey kd c)
mkGenKey forall a b. (a -> b) -> a -> b
$ Word64 -> Word64 -> Word64 -> Word64 -> Word64 -> RawSeed
RawSeed Word64
1 Word64
1 Word64
1 Word64
1 Word64
1 :: KeyHash 'Witness (EraCrypto era)
in forall a.
(HasCallStack, DecCBOR (Annotator a), ToCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBORAnnotated
(forall era. Era era => Version
eraProtVerHigh @era)
String
"timelock_script"
( forall era.
ShelleyEraScript era =>
StrictSeq (NativeScript era) -> NativeScript era
RequireAllOf @era
( forall a. [a] -> StrictSeq a
StrictSeq.fromList
[ forall era.
ShelleyEraScript era =>
Int -> StrictSeq (NativeScript era) -> NativeScript era
RequireMOf Int
1 forall a b. (a -> b) -> a -> b
$ forall a. [a] -> StrictSeq a
StrictSeq.fromList [forall era.
ShelleyEraScript era =>
KeyHash 'Witness (EraCrypto era) -> NativeScript era
RequireSignature KeyHash 'Witness (EraCrypto era)
kh0, forall era.
ShelleyEraScript era =>
KeyHash 'Witness (EraCrypto era) -> NativeScript era
RequireSignature KeyHash 'Witness (EraCrypto era)
kh1]
, forall era. AllegraEraScript era => SlotNo -> NativeScript era
RequireTimeStart (Word64 -> SlotNo
SlotNo Word64
100)
, forall era. AllegraEraScript era => SlotNo -> NativeScript era
RequireTimeExpire (Word64 -> SlotNo
SlotNo Word64
101)
]
)
)
( (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
3
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
3
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
3
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
0
)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S KeyHash 'Witness (EraCrypto era)
kh0
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
0
)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S KeyHash 'Witness (EraCrypto era)
kh1
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
4
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
100
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
5
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
101
)
)
metadataNoScriptsGoldenTest :: forall era. Era era => TestTree
metadataNoScriptsGoldenTest :: forall era. Era era => TestTree
metadataNoScriptsGoldenTest =
forall a.
(HasCallStack, DecCBOR (Annotator a), ToCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBORAnnotated
(forall era. Era era => Version
eraProtVerHigh @era)
String
"metadata_no_scripts"
(forall era.
Era era =>
Map Word64 Metadatum
-> StrictSeq (Timelock era) -> AllegraTxAuxData era
AllegraTxAuxData @era (forall k a. k -> a -> Map k a
Map.singleton Word64
17 (Integer -> Metadatum
TxAuxData.I Integer
42)) forall a. StrictSeq a
StrictSeq.empty)
( (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkMapLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
17
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
42
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
0
)
)
metadataWithScriptsGoldenTest ::
forall era.
(ShelleyEraScript era, NativeScript era ~ Timelock era) =>
TestTree
metadataWithScriptsGoldenTest :: forall era.
(ShelleyEraScript era, NativeScript era ~ Timelock era) =>
TestTree
metadataWithScriptsGoldenTest =
forall a.
(HasCallStack, DecCBOR (Annotator a), ToCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBORAnnotated
(forall era. Era era => Version
eraProtVerHigh @era)
String
"metadata_with_scripts"
( forall era.
Era era =>
Map Word64 Metadatum
-> StrictSeq (Timelock era) -> AllegraTxAuxData era
AllegraTxAuxData @era
(forall k a. k -> a -> Map k a
Map.singleton Word64
17 (Integer -> Metadatum
TxAuxData.I Integer
42))
(forall a. a -> StrictSeq a
StrictSeq.singleton forall era. ShelleyEraScript era => NativeScript era
policy1)
)
( (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkMapLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
17
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
42
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkListLen Word
1
)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S (forall era. ShelleyEraScript era => NativeScript era
policy1 @era)
)
goldenEncodingTestsAllegra :: TestTree
goldenEncodingTestsAllegra :: TestTree
goldenEncodingTestsAllegra =
String -> [TestTree] -> TestTree
testGroup
String
"Allegra"
[ forall a.
(HasCallStack, DecCBOR a, EncCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBOR
(forall era. Era era => Version
eraProtVerHigh @Mary)
String
"value"
(forall t s. Inject t s => t -> s
Val.inject (Integer -> Coin
Coin Integer
1) :: Value Allegra)
((Tokens -> Tokens) -> ToTokens
T (Integer -> Tokens -> Tokens
TkInteger Integer
1))
, forall era.
(AllegraEraScript era, ToCBOR (NativeScript era)) =>
TestTree
scriptGoldenTest @Allegra
, forall era. Era era => TestTree
metadataNoScriptsGoldenTest @Allegra
, forall era.
(ShelleyEraScript era, NativeScript era ~ Timelock era) =>
TestTree
metadataWithScriptsGoldenTest @Allegra
,
let tin :: TxIn (EraCrypto Allegra)
tin = forall c. HasCallStack => TxId c -> Integer -> TxIn c
mkTxInPartial forall c. HashAlgorithm (HASH c) => TxId c
genesisId Integer
1
tout :: ShelleyTxOut Allegra
tout = forall era.
(HasCallStack, Era era, Val (Value era)) =>
Addr (EraCrypto era) -> Value era -> ShelleyTxOut era
ShelleyTxOut @Allegra Addr StandardCrypto
testAddrE (Integer -> Coin
Coin Integer
2)
in forall a.
(HasCallStack, DecCBOR (Annotator a), ToCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBORAnnotated
(forall era. Era era => Version
eraProtVerHigh @Allegra)
String
"minimal_txbody"
( forall era.
(EraTxOut era, EraTxCert era) =>
Set (TxIn (EraCrypto era))
-> StrictSeq (TxOut era)
-> StrictSeq (TxCert era)
-> Withdrawals (EraCrypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
-> AllegraTxBody era
AllegraTxBody
(forall a. Ord a => [a] -> Set a
Set.fromList [TxIn (EraCrypto Allegra)
tin])
(forall a. a -> StrictSeq a
StrictSeq.singleton ShelleyTxOut Allegra
tout)
forall a. StrictSeq a
StrictSeq.empty
(forall c. Map (RewardAccount c) Coin -> Withdrawals c
Withdrawals forall k a. Map k a
Map.empty)
(Integer -> Coin
Coin Integer
9)
(StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval forall a. StrictMaybe a
SNothing forall a. StrictMaybe a
SNothing)
forall a. StrictMaybe a
SNothing
forall a. StrictMaybe a
SNothing
)
( (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkMapLen Word
3)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
0)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S TxIn (EraCrypto Allegra)
tin
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
1)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S ShelleyTxOut Allegra
tout
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
2)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word64 -> Tokens -> Tokens
TkWord64 Word64
9)
)
,
let tin :: TxIn (EraCrypto Allegra)
tin = forall c. HasCallStack => TxId c -> Integer -> TxIn c
mkTxInPartial forall c. HashAlgorithm (HASH c) => TxId c
genesisId Integer
1
tout :: ShelleyTxOut Allegra
tout = forall era.
(HasCallStack, Era era, Val (Value era)) =>
Addr (EraCrypto era) -> Value era -> ShelleyTxOut era
ShelleyTxOut @Allegra Addr StandardCrypto
testAddrE (Integer -> Coin
Coin Integer
2)
reg :: TxCert Allegra
reg = forall era.
ShelleyEraTxCert era =>
StakeCredential (EraCrypto era) -> TxCert era
RegTxCert Credential 'Staking StandardCrypto
testStakeCred
ras :: Map (RewardAccount StandardCrypto) Coin
ras = forall k a. k -> a -> Map k a
Map.singleton (forall c. Network -> Credential 'Staking c -> RewardAccount c
RewardAccount Network
Testnet (forall (kr :: KeyRole) c. KeyHash kr c -> Credential kr c
KeyHashObj KeyHash 'Staking StandardCrypto
testKeyHash)) (Integer -> Coin
Coin Integer
123)
up :: Update Allegra
up = forall era. EraPParams era => Update era
testUpdate
mdh :: AuxiliaryDataHash (EraCrypto Allegra)
mdh = forall era.
EraTxAuxData era =>
TxAuxData era -> AuxiliaryDataHash (EraCrypto era)
hashTxAuxData @Allegra forall a b. (a -> b) -> a -> b
$ forall era.
Era era =>
Map Word64 Metadatum
-> StrictSeq (Timelock era) -> AllegraTxAuxData era
AllegraTxAuxData forall k a. Map k a
Map.empty forall a. StrictSeq a
StrictSeq.empty
in forall a.
(HasCallStack, DecCBOR (Annotator a), ToCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBORAnnotated
(forall era. Era era => Version
eraProtVerHigh @Allegra)
String
"full_txn_body"
( forall era.
(EraTxOut era, EraTxCert era) =>
Set (TxIn (EraCrypto era))
-> StrictSeq (TxOut era)
-> StrictSeq (TxCert era)
-> Withdrawals (EraCrypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
-> AllegraTxBody era
AllegraTxBody
(forall a. Ord a => [a] -> Set a
Set.fromList [TxIn (EraCrypto Allegra)
tin])
(forall a. a -> StrictSeq a
StrictSeq.singleton ShelleyTxOut Allegra
tout)
(forall a. [a] -> StrictSeq a
StrictSeq.fromList [TxCert Allegra
reg])
(forall c. Map (RewardAccount c) Coin -> Withdrawals c
Withdrawals Map (RewardAccount StandardCrypto) Coin
ras)
(Integer -> Coin
Coin Integer
9)
(StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval (forall a. a -> StrictMaybe a
SJust forall a b. (a -> b) -> a -> b
$ Word64 -> SlotNo
SlotNo Word64
500) (forall a. a -> StrictMaybe a
SJust forall a b. (a -> b) -> a -> b
$ Word64 -> SlotNo
SlotNo Word64
600))
(forall a. a -> StrictMaybe a
SJust Update Allegra
up)
(forall a. a -> StrictMaybe a
SJust AuxiliaryDataHash StandardCrypto
mdh)
)
( (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkMapLen Word
9)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
0)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S TxIn (EraCrypto Allegra)
tin
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
1)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S ShelleyTxOut Allegra
tout
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
2)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S (Integer -> Coin
Coin Integer
9)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
3)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S (Word64 -> SlotNo
SlotNo Word64
600)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
4)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S TxCert Allegra
reg
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
5)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S Map (RewardAccount StandardCrypto) Coin
ras
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
6)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S Update Allegra
up
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
7)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S AuxiliaryDataHash StandardCrypto
mdh
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
8)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S (Word64 -> SlotNo
SlotNo Word64
500)
)
]
goldenEncodingTestsMary :: TestTree
goldenEncodingTestsMary :: TestTree
goldenEncodingTestsMary =
String -> [TestTree] -> TestTree
testGroup
String
"Mary"
[ forall a.
(HasCallStack, DecCBOR a, EncCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBOR
(forall era. Era era => Version
eraProtVerHigh @Mary)
String
"ada_only_value"
(forall t s. Inject t s => t -> s
Val.inject (Integer -> Coin
Coin Integer
1) :: MaryValue StandardCrypto)
((Tokens -> Tokens) -> ToTokens
T (Integer -> Tokens -> Tokens
TkInteger Integer
1))
, forall a.
(HasCallStack, DecCBOR a, EncCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBOR
(forall era. Era era => Version
eraProtVerHigh @Mary)
String
"not_just_ada_value"
( forall c. Coin -> MultiAsset c -> MaryValue c
MaryValue @StandardCrypto (Integer -> Coin
Coin Integer
2) forall a b. (a -> b) -> a -> b
$
forall c. Map (PolicyID c) (Map AssetName Integer) -> MultiAsset c
MultiAsset forall a b. (a -> b) -> a -> b
$
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
[
( PolicyID StandardCrypto
policyID1
, forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
[ (ShortByteString -> AssetName
AssetName ShortByteString
assetName1, Integer
13)
, (ShortByteString -> AssetName
AssetName ShortByteString
assetName2, Integer
17)
]
)
,
( PolicyID StandardCrypto
policyID2
, forall k a. k -> a -> Map k a
Map.singleton (ShortByteString -> AssetName
AssetName ShortByteString
assetName3) Integer
19
)
]
)
( (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkMapLen Word
2
)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S PolicyID StandardCrypto
policyID1
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkMapLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes (ShortByteString -> ByteString
SBS.fromShort ShortByteString
assetName1)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
13
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes (ShortByteString -> ByteString
SBS.fromShort ShortByteString
assetName2)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
17
)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S PolicyID StandardCrypto
policyID2
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkMapLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes (ShortByteString -> ByteString
SBS.fromShort ShortByteString
assetName3)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
19
)
)
, forall a.
(HasCallStack, DecCBOR a, EncCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBOR
(forall era. Era era => Version
eraProtVerHigh @Mary)
String
"multiasset_with_negative"
(forall c. Map (PolicyID c) (Map AssetName Integer) -> MultiAsset c
MultiAsset forall a b. (a -> b) -> a -> b
$ forall k a. k -> a -> Map k a
Map.singleton PolicyID StandardCrypto
policyID1 (forall k a. k -> a -> Map k a
Map.singleton (ShortByteString -> AssetName
AssetName ShortByteString
assetName1) (-Integer
19)))
( (Tokens -> Tokens) -> ToTokens
T
(Word -> Tokens -> Tokens
TkMapLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S PolicyID StandardCrypto
policyID1
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkMapLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes (ShortByteString -> ByteString
SBS.fromShort ShortByteString
assetName1)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger (-Integer
19)
)
)
, forall a.
(HasCallStack, DecCBOR a, EncCBOR a, Show a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBORDecodeFailure
(forall era. Era era => Version
eraProtVerHigh @Mary)
String
"value_with_negative"
( forall c. Coin -> MultiAsset c -> MaryValue c
MaryValue (Integer -> Coin
Coin Integer
1) forall a b. (a -> b) -> a -> b
$
forall c. Map (PolicyID c) (Map AssetName Integer) -> MultiAsset c
MultiAsset forall a b. (a -> b) -> a -> b
$
forall k a. k -> a -> Map k a
Map.singleton PolicyID StandardCrypto
policyID1 (forall k a. k -> a -> Map k a
Map.singleton (ShortByteString -> AssetName
AssetName ShortByteString
assetName1) (-Integer
19))
)
( (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkListLen Word
2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger Integer
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word -> Tokens -> Tokens
TkMapLen Word
1
)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S PolicyID StandardCrypto
policyID1
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T
( Word -> Tokens -> Tokens
TkMapLen Word
1
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Tokens -> Tokens
TkBytes (ShortByteString -> ByteString
SBS.fromShort ShortByteString
assetName1)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> Tokens -> Tokens
TkInteger (-Integer
19)
)
)
, forall era.
(AllegraEraScript era, ToCBOR (NativeScript era)) =>
TestTree
scriptGoldenTest @Mary
, forall era. Era era => TestTree
metadataNoScriptsGoldenTest @Mary
, forall era.
(ShelleyEraScript era, NativeScript era ~ Timelock era) =>
TestTree
metadataWithScriptsGoldenTest @Mary
,
let tin :: TxIn (EraCrypto Mary)
tin = forall c. HasCallStack => TxId c -> Integer -> TxIn c
mkTxInPartial forall c. HashAlgorithm (HASH c) => TxId c
genesisId Integer
1
tout :: ShelleyTxOut Mary
tout = forall era.
(HasCallStack, Era era, Val (Value era)) =>
Addr (EraCrypto era) -> Value era -> ShelleyTxOut era
ShelleyTxOut @Mary Addr StandardCrypto
testAddrE (forall t s. Inject t s => t -> s
Val.inject forall a b. (a -> b) -> a -> b
$ Integer -> Coin
Coin Integer
2)
in forall a.
(HasCallStack, DecCBOR (Annotator a), ToCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBORAnnotated
(forall era. Era era => Version
eraProtVerHigh @Mary)
String
"minimal_txbody"
( forall era.
(EraTxOut era, EraTxCert era) =>
Set (TxIn (EraCrypto era))
-> StrictSeq (TxOut era)
-> StrictSeq (TxCert era)
-> Withdrawals (EraCrypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
-> MultiAsset (EraCrypto era)
-> MaryTxBody era
MaryTxBody
(forall a. Ord a => [a] -> Set a
Set.fromList [TxIn (EraCrypto Mary)
tin])
(forall a. a -> StrictSeq a
StrictSeq.singleton ShelleyTxOut Mary
tout)
forall a. StrictSeq a
StrictSeq.empty
(forall c. Map (RewardAccount c) Coin -> Withdrawals c
Withdrawals forall k a. Map k a
Map.empty)
(Integer -> Coin
Coin Integer
9)
(StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval forall a. StrictMaybe a
SNothing forall a. StrictMaybe a
SNothing)
forall a. StrictMaybe a
SNothing
forall a. StrictMaybe a
SNothing
forall a. Monoid a => a
mempty
)
( (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkMapLen Word
3)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
0)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S TxIn (EraCrypto Mary)
tin
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
1)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S ShelleyTxOut Mary
tout
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
2)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word64 -> Tokens -> Tokens
TkWord64 Word64
9)
)
,
let tin :: TxIn (EraCrypto Mary)
tin = forall c. HasCallStack => TxId c -> Integer -> TxIn c
mkTxInPartial forall c. HashAlgorithm (HASH c) => TxId c
genesisId Integer
1
tout :: ShelleyTxOut Mary
tout = forall era.
(HasCallStack, Era era, Val (Value era)) =>
Addr (EraCrypto era) -> Value era -> ShelleyTxOut era
ShelleyTxOut @Mary Addr StandardCrypto
testAddrE (forall t s. Inject t s => t -> s
Val.inject forall a b. (a -> b) -> a -> b
$ Integer -> Coin
Coin Integer
2)
reg :: TxCert Mary
reg = forall era.
ShelleyEraTxCert era =>
StakeCredential (EraCrypto era) -> TxCert era
RegTxCert Credential 'Staking StandardCrypto
testStakeCred
ras :: Map (RewardAccount StandardCrypto) Coin
ras = forall k a. k -> a -> Map k a
Map.singleton (forall c. Network -> Credential 'Staking c -> RewardAccount c
RewardAccount Network
Testnet (forall (kr :: KeyRole) c. KeyHash kr c -> Credential kr c
KeyHashObj KeyHash 'Staking StandardCrypto
testKeyHash)) (Integer -> Coin
Coin Integer
123)
up :: Update Mary
up = forall era. EraPParams era => Update era
testUpdate
mdh :: AuxiliaryDataHash (EraCrypto Allegra)
mdh = forall era.
EraTxAuxData era =>
TxAuxData era -> AuxiliaryDataHash (EraCrypto era)
hashTxAuxData @Allegra forall a b. (a -> b) -> a -> b
$ forall era.
Era era =>
Map Word64 Metadatum
-> StrictSeq (Timelock era) -> AllegraTxAuxData era
AllegraTxAuxData forall k a. Map k a
Map.empty forall a. StrictSeq a
StrictSeq.empty
mint :: Map (PolicyID StandardCrypto) (Map AssetName Integer)
mint = forall k a. k -> a -> Map k a
Map.singleton PolicyID StandardCrypto
policyID1 forall a b. (a -> b) -> a -> b
$ forall k a. k -> a -> Map k a
Map.singleton (ShortByteString -> AssetName
AssetName ShortByteString
assetName1) Integer
13
in forall a.
(HasCallStack, DecCBOR (Annotator a), ToCBOR a, Show a, Eq a) =>
Version -> String -> a -> ToTokens -> TestTree
checkEncodingCBORAnnotated
(forall era. Era era => Version
eraProtVerHigh @Mary)
String
"full_txn_body"
( forall era.
(EraTxOut era, EraTxCert era) =>
Set (TxIn (EraCrypto era))
-> StrictSeq (TxOut era)
-> StrictSeq (TxCert era)
-> Withdrawals (EraCrypto era)
-> Coin
-> ValidityInterval
-> StrictMaybe (Update era)
-> StrictMaybe (AuxiliaryDataHash (EraCrypto era))
-> MultiAsset (EraCrypto era)
-> MaryTxBody era
MaryTxBody
(forall a. Ord a => [a] -> Set a
Set.fromList [TxIn (EraCrypto Mary)
tin])
(forall a. a -> StrictSeq a
StrictSeq.singleton ShelleyTxOut Mary
tout)
(forall a. [a] -> StrictSeq a
StrictSeq.fromList [TxCert Mary
reg])
(forall c. Map (RewardAccount c) Coin -> Withdrawals c
Withdrawals Map (RewardAccount StandardCrypto) Coin
ras)
(Integer -> Coin
Coin Integer
9)
(StrictMaybe SlotNo -> StrictMaybe SlotNo -> ValidityInterval
ValidityInterval (forall a. a -> StrictMaybe a
SJust forall a b. (a -> b) -> a -> b
$ Word64 -> SlotNo
SlotNo Word64
500) (forall a. a -> StrictMaybe a
SJust forall a b. (a -> b) -> a -> b
$ Word64 -> SlotNo
SlotNo Word64
600))
(forall a. a -> StrictMaybe a
SJust Update Mary
up)
(forall a. a -> StrictMaybe a
SJust AuxiliaryDataHash StandardCrypto
mdh)
(forall c. Map (PolicyID c) (Map AssetName Integer) -> MultiAsset c
MultiAsset Map (PolicyID StandardCrypto) (Map AssetName Integer)
mint)
)
( (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkMapLen Word
10)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
0)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S TxIn (EraCrypto Mary)
tin
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
1)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S ShelleyTxOut Mary
tout
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
2)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S (Integer -> Coin
Coin Integer
9)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
3)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S (Word64 -> SlotNo
SlotNo Word64
600)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
4)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkListLen Word
1)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S TxCert Mary
reg
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
5)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S Map (RewardAccount StandardCrypto) Coin
ras
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
6)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S Update Mary
up
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
7)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S AuxiliaryDataHash StandardCrypto
mdh
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
8)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S (Word64 -> SlotNo
SlotNo Word64
500)
forall a. Semigroup a => a -> a -> a
<> (Tokens -> Tokens) -> ToTokens
T (Word -> Tokens -> Tokens
TkWord Word
9)
forall a. Semigroup a => a -> a -> a
<> forall a. EncCBOR a => a -> ToTokens
S Map (PolicyID StandardCrypto) (Map AssetName Integer)
mint
)
]
assetName32Bytes :: Assertion
assetName32Bytes :: Assertion
assetName32Bytes =
forall t.
(EncCBOR t, DecCBOR t, Eq t, HasCallStack) =>
Version -> Version -> t -> Assertion
roundTripCborRangeFailureExpectation (forall era. Era era => Version
eraProtVerHigh @Mary) forall a. Bounded a => a
maxBound forall a b. (a -> b) -> a -> b
$
ShortByteString -> AssetName
AssetName ShortByteString
"123456789-123456789-123456789-123"
goldenEncodingTests :: TestTree
goldenEncodingTests :: TestTree
goldenEncodingTests =
String -> [TestTree] -> TestTree
testGroup
String
"Golden Encoding Tests"
[ TestTree
goldenEncodingTestsAllegra
, TestTree
goldenEncodingTestsMary
, String -> Assertion -> TestTree
testCase String
"33 bytes asset name too big" Assertion
assetName32Bytes
]