Skip to content

Commit 0b9d7f1

Browse files
committed
Drop dependency on ledger-1.1.0
This temporarily restores sanity by removing any dependency on ledger past 1.0.0 (what is in CHaP right now). It therefore also reverts the network bump. ! This commit is meant to be temporary. And to be reverted ontop of a sane CHaP'ified master.
1 parent 5127832 commit 0b9d7f1

File tree

11 files changed

+35
-156
lines changed

11 files changed

+35
-156
lines changed

bench/tx-generator/src/Cardano/Benchmarking/GeneratorTx/Genesis.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Cardano.Benchmarking.GeneratorTx.Genesis
88
where
99

1010
import Cardano.Prelude hiding (TypeError, filter)
11-
import qualified Data.ListMap as ListMap
11+
import qualified Data.Map.Strict as Map
1212
import Prelude (error, filter)
1313

1414
import Cardano.Api
@@ -26,7 +26,7 @@ genesisFunds :: forall era. IsShelleyBasedEra era
2626
=> NetworkId -> ShelleyGenesis StandardShelley -> [(AddressInEra era, Lovelace)]
2727
genesisFunds networkId g
2828
= map (castAddr *** fromShelleyLovelace)
29-
$ ListMap.toList
29+
$ Map.toList
3030
$ sgInitialFunds g
3131
where
3232
castAddr (Addr _ pcr stref)

cardano-api/src/Cardano/Api/Query.hs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,6 @@ data QueryInShelleyBasedEra era result where
241241
QueryCurrentEpochState
242242
:: QueryInShelleyBasedEra era (SerialisedCurrentEpochState era)
243243

244-
QueryPoolState
245-
:: Maybe (Set PoolId)
246-
-> QueryInShelleyBasedEra era (SerialisedPoolState era)
247-
248244
deriving instance Show (QueryInShelleyBasedEra era result)
249245

250246

@@ -581,12 +577,6 @@ toConsensusQueryShelleyBased erainmode QueryProtocolState =
581577
toConsensusQueryShelleyBased erainmode QueryCurrentEpochState =
582578
Some (consensusQueryInEraInMode erainmode (Consensus.GetCBOR Consensus.DebugEpochState))
583579

584-
toConsensusQueryShelleyBased erainmode (QueryPoolState poolIds) =
585-
Some (consensusQueryInEraInMode erainmode (Consensus.GetCBOR (Consensus.GetPoolState (getPoolIds <$> poolIds))))
586-
where
587-
getPoolIds :: Set PoolId -> Set (Shelley.KeyHash Shelley.StakePool Consensus.StandardCrypto)
588-
getPoolIds = Set.map (\(StakePoolKeyHash kh) -> kh)
589-
590580
consensusQueryInEraInMode
591581
:: forall era mode erablock modeblock result result' xs.
592582
ConsensusBlockForEra era ~ erablock
@@ -817,11 +807,6 @@ fromConsensusQueryResultShelleyBased _ QueryCurrentEpochState q' r' =
817807
Consensus.GetCBOR Consensus.DebugEpochState -> SerialisedCurrentEpochState r'
818808
_ -> fromConsensusQueryResultMismatch
819809

820-
fromConsensusQueryResultShelleyBased _ QueryPoolState{} q' r' =
821-
case q' of
822-
Consensus.GetCBOR Consensus.GetPoolState {} -> SerialisedPoolState r'
823-
_ -> fromConsensusQueryResultMismatch
824-
825810
-- | This should /only/ happen if we messed up the mapping in 'toConsensusQuery'
826811
-- and 'fromConsensusQueryResult' so they are inconsistent with each other.
827812
--

cardano-api/src/Cardano/Api/Shelley/Genesis.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module Cardano.Api.Shelley.Genesis
88

99
import Prelude
1010

11-
import qualified Data.ListMap as ListMap
1211
import qualified Data.Map.Strict as Map
1312
import Data.Maybe (fromMaybe)
1413
import qualified Data.Time as Time
@@ -66,7 +65,7 @@ shelleyGenesisDefaults =
6665
-- genesis keys and initial funds
6766
, sgGenDelegs = Map.empty
6867
, sgStaking = emptyGenesisStaking
69-
, sgInitialFunds = ListMap.empty
68+
, sgInitialFunds = Map.empty
7069
, sgMaxLovelaceSupply = 0
7170
}
7271
where

cardano-api/test/Test/Cardano/Api/Genesis.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import Cardano.Prelude
1111

1212
import Cardano.Api.Shelley (ShelleyGenesis (..))
1313

