Skip to content

Commit

Permalink
Remove unused SerialisedTxParts
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed May 26, 2023
1 parent a416959 commit 8ab93ca
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 32 deletions.
4 changes: 0 additions & 4 deletions lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx.hs
Expand Up @@ -39,10 +39,8 @@ module Cardano.Wallet.Primitive.Types.Tx
, sealedTxFromCardano
, sealedTxFromCardano'
, sealedTxFromCardanoBody
, getSerialisedTxParts
, unsafeSealedTxFromBytes
, SerialisedTx (..)
, SerialisedTxParts (..)
, getSealedTxBody
, getSealedTxWitnesses
, persistSealedTx
Expand Down Expand Up @@ -92,11 +90,9 @@ import Cardano.Wallet.Primitive.Types.Tx.Constraints
import Cardano.Wallet.Primitive.Types.Tx.SealedTx
( SealedTx (..)
, SerialisedTx (..)
, SerialisedTxParts (..)
, cardanoTxIdeallyNoLaterThan
, getSealedTxBody
, getSealedTxWitnesses
, getSerialisedTxParts
, mockSealedTx
, persistSealedTx
, sealedTxFromBytes
Expand Down
18 changes: 0 additions & 18 deletions lib/wallet/src/Cardano/Wallet/Primitive/Types/Tx/SealedTx.hs
Expand Up @@ -22,10 +22,8 @@ module Cardano.Wallet.Primitive.Types.Tx.SealedTx (
, sealedTxFromCardano
, sealedTxFromCardano'
, sealedTxFromCardanoBody
, getSerialisedTxParts
, unsafeSealedTxFromBytes
, SerialisedTx (..)
, SerialisedTxParts (..)
, getSealedTxBody
, getSealedTxWitnesses
, persistSealedTx
Expand All @@ -45,7 +43,6 @@ import Cardano.Api
, InAnyCardanoEra (..)
, anyCardanoEra
, deserialiseFromCBOR
, serialiseToCBOR
)
import Cardano.Binary
( DecoderError )
Expand Down Expand Up @@ -295,27 +292,12 @@ unPersistMock bs
where
(header, body) = B8.splitAt (B8.length mockSealedTxMagic) bs

-- | Get the serialised transaction body and witnesses from a 'SealedTx'.
getSerialisedTxParts :: SealedTx -> SerialisedTxParts
getSerialisedTxParts (SealedTx _ (InAnyCardanoEra _ tx) _) = SerialisedTxParts
{ serialisedTxBody = serialiseToCBOR $ Cardano.getTxBody tx
, serialisedTxWitnesses = serialiseToCBOR <$> Cardano.getTxWitnesses tx
}

-- | A serialised transaction that may be only partially signed, or even
-- invalid.
newtype SerialisedTx = SerialisedTx { payload :: ByteString }
deriving stock (Show, Eq, Generic, Ord)
deriving newtype (Semigroup, Monoid, ByteArray, ByteArrayAccess, NFData)

-- | @SerialisedTxParts@ is a serialised transaction body, and a possibly
-- incomplete set of serialised witnesses.
data SerialisedTxParts = SerialisedTxParts
{ serialisedTxBody :: ByteString
, serialisedTxWitnesses :: [ByteString]
} deriving stock (Show, Eq, Generic)


{-------------------------------------------------------------------------------
Internal functions for unit testing
-------------------------------------------------------------------------------}
Expand Down
9 changes: 0 additions & 9 deletions lib/wallet/test/unit/Cardano/Wallet/Api/TypesSpec.hs
Expand Up @@ -337,7 +337,6 @@ import Cardano.Wallet.Primitive.Types.Tx
( Direction (..)
, SealedTx (..)
, SerialisedTx (..)
, SerialisedTxParts (..)
, TxMetadata (..)
, TxScriptValidity (..)
, TxStatus (..)
Expand Down Expand Up @@ -2173,9 +2172,6 @@ selectFromPreparedBinaries = elements $ toByteString <$>
let (Right bs) = fromHex $ T.encodeUtf8 txt
in bs

genWits :: Gen ByteString
genWits = BS.pack <$> Test.QuickCheck.scale (min 32) (listOf arbitrary)

deriving instance Arbitrary a => Arbitrary (ApiAsArray s a)

instance Arbitrary (ApiBytesT base ByteString) where
Expand All @@ -2194,11 +2190,6 @@ instance Arbitrary SealedTx where
instance Arbitrary SerialisedTx where
arbitrary = SerialisedTx <$> selectFromPreparedBinaries

instance Arbitrary SerialisedTxParts where
arbitrary = SerialisedTxParts
<$> selectFromPreparedBinaries
<*> listOf genWits

instance Arbitrary TxMetadata where
arbitrary = genNestedTxMetadata
shrink = shrinkTxMetadata
Expand Down
1 change: 0 additions & 1 deletion weeder.dhall
Expand Up @@ -37,7 +37,6 @@
-- TODO: [ADP-919] Temporary weeder roots
, "signTransaction"
, "getSealedTxWitnesses"
, "getSerialisedTxParts"
]
, type-class-roots = True
}

0 comments on commit 8ab93ca

Please sign in to comment.