Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sevanspowell committed Jun 8, 2021
1 parent 46d4602 commit 6ef5b85
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Expand Up @@ -1263,9 +1263,9 @@ encodeBoundaryTestCriteria c = SelectionCriteria
, extraCoinSource =
Nothing
, mintInputs =
mempty
TokenMap.empty
, burnInputs =
mempty
TokenMap.empty
}
where
dummyAddresses :: [Address]
Expand Down Expand Up @@ -1765,8 +1765,8 @@ prop_makeChange_identity bundles = (===)
, bundleSizeAssessor = mkBundleSizeAssessor NoBundleSizeLimit
, inputBundles = bundles
, outputBundles = bundles
, mintInputs = mempty
, burnInputs = mempty
, mintInputs = TokenMap.empty
, burnInputs = TokenMap.empty
}

-- | Tests that 'makeChange' generates the correct number of change bundles.
Expand Down Expand Up @@ -2028,8 +2028,8 @@ unit_makeChange =
, bundleSizeAssessor
, inputBundles = i
, outputBundles = o
, mintInputs = mempty
, burnInputs = mempty
, mintInputs = TokenMap.empty
, burnInputs = TokenMap.empty
}
]
where
Expand Down
16 changes: 8 additions & 8 deletions lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs
Expand Up @@ -15,6 +15,7 @@
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE LambdaCase #-}

-- |
-- Copyright: © 2020 IOHK
Expand Down Expand Up @@ -1106,14 +1107,13 @@ estimateTxSize skeleton =
-- ; Timelock validity intervals are half-open intervals [a, b).
-- ; This field specifies the right (excluded) endpoint b.
-- ]
sizeOf_NativeScript script =
case script of
(RequireSignatureOf _) -> sizeOf_SmallUInt + sizeOf_Hash28
(RequireAllOf ss) -> sizeOf_SmallUInt + sizeOf_Array + sumVia sizeOf_NativeScript ss
(RequireAnyOf ss) -> sizeOf_SmallUInt + sizeOf_Array + sumVia sizeOf_NativeScript ss
(RequireSomeOf _ ss) -> sizeOf_SmallUInt + sizeOf_UInt + sizeOf_Array + sumVia sizeOf_NativeScript ss
(ActiveFromSlot _) -> sizeOf_SmallUInt + sizeOf_UInt
(ActiveUntilSlot _) -> sizeOf_SmallUInt + sizeOf_UInt
sizeOf_NativeScript = \case
RequireSignatureOf _ -> sizeOf_SmallUInt + sizeOf_Hash28
RequireAllOf ss -> sizeOf_SmallUInt + sizeOf_Array + sumVia sizeOf_NativeScript ss
RequireAnyOf ss -> sizeOf_SmallUInt + sizeOf_Array + sumVia sizeOf_NativeScript ss
RequireSomeOf _ ss -> sizeOf_SmallUInt + sizeOf_UInt + sizeOf_Array + sumVia sizeOf_NativeScript ss
ActiveFromSlot _ -> sizeOf_SmallUInt + sizeOf_UInt
ActiveUntilSlot _ -> sizeOf_SmallUInt + sizeOf_UInt

-- A Blake2b-224 hash, resulting in a 28-byte digest wrapped in CBOR, so
-- with 2 bytes overhead (length <255, but length > 23)
Expand Down
Expand Up @@ -267,7 +267,7 @@ spec = do
mkByronWitness unsignedTx Cardano.Mainnet addr
addrWits = zipWith (mkByronWitness' unsigned) inps pairs
fee = toCardanoLovelace $ selectionDelta txOutCoin cs
Right unsigned = mkUnsignedTx era slotNo cs md mempty [] fee (mempty, mempty)
Right unsigned = mkUnsignedTx era slotNo cs md mempty [] fee (TokenMap.empty, TokenMap.empty)
cs = SelectionResult
{ inputsSelected = NE.fromList inps
, extraCoinSource = Nothing
Expand Down Expand Up @@ -361,7 +361,7 @@ spec = do
mkByronWitness unsignedTx net addr
addrWits = zipWith (mkByronWitness' unsigned) inps pairs
fee = toCardanoLovelace $ selectionDelta txOutCoin cs
Right unsigned = mkUnsignedTx era slotNo cs md mempty [] fee (mempty, mempty)
Right unsigned = mkUnsignedTx era slotNo cs md mempty [] fee (TokenMap.empty, TokenMap.empty)
cs = SelectionResult
{ inputsSelected = NE.fromList inps
, extraCoinSource = Nothing
Expand Down Expand Up @@ -493,7 +493,7 @@ prop_decodeSignedShelleyTxRoundtrip shelleyEra (DecodeShelleySetup utxo outs md
let inps = Map.toList $ getUTxO utxo
let cs = mkSelection inps
let fee = toCardanoLovelace $ selectionDelta txOutCoin cs
let Right unsigned = mkUnsignedTx shelleyEra slotNo cs md mempty [] fee (mempty, mempty)
let Right unsigned = mkUnsignedTx shelleyEra slotNo cs md mempty [] fee (TokenMap.empty, TokenMap.empty)
let addrWits = map (mkShelleyWitness unsigned) pairs
let wits = addrWits
let ledgerTx = Cardano.makeSignedTransaction wits unsigned
Expand Down Expand Up @@ -521,7 +521,7 @@ prop_decodeSignedByronTxRoundtrip (DecodeByronSetup utxo outs slotNo ntwrk pairs
let inps = Map.toList $ getUTxO utxo
let cs = mkSelection inps
let fee = toCardanoLovelace $ selectionDelta txOutCoin cs
let Right unsigned = mkUnsignedTx shelleyEra slotNo cs Nothing mempty [] fee (mempty, mempty)
let Right unsigned = mkUnsignedTx shelleyEra slotNo cs Nothing mempty [] fee (TokenMap.empty, TokenMap.empty)
let byronWits = zipWith (mkByronWitness' unsigned) inps pairs
let ledgerTx = Cardano.makeSignedTransaction byronWits unsigned

Expand Down

0 comments on commit 6ef5b85

Please sign in to comment.