|
1 | 1 | {-# LANGUAGE DeriveAnyClass #-}
|
| 2 | + |
2 | 3 | {-# OPTIONS_GHC -fno-warn-orphans #-}
|
3 | 4 |
|
4 | 5 | -- | Context needed for the translation between DSL and Cardano types
|
@@ -50,7 +51,7 @@ import Pos.Chain.Block (BlockHeader (..), GenesisBlock, HeaderHash,
|
50 | 51 | blockHeaderHash, genesisBlock0, _gbHeader)
|
51 | 52 | import Pos.Chain.Lrc
|
52 | 53 | import Pos.Chain.Txp
|
53 |
| -import Pos.Core |
| 54 | +import Pos.Core as Core |
54 | 55 | import Pos.Core.Delegation (ProxySKHeavy)
|
55 | 56 | import Pos.Core.Genesis (GeneratedSecrets (..), GenesisData (..),
|
56 | 57 | GenesisDelegation (..), PoorSecret (..), RichSecrets (..))
|
@@ -88,20 +89,29 @@ data CardanoContext = CardanoContext {
|
88 | 89 | , ccEpochSlots :: SlotCount
|
89 | 90 | }
|
90 | 91 |
|
91 |
| -initCardanoContext :: HasConfiguration => ProtocolMagic -> CardanoContext |
92 |
| -initCardanoContext ccMagic = CardanoContext{..} |
| 92 | +initCardanoContext |
| 93 | + :: HasConfiguration |
| 94 | + => Core.Config |
| 95 | + -> CardanoContext |
| 96 | +initCardanoContext coreConfig = CardanoContext |
| 97 | + { ccStakes = genesisStakes |
| 98 | + , ccBlock0 = ccBlock0 |
| 99 | + , ccData = genesisData |
| 100 | + , ccUtxo = ccUtxo |
| 101 | + , ccSecrets = fromMaybe (error "initCardanoContext: no secrets") $ |
| 102 | + configGeneratedSecrets coreConfig |
| 103 | + , ccMagic = configProtocolMagic coreConfig |
| 104 | + , ccInitLeaders = ccLeaders |
| 105 | + , ccBalances = utxoToAddressCoinPairs ccUtxo |
| 106 | + , ccHash0 = (blockHeaderHash . BlockHeaderGenesis . _gbHeader) ccBlock0 |
| 107 | + , ccEpochSlots = epochSlots |
| 108 | + } |
93 | 109 | where
|
94 |
| - ccLeaders = genesisLeaders epochSlots |
95 |
| - ccStakes = genesisStakes |
96 |
| - ccBlock0 = genesisBlock0 ccMagic (GenesisHash genesisHash) ccLeaders |
97 |
| - ccData = genesisData |
98 |
| - ccUtxo = unGenesisUtxo genesisUtxo |
99 |
| - ccSecrets = fromMaybe (error "initCardanoContext: no secrets") $ |
100 |
| - generatedSecrets |
101 |
| - ccInitLeaders = ccLeaders |
102 |
| - ccBalances = utxoToAddressCoinPairs ccUtxo |
103 |
| - ccHash0 = (blockHeaderHash . BlockHeaderGenesis . _gbHeader) ccBlock0 |
104 |
| - ccEpochSlots = epochSlots |
| 110 | + ccLeaders = genesisLeaders epochSlots |
| 111 | + ccBlock0 = genesisBlock0 (configProtocolMagic coreConfig) |
| 112 | + (GenesisHash genesisHash) |
| 113 | + ccLeaders |
| 114 | + ccUtxo = unGenesisUtxo genesisUtxo |
105 | 115 |
|
106 | 116 | {-------------------------------------------------------------------------------
|
107 | 117 | More explicit representation of the various actors in the genesis block
|
|
0 commit comments