Skip to content

Commit

Permalink
Respond with correct JSON on /protocol-parameters
Browse files Browse the repository at this point in the history
This matches now what we also accept on the command line and what the
cardano-cli is giving us.
  • Loading branch information
ch1bo committed Jan 9, 2024
1 parent ad84e29 commit 9ec42c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion hydra-node/src/Hydra/API/HTTPServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ httpApp tracer directChain pparams getInitializingHeadId request respond = do
>>= handleDraftCommitUtxo directChain getInitializingHeadId
>>= respond
("GET", ["protocol-parameters"]) ->
respond $ responseLBS status200 [] (Aeson.encode $ fromLedgerPParams shelleyBasedEra pparams)
respond . responseLBS status200 [] . Aeson.encode $
fromLedgerPParams shelleyBasedEra pparams
("POST", ["cardano-transaction"]) ->
consumeRequestBodyStrict request
>>= handleSubmitUserTx directChain
Expand Down
4 changes: 2 additions & 2 deletions hydra-node/test/Hydra/API/HTTPServerSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Data.Aeson.Lens (key, nth)
import Data.ByteString.Base16 qualified as Base16
import Hydra.API.HTTPServer (DraftCommitTxRequest, DraftCommitTxResponse, SubmitTxRequest (..), TransactionSubmitted, httpApp)
import Hydra.API.ServerSpec (dummyChainHandle)
import Hydra.Cardano.Api (serialiseToTextEnvelope, toLedgerTx)
import Hydra.Cardano.Api (fromLedgerPParams, serialiseToTextEnvelope, shelleyBasedEra, toLedgerTx)
import Hydra.Chain.Direct.Fixture (defaultPParams)
import Hydra.JSONSchema (SchemaSelector, prop_validateJSONSchema, validateJSON, withJsonSpecifications)
import Hydra.Ledger.Cardano (Tx)
Expand Down Expand Up @@ -102,7 +102,7 @@ apiServerSpec = do
it "responds given parameters" $
get "/protocol-parameters"
`shouldRespondWith` 200
{ matchBody = matchJSON defaultPParams
{ matchBody = matchJSON $ fromLedgerPParams shelleyBasedEra defaultPParams
}
where
webServer = httpApp nullTracer dummyChainHandle defaultPParams getHeadId
Expand Down

0 comments on commit 9ec42c4

Please sign in to comment.