@@ -15,18 +15,18 @@ import qualified Data.Map as Map
15
15
import Formatting (build , int , sformat , stext , (%) )
16
16
import qualified Text.JSON.Canonical as CanonicalJSON
17
17
18
+ import Pos.Chain.Genesis as Genesis (Config (.. ), configEpochSlots ,
19
+ configGeneratedSecretsThrow )
20
+ import Pos.Chain.Genesis (gsSecretKeys )
18
21
import Pos.Chain.Txp (TxOut (.. ), TxpConfiguration )
19
22
import Pos.Chain.Update (BlockVersionModifier (.. ))
20
23
import Pos.Client.KeyStorage (addSecretKey , getSecretKeysPlain )
21
24
import Pos.Client.Txp.Balances (getBalance )
22
- import Pos.Core as Core (AddrStakeDistribution (.. ), Config (.. ),
23
- StakeholderId , addressHash , configEpochSlots ,
24
- configGeneratedSecretsThrow , mkMultiKeyDistr ,
25
- unsafeGetCoin )
25
+ import Pos.Core (AddrStakeDistribution (.. ), StakeholderId ,
26
+ addressHash , mkMultiKeyDistr , unsafeGetCoin )
26
27
import Pos.Core.Common (AddrAttributes (.. ), AddrSpendingData (.. ),
27
28
makeAddress )
28
29
import Pos.Core.Delegation (HeavyDlgIndex (.. ))
29
- import Pos.Core.Genesis (gsSecretKeys )
30
30
import Pos.Core.Update (SoftwareVersion (.. ))
31
31
import Pos.Crypto (PublicKey , emptyPassphrase , encToPublic ,
32
32
fullPublicKeyF , hashHexF , noPassEncrypt , safeCreatePsk ,
@@ -65,7 +65,7 @@ import Repl (PrintAction)
65
65
66
66
createCommandProcs ::
67
67
forall m . (MonadIO m , CanLog m , HasLoggerName m )
68
- => Maybe Core . Config
68
+ => Maybe Genesis . Config
69
69
-> Maybe TxpConfiguration
70
70
-> Maybe (Dict (MonadAuxxMode m ))
71
71
-> PrintAction m
@@ -102,7 +102,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
102
102
},
103
103
104
104
let name = " addr" in
105
- needsCoreConfig name >>= \ coreConfig ->
105
+ needsCoreConfig name >>= \ genesisConfig ->
106
106
needsAuxxMode name >>= \ Dict ->
107
107
return CommandProc
108
108
{ cpName = name
@@ -114,7 +114,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
114
114
, cpExec = \ (pk', mDistr) -> do
115
115
pk <- toLeft pk'
116
116
addr <- case mDistr of
117
- Nothing -> makePubKeyAddressAuxx (configEpochSlots coreConfig ) pk
117
+ Nothing -> makePubKeyAddressAuxx (configEpochSlots genesisConfig ) pk
118
118
Just distr -> return $
119
119
makeAddress (PubKeyASD pk) (AddrAttributes Nothing distr)
120
120
return $ ValueAddress addr
@@ -124,7 +124,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
124
124
},
125
125
126
126
let name = " addr-hd" in
127
- needsCoreConfig name >>= \ coreConfig ->
127
+ needsCoreConfig name >>= \ genesisConfig ->
128
128
needsAuxxMode name >>= \ Dict ->
129
129
return CommandProc
130
130
{ cpName = name
@@ -135,7 +135,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
135
135
sk <- evaluateWHNF (sks !! i) -- WHNF is sufficient to force possible errors
136
136
-- from using (!!). I'd use NF but there's no
137
137
-- NFData instance for secret keys.
138
- addrHD <- deriveHDAddressAuxx (configEpochSlots coreConfig ) sk
138
+ addrHD <- deriveHDAddressAuxx (configEpochSlots genesisConfig ) sk
139
139
return $ ValueAddress addrHD
140
140
, cpHelp = " address of the HD wallet for the specified public key"
141
141
},
@@ -192,17 +192,17 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
192
192
return . procConst " false" $ ValueBool False ,
193
193
194
194
let name = " balance" in
195
- needsCoreConfig name >>= \ coreConfig ->
195
+ needsCoreConfig name >>= \ genesisConfig ->
196
196
needsAuxxMode name >>= \ Dict ->
197
197
return CommandProc
198
198
{ cpName = name
199
199
, cpArgumentPrepare = identity
200
200
, cpArgumentConsumer = getArg (tyAddress `tyEither` tyPublicKey `tyEither` tyInt) " addr"
201
201
, cpExec = \ addr' -> do
202
202
addr <-
203
- either return (makePubKeyAddressAuxx $ configEpochSlots coreConfig ) <=<
203
+ either return (makePubKeyAddressAuxx $ configEpochSlots genesisConfig ) <=<
204
204
traverse (either return getPublicKeyFromIndex) $ addr'
205
- balance <- getBalance (configGenesisData coreConfig ) addr
205
+ balance <- getBalance (configGenesisData genesisConfig ) addr
206
206
return $ ValueNumber (fromIntegral . unsafeGetCoin $ balance)
207
207
, cpHelp = " check the amount of coins on the specified address"
208
208
},
@@ -218,7 +218,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
218
218
},
219
219
220
220
let name = " send-to-all-genesis" in
221
- needsCoreConfig name >>= \ coreConfig ->
221
+ needsCoreConfig name >>= \ genesisConfig ->
222
222
needsDiffusion name >>= \ diffusion ->
223
223
needsAuxxMode name >>= \ Dict ->
224
224
return CommandProc
@@ -232,8 +232,8 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
232
232
stagpTpsSentFile <- getArg tyFilePath " file"
233
233
return Tx. SendToAllGenesisParams {.. }
234
234
, cpExec = \ stagp -> do
235
- secretKeys <- gsSecretKeys <$> configGeneratedSecretsThrow coreConfig
236
- Tx. sendToAllGenesis coreConfig secretKeys diffusion stagp
235
+ secretKeys <- gsSecretKeys <$> configGeneratedSecretsThrow genesisConfig
236
+ Tx. sendToAllGenesis genesisConfig secretKeys diffusion stagp
237
237
return ValueUnit
238
238
, cpHelp = " create and send transactions from all genesis addresses \
239
239
\ for <duration> seconds, <delay> in ms. <conc> is the \
@@ -254,7 +254,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
254
254
},
255
255
256
256
let name = " send" in
257
- needsCoreConfig name >>= \ coreConfig ->
257
+ needsCoreConfig name >>= \ genesisConfig ->
258
258
needsDiffusion name >>= \ diffusion ->
259
259
needsAuxxMode name >>= \ Dict ->
260
260
return CommandProc
@@ -264,14 +264,14 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
264
264
(,) <$> getArg tyInt " i"
265
265
<*> getArgSome tyTxOut " out"
266
266
, cpExec = \ (i, outputs) -> do
267
- Tx. send coreConfig diffusion i outputs
267
+ Tx. send genesisConfig diffusion i outputs
268
268
return ValueUnit
269
269
, cpHelp = " send from #i to specified transaction outputs \
270
270
\ (use 'tx-out' to build them)"
271
271
},
272
272
273
273
let name = " vote" in
274
- needsCoreConfig name >>= \ coreConfig ->
274
+ needsCoreConfig name >>= \ genesisConfig ->
275
275
needsDiffusion name >>= \ diffusion ->
276
276
needsAuxxMode name >>= \ Dict ->
277
277
return CommandProc
@@ -282,7 +282,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
282
282
<*> getArg tyBool " agree"
283
283
<*> getArg tyHash " up-id"
284
284
, cpExec = \ (i, decision, upId) -> do
285
- Update. vote (configProtocolMagic coreConfig ) diffusion i decision upId
285
+ Update. vote (configProtocolMagic genesisConfig ) diffusion i decision upId
286
286
return ValueUnit
287
287
, cpHelp = " send vote for update proposal <up-id> and \
288
288
\ decision <agree> ('true' or 'false'), \
@@ -338,7 +338,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
338
338
},
339
339
340
340
let name = " propose-update" in
341
- needsCoreConfig name >>= \ coreConfig ->
341
+ needsCoreConfig name >>= \ genesisConfig ->
342
342
needsDiffusion name >>= \ diffusion ->
343
343
needsAuxxMode name >>= \ Dict ->
344
344
return CommandProc
@@ -361,7 +361,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
361
361
-- is to have two ValueHash constructors, one with universal and
362
362
-- one with existential (relevant via singleton-style GADT) quantification.
363
363
ValueHash . unsafeCheatingHashCoerce
364
- <$> Update. propose (configProtocolMagic coreConfig ) diffusion params
364
+ <$> Update. propose (configProtocolMagic genesisConfig ) diffusion params
365
365
, cpHelp = " propose an update with one positive vote for it \
366
366
\ using secret key #i"
367
367
},
@@ -377,7 +377,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
377
377
},
378
378
379
379
let name = " delegate-heavy" in
380
- needsCoreConfig name >>= \ coreConfig ->
380
+ needsCoreConfig name >>= \ genesisConfig ->
381
381
needsDiffusion name >>= \ diffusion ->
382
382
needsAuxxMode name >>= \ Dict ->
383
383
return CommandProc
@@ -393,7 +393,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
393
393
withSafeSigner issuerSk (pure emptyPassphrase) $ \ case
394
394
Nothing -> logError " Invalid passphrase"
395
395
Just ss -> do
396
- let psk = safeCreatePsk (configProtocolMagic coreConfig )
396
+ let psk = safeCreatePsk (configProtocolMagic genesisConfig )
397
397
ss
398
398
delegatePk
399
399
(HeavyDlgIndex curEpoch)
@@ -414,7 +414,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
414
414
},
415
415
416
416
let name = " generate-blocks" in
417
- needsCoreConfig name >>= \ coreConfig ->
417
+ needsCoreConfig name >>= \ genesisConfig ->
418
418
needsAuxxMode name >>= \ Dict ->
419
419
needsTxpConfig name >>= \ txpConfig ->
420
420
return CommandProc
@@ -425,21 +425,21 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
425
425
bgoSeed <- getArgOpt tyInt " seed"
426
426
return GenBlocksParams {.. }
427
427
, cpExec = \ params -> do
428
- generateBlocks coreConfig txpConfig params
428
+ generateBlocks genesisConfig txpConfig params
429
429
return ValueUnit
430
430
, cpHelp = " generate <n> blocks"
431
431
},
432
432
433
433
let name = " add-key-pool" in
434
- needsCoreConfig name >>= \ coreConfig ->
434
+ needsCoreConfig name >>= \ genesisConfig ->
435
435
needsAuxxMode name >>= \ Dict ->
436
436
return CommandProc
437
437
{ cpName = name
438
438
, cpArgumentPrepare = identity
439
439
, cpArgumentConsumer = getArgMany tyInt " i"
440
440
, cpExec = \ is -> do
441
441
when (null is) $ logWarning " Not adding keys from pool (list is empty)"
442
- secretKeys <- gsSecretKeys <$> configGeneratedSecretsThrow coreConfig
442
+ secretKeys <- gsSecretKeys <$> configGeneratedSecretsThrow genesisConfig
443
443
forM_ is $ \ i -> do
444
444
key <- evaluateNF $ secretKeys !! i
445
445
addSecretKey $ noPassEncrypt key
@@ -470,7 +470,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
470
470
},
471
471
472
472
let name = " rollback" in
473
- needsCoreConfig name >>= \ coreConfig ->
473
+ needsCoreConfig name >>= \ genesisConfig ->
474
474
needsAuxxMode name >>= \ Dict ->
475
475
return CommandProc
476
476
{ cpName = name
@@ -480,20 +480,20 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
480
480
rpDumpPath <- getArg tyFilePath " dump-file"
481
481
pure RollbackParams {.. }
482
482
, cpExec = \ RollbackParams {.. } -> do
483
- Rollback. rollbackAndDump coreConfig rpNum rpDumpPath
483
+ Rollback. rollbackAndDump genesisConfig rpNum rpDumpPath
484
484
return ValueUnit
485
485
, cpHelp = " "
486
486
},
487
487
488
488
let name = " listaddr" in
489
- needsCoreConfig name >>= \ coreConfig ->
489
+ needsCoreConfig name >>= \ genesisConfig ->
490
490
needsAuxxMode name >>= \ Dict ->
491
491
return CommandProc
492
492
{ cpName = name
493
493
, cpArgumentPrepare = identity
494
494
, cpArgumentConsumer = do pure ()
495
495
, cpExec = \ () -> do
496
- let epochSlots = configEpochSlots coreConfig
496
+ let epochSlots = configEpochSlots genesisConfig
497
497
sks <- getSecretKeysPlain
498
498
printAction " Available addresses:"
499
499
for_ (zip [0 :: Int .. ] sks ) $ \ (i, sk) -> do
@@ -534,7 +534,7 @@ createCommandProcs mCoreConfig mTxpConfig hasAuxxMode printAction mDiffusion = r
534
534
mData
535
535
needsAuxxMode = needsData hasAuxxMode " AuxxMode"
536
536
needsDiffusion = needsData mDiffusion " Diffusion layer"
537
- needsCoreConfig = needsData mCoreConfig " Core .Config"
537
+ needsCoreConfig = needsData mCoreConfig " Genesis .Config"
538
538
needsTxpConfig = needsData mTxpConfig " TxpConfiguration"
539
539
540
540
procConst :: Applicative m => Name -> Value -> CommandProc m
0 commit comments