@@ -365,6 +365,12 @@ data instance BlockQuery (ShelleyBlock proto era) fp result where
365365 BlockQuery (ShelleyBlock proto era ) QFNoTables SL. PoolDistr
366366 GetMaxMajorProtocolVersion ::
367367 BlockQuery (ShelleyBlock proto era ) QFNoTables MaxMajorProtVer
368+ GetDRepDelegations ::
369+ Set SL. DRep ->
370+ BlockQuery
371+ (ShelleyBlock proto era )
372+ QFNoTables
373+ (Map SL. DRep (Set (SL. Credential 'SL.Staking )))
368374
369375-- WARNING: please add new queries to the end of the list and stick to this
370376-- order in all other pattern matches on queries. This helps in particular
@@ -533,6 +539,8 @@ instance
533539 . configConsensus
534540 . getExtLedgerCfg
535541 $ cfg
542+ GetDRepDelegations dreps ->
543+ SL. queryDRepDelegations st dreps
536544 where
537545 lcfg = configLedger $ getExtLedgerCfg cfg
538546 globals = shelleyLedgerGlobals lcfg
@@ -592,6 +600,7 @@ instance
592600 GetPoolDistr2 {} -> (>= v13)
593601 GetStakeDistribution2 {} -> (>= v13)
594602 GetMaxMajorProtocolVersion -> (>= v13)
603+ GetDRepDelegations {} -> (>= v14)
595604 where
596605 -- WARNING: when adding a new query, a new @ShelleyNodeToClientVersionX@
597606 -- must be added. See #2830 for a template on how to do this.
@@ -602,6 +611,7 @@ instance
602611 v11 = ShelleyNodeToClientVersion11
603612 v12 = ShelleyNodeToClientVersion12
604613 v13 = ShelleyNodeToClientVersion13
614+ v14 = ShelleyNodeToClientVersion14
605615
606616instance SameDepIndex2 (BlockQuery (ShelleyBlock proto era )) where
607617 sameDepIndex2 GetLedgerTip GetLedgerTip =
@@ -761,6 +771,12 @@ instance SameDepIndex2 (BlockQuery (ShelleyBlock proto era)) where
761771 sameDepIndex2 GetStakeDistribution2 {} _ = Nothing
762772 sameDepIndex2 GetMaxMajorProtocolVersion {} GetMaxMajorProtocolVersion {} = Just Refl
763773 sameDepIndex2 GetMaxMajorProtocolVersion {} _ = Nothing
774+ sameDepIndex2 (GetDRepDelegations dreps) (GetDRepDelegations dreps')
775+ | dreps == dreps' =
776+ Just Refl
777+ | otherwise =
778+ Nothing
779+ sameDepIndex2 GetDRepDelegations {} _ = Nothing
764780
765781deriving instance Eq (BlockQuery (ShelleyBlock proto era ) fp result )
766782deriving instance Show (BlockQuery (ShelleyBlock proto era ) fp result )
@@ -806,6 +822,7 @@ instance ShelleyCompatible proto era => ShowQuery (BlockQuery (ShelleyBlock prot
806822 GetPoolDistr2 {} -> show
807823 GetStakeDistribution2 {} -> show
808824 GetMaxMajorProtocolVersion {} -> show
825+ GetDRepDelegations {} -> show
809826
810827{- ------------------------------------------------------------------------------
811828 Auxiliary
@@ -930,6 +947,8 @@ encodeShelleyQuery query = case query of
930947 CBOR. encodeListLen 1 <> CBOR. encodeWord8 37
931948 GetMaxMajorProtocolVersion ->
932949 CBOR. encodeListLen 1 <> CBOR. encodeWord8 38
950+ GetDRepDelegations dreps ->
951+ CBOR. encodeListLen 2 <> CBOR. encodeWord8 39 <> LC. toEraCBOR @ era dreps
933952
934953decodeShelleyQuery ::
935954 forall era proto .
@@ -1004,6 +1023,7 @@ decodeShelleyQuery = do
10041023 (2 , 36 ) -> SomeBlockQuery . GetPoolDistr2 <$> fromCBOR
10051024 (1 , 37 ) -> return $ SomeBlockQuery GetStakeDistribution2
10061025 (1 , 38 ) -> return $ SomeBlockQuery GetMaxMajorProtocolVersion
1026+ (2 , 39 ) -> SomeBlockQuery . GetDRepDelegations <$> LC. fromEraCBOR @ era
10071027 _ -> failmsg " invalid"
10081028
10091029encodeShelleyResult ::
@@ -1053,6 +1073,7 @@ encodeShelleyResult v query = case query of
10531073 GetPoolDistr2 {} -> LC. toEraCBOR @ era
10541074 GetStakeDistribution2 {} -> LC. toEraCBOR @ era
10551075 GetMaxMajorProtocolVersion -> toCBOR
1076+ GetDRepDelegations {} -> LC. toEraCBOR @ era
10561077
10571078decodeShelleyResult ::
10581079 forall proto era fp result .
@@ -1101,6 +1122,7 @@ decodeShelleyResult v query = case query of
11011122 GetPoolDistr2 {} -> LC. fromEraCBOR @ era
11021123 GetStakeDistribution2 -> LC. fromEraCBOR @ era
11031124 GetMaxMajorProtocolVersion -> fromCBOR
1125+ GetDRepDelegations {} -> LC. fromEraCBOR @ era
11041126
11051127currentPParamsEnDecoding ::
11061128 forall era s .
0 commit comments