Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nc6 committed Oct 4, 2019
1 parent 50c7c08 commit df5d8fe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
8 changes: 1 addition & 7 deletions shelley/chain-and-ledger/executable-spec/src/BaseTypes.hs
Expand Up @@ -73,7 +73,7 @@ interval1 = UnitInterval 1
-- | Evolving nonce type.
data Nonce
= Nonce (Hash SHA256 Nonce)
| NeutralNonce -- ^ 0 element
| NeutralNonce -- ^ Identity element
deriving (Eq, Ord, Show)

instance ToCBOR Nonce where
Expand All @@ -86,12 +86,6 @@ instance ToCBOR Nonce where
x NeutralNonce = x
NeutralNonce x = x

instance Semigroup Nonce where
(<>) = (⭒)

instance Monoid Nonce where
mempty = NeutralNonce

-- | Make a nonce from a natural number
mkNonce :: Natural -> Nonce
mkNonce = Nonce . coerce . hash @SHA256
Expand Down
4 changes: 2 additions & 2 deletions shelley/chain-and-ledger/executable-spec/src/BlockChain.hs
Expand Up @@ -230,8 +230,8 @@ mkSeed
-> Nonce -- ^ Epoch nonce
-> HashHeader hashAlgo dsignAlgo kesAlgo vrfAlgo
-> Seed
mkSeed (Nonce eta0) slot nonce lastHash =
Seed . coerce $ eta0 `Hash.xor` coerce (hash @SHA256 (slot, nonce, lastHash))
mkSeed (Nonce uc) slot nonce lastHash =
Seed . coerce $ uc `Hash.xor` coerce (hash @SHA256 (slot, nonce, lastHash))
mkSeed NeutralNonce slot nonce lastHash =
Seed . coerce $ (hash @SHA256 (slot, nonce, lastHash))

Expand Down
2 changes: 1 addition & 1 deletion shelley/chain-and-ledger/executable-spec/test/STSTests.hs
Expand Up @@ -46,7 +46,7 @@ testUPNLate =
let
st = applySTS @UPDN (TRC (mkNonce 1, UpdnState (mkNonce 2) (mkNonce 3), Slot.Slot 85))
in
st @?= Right (UpdnState ((mkNonce 2) <> (mkNonce 1)) (mkNonce 3))
st @?= Right (UpdnState ((mkNonce 2) (mkNonce 1)) (mkNonce 3))

testCHAINExample :: CHAINExample -> Assertion
testCHAINExample (CHAINExample slotNow initSt block expectedSt) = do
Expand Down

0 comments on commit df5d8fe

Please sign in to comment.