Skip to content
This repository was archived by the owner on Apr 7, 2021. It is now read-only.

Commit 1b6001c

Browse files
authored
Merge pull request #110 from input-output-hk/KtorZ/3.1.1-fix-submit-api
Revert added feature in 3.0.0 causing issue
2 parents 5f21fe7 + dd1a6ea commit 1b6001c

File tree

8 files changed

+21
-37
lines changed

8 files changed

+21
-37
lines changed

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ services:
6161
max-file: "10"
6262

6363
cardano-explorer-api:
64-
image: inputoutput/cardano-explorer-api:${CARDANO_EXPLORER_API_VERSION:-3.1.0}
64+
image: inputoutput/cardano-explorer-api:${CARDANO_EXPLORER_API_VERSION:-3.1.1}
6565
depends_on:
6666
- postgres
6767
- cardano-db-sync
@@ -83,7 +83,7 @@ services:
8383
max-file: "10"
8484

8585
cardano-submit-api:
86-
image: inputoutput/cardano-submit-api:${CARDANO_SUBMIT_API_VERSION:-3.1.0}
86+
image: inputoutput/cardano-submit-api:${CARDANO_SUBMIT_API_VERSION:-3.1.1}
8787
environment:
8888
- NETWORK=${NETWORK:-mainnet}
8989
depends_on:

explorer-api/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 3.1.1 -- December 2020
4+
5+
* ø (patch in submit-api).
6+
37
## 3.1.0 -- December 2020
48

59
* Fix an internal error with 'InnerJoin' requests on block's transaction summary.

explorer-api/cardano-explorer-api.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cabal-version: >= 1.10
33
-- http://haskell.org/cabal/users-guide/
44

55
name: cardano-explorer-api
6-
version: 3.1.0
6+
version: 3.1.1
77
synopsis: A Block Explorer for the Cardano network
88
description:
99
homepage: https://github.com/input-output-hk/cardano-explorer

rest-common/cardano-rest-common.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cabal-version: >= 1.10
33
-- http://haskell.org/cabal/users-guide/
44

55
name: cardano-rest-common
6-
version: 3.1.0
6+
version: 3.1.1
77
synopsis: A Block Explorer for the Cardano network
88
description:
99
homepage: https://github.com/input-output-hk/cardano-explorer

submit-api/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 3.1.1 -- December 2020
4+
5+
* Revert the MIME-type `encoding` addition from 3.1.0. Turns out there's a bug with an underlying dependency
6+
causing the feature to misbehave. Removing for now. Will rework later if time allows.
7+
38
## 3.1.0 -- December 2020
49

510
* Allow clients to define an extra outer-encoding for the submit endpoint using a MIME-type parameter `encoding`.

submit-api/cardano-submit-api.cabal

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cabal-version: >= 1.10
33
-- http://haskell.org/cabal/users-guide/
44

55
name: cardano-submit-api
6-
version: 3.1.0
6+
version: 3.1.1
77
synopsis: A web server that allows transactions to be POSTed to the cardano chain
88
description:
99
homepage: https://github.com/input-output-hk/cardano-explorer
@@ -52,8 +52,7 @@ library
5252
build-depends: base >= 4.12 && < 4.13
5353
, aeson
5454
, async
55-
, base16
56-
, base64
55+
, base16-bytestring
5756
, bytestring
5857
, cardano-api
5958
, cardano-binary

submit-api/src/Cardano/TxSubmit/Types.hs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,18 @@ import Cardano.Binary
1717
( DecoderError )
1818
import Cardano.TxSubmit.Tx
1919
( TxSubmitError, renderTxSubmitError )
20-
import Control.Arrow
21-
( left )
2220
import Data.Aeson
2321
( ToJSON (..), Value (..) )
24-
import Data.Bifunctor
25-
( bimap )
26-
import Data.ByteString.Base16
27-
( decodeBase16 )
2822
import Data.ByteString.Char8
2923
( ByteString )
30-
import Data.ByteString.Lazy.Base64
31-
( decodeBase64 )
32-
import Data.List.NonEmpty
33-
( NonEmpty (..) )
3424
import Data.Text
3525
( Text )
3626
import Formatting
3727
( build, sformat )
3828
import GHC.Generics
3929
( Generic )
4030
import Network.HTTP.Media
41-
( parameters, (//), (/:) )
31+
( (//) )
4232
import Servant
4333
( (:>)
4434
, Accept (..)
@@ -52,8 +42,6 @@ import Servant.API.Generic
5242
( (:-), ToServantApi )
5343

5444
import qualified Data.ByteString.Lazy.Char8 as LBS
55-
import qualified Data.Map.Strict as Map
56-
import qualified Data.Text as T
5745

5846
newtype TxSubmitPort
5947
= TxSubmitPort Int
@@ -98,10 +86,7 @@ data TxSubmitApiRecord route = TxSubmitApiRecord
9886
data CBORStream
9987

10088
instance Accept CBORStream where
101-
contentTypes _ = "application" // "cbor" /: ("encoding", "base16") :|
102-
[ "application" // "cbor" /: ("encoding", "base64")
103-
, "application" // "cbor"
104-
]
89+
contentType _ = "application" // "cbor"
10590

10691
instance MimeRender CBORStream ByteString where
10792
mimeRender _ = LBS.fromStrict
@@ -110,16 +95,7 @@ instance MimeRender CBORStream LBS.ByteString where
11095
mimeRender _ = id
11196

11297
instance MimeUnrender CBORStream ByteString where
113-
mimeUnrender proxy = fmap LBS.toStrict . mimeUnrender proxy
98+
mimeUnrender _ = Right . LBS.toStrict
11499

115100
instance MimeUnrender CBORStream LBS.ByteString where
116-
mimeUnrenderWithType _ mediaType bytes =
117-
case Map.lookup "encoding" (parameters mediaType) of
118-
Nothing ->
119-
Right bytes
120-
Just "base16" ->
121-
bimap T.unpack LBS.fromStrict . decodeBase16 . LBS.toStrict $ bytes
122-
Just "base64" ->
123-
left T.unpack . decodeBase64 $ bytes
124-
Just _ ->
125-
Left "unrecognized encoding: must be 'base16' or 'base64' if specified."
101+
mimeUnrender _ = Right . id

submit-api/swagger.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ paths:
2020
post:
2121
operationId: postTransaction
2222
summary: Submit Tx
23-
description: Submit an already serialized transaction to the network. Use an extra 'encoding' MIME parameter to send bytestring encoded in `base16` or `base64`.
23+
description: Submit an already serialized transaction to the network.
2424
parameters:
2525
- in: header
2626
name: Content-Type
2727
required: true
2828
type: string
29-
enum: ["application/cbor", "application/cbor; encoding=base16", "application/cbor; encoding=base64"]
29+
enum: ["application/cbor"]
3030

3131
x-code-samples:
3232
- lang: "Shell"

0 commit comments

Comments
 (0)