Skip to content

Commit 071530a

Browse files
authored
Merge pull request #5297 from IntersectMBO/aniketd/remove-umap
Remove UMap
2 parents 4b8d55d + 35e54f0 commit 071530a

File tree

22 files changed

+34
-1461
lines changed

22 files changed

+34
-1461
lines changed

eras/allegra/impl/testlib/Test/Cardano/Ledger/Allegra/Era.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ instance EraTest AllegraEra where
2929

3030
accountsFromAccountsMap = shelleyAccountsFromAccountsMap
3131

32-
accountsToUMap = shelleyAccountsToUMap
33-
3432
instance ShelleyEraTest AllegraEra
3533

3634
instance AllegraEraTest AllegraEra

eras/alonzo/impl/testlib/Test/Cardano/Ledger/Alonzo/Era.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ instance EraTest AlonzoEra where
4242

4343
accountsFromAccountsMap = shelleyAccountsFromAccountsMap
4444

45-
accountsToUMap = shelleyAccountsToUMap
46-
4745
instance ShelleyEraTest AlonzoEra
4846

4947
instance AllegraEraTest AlonzoEra

eras/babbage/impl/testlib/Test/Cardano/Ledger/Babbage/Era.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ instance EraTest BabbageEra where
3131

3232
accountsFromAccountsMap = shelleyAccountsFromAccountsMap
3333

34-
accountsToUMap = shelleyAccountsToUMap
35-
3634
instance ShelleyEraTest BabbageEra
3735

3836
instance AllegraEraTest BabbageEra

eras/conway/impl/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- Add `hardforkConwayMoveWithdrawalsAndDRepChecksToLedgerRule` to `Conway.Era`.
88
- Add `updateDormantDRepExpiries` and `updateVotingDRepExpiries`
99

10+
### `testlib`
11+
12+
* Remove `conwayAccountsToUMap` corresponding to the removal of `UMap` from core.
13+
1014
## 1.20.0.0
1115

1216
* Decoupled `ConwayEraTxCert` from `ShelleyEraTxCert`, so added `ShelleyEraTxCert` constraint to:

eras/conway/impl/testlib/Test/Cardano/Ledger/Conway/Era.hs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,16 @@ module Test.Cardano.Ledger.Conway.Era (
77
module Test.Cardano.Ledger.Babbage.Era,
88
ConwayEraTest,
99
mkConwayTestAccountState,
10-
conwayAccountsToUMap,
1110
) where
1211

1312
import Cardano.Ledger.Alonzo.Plutus.Context (EraPlutusTxInfo)
14-
import Cardano.Ledger.BaseTypes
1513
import Cardano.Ledger.Coin
1614
import Cardano.Ledger.Conway
1715
import Cardano.Ledger.Conway.Core
1816
import Cardano.Ledger.Conway.Governance
1917
import Cardano.Ledger.Conway.State
2018
import Cardano.Ledger.Plutus (Language (..))
21-
import Cardano.Ledger.UMap
2219
import Data.Coerce
23-
import qualified Data.Map.Strict as Map
24-
import qualified Data.Set as Set
2520
import Lens.Micro
2621
import Test.Cardano.Ledger.Babbage.Era
2722
import Test.Cardano.Ledger.Conway.Arbitrary ()
@@ -45,8 +40,6 @@ instance EraTest ConwayEra where
4540

4641
accountsFromAccountsMap = coerce
4742

48-
accountsToUMap = conwayAccountsToUMap
49-
5043
instance ShelleyEraTest ConwayEra
5144

5245
instance AllegraEraTest ConwayEra
@@ -71,17 +64,3 @@ mkConwayTestAccountState deposit mStakePool mDRep =
7164
mkConwayAccountState deposit
7265
& stakePoolDelegationAccountStateL .~ mStakePool
7366
& dRepDelegationAccountStateL .~ mDRep
74-
75-
conwayAccountsToUMap :: ConwayEraAccounts era => Accounts era -> UMap
76-
conwayAccountsToUMap accounts =
77-
UMap
78-
{ umElems = Map.map toUMElem (accounts ^. accountsMapL)
79-
, umPtrs = Map.empty
80-
}
81-
where
82-
toUMElem accountState =
83-
UMElem
84-
(SJust (RDPair (accountState ^. balanceAccountStateL) (accountState ^. depositAccountStateL)))
85-
Set.empty
86-
(maybeToStrictMaybe (accountState ^. stakePoolDelegationAccountStateL))
87-
(maybeToStrictMaybe (accountState ^. dRepDelegationAccountStateL))

