Skip to content

Add ToJSON/FromJSON instances for each era transaction types#5818

Draft
koslambrou wants to merge 7 commits into
masterfrom
koslambrou/golden-example-tx-json
Draft

Add ToJSON/FromJSON instances for each era transaction types#5818
koslambrou wants to merge 7 commits into
masterfrom
koslambrou/golden-example-tx-json

Conversation

@koslambrou

@koslambrou koslambrou commented May 11, 2026

Copy link
Copy Markdown
Contributor

Description

Add golden JSON tests for Tx TopTx era for each era at eras/<era>/impl/golden/tx.json.

Checklist

  • Commits in meaningful sequence and with useful messages.
  • Tests added or updated when needed.
  • CHANGELOG.md files updated for packages with externally visible changes.
    NOTE: New section is never added with the code changes. (See RELEASING.md).
  • Versions updated in .cabal and CHANGELOG.md files when necessary, according to the
    versioning process.
  • Version bounds in .cabal files updated when necessary.
    NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
  • Code formatted (use scripts/fourmolize.sh).
  • Cabal files formatted (use scripts/cabal-format.sh).
  • CDDL files are up to date (use scripts/gen-cddl.sh)
  • hie.yaml updated (use scripts/gen-hie.sh).
  • Self-reviewed the diff.

@koslambrou koslambrou changed the title Add ToJSON/FromJSON instances for Shelley era transaction types Add ToJSON/FromJSON instances for each era transaction types May 11, 2026
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-json branch from feac89b to b53134a Compare May 11, 2026 17:33
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-each-era branch from 3ca2a75 to fdc28e0 Compare May 11, 2026 19:19
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-json branch 2 times, most recently from f475885 to 87d9b46 Compare May 11, 2026 19:23
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-each-era branch from fdc28e0 to b22c9a7 Compare May 11, 2026 19:23
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-json branch from 87d9b46 to e04de93 Compare May 11, 2026 19:44
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-each-era branch from b22c9a7 to 4d6655d Compare May 11, 2026 19:44
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-json branch from e04de93 to dc70149 Compare May 11, 2026 20:02
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-each-era branch from 4d6655d to 8f6be2b Compare May 11, 2026 20:02
@lehins

lehins commented May 12, 2026

Copy link
Copy Markdown
Collaborator

@koslambrou Could I please ask you to split out addition of golden files into a separate PR, this one is getting unwieldy

@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-each-era branch 3 times, most recently from d726379 to e00b05e Compare May 12, 2026 14:36
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-json branch from dc70149 to 95ad341 Compare May 12, 2026 16:53
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-each-era branch from e00b05e to 06606e0 Compare May 12, 2026 17:21
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-json branch from 95ad341 to 03c9c47 Compare May 12, 2026 17:23
@koslambrou koslambrou closed this May 12, 2026
@koslambrou koslambrou deleted the koslambrou/golden-example-tx-json branch May 12, 2026 20:35
@koslambrou koslambrou restored the koslambrou/golden-example-tx-json branch May 12, 2026 20:44
@koslambrou koslambrou reopened this May 12, 2026
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-json branch 2 times, most recently from 32de64d to bcabd9d Compare May 12, 2026 21:09
Add JSON serialisation instances for all types composing `Tx TopTx ShelleyEra`:
- `cardano-ledger-core`: `TxIn`, `TxId`, `Metadatum`, `WitVKey`,
  `BootstrapWitness`, `Addr`, `RewardAccount`, `ScriptHash` (ToJSONKey/FromJSONKey)
- `cardano-ledger-shelley`: `ShelleyTx`, `ShelleyTxBody`, `ShelleyTxWits`,
  `ShelleyTxAuxData`, `ShelleyTxOut`, `MultiSig`, `Update`, `ProposedPPUpdates`

Conventions followed:
- `kindObject` for sum types
- `ToKeyValuePairs` + `deriving via KeyValuePairs` for product types
- TxIn serialised as "TxIx#TxIx" text key
- Map fields serialised as JSON objects (not lists of pairs)

Add golden JSON test for `Tx TopTx ShelleyEra` at `eras/shelley/impl/golden/tx.json`.
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-each-era branch from 06606e0 to 88e4fda Compare May 13, 2026 12:45
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-json branch from bcabd9d to eb0e80c Compare May 13, 2026 12:46
@koslambrou koslambrou force-pushed the koslambrou/golden-example-tx-json branch from eb0e80c to 3e008d6 Compare May 13, 2026 14:29
Base automatically changed from koslambrou/golden-example-tx-each-era to master May 13, 2026 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants