-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add Inject instances for Eons. Deprecate old eons conversion functions. #636
base: main
Are you sure you want to change the base?
Conversation
4af9910
to
c2dee39
Compare
c2dee39
to
353db1b
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.
Nice QoL change 👍
genValueForMinting w = | ||
fromLedgerValue sbe <$> genValue w genAssetIdNoAda genSignedNonZeroQuantity | ||
where | ||
sbe = maryEraOnwardsToShelleyBasedEra w | ||
sbe = inject w :: ShelleyBasedEra 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.
sbe = inject w :: ShelleyBasedEra era | |
sbe :: ShelleyBasedEra era = inject w |
Rationale: It's more common to have the type attached to the variable
@@ -274,7 +275,7 @@ queryStakeDelegDeposits | |||
queryStakeDelegDeposits era stakeCreds | |||
| S.null stakeCreds = pure . pure $ pure mempty | |||
| otherwise = do | |||
let sbe = babbageEraOnwardsToShelleyBasedEra era | |||
let sbe = inject era :: ShelleyBasedEra 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.
let sbe = inject era :: ShelleyBasedEra era | |
let sbe :: ShelleyBasedEra era = inject era |
@@ -398,12 +399,12 @@ queryDRepState | |||
(Either EraMismatch (Map (L.Credential L.DRepRole L.StandardCrypto) (L.DRepState L.StandardCrypto))) | |||
) | |||
queryDRepState era drepCreds = do | |||
let sbe = conwayEraOnwardsToShelleyBasedEra era | |||
let sbe = inject era :: ShelleyBasedEra 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.
let sbe = inject era :: ShelleyBasedEra era | |
let sbe :: ShelleyBasedEra era = inject era |
@@ -472,12 +473,12 @@ queryStakeVoteDelegatees | |||
(Either EraMismatch (Map StakeCredential (L.DRep L.StandardCrypto))) | |||
) | |||
queryStakeVoteDelegatees era stakeCredentials = do | |||
let sbe = conwayEraOnwardsToShelleyBasedEra era | |||
let sbe = inject era :: ShelleyBasedEra 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.
let sbe = inject era :: ShelleyBasedEra era | |
let sbe :: ShelleyBasedEra era = inject era |
@@ -2049,12 +2048,11 @@ fromAlonzoTxOut w txOut = | |||
(fromAlonzoTxOutDatumHash w (txOut ^. L.dataHashTxOutL)) | |||
ReferenceScriptNone | |||
where | |||
sbe = alonzoEraOnwardsToShelleyBasedEra w | |||
sbe = inject w :: ShelleyBasedEra 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.
sbe = inject w :: ShelleyBasedEra era | |
sbe :: ShelleyBasedEra era = inject w |
@@ -2069,7 +2067,7 @@ fromBabbageTxOut w txdatums txout = | |||
SJust rScript -> fromShelleyScriptToReferenceScript shelleyBasedEra rScript | |||
) | |||
where | |||
sbe = babbageEraOnwardsToShelleyBasedEra w | |||
sbe = inject w :: ShelleyBasedEra 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.
sbe = inject w :: ShelleyBasedEra era | |
sbe :: ShelleyBasedEra era = inject w |
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 are adding an additional step to the deprecation of these era conversion functions where what we should be doing is figuring out how to change the interface then deprecating and eventually remove the functions. Creating Inject
instances for them seems to be an additional unnecessary step.
@Jimbo4350 the goal of this PR is to make the codebase more pleasant to work with until we get rid of Eons. There's still significant amount of work left to do, before we arrive there. I disagree that it adds an additional step in deprecation, I see If you think this PR is changing too much, what do you think of just using |
Changelog
Context
Use Inject for eons conversion instead of specialised and hard to remember functions.
You can migrate your codebase using this snippet:
Checklist