Skip to content

Commit 5fc5339

Browse files
committed
refactor: Remove test duplication
Move out new committee credentials to Forging module
1 parent 1b6a411 commit 5fc5339

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

cardano-chain-gen/src/Cardano/Mock/Forging/Tx/Generic.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ module Cardano.Mock.Forging.Tx.Generic (
2525
registeredByronGenesisKeys,
2626
registeredShelleyGenesisKeys,
2727
bootstrapCommitteeCreds,
28+
unregisteredCommitteeCreds,
2829
unregisteredDRepIds,
2930
consPoolParams,
3031
getPoolStakeCreds,
@@ -292,6 +293,12 @@ bootstrapCommitteeCreds =
292293
)
293294
]
294295

296+
unregisteredCommitteeCreds :: [Credential 'ColdCommitteeRole StandardCrypto]
297+
unregisteredCommitteeCreds =
298+
[ KeyHashObj $ KeyHash "e0a714319812c3f773ba04ec5d6b3ffcd5aad85006805b047b082541"
299+
, KeyHashObj $ KeyHash "f15d3cfda3ac52c86d2d98925419795588e74f4e270a3c17beabeaff"
300+
]
301+
295302
unregisteredDRepIds :: [Credential 'DRepRole StandardCrypto]
296303
unregisteredDRepIds =
297304
[KeyHashObj $ KeyHash "0d94e174732ef9aae73f395ab44507bfa983d65023c11a951f0c32e4"]

cardano-chain-gen/test/Test/Cardano/Db/Mock/Unit/Conway/Governance.hs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ import Cardano.Ledger.Coin (Coin (..))
3131
import Cardano.Ledger.Conway.Governance (GovActionId (..), GovActionIx (..))
3232
import qualified Cardano.Ledger.Conway.Governance as Governance
3333
import Cardano.Ledger.Core (txIdTx)
34-
import Cardano.Ledger.Credential (Credential (..))
35-
import Cardano.Ledger.Keys (KeyHash (..))
3634
import Cardano.Ledger.SafeHash (SafeToHash (..))
3735
import Cardano.Mock.ChainSync.Server (IOManager, ServerHandle)
3836
import Cardano.Mock.Forging.Interpreter (Interpreter, getCurrentEpoch)
@@ -168,13 +166,11 @@ chainedNewCommittee =
168166

169167
let
170168
-- Propose a new committee member
171-
committee1Hash = "e0a714319812c3f773ba04ec5d6b3ffcd5aad85006805b047b082541"
172-
committee1Cred = KeyHashObj (KeyHash committee1Hash)
169+
committee1Cred = Prelude.head Forging.unregisteredCommitteeCreds
173170
proposal1 = Conway.mkAddCommitteeTx Nothing committee1Cred
174171

175172
-- Propose another, using proposal1 as the prev governance action
176-
committee2Hash = "f15d3cfda3ac52c86d2d98925419795588e74f4e270a3c17beabeaff"
177-
committee2Cred = KeyHashObj (KeyHash committee2Hash)
173+
committee2Cred = Forging.unregisteredCommitteeCreds Prelude.!! 1
178174
proposal2 = Conway.mkAddCommitteeTx (Just prevGovActionId) committee2Cred
179175
proposal2TxHash = unTxHash (txIdTx proposal2)
180176

@@ -268,8 +264,7 @@ proposeNewCommittee :: AlonzoTx Consensus.StandardConway
268264
proposeNewCommittee =
269265
Conway.mkAddCommitteeTx Nothing committeeCred
270266
where
271-
committeeHash = "e0a714319812c3f773ba04ec5d6b3ffcd5aad85006805b047b082541"
272-
committeeCred = KeyHashObj (KeyHash committeeHash)
267+
committeeCred = Prelude.head Forging.unregisteredCommitteeCreds
273268

274269
rollbackBlocks ::
275270
Interpreter ->

0 commit comments

Comments
 (0)