Skip to content

Commit

Permalink
rename poolIDfromBHBody to issuerIDfromBHBody
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Corduan committed Sep 16, 2020
1 parent 44ef10a commit 9865baa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Expand Up @@ -23,6 +23,7 @@ module Shelley.Spec.Ledger.BlockChain
lastAppliedHash,
BHBody (..),
poolIDfromBHBody,
issuerIDfromBHBody,
BHeader (BHeader),
Block (Block),
LaxBlock (..),
Expand Down Expand Up @@ -489,6 +490,12 @@ instance
-- from the body of the block header.
poolIDfromBHBody :: Era era => BHBody era -> KeyHash 'BlockIssuer era
poolIDfromBHBody = hashKey . bheaderVk
{-# DEPRECATED poolIDfromBHBody "poolIDfromBHBody has been deprecated (the name is misleading), use issuerIDfromBHBody" #-}

-- | Retrieve the issuer id (the hash of the cold key) from the body of the block header.
-- This corresponds to either a genesis/core node or a stake pool.
issuerIDfromBHBody :: Era era => BHBody era -> KeyHash 'BlockIssuer era
issuerIDfromBHBody = hashKey . bheaderVk

-- | Retrieve the new nonce from the block header body.
bnonce :: BHBody era -> Nonce
Expand Down
Expand Up @@ -44,7 +44,7 @@ import Shelley.Spec.Ledger.BlockChain
bbHash,
hBbsize,
incrBlocks,
poolIDfromBHBody,
issuerIDfromBHBody,
)
import Shelley.Spec.Ledger.EpochBoundary (BlocksMade)
import Shelley.Spec.Ledger.Keys (DSignable, Hash, coerceKeyRole)
Expand Down Expand Up @@ -134,7 +134,7 @@ bbodyTransition =
-- Note that this may not actually be a stake pool - it could be a genesis key
-- delegate. However, this would only entail an overhead of 7 counts, and it's
-- easier than differentiating here.
let hkAsStakePool = coerceKeyRole . poolIDfromBHBody $ bhb
let hkAsStakePool = coerceKeyRole . issuerIDfromBHBody $ bhb
slot = bheaderSlotNo bhb
firstSlotNo <- liftSTS $ do
ei <- asks epochInfo
Expand Down
Expand Up @@ -48,8 +48,8 @@ import Shelley.Spec.Ledger.BlockChain
( BHBody (..),
BHeader (..),
checkLeaderValue,
issuerIDfromBHBody,
mkSeed,
poolIDfromBHBody,
seedEta,
seedL,
)
Expand Down Expand Up @@ -212,7 +212,7 @@ praosVrfChecks eta0 (PoolDistr pd) f bhb = do
(throwError $ VRFLeaderValueTooBig (VRF.certifiedOutput $ bheaderL bhb) sigma f)
pure ()
where
hk = coerceKeyRole . poolIDfromBHBody $ bhb
hk = coerceKeyRole . issuerIDfromBHBody $ bhb
vrfK = bheaderVrfVk bhb

pbftVrfChecks ::
Expand All @@ -232,7 +232,7 @@ pbftVrfChecks vrfHK eta0 bhb = do
vrfChecks eta0 bhb
pure ()
where
hk = poolIDfromBHBody bhb
hk = issuerIDfromBHBody bhb
vrfK = bheaderVrfVk bhb

overlayTransition ::
Expand Down
6 changes: 3 additions & 3 deletions shelley/chain-and-ledger/formal-spec/chain.tex
Expand Up @@ -1242,8 +1242,8 @@ \subsection{Verifiable Random Function}
\begin{figure}
\emph{VRF helper function}
\begin{align*}
& \fun{poolIDfromBHBody} \in \BHBody \to \KeyHash_{pool} \\
& \fun{poolIDfromBHBody} = \hashKey{} \circ \bvkcold{} \\
& \fun{issuerIDfromBHBody} \in \BHBody \to \KeyHash_{pool} \\
& \fun{issuerIDfromBHBody} = \hashKey{} \circ \bvkcold{} \\
\end{align*}
%
\begin{align*}
Expand Down Expand Up @@ -1278,7 +1278,7 @@ \subsection{Verifiable Random Function}
~~~~ \land & \fun{checkLeaderVal}~(\fun{bleader}~\var{bhb})~\sigma~\var{f} \\
\end{array} \\
& ~~~~\where \\
& ~~~~~~~~~~\var{hk} \leteq \fun{poolIDfromBHBody}~\var{bhb} \\
& ~~~~~~~~~~\var{hk} \leteq \fun{issuerIDfromBHBody}~\var{bhb} \\
& ~~~~~~~~~~\var{vrfK} \leteq \fun{bvkvrf}~\var{bhb} \\
\end{align*}
%
Expand Down

0 comments on commit 9865baa

Please sign in to comment.