Skip to content

Commit

Permalink
Ensure deposit for DReps is at least what ConwayGenesis says
Browse files Browse the repository at this point in the history
  • Loading branch information
palas committed Mar 14, 2024
1 parent 03b7872 commit 9661091
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ packages:
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-api.git
tag: d77f096d0647c38bc2f87a97fda28cef7f31c679
tag: 9560e4572f44ff2b466f881d9353ade446f27e1f
subdir: cardano-api
--sha256: sha256-lFDjMQayPFhc5suvTChFZHtuVIOM9oLVDsfAZ42qm0k=
--sha256: sha256-Innf1vfuHZzTcTcqDV7SIhHe2rUD1UbqwifUnUQx+7I=

package cardano-cli
ghc-options: -Werror
Expand Down
14 changes: 7 additions & 7 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/CreateTestnetData.hs
Original file line number Diff line number Diff line change
Expand Up @@ -325,19 +325,19 @@ runGenesisCreateTestNetDataCmd Cmd.GenesisCreateTestNetDataCmdArgs
-> L.ConwayGenesis L.StandardCrypto -> L.ConwayGenesis L.StandardCrypto
addDRepsToConwayGenesis dRepKeys stakingKeys conwayGenesis =
conwayGenesis { L.cgDelegs = delegs (zip stakingKeys (case dRepKeys of [] -> []; _ -> cycle dRepKeys))
, L.cgInitialDReps = initialDReps dRepKeys
, L.cgInitialDReps = initialDReps (L.ucppDRepDeposit $ L.cgUpgradePParams conwayGenesis) dRepKeys
}

where
delegs :: [(VerificationKey StakeKey, VerificationKey DRepKey)] -> ListMap (L.Credential L.Staking L.StandardCrypto) (L.Delegatee L.StandardCrypto)
delegs = ListMap.fromList . map (bimap verificationKeytoStakeCredential (L.DelegVote . L.DRepCredential . verificationKeyToDRepCredential))

initialDReps :: [VerificationKey DRepKey] -> ListMap (L.Credential L.DRepRole L.StandardCrypto) (L.DRepState L.StandardCrypto)
initialDReps = ListMap.fromList . map (\c -> ( verificationKeyToDRepCredential c
, L.DRepState { L.drepExpiry = EpochNo 1000
, L.drepAnchor = SNothing
, L.drepDeposit = L.Coin 100_000_000
}))
initialDReps :: L.Coin -> [VerificationKey DRepKey] -> ListMap (L.Credential L.DRepRole L.StandardCrypto) (L.DRepState L.StandardCrypto)
initialDReps minDeposit = ListMap.fromList . map (\c -> ( verificationKeyToDRepCredential c
, L.DRepState { L.drepExpiry = EpochNo 1000
, L.drepAnchor = SNothing
, L.drepDeposit = max (L.Coin 1_000_000) minDeposit
}))

verificationKeyToDRepCredential :: VerificationKey DRepKey -> L.Credential L.DRepRole L.StandardCrypto
verificationKeyToDRepCredential vk = dRepKeyToCredential (verificationKeyHash vk)
Expand Down

0 comments on commit 9661091

Please sign in to comment.