Skip to content

Commit

Permalink
Merge pull request #239 from input-output-hk/mgalazyn/fix/query-error…
Browse files Browse the repository at this point in the history
…-in-transaction-build

Fix Query error in `QueryStakeDelegDeposits` when executing `transaction build`
  • Loading branch information
carbolymer committed Sep 13, 2023
2 parents e8da7ae + d50500b commit 674230b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cardano-api/internal/Cardano/Api/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ import Data.SOP.Constraint (SListI)
import Data.Text (Text)
import qualified Data.Text as Text
import Data.Word (Word64)
import GHC.Stack


-- ----------------------------------------------------------------------------
Expand Down Expand Up @@ -670,7 +671,7 @@ toConsensusQueryShelleyBased erainmode (QueryPoolDistribution poolIds) =
getPoolIds = Set.map (\(StakePoolKeyHash kh) -> kh)

toConsensusQueryShelleyBased erainmode (QueryStakeDelegDeposits creds) =
Some (consensusQueryInEraInMode erainmode (Consensus.GetCBOR $ Consensus.GetStakeDelegDeposits creds'))
Some (consensusQueryInEraInMode erainmode (Consensus.GetStakeDelegDeposits creds'))
where
creds' = Set.map toShelleyStakeCredential creds

Expand Down Expand Up @@ -712,7 +713,9 @@ consensusQueryInEraInMode erainmode =
-- Conversions of query results from the consensus types.
--

fromConsensusQueryResult :: forall mode block result result'. ConsensusBlockForMode mode ~ block
fromConsensusQueryResult :: forall mode block result result'.
HasCallStack
=> ConsensusBlockForMode mode ~ block
=> QueryInMode mode result
-> Consensus.Query block result'
-> result'
Expand Down Expand Up @@ -842,7 +845,8 @@ fromConsensusQueryResult (QueryInEra ConwayEraInCardanoMode

fromConsensusQueryResultShelleyBased
:: forall era ledgerera protocol result result'.
ShelleyLedgerEra era ~ ledgerera
HasCallStack
=> ShelleyLedgerEra era ~ ledgerera
=> Core.EraCrypto ledgerera ~ Consensus.StandardCrypto
=> ConsensusProtocol era ~ protocol
=> ShelleyBasedEra era
Expand Down Expand Up @@ -988,8 +992,9 @@ fromConsensusQueryResultShelleyBased _ QueryCommitteeState{} q' committeeState'
--
-- Such mismatches should be preventable with an appropriate property test.
--
fromConsensusQueryResultMismatch :: a
fromConsensusQueryResultMismatch :: HasCallStack => a
fromConsensusQueryResultMismatch =
withFrozenCallStack $
error "fromConsensusQueryResult: internal query mismatch"


Expand Down

0 comments on commit 674230b

Please sign in to comment.