Skip to content

Commit

Permalink
Try #2100:
Browse files Browse the repository at this point in the history
  • Loading branch information
iohk-bors[bot] authored Sep 4, 2020
2 parents f9a52ab + 6385011 commit 3bf8f7e
Show file tree
Hide file tree
Showing 52 changed files with 136 additions and 430 deletions.
145 changes: 0 additions & 145 deletions cardano-1.19.dev1.yaml

This file was deleted.

9 changes: 8 additions & 1 deletion lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ module Cardano.Wallet.Shelley.Compatibility

-- * Utilities
, invertUnitInterval
, interval0
, interval1
) where

import Prelude
Expand Down Expand Up @@ -159,6 +161,8 @@ import Data.Proxy
( Proxy )
import Data.Quantity
( Percentage, Quantity (..), mkPercentage )
import Data.Ratio
( (%) )
import Data.Text
( Text )
import Data.Text.Class
Expand Down Expand Up @@ -206,7 +210,7 @@ import Ouroboros.Network.NodeToClient
import Ouroboros.Network.Point
( WithOrigin (..) )
import Shelley.Spec.Ledger.BaseTypes
( strictMaybeToMaybe, urlToText )
( interval0, strictMaybeToMaybe, urlToText )
import Type.Reflection
( Typeable, typeRep )

Expand Down Expand Up @@ -1093,3 +1097,6 @@ instance Buildable LocalAddress where
--
invertUnitInterval :: SL.UnitInterval -> SL.UnitInterval
invertUnitInterval = SL.truncateUnitInterval . (1 - ) . SL.intervalValue

interval1 :: SL.UnitInterval
interval1 = SL.truncateUnitInterval (1 % 1)
2 changes: 1 addition & 1 deletion lib/shelley/src/Cardano/Wallet/Shelley/Launch.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ moveInstantaneousRewardsTo tr dir targets = do
stakeCert <- issueStakeCert tr dir pub stakeVK
void $ cli tr
[ "shelley", "governance", "create-mir-certificate"
, "--treasury"
, "--reserves"
, "--reward", show reward
, "--stake-verification-key-file", stakeVK
, "--out-file", mirCert
Expand Down
18 changes: 10 additions & 8 deletions lib/shelley/test/unit/Cardano/Wallet/Shelley/CompatibilitySpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ import Cardano.Wallet.Shelley.Compatibility
, TPraosStandardCrypto
, decentralizationLevelFromPParams
, fromTip
, interval0
, interval1
, invertUnitInterval
, toCardanoHash
, toPoint
Expand Down Expand Up @@ -198,10 +200,10 @@ spec = do
checkCoverage $ property $ \i ->
let half = SL.truncateUnitInterval (1 % 2) in
cover 10 (i == half) "i = 0.5" $
cover 10 (i == SL.interval0) "i = 0" $
cover 10 (i == SL.interval1) "i = 1" $
cover 10 (i > SL.interval0 && i < half) "0 < i < 0.5" $
cover 10 (half < i && i < SL.interval1) "0.5 < i < 1"
cover 10 (i == interval0) "i = 0" $
cover 10 (i == interval1) "i = 1" $
cover 10 (i > interval0 && i < half) "0 < i < 0.5" $
cover 10 (half < i && i < interval1) "0.5 < i < 1"
True

it "invertUnitInterval . invertUnitInterval == id" $
Expand All @@ -214,10 +216,10 @@ spec = do
`shouldBe` 1

it "invertUnitInterval interval0 == interval1" $
invertUnitInterval SL.interval0 `shouldBe` SL.interval1
invertUnitInterval interval0 `shouldBe` interval1

it "invertUnitInterval interval1 == interval0" $
invertUnitInterval SL.interval1 `shouldBe` SL.interval0
invertUnitInterval interval1 `shouldBe` interval0

it "invertUnitInterval half == half" $
let half = SL.truncateUnitInterval (1 % 2) in
Expand Down Expand Up @@ -251,8 +253,8 @@ epochLength = EpochLength 10

instance Arbitrary SL.UnitInterval where
arbitrary = oneof
[ pure SL.interval0
, pure SL.interval1
[ pure interval0
, pure interval1
, pure $ SL.truncateUnitInterval (1 % 2)
, SL.truncateUnitInterval . (% 1000) <$> choose (0, 1000)
]
Expand Down
4 changes: 2 additions & 2 deletions nix/.stack.nix/Win32-network.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/byron-spec-chain.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/byron-spec-ledger.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions nix/.stack.nix/cardano-api.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/cardano-binary-test.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/cardano-binary.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions nix/.stack.nix/cardano-cli.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/cardano-config.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/cardano-crypto-class.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/cardano-crypto-praos.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/cardano-crypto-test.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/.stack.nix/cardano-crypto-wrapper.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3bf8f7e

Please sign in to comment.