Skip to content

Commit

Permalink
Make constructor names of TokenBundleSizeAssessment consistent.
Browse files Browse the repository at this point in the history
For some reason, the names of the constructors have diverged.

This commit makes them consistent again.
  • Loading branch information
jonathanknowles committed Oct 22, 2021
1 parent 76e949f commit 39d6d24
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/core/src/Cardano/Wallet/Primitive/CoinSelection.hs
Expand Up @@ -860,7 +860,7 @@ verifySelectionOutputSizeExceedsLimitError cs _ps e
where
isWithinLimit = case (cs ^. #assessTokenBundleSize) bundle of
TokenBundleSizeWithinLimit -> True
OutputTokenBundleSizeExceedsLimit -> False
TokenBundleSizeExceedsLimit -> False
where
bundle = outputReportedAsExceedingLimit ^. #tokens

Expand Down Expand Up @@ -1294,7 +1294,7 @@ verifyOutputSize cs out
withinLimit =
case (cs ^. #assessTokenBundleSize) (out ^. #tokens) of
TokenBundleSizeWithinLimit -> True
OutputTokenBundleSizeExceedsLimit -> False
TokenBundleSizeExceedsLimit -> False

-- | Indicates that a token quantity exceeds the maximum quantity that can
-- appear in a transaction output's token bundle.
Expand Down
Expand Up @@ -1330,7 +1330,7 @@ tokenBundleSizeExceedsLimit (TokenBundleSizeAssessor assess) b =
case assess b of
TokenBundleSizeWithinLimit->
False
OutputTokenBundleSizeExceedsLimit ->
TokenBundleSizeExceedsLimit ->
True

-- | Constructs change bundles for a set of selected inputs and outputs.
Expand Down
6 changes: 3 additions & 3 deletions lib/core/src/Cardano/Wallet/Primitive/Types/Tx.hs
Expand Up @@ -782,8 +782,8 @@ data LocalTxSubmissionStatus tx = LocalTxSubmissionStatus
-- * Enlarging a bundle that exceeds the limit should also result in a
-- bundle that exceeds the limit:
-- @
-- f b1 == OutputTokenBundleSizeExceedsLimit
-- ==> f (b1 `add` b2) == OutputTokenBundleSizeExceedsLimit
-- f b1 == TokenBundleSizeExceedsLimit
-- ==> f (b1 `add` b2) == TokenBundleSizeExceedsLimit
-- @
--
-- * Shrinking a bundle that's within the limit should also result in a
Expand All @@ -805,7 +805,7 @@ data TokenBundleSizeAssessment
= TokenBundleSizeWithinLimit
-- ^ Indicates that the size of a token bundle does not exceed the maximum
-- size that can be included in a transaction output.
| OutputTokenBundleSizeExceedsLimit
| TokenBundleSizeExceedsLimit
-- ^ Indicates that the size of a token bundle exceeds the maximum size
-- that can be included in a transaction output.
deriving (Eq, Generic, Show)
Expand Down
Expand Up @@ -2218,7 +2218,7 @@ unMockAssessTokenBundleSize = \case
case assetCount `compare` upperLimit of
LT -> TokenBundleSizeWithinLimit
EQ -> TokenBundleSizeWithinLimit
GT -> OutputTokenBundleSizeExceedsLimit
GT -> TokenBundleSizeExceedsLimit

mkTokenBundleSizeAssessor
:: MockAssessTokenBundleSize -> TokenBundleSizeAssessor
Expand Down
2 changes: 1 addition & 1 deletion lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs
Expand Up @@ -1922,7 +1922,7 @@ tokenBundleSizeAssessor maxSize = W.TokenBundleSizeAssessor {..}
| serializedLengthBytes <= maxSize' =
W.TokenBundleSizeWithinLimit
| otherwise =
W.OutputTokenBundleSizeExceedsLimit
W.TokenBundleSizeExceedsLimit
where
serializedLengthBytes :: W.TxSize
serializedLengthBytes = computeTokenBundleSerializedLengthBytes tb
Expand Down
Expand Up @@ -416,11 +416,11 @@ prop_assessTokenBundleSize_enlarge
-> Blind (VariableSize16 TokenBundle)
-> Property
prop_assessTokenBundleSize_enlarge b1' b2' =
assess b1 == OutputTokenBundleSizeExceedsLimit ==> conjoin
assess b1 == TokenBundleSizeExceedsLimit ==> conjoin
[ assess (b1 `TokenBundle.add` b2)
=== OutputTokenBundleSizeExceedsLimit
=== TokenBundleSizeExceedsLimit
, assess (b1 `TokenBundle.setCoin` maxBound)
=== OutputTokenBundleSizeExceedsLimit
=== TokenBundleSizeExceedsLimit
]
where
assess = assessTokenBundleSize
Expand Down Expand Up @@ -516,15 +516,15 @@ unit_assessTokenBundleSize_fixedSizeBundle_64
:: Blind (FixedSize64 TokenBundle) -> Property
unit_assessTokenBundleSize_fixedSizeBundle_64 (Blind (FixedSize64 b)) =
unit_assessTokenBundleSize_fixedSizeBundle b
OutputTokenBundleSizeExceedsLimit
TokenBundleSizeExceedsLimit
maryTokenBundleMaxSize
(TxSize 4228) (TxSize 4748)

unit_assessTokenBundleSize_fixedSizeBundle_128
:: Blind (FixedSize128 TokenBundle) -> Property
unit_assessTokenBundleSize_fixedSizeBundle_128 (Blind (FixedSize128 b)) =
unit_assessTokenBundleSize_fixedSizeBundle b
OutputTokenBundleSizeExceedsLimit
TokenBundleSizeExceedsLimit
maryTokenBundleMaxSize
(TxSize 8452) (TxSize 9484)

Expand Down

0 comments on commit 39d6d24

Please sign in to comment.