14-
import Data.ListMap (ListMap(ListMap))
1514
import qualified Data.Map.Strict as Map
1615
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
1716

@@ -54,7 +53,7 @@ exampleShelleyGenesis =
5453
[( genesisVerKeyHash
5554
, GenDelegPair delegVerKeyHash delegVrfKeyHash)
5655
]
57-
, sgInitialFunds = ListMap [(initialFundedAddress,initialFunds)]
56+
, sgInitialFunds = Map.fromList [(initialFundedAddress,initialFunds)]
5857
, sgStaking = emptyGenesisStaking
5958
}
6059
where

cardano-cli/src/Cardano/CLI/Shelley/Run/Genesis.hs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import qualified Data.ByteString.Lazy.Char8 as LBS
4141
import Data.Coerce (coerce)
4242
import qualified Data.List as List
4343
import qualified Data.List.Split as List
44-
import qualified Data.ListMap as ListMap
4544
import qualified Data.Map.Strict as Map
4645

4746
import qualified Data.Sequence.Strict as Seq
@@ -115,8 +114,6 @@ import Data.Fixed (Fixed (MkFixed))
115114
import qualified Data.Yaml as Yaml
116115
import Text.JSON.Canonical (parseCanonicalJSON, renderCanonicalJSON)
117116

118-
import Data.ListMap (ListMap (..))
119-
120117
import qualified Cardano.CLI.IO.Lazy as Lazy
121118

