-
Notifications
You must be signed in to change notification settings - Fork 15
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 behavior for create-testnet-data --total-supply and --delegated-supply #874
create-testnet-data: better behavior for create-testnet-data --total-supply and --delegated-supply #874
Conversation
9db2c14
to
e7d890a
Compare
H.readJsonFileOk $ outputDir </> "shelley-genesis.json" | ||
|
||
-- Because we don't test this elsewhere in this file: | ||
(L.sgMaxLovelaceSupply outputGenesis) H.=== tweakedValue |
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.
Rather than checking a single value, why not do a golden test on the entire genesis value?
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.
@Jimbo4350> I hadn't done it initially, because the generated genesis file is not stable.
However, I brought cardano-node's redactJsonFieldsInFile function to redact the unstable fields, and I now made this a golden test.
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.
@Jimbo4350> I did that in an additional commit (that I will fixup later on), to make your review easier.
8c954a4
to
099cb78
Compare
099cb78
to
e765b47
Compare
e765b47
to
059b553
Compare
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.
LGTM!
let outputDir = tempDir </> "out" | ||
void $ | ||
execCardanoCLI | ||
[ "conway" |
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.
We shouldn't hardcore the era here. Use eraToString
.
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 there is no era witness floating around here. This is the one place where we define the era. (and by the way, eraToString
is not a thing in CLI nor API, it's a cardano-testnet
thing)(which maybe we should move to API?).
So I'm merging like this.
-- | ||
-- This test checks that we use the total supply value from the shelley template when --total-supply | ||
-- is not specified. It was broken in the past (see https://github.com/IntersectMBO/cardano-node/issues/5953). | ||
hprop_golden_create_testnet_data_total_supply_template :: Property |
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.
The property name should be updated. It's a golden test of the output of create-testnet-data
.
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 👍
059b553
to
bc34881
Compare
…ply value from the template is ignored
…y genesis + default delegated supply to half the total supply (no default anymore)
bc34881
to
7ee805f
Compare
Changelog
Context
Contributes to fixing IntersectMBO/cardano-node#5953
The API for
create-testnet-data
's total supply and delegated supply was bad:--total-supply
had a default value. So we would never pick up the value coming from the shelley genesis file. Now the behavior is that, if--total-supply
is specified, it overrides the value from the shelley genesis file. Because the shelley genesis file is defaulted, there is always a value available.--delegated-supply
had a default value. This does not play well with the value of total supply coming from either the genesis file or--total-supply
. Now the default is to take half of the total supply (no matter from where it comes from).How to trust this PR
cardano-testnet
at fecf2bf0c728060c0ff408d2a7fecc152c25dd4fChecklist