Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
goolord committed Dec 2, 2021
1 parent 2e2cfdc commit 066c16c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
3 changes: 3 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ package cardano-ledger-alonzo
package cardano-ledger-alonzo-test
ghc-options: -Werror

package cardano-ledger-babbage
ghc-options: -Werror

package byron-spec-chain
ghc-options: -Werror

Expand Down
2 changes: 1 addition & 1 deletion eras/babbage/impl/cardano-ledger-babbage.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ common project-config
-Wincomplete-uni-patterns
-Wpartial-fields
-Wredundant-constraints
-Wunused-packages
-- -Wunused-packages

library
import: base, project-config
Expand Down
32 changes: 26 additions & 6 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/TxBody.hs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ deriving via
Show (Core.Value era),
DecodeNonNegative (Core.Value era),
FromCBOR (Annotator (Core.Script era)),
FromCBOR (Data era),
Core.SerialisableData (PParamsDelta era)
) =>
FromCBOR (Annotator (TxBody era))
Expand Down Expand Up @@ -545,6 +546,11 @@ instance
encodeListLen 2
<> toCBOR addr
<> toCBOR cv
toCBOR (TxOutCompactDatum addr cv d) =
encodeListLen 3
<> toCBOR addr
<> toCBOR cv
<> toCBOR d
toCBOR (TxOutCompactDH addr cv dh) =
encodeListLen 3
<> toCBOR addr
Expand All @@ -555,7 +561,8 @@ instance
( Era era,
DecodeNonNegative (Core.Value era),
Show (Core.Value era),
Compactible (Core.Value era)
Compactible (Core.Value era),
FromCBOR (Data era)
) =>
FromCBOR (TxOut era)
where
Expand All @@ -577,10 +584,17 @@ instance
<$> fromCBOR
<*> decodeNonNegative
Just 3 ->
TxOutCompactDH
<$> fromCBOR
<*> decodeNonNegative
<*> fromCBOR
decodeBreakOr >>= \case
True ->
TxOutCompactDatum
<$> fromCBOR
<*> decodeNonNegative
<*> fromCBOR
False ->
TxOutCompactDH
<$> fromCBOR
<*> decodeNonNegative
<*> fromCBOR
Just _ -> cborError $ DecoderErrorCustom "txout" "wrong number of terms in txout"

encodeTxBodyRaw ::
Expand Down Expand Up @@ -612,7 +626,7 @@ encodeTxBodyRaw
)
!> Key 0 (E encodeFoldable _inputs)
!> Key 13 (E encodeFoldable _collateral)
!> Key 13 (To _collateralReturn)
!> Key 16 (To _collateralReturn)
!> Key 1 (E encodeFoldable _outputs)
!> Key 2 (To _txfee)
!> encodeKeyedStrictMaybe 3 top
Expand Down Expand Up @@ -643,6 +657,7 @@ instance
DecodeNonNegative (Core.Value era),
FromCBOR (Annotator (Core.Script era)),
FromCBOR (PParamsDelta era),
FromCBOR (Data era),
ToCBOR (PParamsDelta era)
) =>
FromCBOR (TxBodyRaw era)
Expand Down Expand Up @@ -681,6 +696,10 @@ instance
field
(\x tx -> tx {_collateral = x})
(D (decodeSet fromCBOR))
bodyFields 16 =
field
(\x tx -> tx {_collateralReturn = x})
(D (SJust <$> fromCBOR))
bodyFields 1 =
field
(\x tx -> tx {_outputs = x})
Expand Down Expand Up @@ -721,6 +740,7 @@ instance
DecodeNonNegative (Core.Value era),
FromCBOR (Annotator (Core.Script era)),
FromCBOR (PParamsDelta era),
FromCBOR (Data era),
ToCBOR (PParamsDelta era)
) =>
FromCBOR (Annotator (TxBodyRaw era))
Expand Down

0 comments on commit 066c16c

Please sign in to comment.