eras/dijkstra/impl/testlib/Test/Cardano/Ledger/Dijkstra/Era.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ instance EraTest DijkstraEra where
2222

2323
accountsFromAccountsMap = coerce
2424

25-
accountsToUMap = conwayAccountsToUMap
26-
2725
class
2826
ConwayEraTest era =>
2927
DijkstraEraTest era

eras/mary/impl/testlib/Test/Cardano/Ledger/Mary/Era.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ instance EraTest MaryEra where
2626

2727
accountsFromAccountsMap = shelleyAccountsFromAccountsMap
2828

29-
accountsToUMap = shelleyAccountsToUMap
30-
3129
instance ShelleyEraTest MaryEra
3230

3331
instance AllegraEraTest MaryEra

eras/shelley/impl/CHANGELOG.md

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

9292
### `testlib`
9393

94+
* Remove `shelleyAccountsToUMap` corresponding to the removal of `UMap` from core.
9495
* Added `impSatisfySignature` and `impSatisfyMNativeScripts`
9596
* Added `EraSpecificSpec ShelleyEra` instance
9697
* Added `EraSpecificSpec` class

eras/shelley/impl/testlib/Test/Cardano/Ledger/Shelley/Era.hs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ module Test.Cardano.Ledger.Shelley.Era (
1313
nativeAlwaysFails,
1414
nativeAlwaysSucceeds,
1515
shelleyAccountsFromAccountsMap,
16-
shelleyAccountsToUMap,
1716
) where
1817

19-
import Cardano.Ledger.BaseTypes
2018
import Cardano.Ledger.Coin
2119
import Cardano.Ledger.Core
2220
import Cardano.Ledger.Credential
@@ -26,10 +24,8 @@ import Cardano.Ledger.Shelley.LedgerState
2624
import Cardano.Ledger.Shelley.Scripts
2725
import Cardano.Ledger.Shelley.State
2826
import Cardano.Ledger.Shelley.Transition
29-
import Cardano.Ledger.UMap
3027
import Data.Default
3128
import qualified Data.Map.Strict as Map
32-
import qualified Data.Set as Set
3329
import Lens.Micro
3430
import Test.Cardano.Ledger.Common
3531
import Test.Cardano.Ledger.Era
@@ -58,8 +54,6 @@ instance EraTest ShelleyEra where
5854

5955
accountsFromAccountsMap = shelleyAccountsFromAccountsMap
6056

61-
accountsToUMap = shelleyAccountsToUMap
62-
6357
instance ShelleyEraTest ShelleyEra
6458

6559
mkShelleyTestAccountState ::
@@ -91,20 +85,6 @@ shelleyAccountsFromAccountsMap accountsMap =
9185
[(accountState ^. ptrAccountStateG, cred) | (cred, accountState) <- Map.toList accountsMap]
9286
}
9387

94-
shelleyAccountsToUMap :: ShelleyEraAccounts era => Accounts era -> UMap
95-
shelleyAccountsToUMap accounts =
96-
UMap
97-
{ umElems = Map.map toUMElem (accounts ^. accountsMapL)
98-
, umPtrs = accounts ^. accountsPtrsMapG
99-
}
100-
where
101-
toUMElem accountState =
102-
UMElem
103-
(SJust (RDPair (accountState ^. balanceAccountStateL) (accountState ^. depositAccountStateL)))
104-
(Set.singleton (accountState ^. ptrAccountStateG))
105-
(maybeToStrictMaybe (accountState ^. stakePoolDelegationAccountStateL))
106-
SNothing
107-
10888
-- Minimal native scripts that can be used in all post-Shelley eras
10989

11090
nativeAlwaysFails :: forall era. ShelleyEraScript era => Script era

hie.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,6 @@ cradle:
243243
- path: "libs/cardano-ledger-core/test"
244244
component: "cardano-ledger-core:test:tests"
245245

246-
- path: "libs/cardano-ledger-core/bench/UMap.hs"
247-
component: "cardano-ledger-core:bench:umap"
248-
249246
- path: "libs/cardano-ledger-core/bench/Addr.hs"
250247
component: "cardano-ledger-core:bench:addr"
251248

0 commit comments

Comments
 (0)