-
Notifications
You must be signed in to change notification settings - Fork 22
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
Introduce EraBasedProtocolParametersUpdate #180
Conversation
let common = createCommonPParamsUpdate c | ||
preAl' = createPParamsUpdatePreAlonzo preAl | ||
pCon' = createPParamsUpdatePreConway pCon | ||
in common -- <> preAl' <> pCon' |
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.
A SemiGroup PParams
instance will allow us to do this.
newtype PParamsUpdate era = PParamsUpdate (PParamsHKD StrictMaybe era)
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.
Is this something ledger can provide? Or are we proposing to add a wrapper?
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 could use PParams
instead of PPUpdate
here, it should be possible to do:
L.emptyPParams `L.applyPPupdates` preAl' `L.applyPPupdates` pCon'
but then PParams
is a bit unwieldy here
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.
Is this something ledger can provide? Or are we proposing to add a wrapper?
They can provide it but I'm going to do an orphan instance.
If we could use PParams instead of PPUpdate here, it should be possible to do:
L.emptyPParamsL.applyPPupdates
preAl'L.applyPPupdates
pCon'
but then PParams is a bit unwieldy here
This is a little hacky.
|
||
data IntroducedInConwayPParamsUpdate era | ||
|
||
data IntroducedInAlonzoPParamsUpdate ledgerera |
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.
Explicit data type that tells us what was introduced in the Alonzo era
, alMaxCollateralInputs :: StrictMaybe Natural | ||
} | ||
|
||
data CommonProtocolParameters |
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.
Currently all of these are common to all Shelley based eras. We can pluck them as necessary if any are deprecated.
(StrictMaybe Ledger.Nonce) -- ^ Extra entropy | ||
(StrictMaybe Ledger.UnitInterval) -- ^ Decentralization parameter | ||
|
||
createPParamsUpdatePreConway |
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.
Additional type safety as a result of using ledger's lenses
c1955e9
to
a8e8a28
Compare
a8e8a28
to
5c25aa3
Compare
data DeprecatedAfterAlonzoPParams' ledgerera | ||
= DeprecatedAfterAlonzoPParams' | ||
(StrictMaybe Ledger.Nonce) -- ^ Extra entropy | ||
(StrictMaybe Ledger.UnitInterval) -- ^ Decentralization parameter |
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 think there is a good case to use field names we we break up the protocol parameters into pieces like this.
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 tried to add record but GHC is complaining they aren't used.
|
||
-- | Each constructor corresponds to the set of protocol parameters available | ||
-- in a given era. | ||
data EraBasedProtocolParametersUpdate era where |
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.
Will we be needing another one for EraBasedProtocolParameters era
to match PParams era
?
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 want to reuse this to construct PParams era
cccd834
to
7298f0c
Compare
7298f0c
to
aa68252
Compare
…era-based-parsers Remove example era-based parsers we don't need anymore
Changelog
Context
Additional context for the PR goes here.
If the PR fixes a particular issue please provide a
link
to the issue.
Checklist
See Running tests for more details
.cabal
files are updatedhlint
. See.github/workflows/check-hlint.yml
to get thehlint
versionstylish-haskell
. See.github/workflows/stylish-haskell.yml
to get thestylish-haskell
versionghc-8.10.7
andghc-9.2.7