Skip to content
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

Fix Eq, Show for Proposal type #115

Merged
merged 2 commits into from
Jul 12, 2023

Conversation

carbolymer
Copy link
Contributor

@carbolymer carbolymer commented Jul 11, 2023

Changelog

- description: |
    Fix Show and Eq instances for Proposal type
  # no-api-changes: the API has not changed
  # compatible: the API has changed but is non-breaking
  # breaking: the API has changed in a breaking way
  compatibility: no-api-changes
  # feature: the change implements a new feature in the API
  # bugfix: the change fixes a bug in the API
  # test: the change fixes modifies tests
  # maintenance: the change involves something other than the API
  # If more than one is applicable, it may be put into a list.
  type: bugfix

Context

Fixing Conway TODOs.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • The change log section in the PR description has been filled in
  • New tests are added if needed and existing tests are updated. These may include:
    • golden tests
    • property tests
    • roundtrip tests
  • The version bounds in .cabal files are updated
  • CI passes. See note on CI. The following CI checks are required:
    • Code is linted with hlint. See .github/workflows/check-hlint.yml to get the hlint version
    • Code is formatted with stylish-haskell. See .github/workflows/stylish-haskell.yml to get the stylish-haskell version
    • Code builds on Linux, MacOS and Windows for ghc-8.10.7 and ghc-9.2.7
  • The changelog section in the PR is updated to describe the change
  • Self-reviewed the diff

Note on CI

If your PR is from a fork, the necessary CI jobs won't trigger automatically for security reasons.
You will need to get someone with write privileges. Please contact IOG node developers to do this
for you.

@carbolymer carbolymer force-pushed the mgalazyn/fix/fix-eq-show-proposal-type branch from dc20f0a to 7b922f9 Compare July 12, 2023 11:29
@carbolymer carbolymer marked this pull request as ready for review July 12, 2023 11:31
@@ -3598,12 +3598,16 @@ convReferenceInputs txInsReference =
TxInsReferenceNone -> mempty
TxInsReference _ refTxins -> Set.fromList $ map toShelleyTxIn refTxins

convGovActions :: ShelleyBasedEra era -> TxGovernanceActions era -> Seq.StrictSeq (Gov.ProposalProcedure (ShelleyLedgerEra era))
convGovActions :: forall era. Ledger.EraCrypto (ShelleyLedgerEra era) ~ StandardCrypto => ShelleyBasedEra era -> TxGovernanceActions era -> Seq.StrictSeq (Gov.ProposalProcedure (ShelleyLedgerEra era))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can satisfy this constraint within the function (and save the caller from having to satisfy it) via the following:

(StakeKeyHash $ obtainEraCryptoConstraints sbe pProcReturnAddr)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can simplify this even further without needing list comprehension at all.

deriving instance (Shelley.EraPParams (ShelleyLedgerEra era)) => Eq (Proposal era)
instance IsShelleyBasedEra era => Show (Proposal era) where
show (Proposal pp) = do
let ppStr = withShelleyBasedEraConstraintsForLedger (shelleyBasedEra @era) $ show pp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work however what we really should be doing is asking the ledger team to provide a show instance for us. Can you propagate these changes to cardano-cli to see how what the changes will look like?

Copy link
Contributor Author

@carbolymer carbolymer Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carbolymer carbolymer force-pushed the mgalazyn/fix/fix-eq-show-proposal-type branch from 27f66b9 to e2fef97 Compare July 12, 2023 14:57
@carbolymer carbolymer added this pull request to the merge queue Jul 12, 2023
Merged via the queue into main with commit a6f40d5 Jul 12, 2023
14 checks passed
@carbolymer carbolymer deleted the mgalazyn/fix/fix-eq-show-proposal-type branch July 12, 2023 16:22
newhoggy added a commit that referenced this pull request Mar 11, 2024
…no-api-8.10.2.0

Update to `cardano-api-8.10.2.0`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants