-
Notifications
You must be signed in to change notification settings - Fork 156
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
Addition of lenses for PParams #3242
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a3a0b49
to
afa8445
Compare
Soupstraw
reviewed
Jan 11, 2023
Soupstraw
reviewed
Jan 11, 2023
1814588
to
67ea7d0
Compare
67ea7d0
to
7af79f9
Compare
Soupstraw
reviewed
Jan 12, 2023
Soupstraw
reviewed
Jan 12, 2023
Soupstraw
reviewed
Jan 12, 2023
7af79f9
to
5f267c4
Compare
Soupstraw
reviewed
Jan 12, 2023
eras/shelley/impl/src/Cardano/Ledger/Shelley/API/ByronTranslation.hs
Outdated
Show resolved
Hide resolved
eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Examples/GenesisDelegation.hs
Outdated
Show resolved
Hide resolved
eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Examples/GenesisDelegation.hs
Outdated
Show resolved
Hide resolved
eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Examples/Mir.hs
Outdated
Show resolved
Hide resolved
eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/Examples/MirTransfer.hs
Show resolved
Hide resolved
eras/shelley/test-suite/test/Test/Cardano/Ledger/Shelley/RulesTests.hs
Outdated
Show resolved
Hide resolved
Soupstraw
reviewed
Jan 12, 2023
eras/babbage/test-suite/src/Test/Cardano/Ledger/Babbage/Examples/Consensus.hs
Show resolved
Hide resolved
JaredCorduan
approved these changes
Jan 12, 2023
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 all looks amazing, thank you!
You don't have to do this, just an idea: maybe we could add a section to the CONTRIBUTING.md
doc about open imports, forbidden them except for Core
modules, and maybe lenses?
5f267c4
to
26b4305
Compare
* Added `EraPParams` `AlonzoEraPParams` and `BabageEraPParams` with lenses that can access and manipulate both `PParams` and `ParamsUpdate` for each era. * Introduced `upgradePParams` and `downgradePParams`, which loosely correspond to `extendPP` and `retractPP`. * Removed all occurrences of HasField from all the eras. * Extracted `Era` related code and `TranslateEra` related code from `Cardano.Ledger.Core` into `Cardano.Ledger.Core.Era` and `Cardano.Ledger.Core.Translation` respectfully * Moved `PreviousEra` type family into `Era` type class. * Defined an `Era` instance for new `ByronEra` type * Concrete PParams types for each era had their fields renamed to follow the convention used throughout the codebase * Adjust transaction generation in the travce generator to work for eras beyond Mary * Got rid of `ShelleyTest` and `UsesPP` type synonyms
It is acceptable to turn off the warning for the whole package for ghc-8.10 since we are developing with ghc-9.2 and we have CI for both of those GHC versions, so we will definitely catch any name shadowing warnings that aren't related to the bug.
* According to Github documentation cache action will already automatically look into `master` branch cache, however it will never look into caches for other branches. So, previous logic was a bit faulty * Enable trigger on pushes to master, this way we can have a build after each PR is merged.
26b4305
to
9e2a28b
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Addition of
EraPParams
,AlonzoEraPParams
andBabageEraPParams
type classes with lenses that can access and manipulate bothPParams
andParamsUpdate
. Each type class requires implementation lenses for thePParamsHKD
type, which are later used for defining specific lenses for PParams and PParamsUpdate respectfullyHKD types
ShelleyPParams
,AlonzoPParams
andBabbagePParams
now become internal, for the most part and thePParams
+PParamsUpdate
are the newtype wrappers around the era specific internal HKD type. All operations on PParams should be done with lenses from now on.Other notable things in this PR:
Ord
instances forAlonzoPParams
andBabbagePParams
by introducing an internal `OrdExUniits type.To/FromJSON
instances to prevent the from being orphanCostModels
intoCardano.Ledger.Alozno.Scripts
fromCardano.Ledger.Alozno.PParams
PoolEnv
fields strictByronEra
that has anEra
instance. This is done mostly for completeness, but also to allow getting protocol version from the type level. Also this allowedPreviousEra
type family to be moved intoEra
type class.Cardano.Ledger.{EraName}.Core
module. It was discussed before, but wasn't fully implemented.Fixes #2927
Checklist
fourmolu
(which can be run withscripts/fourmolize.sh