Skip to content

Commit abe3004

Browse files
authored
Merge pull request #5004 from IntersectMBO/aniketd/json-roundtrip-conway-genesis
Remove delegators field from conway-genesis JSON
2 parents 39a08b0 + b2fdfb3 commit abe3004

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

libs/cardano-ledger-core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 1.18.0.0
44

5+
* Remove `delegators` field from JSON serialiser for `DRepState` for correct round-tripping. #5004
56
* Change `TxBody` to an associated `data` family
67
* Remove `HeapWords` instances for: #5001
78
- `Coin`

libs/cardano-ledger-core/src/Cardano/Ledger/DRep.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,8 @@ instance ToJSON DRepState where
186186
object $
187187
[ "expiry" .= toJSON drepExpiry
188188
, "deposit" .= toJSON drepDeposit
189-
, "delegators" .= toJSON drepDelegs
189+
-- Since the corresponding `FromJSON` instance ignores the `delegators` field,
190+
-- we omit it from the `ToJSON` instance, ensuring that round-tripping behaves as expected.
190191
]
191192
++ ["anchor" .= toJSON anchor | SJust anchor <- [drepAnchor]]
192193

@@ -196,7 +197,7 @@ instance FromJSON DRepState where
196197
<$> o .: "expiry"
197198
<*> o .:? "anchor" .!= SNothing
198199
<*> o .: "deposit"
199-
-- Construction of DRep state with deleagations is intentionally prohibited, since
200+
-- Construction of DRep state with delegations is intentionally prohibited, since
200201
-- there is a requirement to retain the invariant of delegations in the UMap
201202
<*> pure mempty
202203

0 commit comments

Comments
 (0)