-
Notifications
You must be signed in to change notification settings - Fork 163
5191 Rename PoolParams #5211
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
base: master
Are you sure you want to change the base?
5191 Rename PoolParams #5211
Conversation
PR is in draft mode pending 3 more changes
|
Rename PoolParams to StatekPoolParams, to avoid confusion with protocol parameters
f9f17a3
to
54ded1e
Compare
|
||
-- | A stake pool. | ||
data PoolParams = PoolParams | ||
data StakePoolParams = StakePoolParams |
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.
all member should change such that instead of starting with pp
, start with sp
, yes?
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.
Sorry, I didn't realize this was in Draft, so I went through it.
Most of my comments are about the following:
In PState
, we already have psStakePoolParams
and psFutureStakePoolParams
, so no need to duplicate Stake
.
And a few minor missed ones.
My take on your questions:
- This PR made changes to many directories; thus, the corresponding CHANGELOG for all those sub-projects needs to be updated, yes?
Yes, but only for things that are visible from outside the packages - not internal names.
- We should also change the module name from Cardano.Ledger.PoolParams to Cardano.Ledger.StakePoolParams yes?
I don't see why not. It would be good to do int a way that preserves git history
- StatkePoolParams data members should start with sp, yes?
I would say even spp
for prefix.
Will leave it to Alexey to approve, but otherwise looks good to me - barring the things above ^ .
explainWit "poolparams :: (PoolParams c)" univ $ | ||
WitUniv era -> Specification StakePoolParams | ||
witStakePoolParamsSpec univ = | ||
explainWit "poolparams :: (StakePoolParams c)" univ $ |
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.
Missed one here:
explainWit "poolparams :: (StakePoolParams c)" univ $ | |
explainWit "stakePoolParams :: (StakePoolParams c)" univ $ |
-- | The state used by the POOL rule, which tracks stake pool information. | ||
data PState era = PState | ||
{ psStakePoolParams :: !(Map (KeyHash 'StakePool) PoolParams) | ||
{ psStakeStakePoolParams :: !(Map (KeyHash 'StakePool) StakePoolParams) |
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.
Don't think we need duplicated Stake
here:
{ psStakeStakePoolParams :: !(Map (KeyHash 'StakePool) StakePoolParams) | |
{ psStakePoolParams :: !(Map (KeyHash 'StakePool) StakePoolParams) |
{ psStakeStakePoolParams :: !(Map (KeyHash 'StakePool) StakePoolParams) | ||
-- ^ The stake pool parameters. | ||
, psFutureStakePoolParams :: !(Map (KeyHash 'StakePool) PoolParams) | ||
, psFutureStakeStakePoolParams :: !(Map (KeyHash 'StakePool) StakePoolParams) |
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.
Same as above, stake
is already in the name:
, psFutureStakeStakePoolParams :: !(Map (KeyHash 'StakePool) StakePoolParams) | |
, psFutureStakePoolParams :: !(Map (KeyHash 'StakePool) StakePoolParams) |
[ "stakeStakePoolParams" .= psStakeStakePoolParams | ||
, "futureStakeStakePoolParams" .= psFutureStakeStakePoolParams |
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 values in the keys should also not be duplicated:
[ "stakeStakePoolParams" .= psStakeStakePoolParams | |
, "futureStakeStakePoolParams" .= psFutureStakeStakePoolParams | |
[ "stakePoolParams" .= psStakePoolParams | |
, "futureStakePoolParams" .= psFutureStakePoolParams |
psStakeStakePoolParamsL :: Lens' (PState era) (Map (KeyHash 'StakePool) StakePoolParams) | ||
psStakeStakePoolParamsL = lens psStakeStakePoolParams (\ds u -> ds {psStakeStakePoolParams = u}) |
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.
Extra Stake
:
psStakeStakePoolParamsL :: Lens' (PState era) (Map (KeyHash 'StakePool) StakePoolParams) | |
psStakeStakePoolParamsL = lens psStakeStakePoolParams (\ds u -> ds {psStakeStakePoolParams = u}) | |
psStakePoolParamsL :: Lens' (PState era) (Map (KeyHash 'StakePool) StakePoolParams) | |
psStakePoolParamsL = lens psStakePoolParams (\ds u -> ds {psStakePoolParams = u}) |
in [ "stake" .= ssStake | ||
, "delegations" .= ssDelegations | ||
, "poolParams" .= ssPoolParams | ||
, "poolParams" .= ssStakePoolParams |
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.
, "poolParams" .= ssStakePoolParams | |
, "stakePoolParams" .= ssStakePoolParams |
-- | ||
-- > let lookupRefund = lookupDepositDState (certDState dpState) | ||
-- > let isRegPoolId = (`Map.member` psStakePoolParams (certPState dpState)) | ||
-- > let isRegPoolId = (`Map.member` psStakeStakePoolParams (certPState dpState)) |
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.
If we remove the duplicate Stake
in PState
this will be:
-- > let isRegPoolId = (`Map.member` psStakeStakePoolParams (certPState dpState)) | |
-- > let isRegPoolId = (`Map.member` psStakePoolParams (certPState dpState)) |
-- If this value is not at least as large as the 'pledgeRatioP', | ||
-- the stake pool will not earn any rewards for the given epoch. | ||
, poolParamsP :: !PoolParams | ||
, poolParamsP :: !StakePoolParams |
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.
Should we rename this too?
, poolParamsP :: !StakePoolParams | |
, stakePoolParamsP :: !StakePoolParams |
psStakeStakePoolParamsL, | ||
psFutureStakeStakePoolParamsL, |
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.
With the removing of the extra Stake
in core these will be:
psStakeStakePoolParamsL, | |
psFutureStakeStakePoolParamsL, | |
psStakePoolParamsL, | |
psFutureStakePoolParamsL, |
, stakeNotVoted :: Coin | ||
, delegatees :: Map (Credential 'Staking) DRep | ||
, poolParams :: Map (KeyHash 'StakePool) PoolParams | ||
, poolParams :: Map (KeyHash 'StakePool) StakePoolParams |
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 know this is not so important, but we could change it too, for consistency:
, poolParams :: Map (KeyHash 'StakePool) StakePoolParams | |
, stakePoolParams :: Map (KeyHash 'StakePool) StakePoolParams |
Thank you for taking the time to go through the PR. I'll fix the issues you pointed out later today, after hours :) |
Also, I realize now that this PR is quite conflicting with: #5196, which is redefining |
I was not aware of #5196. I should've gone through the pending PRs 1st. I did a preliminary |
one question: this file libs/cardano-ledger-conformance/src/Test/Cardano/Ledger/Conformance/Orphans.hs matches the pattern PoolParams , but it is skipped now, will/should it be renamed ? |
I think it might be best to wait for the earlier PR, #5196, to be completed before continuing with this work. For now, I have stopped working on this draft PR. |
Rename PoolParams to StatekPoolParams, to avoid confusion with protocol parameters
Description
This PR is for issue #5191, Rename PoolParams to StatekPoolParams, to avoid confusion with protocol parameters
Checklist
CHANGELOG.md
files updated for packages with externally visible changes.NOTE: New section is never added with the code changes. (See RELEASING.md).
.cabal
andCHANGELOG.md
files when necessary, according to theversioning process.
.cabal
files updated when necessary.NOTE: If bounds change in a cabal file, that package itself must have a version increase. (See RELEASING.md).
scripts/fourmolize.sh
).scripts/cabal-format.sh
).scripts/gen-cddl.sh
)hie.yaml
updated (usescripts/gen-hie.sh
).