122119
import qualified System.Random as Random
@@ -1031,18 +1028,18 @@ updateTemplate (SystemStart start)
10311028
{ sgSystemStart = start
10321029
, sgMaxLovelaceSupply = fromIntegral $ nonDelegCoin + delegCoin
10331030
, sgGenDelegs = shelleyDelKeys
1034-
, sgInitialFunds = ListMap.fromList
1031+
, sgInitialFunds = Map.fromList
10351032
[ (toShelleyAddr addr, toShelleyLovelace v)
10361033
| (addr, v) <-
10371034
distribute (nonDelegCoin - subtractForTreasury) utxoAddrsNonDeleg ++
10381035
distribute (delegCoin - subtractForTreasury) utxoAddrsDeleg ++
10391036
mkStuffedUtxo stuffedUtxoAddrs ]
10401037
, sgStaking =
10411038
ShelleyGenesisStaking
1042-
{ sgsPools = ListMap.fromList
1039+
{ sgsPools = Map.fromList
10431040
[ (Ledger._poolId poolParams, poolParams)
10441041
| poolParams <- Map.elems poolSpecs ]
1045-
, sgsStake = ListMap.fromMap $ Ledger._poolId <$> poolSpecs
1042+
, sgsStake = Ledger._poolId <$> poolSpecs
10461043
}
10471044
, sgProtocolParams = pparamsFromTemplate
10481045
}
@@ -1113,7 +1110,7 @@ updateCreateStakedOutputTemplate
11131110
{ sgSystemStart = start
11141111
, sgMaxLovelaceSupply = fromIntegral $ nonDelegCoin + delegCoin
11151112
, sgGenDelegs = shelleyDelKeys
1116-
, sgInitialFunds = ListMap.fromList
1113+
, sgInitialFunds = Map.fromList
11171114
[ (toShelleyAddr addr, toShelleyLovelace v)
11181115
| (addr, v) <-
11191116
distribute (nonDelegCoin - subtractForTreasury) nUtxoAddrsNonDeleg utxoAddrsNonDeleg
@@ -1124,8 +1121,8 @@ updateCreateStakedOutputTemplate
11241121
]
11251122
, sgStaking =
11261123
ShelleyGenesisStaking
1127-
{ sgsPools = ListMap pools
1128-
, sgsStake = ListMap stake
1124+
{ sgsPools = Map.fromList pools
1125+
, sgsStake = Map.fromList stake
11291126
}
11301127
, sgProtocolParams = pparamsFromTemplate
11311128
}

cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs

Lines changed: 3 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ import Cardano.Ledger.Keys (KeyHash (..), KeyRole (..))
8585
import Cardano.Ledger.Shelley.Constraints
8686
import Cardano.Ledger.Shelley.EpochBoundary
8787
import Cardano.Ledger.Shelley.LedgerState (EpochState (esSnapshots),
88-
NewEpochState (nesEs), PState (_fPParams, _pParams, _retiring))
89-
import qualified Cardano.Ledger.Shelley.LedgerState as SL
88+
NewEpochState (nesEs))
9089
import qualified Cardano.Ledger.Shelley.PParams as Shelley
9190
import Cardano.Ledger.Shelley.Scripts ()
9291
import Cardano.Slotting.EpochInfo (EpochInfo (..), epochInfoSlotToUTCTime, hoistEpochInfo)
@@ -180,8 +179,7 @@ runQueryCmd cmd =
180179
runQueryProtocolParameters consensusModeParams network mOutFile
181180
QueryTip consensusModeParams network mOutFile ->
182181
runQueryTip consensusModeParams network mOutFile
183-
QueryStakePools' consensusModeParams network mOutFile ->
184-
runQueryStakePools consensusModeParams network mOutFile
182+
QueryStakePools' _ _ _ -> throwError $ ShelleyQueryCmdSlotToUtcError "currently missing"
185183
QueryStakeDistribution' consensusModeParams network mOutFile ->
186184
runQueryStakeDistribution consensusModeParams network mOutFile
187185
QueryStakeAddressInfo consensusModeParams addr network mOutFile ->
@@ -196,8 +194,7 @@ runQueryCmd cmd =
196194
runQueryUTxO consensusModeParams qFilter networkId mOutFile
197195
QueryKesPeriodInfo consensusModeParams network nodeOpCert mOutFile ->
198196
runQueryKesPeriodInfo consensusModeParams network nodeOpCert mOutFile
199-
QueryPoolState' consensusModeParams network poolid ->
200-
runQueryPoolState consensusModeParams network poolid
197+
QueryPoolState' _ _ _ -> throwError $ ShelleyQueryCmdSlotToUtcError "currently missing"
201198
QueryTxMempool consensusModeParams network op mOutFile ->
202199
runQueryTxMempool consensusModeParams network op mOutFile
203200

@@ -607,34 +604,6 @@ renderOpCertIntervalInformation opCertFile
607604
" Operational certificate's starting KES period: " <> show start <> "\n" <>
608605
" Operational certificate's expiry KES period: " <> show end
609606

610-
-- | Query the current and future parameters for a stake pool, including the retirement date.
611-
-- Any of these may be empty (in which case a null will be displayed).
612-
--
613-
runQueryPoolState
614-
:: AnyConsensusModeParams
615-
-> NetworkId
616-
-> [Hash StakePoolKey]
617-
-> ExceptT ShelleyQueryCmdError IO ()
618-
runQueryPoolState (AnyConsensusModeParams cModeParams) network poolIds = do
619-
SocketPath sockPath <- firstExceptT ShelleyQueryCmdEnvVarSocketErr
620-
$ newExceptT readEnvSocketPath
621-
let localNodeConnInfo = LocalNodeConnectInfo cModeParams network sockPath
622-
623-
624-
anyE@(AnyCardanoEra era) <-
625-
firstExceptT ShelleyQueryCmdAcquireFailure
626-
. newExceptT $ determineEra cModeParams localNodeConnInfo
627-
628-
let cMode = consensusModeOnly cModeParams
629-
sbe <- getSbe $ cardanoEraStyle era
630-
631-
eInMode <- toEraInMode era cMode
632-
& hoistMaybe (ShelleyQueryCmdEraConsensusModeMismatch (AnyConsensusMode cMode) anyE)
633-
634-
let qInMode = QueryInEra eInMode . QueryInShelleyBasedEra sbe $ QueryPoolState $ Just $ Set.fromList poolIds
635-
result <- executeQuery era cModeParams localNodeConnInfo qInMode
636-
obtainLedgerEraClassConstraints sbe writePoolState result
637-
638607
-- | Query the local mempool state
639608
runQueryTxMempool
640609
:: AnyConsensusModeParams
@@ -894,35 +863,6 @@ getAllStake (SnapShot stake _ _) = activeStake
894863
where
895864
Coin activeStake = fold (fmap fromCompact (VMap.toMap (unStake stake)))
896865

897-
-- | This function obtains the pool parameters, equivalent to the following jq query on the output of query ledger-state
898-
-- .nesEs.esLState._delegationState._pstate._pParams.<pool_id>
899-
writePoolState :: forall era ledgerera. ()
900-
=> ShelleyLedgerEra era ~ ledgerera
901-
=> Era.Crypto ledgerera ~ StandardCrypto
902-
=> Ledger.Era ledgerera
903-
=> SerialisedPoolState era
904-
-> ExceptT ShelleyQueryCmdError IO ()
905-
writePoolState serialisedCurrentEpochState =
906-
case decodePoolState serialisedCurrentEpochState of
907-
Left err -> left (ShelleyQueryCmdPoolStateDecodeError err)
908-
909-
Right (PoolState poolState) -> do
910-
let hks = Set.toList $ Set.fromList $ Map.keys (_pParams poolState) <> Map.keys (_fPParams poolState) <> Map.keys (_retiring poolState)
911-
912-
let poolStates :: Map (KeyHash 'StakePool StandardCrypto) (Params StandardCrypto)
913-
poolStates = Map.fromList $ hks <&>
914-
( \hk ->
915-
( hk
916-
, Params
917-
{ poolParameters = Map.lookup hk (SL._pParams poolState)
918-
, futurePoolParameters = Map.lookup hk (SL._fPParams poolState)
919-
, retiringEpoch = Map.lookup hk (SL._retiring poolState)
920-
}
921-
)
922-
)
923-
924-
liftIO . LBS.putStrLn $ encodePretty poolStates
925-
926866
writeProtocolState ::
927867
( FromCBOR (Consensus.ChainDepState (ConsensusProtocol era))
928868
, ToJSON (Consensus.ChainDepState (ConsensusProtocol era))
@@ -1037,50 +977,6 @@ printUtxo shelleyBasedEra' txInOutTuple =
1037977
printableValue (TxOutValue _ val) = renderValue val
1038978
printableValue (TxOutAdaOnly _ (Lovelace i)) = Text.pack $ show i
1039979

1040-
runQueryStakePools
1041-
:: AnyConsensusModeParams
1042-
-> NetworkId
1043-
-> Maybe OutputFile
1044-
-> ExceptT ShelleyQueryCmdError IO ()
1045-
runQueryStakePools (AnyConsensusModeParams cModeParams)
1046-
network mOutFile = do
1047-
SocketPath sockPath <- firstExceptT ShelleyQueryCmdEnvVarSocketErr
1048-
$ newExceptT readEnvSocketPath
1049-
1050-
let localNodeConnInfo = LocalNodeConnectInfo cModeParams network sockPath
1051-
1052-
result <- ExceptT . fmap (join . first ShelleyQueryCmdAcquireFailure) $
1053-
executeLocalStateQueryExpr localNodeConnInfo Nothing $ \_ntcVersion -> runExceptT @ShelleyQueryCmdError $ do
1054-
anyE@(AnyCardanoEra era) <- case consensusModeOnly cModeParams of
1055-
ByronMode -> return $ AnyCardanoEra ByronEra
1056-
ShelleyMode -> return $ AnyCardanoEra ShelleyEra
1057-
CardanoMode -> lift . queryExpr $ QueryCurrentEra CardanoModeIsMultiEra
1058-
1059-
let cMode = consensusModeOnly cModeParams
1060-
1061-
case toEraInMode era cMode of
1062-
Just eInMode -> do
1063-
sbe <- getSbe $ cardanoEraStyle era
1064-
1065-
firstExceptT ShelleyQueryCmdEraMismatch . ExceptT $
1066-
queryExpr . QueryInEra eInMode . QueryInShelleyBasedEra sbe $ QueryStakePools
1067-
1068-
Nothing -> left $ ShelleyQueryCmdEraConsensusModeMismatch (AnyConsensusMode cMode) anyE
1069-
1070-
writeStakePools mOutFile result
1071-
1072-
writeStakePools
1073-
:: Maybe OutputFile
1074-
-> Set PoolId
1075-
-> ExceptT ShelleyQueryCmdError IO ()
1076-
writeStakePools (Just (OutputFile outFile)) stakePools =
1077-
handleIOExceptT (ShelleyQueryCmdWriteFileError . FileIOError outFile) $
1078-
LBS.writeFile outFile (encodePretty stakePools)
1079-
1080-
writeStakePools Nothing stakePools =
1081-
forM_ (Set.toList stakePools) $ \poolId ->
1082-
liftIO . putStrLn $ Text.unpack (serialiseToBech32 poolId)
1083-
1084980
runQueryStakeDistribution
1085981
:: AnyConsensusModeParams
1086982
-> NetworkId

cardano-node/src/Cardano/Node/Tracing/Documentation.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ docTracers configFileName outputFileName _ _ _ = do
687687
allPublic
688688
configureTracers trConfig docDebugPeerSelection [debugPeerSelectionTr]
689689
debugPeerSelectionTrDoc <- documentTracer trConfig debugPeerSelectionTr
690-
(docDebugPeerSelection :: Documented (DebugPeerSelection Socket.SockAddr))
690+
(docDebugPeerSelection :: Documented (DebugPeerSelection Socket.SockAddr peer))
691691

692692
debugPeerSelectionResponderTr <- mkCardanoTracer
693693
trBase trForward mbTrEKG
@@ -697,7 +697,7 @@ docTracers configFileName outputFileName _ _ _ = do
697697
allPublic
698698
configureTracers trConfig docDebugPeerSelection [debugPeerSelectionResponderTr]
699699
debugPeerSelectionResponderTrDoc <- documentTracer trConfig debugPeerSelectionResponderTr
700-
(docDebugPeerSelection :: Documented (DebugPeerSelection Socket.SockAddr))
700+
(docDebugPeerSelection :: Documented (DebugPeerSelection Socket.SockAddr peer))
701701

702702
peerSelectionCountersTr <- mkCardanoTracer
703703
trBase trForward mbTrEKG

cardano-node/src/Cardano/Node/Tracing/Era/Shelley.hs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,8 @@ instance ( ShelleyBasedEra era
435435
mconcat [ "kind" .= String "InvalidWitnessesUTXOW"
436436
, "invalidWitnesses" .= map textShow wits'
437437
]
438-
forMachine _dtal (MissingVKeyWitnessesUTXOW wits') =
439-
mconcat [ "kind" .= String "MissingVKeyWitnessesUTXOW"
440-
, "missingWitnesses" .= wits'
441-
]
438+
forMachine _dtal (MissingVKeyWitnessesUTXOW _wits') =
439+
mconcat [ ]
442440
forMachine _dtal (MissingScriptWitnessesUTXOW missingScripts) =
443441
mconcat [ "kind" .= String "MissingScriptWitnessesUTXOW"
444442
, "missingScripts" .= missingScripts

cardano-node/src/Cardano/Node/Tracing/Tracers/P2P.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,13 @@ peerSelectionTargetsToObject
591591
-- DebugPeerSelection Tracer
592592
--------------------------------------------------------------------------------
593593

594-
namesForDebugPeerSelection :: DebugPeerSelection SockAddr -> [Text]
594+
namesForDebugPeerSelection :: DebugPeerSelection SockAddr peerConn -> [Text]
595595
namesForDebugPeerSelection _ = ["GovernorState"]
596596

597-
severityDebugPeerSelection :: DebugPeerSelection SockAddr -> SeverityS
597+
severityDebugPeerSelection :: DebugPeerSelection SockAddr peerConn -> SeverityS
598598
severityDebugPeerSelection _ = Debug
599599

600-
instance LogFormatting (DebugPeerSelection SockAddr) where
600+
instance Show peerConn => LogFormatting (DebugPeerSelection SockAddr peerConn) where
601601
forMachine DNormal (TraceGovernorState blockedAt wakeupAfter
602602
PeerSelectionState { targets, knownPeers, establishedPeers, activePeers }) =
603603
mconcat [ "kind" .= String "DebugPeerSelection"
@@ -618,7 +618,7 @@ instance LogFormatting (DebugPeerSelection SockAddr) where
618618
]
619619
forHuman = pack . show
620620

621-
docDebugPeerSelection :: Documented (DebugPeerSelection SockAddr)
621+
docDebugPeerSelection :: Documented (DebugPeerSelection SockAddr conn)
622622
docDebugPeerSelection = Documented
623623
[ DocMsg
624624
["GovernorState"]
@@ -753,6 +753,7 @@ namesForConnectionManager TrConnectionManagerCounters {} = ["ConnectionManagerCo
753753
namesForConnectionManager TrState {} = ["State"]
754754
namesForConnectionManager ConnectionManager.TrUnexpectedlyFalseAssertion {} =
755755
["UnexpectedlyFalseAssertion"]
756+
namesForConnectionManager TrUnknownConnection {} = ["ERROR"];
756757

757758
severityConnectionManager ::
758759
ConnectionManagerTrace addr
@@ -787,6 +788,7 @@ severityConnectionManager TrConnectionManagerCounters {} = Info
787788
severityConnectionManager TrState {} = Info
788789
severityConnectionManager ConnectionManager.TrUnexpectedlyFalseAssertion {} =
789790
Error
791+
severityConnectionManager _ = Error
790792

791793
instance (Show addr, Show versionNumber, Show agreedOptions, LogFormatting addr,
792794
ToJSON addr, ToJSON versionNumber, ToJSON agreedOptions)
@@ -923,6 +925,8 @@ instance (Show addr, Show versionNumber, Show agreedOptions, LogFormatting addr,
923925
[ "kind" .= String "UnexpectedlyFalseAssertion"
924926
, "info" .= String (pack . show $ info)
925927
]
928+
forMachine _ _ = mconcat []
929+
926930
forHuman = pack . show
927931
asMetrics (TrConnectionManagerCounters ConnectionManagerCounters {..}) =
928932
[ IntM

0 commit comments

Comments
 (0)