Skip to content

Commit

Permalink
Merge #1928 #1962
Browse files Browse the repository at this point in the history
1928: Fix thunks in Shelley r=mrBliss a=mrBliss

Fixes #1558.

1962: node to client api changes r=coot a=coot

Small changes to NodeToClient api and LocalStateQuery protocol type signatures.

Related to #1950

- Added null peers in NodeToNode module
- Add kinds to type signatures of LocalQueryProtocol


Co-authored-by: Thomas Winant <[email protected]>
Co-authored-by: Marcin Szamotulski <[email protected]>
  • Loading branch information
3 people authored Apr 16, 2020
3 parents 695730a + f6bb9ec + 32f0c9e commit 635f38e
Show file tree
Hide file tree
Showing 19 changed files with 134 additions and 165 deletions.
24 changes: 12 additions & 12 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -159,43 +159,43 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: 27281d832f2d1d09198efc8ab1916a55c079208a
--sha256: 14x6yf7hhzd3d1xgd91wj76dmx6mxgjxv7bp7sjaa6ss6yvkjsg9
tag: ea8ee1f0711af70e7ba9dbcaa03d04043626018e
--sha256: 192ci4m9n05j4lp787ci77d5z3c3j7lxjkgr6h0rzfdxacib9mxg
subdir: semantics/executable-spec

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: 27281d832f2d1d09198efc8ab1916a55c079208a
--sha256: 14x6yf7hhzd3d1xgd91wj76dmx6mxgjxv7bp7sjaa6ss6yvkjsg9
tag: ea8ee1f0711af70e7ba9dbcaa03d04043626018e
--sha256: 192ci4m9n05j4lp787ci77d5z3c3j7lxjkgr6h0rzfdxacib9mxg
subdir: byron/ledger/executable-spec

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: 27281d832f2d1d09198efc8ab1916a55c079208a
--sha256: 14x6yf7hhzd3d1xgd91wj76dmx6mxgjxv7bp7sjaa6ss6yvkjsg9
tag: ea8ee1f0711af70e7ba9dbcaa03d04043626018e
--sha256: 192ci4m9n05j4lp787ci77d5z3c3j7lxjkgr6h0rzfdxacib9mxg
subdir: byron/chain/executable-spec

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: 27281d832f2d1d09198efc8ab1916a55c079208a
--sha256: 14x6yf7hhzd3d1xgd91wj76dmx6mxgjxv7bp7sjaa6ss6yvkjsg9
tag: ea8ee1f0711af70e7ba9dbcaa03d04043626018e
--sha256: 192ci4m9n05j4lp787ci77d5z3c3j7lxjkgr6h0rzfdxacib9mxg
subdir: shelley/chain-and-ledger/dependencies/non-integer

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: 27281d832f2d1d09198efc8ab1916a55c079208a
--sha256: 14x6yf7hhzd3d1xgd91wj76dmx6mxgjxv7bp7sjaa6ss6yvkjsg9
tag: ea8ee1f0711af70e7ba9dbcaa03d04043626018e
--sha256: 192ci4m9n05j4lp787ci77d5z3c3j7lxjkgr6h0rzfdxacib9mxg
subdir: shelley/chain-and-ledger/executable-spec

source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger-specs
tag: 27281d832f2d1d09198efc8ab1916a55c079208a
--sha256: 14x6yf7hhzd3d1xgd91wj76dmx6mxgjxv7bp7sjaa6ss6yvkjsg9
tag: ea8ee1f0711af70e7ba9dbcaa03d04043626018e
--sha256: 192ci4m9n05j4lp787ci77d5z3c3j7lxjkgr6h0rzfdxacib9mxg
subdir: shelley/chain-and-ledger/executable-spec/test

source-repository-package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ test-suite test
, cardano-binary
, cardano-crypto-class
, cardano-crypto-wrapper
, cardano-prelude
, cardano-slotting
, cborg
, containers >=0.5 && <0.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Ouroboros.Consensus.Shelley.Ledger.Forge (
) where

import Crypto.Random (MonadRandom)
import qualified Data.Sequence as Seq
import qualified Data.Sequence.Strict as Seq

import Cardano.Slotting.Block
import Cardano.Slotting.Slot
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ protocolInfoShelley genesis protVer mbCredentials =
runShelleyBase :: SL.ShelleyBase a -> a
runShelleyBase sb = runReader sb shelleyGlobals

