Skip to content

Commit 751a36d

Browse files
committed
AllegraTxbody, allegratxbodyraw
1 parent 5f37c88 commit 751a36d

File tree

1 file changed

+13
-1
lines changed
  • eras/allegra/impl/src/Cardano/Ledger/Allegra

1 file changed

+13
-1
lines changed

eras/allegra/impl/src/Cardano/Ledger/Allegra/TxBody.hs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import Cardano.Ledger.Allegra.Scripts (ValidityInterval (..))
4242
import Cardano.Ledger.Allegra.TxCert ()
4343
import Cardano.Ledger.Allegra.TxOut ()
4444
import Cardano.Ledger.BaseTypes (SlotNo, StrictMaybe (SJust, SNothing))
45-
import Cardano.Ledger.Binary (DecCBOR (..), EncCBOR (..), ToCBOR)
45+
import Cardano.Ledger.Binary (Annotator, DecCBOR (..), EncCBOR (..), ToCBOR)
4646
import Cardano.Ledger.Binary.Coders (
4747
Decode (..),
4848
Encode (..),
@@ -59,6 +59,7 @@ import Cardano.Ledger.Coin (Coin (..))
5959
import Cardano.Ledger.Core
6060
import Cardano.Ledger.MemoBytes (
6161
EqRaw,
62+
Mem,
6263
MemoBytes,
6364
MemoHashIndex,
6465
Memoized (RawType),
@@ -124,6 +125,12 @@ instance (DecCBOR ma, Monoid ma, AllegraEraTxBody era) => DecCBOR (AllegraTxBody
124125
[(0, "atbrInputs"), (1, "atbrOutputs"), (2, "atbrFee")]
125126
)
126127

128+
instance
129+
(DecCBOR m, Monoid m, AllegraEraTxBody era) =>
130+
DecCBOR (Annotator (AllegraTxBodyRaw m era))
131+
where
132+
decCBOR = pure <$> decCBOR
133+
127134
-- Sparse encodings of AllegraTxBodyRaw, the key values are fixed by backward compatibility
128135
-- concerns as we want the ShelleyTxBody to deserialise as AllegraTxBody.
129136
-- txXparse and bodyFields should be Duals, visual inspection helps ensure this.
@@ -196,6 +203,11 @@ emptyAllegraTxBodyRaw =
196203
instance Memoized (TxBody AllegraEra) where
197204
type RawType (TxBody AllegraEra) = AllegraTxBodyRaw () AllegraEra
198205

206+
deriving via
207+
Mem (AllegraTxBodyRaw () AllegraEra)
208+
instance
209+
DecCBOR (Annotator (TxBody AllegraEra))
210+
199211
deriving instance Eq (TxBody AllegraEra)
200212

201213
deriving instance Show (TxBody AllegraEra)

0 commit comments

Comments
 (0)