Skip to content

Commit

Permalink
Update golden files with new description
Browse files Browse the repository at this point in the history
Using the upstream serialization from cardano-api includes a
description. Also left a note why we are using a deprecated function
here now (they'll fix it in cardano-api).

See IntersectMBO/cardano-api#630
  • Loading branch information
ch1bo committed Sep 9, 2024
1 parent 26393b3 commit 66e39b3
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 32 deletions.
2 changes: 1 addition & 1 deletion hydra-node/golden/StateChanged/DecommitRecorded.json

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions hydra-node/golden/StateChanged/SnapshotRequested.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion hydra-node/golden/StateChanged/TransactionReceived.json

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions hydra-node/json-schemas/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,16 @@ components:
- cborHex
- description
- type
description: |
A Cardano transaction in the text envelope format . That is, a JSON
object wrapper with some 'type' around a 'cborHex' encoded transaction.
The hydra-node uses this format as follows:
- When encoding, an additonal 'txId' is included.
- On decoding, when 'txId' is included it is checked to be consistent.
- The 'type' is not used to determine content and any transaction is
tried to decode as a 'ConwayEra' transaction, which mostly is
backward compatible to previous eras.
properties:
type:
type: string
Expand Down
1 change: 0 additions & 1 deletion hydra-tx/hydra-tx.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ library
, hydra-plutus-extras
, hydra-prelude
, lens
, lens-aeson
, ouroboros-consensus
, ouroboros-consensus-cardano
, plutus-core
Expand Down
8 changes: 7 additions & 1 deletion hydra-tx/src/Hydra/Tx/IsTx.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE TypeFamilyDependencies #-}
-- NOTE: For serialiseTxLedgerCddl
{-# OPTIONS_GHC -Wno-deprecations #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Hydra.Tx.IsTx where
Expand Down Expand Up @@ -108,7 +110,11 @@ type ArbitraryIsTx tx =

instance IsShelleyBasedEra era => ToJSON (Api.Tx era) where
toJSON tx =
case toJSON $ serialiseToTextEnvelope (Just "Hydra-encoded cardano-api Tx") tx of
-- XXX: This is a deprecated function, but the only one that produces the
-- right 'Witnessed Tx ConwayEra' in the envelope type. Cardano-api will be
-- fixing the 'HasTextEnvelope' instance for 'Tx era' and then we can use
-- 'serialiseToTextEnvelope' here.
case toJSON $ serialiseTxLedgerCddl shelleyBasedEra tx of
Aeson.Object km ->
Aeson.Object $ KeyMap.insert "txId" (toJSON $ getTxId $ getTxBody tx) km
v -> v
Expand Down

0 comments on commit 66e39b3

Please sign in to comment.