Skip to content

Commit

Permalink
Merge #1668
Browse files Browse the repository at this point in the history
1668: Merge networkMagic and protocolMagicId r=dcoutts a=kderme



Co-authored-by: kderme <[email protected]>
  • Loading branch information
iohk-bors[bot] and kderme authored Jul 15, 2020
2 parents dae9940 + 000c2e7 commit f083287
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ module Shelley.Spec.Ledger.Genesis
)
where

import Cardano.Crypto (ProtocolMagicId)
import qualified Cardano.Crypto.Hash.Class as Crypto
import Cardano.Crypto.KES.Class (totalPeriodsKES)
import Cardano.Prelude (NoUnexpectedThunks)
Expand Down Expand Up @@ -91,7 +90,6 @@ data ShelleyGenesis c = ShelleyGenesis
{ sgSystemStart :: !UTCTime,
sgNetworkMagic :: !Word32,
sgNetworkId :: !Network,
sgProtocolMagicId :: !ProtocolMagicId,
sgActiveSlotsCoeff :: !Rational,
sgSecurityParam :: !Word64,
sgEpochLength :: !EpochSize,
Expand All @@ -118,11 +116,8 @@ instance Crypto crypto => ToJSON (ShelleyGenesis crypto) where
toJSON sg =
Aeson.object
[ "systemStart" .= sgSystemStart sg,
--TODO: this should not have both network magic and protocol magic
-- they are different names for the same thing used in two ways.
"networkMagic" .= sgNetworkMagic sg,
"networkId" .= sgNetworkId sg,
"protocolMagicId" .= sgProtocolMagicId sg,
"activeSlotsCoeff" .= (fromRational (sgActiveSlotsCoeff sg) :: Scientific),
"securityParam" .= sgSecurityParam sg,
"epochLength" .= sgEpochLength sg,
Expand All @@ -144,7 +139,6 @@ instance Crypto crypto => FromJSON (ShelleyGenesis crypto) where
<$> obj .: "systemStart"
<*> obj .: "networkMagic"
<*> obj .: "networkId"
<*> obj .: "protocolMagicId"
<*> ( (toRational :: Scientific -> Rational)
<$> obj .: "activeSlotsCoeff"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"tau": 0,
"a0": 0
},
"protocolMagicId": 838299499,
"genDelegs": {
"23d51e9123d51e91": {
"delegate": "839b047f839b047f",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ module Test.Shelley.Spec.Ledger.Examples
where

import Cardano.Crypto.Hash (HashAlgorithm)
import Cardano.Crypto.ProtocolMagic
import qualified Cardano.Crypto.VRF as VRF
import Cardano.Prelude (asks)
import Cardano.Slotting.Slot (EpochSize (..), WithOrigin (..))
Expand Down Expand Up @@ -3516,7 +3515,6 @@ exampleShelleyGenesis =
{ sgSystemStart = posixSecondsToUTCTime $ realToFrac (1234566789 :: Integer),
sgNetworkMagic = 4036000900,
sgNetworkId = Testnet,
sgProtocolMagicId = ProtocolMagicId 838299499,
sgActiveSlotsCoeff = 6.259,
sgSecurityParam = 120842,
sgEpochLength = EpochSize 1215,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import Shelley.Spec.Ledger.Keys
import Shelley.Spec.Ledger.PParams
import Shelley.Spec.Ledger.Scripts
import Shelley.Spec.Ledger.TxData
import Test.Cardano.Crypto.Gen (genProtocolMagicId)
import Test.Shelley.Spec.Ledger.Serialization (genIPv4, genIPv6)
import Test.Shelley.Spec.Ledger.Utils (mkHash)

Expand All @@ -53,7 +52,6 @@ genShelleyGenesis =
<$> genUTCTime
<*> genNetworkMagic
<*> Gen.element [Mainnet, Testnet]
<*> genProtocolMagicId
<*> fmap realToFrac genSlotLength
<*> Gen.word64 (Range.linear 1 1000000)
<*> fmap EpochSize genSecurityParam
Expand Down

0 comments on commit f083287

Please sign in to comment.