oSched :: Map SlotNo (Maybe (SL.GenKeyHash c))
oSched :: Map SlotNo (SL.OBftSlot c)
oSched = runShelleyBase $
SL.overlaySchedule
initialEpochNo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import qualified Shelley.Spec.Ledger.BaseTypes as SL
import qualified Shelley.Spec.Ledger.BlockChain as SL
import qualified Shelley.Spec.Ledger.Delegation.Certificates as SL
import qualified Shelley.Spec.Ledger.Keys as SL
import qualified Shelley.Spec.Ledger.LedgerState as SL
import qualified Shelley.Spec.Ledger.OCert as SL
import qualified Shelley.Spec.Ledger.STS.Prtcl as STS

Expand Down Expand Up @@ -357,11 +358,11 @@ instance TPraosCrypto c => ConsensusProtocol (TPraos c) where
-> Nothing

-- This is a non-active slot; nobody may produce a block
Just Nothing -> Nothing
Just SL.NonActiveSlot -> Nothing

-- The given genesis key has authority to produce a block in this
-- slot. Check whether we're its delegate.
Just (Just gkhash) -> case Map.lookup gkhash dlgMap of
Just (SL.ActiveSlot gkhash) -> case Map.lookup gkhash dlgMap of
Just dlgHash | dlgHash == vkhCold -> Just TPraosProof {
tpraosEta = coerce rho
-- Note that this leader value is not checked for slots in
Expand Down
18 changes: 16 additions & 2 deletions ouroboros-consensus-shelley/test/Test/Consensus/Shelley/Ledger.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import qualified Data.Map.Strict as Map
import Data.Maybe (fromJust)
import Data.Proxy (Proxy (..))
import Data.Ratio ((%))
import Data.Sequence.Strict (StrictSeq)
import qualified Data.Sequence.Strict as StrictSeq
import Numeric.Natural (Natural)

import Cardano.Binary (Annotator (..), FullByteString (..), fromCBOR,
Expand All @@ -36,10 +38,10 @@ import Ouroboros.Consensus.Storage.ImmutableDB (BinaryInfo (..),
HashInfo (..))

import qualified Shelley.Spec.Ledger.API as SL
import qualified Shelley.Spec.Ledger.Crypto as SL
import qualified Shelley.Spec.Ledger.BaseTypes as SL
import qualified Shelley.Spec.Ledger.BlockChain as SL
import qualified Shelley.Spec.Ledger.Coin as SL
import qualified Shelley.Spec.Ledger.Crypto as SL
import qualified Shelley.Spec.Ledger.Delegation.Certificates as SL
import qualified Shelley.Spec.Ledger.EpochBoundary as SL
import qualified Shelley.Spec.Ledger.Keys as SL
Expand Down Expand Up @@ -458,6 +460,14 @@ instance Crypto c => Arbitrary (SL.PoolDistr c) where
where
genVal = (,) <$> arbitrary <*> genHash (Proxy @c)

instance Arbitrary a => Arbitrary (SL.StrictMaybe a) where
arbitrary = genericArbitraryU
shrink = genericShrink

instance Crypto c => Arbitrary (SL.OBftSlot c) where
arbitrary = genericArbitraryU
shrink = genericShrink

instance Arbitrary (SL.NewEpochState TPraosMockCrypto) where
arbitrary = genericArbitraryU
shrink = genericShrink
Expand All @@ -477,6 +487,10 @@ instance Crypto c => Arbitrary (SL.Stake c) where
instance Arbitrary SL.Url where
arbitrary = return $ SL.Url $ SL.text64 "text"

instance Arbitrary a => Arbitrary (StrictSeq a) where
arbitrary = StrictSeq.toStrict <$> arbitrary
shrink = map StrictSeq.toStrict . shrink . StrictSeq.getSeq

instance Arbitrary SL.PoolMetaData where
arbitrary = (`SL.PoolMetaData` "bytestring") <$> arbitrary

Expand Down Expand Up @@ -538,7 +552,7 @@ instance Arbitrary SL.ProtVer where
instance Arbitrary SL.ActiveSlotCoeff where
arbitrary = SL.mkActiveSlotCoeff <$> arbitrary

instance Arbitrary (SL.PParams' Maybe) where
instance Arbitrary (SL.PParams' SL.StrictMaybe) where
arbitrary = genericArbitraryU
shrink = genericShrink

Expand Down
Loading

0 comments on commit 635f38e

Please sign in to comment.