-
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: correctly compute set of credentials delegating votes to a drep in conway genesis #943
base: main
Are you sure you want to change the base?
create-testnet-data: correctly compute set of credentials delegating votes to a drep in conway genesis #943
Conversation
:: [(VerificationKey StakeKey, VerificationKey DRepKey)] | ||
-> ListMap (L.Credential L.Staking L.StandardCrypto) (L.Delegatee L.StandardCrypto) | ||
-- The credential, to the drep it delegates to | ||
delegs :: [(L.Credential L.Staking L.StandardCrypto, VerificationKey DRepKey)] | ||
delegs = |
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.
Note to @palas: this new delegs
value is like the old cgDelegs
one, except that it doesn't hardcode applying some constructors right away in nested positions. This allows to use delegs
at the source for computing cgDelegs
and cgInitialDReps
. This is important to make sure we are consistent between the two.
…votes to a drep in conway genesis
14c29a8
to
1a46427
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.
Great work. The screenshot was perfection 👌.
) | ||
map | ||
(first verificationKeytoStakeCredential) | ||
(zip stakingKeys (case dRepKeys of [] -> []; _ -> cycle dRepKeys)) |
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 is problematic and thankfully it showed up in the tests:
/out/conway-genesis.json
149 ┃
150 ┃ length (cgInitialDReps conwayGenesis) H.=== numDReps
┃ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
┃ │ ━━━ Failed (- lhs) (+ rhs) ━━━
┃ │ - 4
┃ │ + 5
151 ┃
152 ┃ length (cgDelegs conwayGenesis) H.=== numStakeDelegs
We have: numStakeDelegs = 4
and
numDReps :: Int
numDReps = 5
Because we use zip
the 5th drep is ignored because there is no stake key to delegate to it. We must therefore take into consideration dreps with no delegators.
c35b0a8
to
667ea29
Compare
Changelog
Context
There was uncertainty (see this thread on Slack and here on GitHub) when fixing some part of
create-testnet-data
when writing #940. Because we wanted to merge 940 fast, we proceeded leaving an incorrect value increate-testnet-data
's conway genesis, in the presence of dreps; because we needed to synchronize with the ledger team to understand what to do.This PR corrects the incorrect value.
How to trust this PR
Here is a before and after comparison of the conway genesis created by
create-testnet-data
:On the left, one can see that the
delegators
fields of theinitialDReps
are all left empty. But this is incorrect: the fielddelegs
(above in the screenshot) show that indeed there are votes delegations happening.On the right, you can see that the
delegators
fields are populated with values corresponding to the ones indelegs
✔️Checklist