-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create-testnet-data: better UX for supply arguments #581
Conversation
86c135d
to
f87de12
Compare
f87de12
to
af8d6bf
Compare
93f3929
to
e83e4ec
Compare
af8d6bf
to
d0c60ea
Compare
, supply :: !(Maybe Lovelace) -- ^ The number of Lovelace to distribute over initial, non-delegating stake holders. | ||
, supplyDelegated :: !(Maybe Lovelace) -- ^ The number of Lovelace to distribute over delegating stake holders. | ||
, totalSupply :: !(Maybe Lovelace) -- ^ The total number of Lovelace | ||
, delegatedSupply :: !(Maybe Lovelace) -- ^ The number of Lovelace being delegated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much more understandable 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does total supply indicate total maximum possible supply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Humm not sure what you mean. totalSupply
indicates the entire amount of currency in the testnet being created IIUC.
289d218
to
7c7f6cf
Compare
@@ -660,6 +661,75 @@ runGenesisCreateStakedCmd | |||
|
|||
-- ------------------------------------------------------------------------------------------------- | |||
|
|||
updateOutputTemplate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carbolymer> It's not duplicated: the code you refer to was previously shared was previously used both by create-staked
and create-testnet-data
. To keep create-staked
's existing behavior, I unshared it, by copying the preexisting version to create-staked
's file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of similar code, like utilities in where
. Especially this funds distribution part:
distribute (nonDelegCoin - subtractForTreasury) nUtxoAddrsNonDeleg utxoAddrsNonDeleg
++
distribute (delegCoin - subtractForTreasury) nUtxoAddrsDeleg utxoAddrsDeleg
++
mkStuffedUtxo stuffedUtxoAddrs
Can you de-duplicate parts of this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't want to change behavior of create-staked
and don't plan on improving it, I am more in favor of duplicating, so that we have ours hand more free for changing create-testnet-data
in the future; if you don't mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favour of de-duplicating. I'm un-requesting changes. @Jimbo4350 your call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's focus on create-testnet-data
for now. Benchmarking depends on create-staked
. We can revisit in the future and clean it up. I would rename it to something create testnet data specific though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not exported by the module, so I think its name doesn't need to be create-testnet-data
specific.
[--total-supply LOVELACE] | ||
[--delegated-supply LOVELACE] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[--total-supply LOVELACE] | |
[--delegated-supply LOVELACE] | |
[--supply-total LOVELACE] | |
[--supply-delegated LOVELACE] |
I think supply
prefix may be more intuitive. I'm not sure - current version is fine too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I agree with you, but I chose to stay consistent with the existing flags, e.g. in --drep-keys
, --utxo-keys
, and --genesis-keys
; the prefix is the disambiguation. By having --supply-total
and --supply-delegated
, I stick to this convention 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delegCoin = maybe 0 fromIntegral amountDeleg | ||
totalSupply, nonDelegCoin, delegCoin :: Integer | ||
-- if --total-supply is not specified, supply comes from the template passed to this function: | ||
totalSupply = fromIntegral (maybe maximumLovelaceSupply unLovelace mTotalSupply) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not modify: sgMaxLovelaceSupply = fromIntegral $ nonDelegCoin + delegCoin
to sgMaxLovelaceSupply = totalSupply
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, done 👍
@@ -660,6 +661,75 @@ runGenesisCreateStakedCmd | |||
|
|||
-- ------------------------------------------------------------------------------------------------- | |||
|
|||
updateOutputTemplate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's focus on create-testnet-data
for now. Benchmarking depends on create-staked
. We can revisit in the future and clean it up. I would rename it to something create testnet data specific though.
nonDelegCoin = totalSupply - delegCoin | ||
totalSupply = maybe maximumLovelaceSupply unLovelace mTotalSupply | ||
totalSupply', delegCoin, nonDelegCoin :: Integer | ||
totalSupply' = fromIntegral totalSupply |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove totalSupply'
and call fromIntegral
within the definitions of other variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
d3e6c97
to
303afd8
Compare
303afd8
to
8c399c9
Compare
Changelog
Context
As discussed with @CarlosLopezDeLara, the UI for
--supply
and--supply-delegated
increate-staked
was counter-intuitive. As @Jimbo4350 requested here, we can seize the occasion of introducingcreate-testnet-data
to improve.Corresponding
cardano-node
PR: IntersectMBO/cardano-node#5646Fixes #574
How to trust this PR
cardano-node
pass, see CI runs on Adapt to create-testnet-data change cardano-node#5646Checklist