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

Update cardano-api to a newer cardano-ledger #227

Merged
merged 2 commits into from
Sep 12, 2023

Conversation

coot
Copy link
Contributor

@coot coot commented Sep 4, 2023

Changelog

- description: |
    - Added `Cardano.Api.Certificate.filterUnRegDRepCreds`.
    - `queryStateForBalancedTx`  returns `DRep` credetnial.
    - `QueryDRepState` returns map indexed by `DRepCredential`.
    - `contructBalancedTx` and `evaluateTransactionBalance` takes `DRep` credential as an argument.
    - Updated IPC to `ouroboros-network-0.9.0.0` API

# uncomment types applicable to the change:
  type:
  # - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  # - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - improvement    # QoL changes e.g. refactoring
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
    - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

Make cardano-api compatible with a newer ledger IntersectMBO/cardano-ledger@9e2f815.

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
    • round trip tests
    • integration tests
      See Running tests for more details
  • 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

@coot coot self-assigned this Sep 4, 2023
@coot coot force-pushed the coot/cardano-ledger-conway-1.8 branch from 6ed090a to fd1cda8 Compare September 4, 2023 16:35
@coot coot force-pushed the coot/cardano-ledger-conway-1.8 branch 3 times, most recently from a0d1a33 to 7a4e626 Compare September 5, 2023 13:21
@coot coot marked this pull request as ready for review September 5, 2023 13:23
@coot coot marked this pull request as draft September 5, 2023 13:23
@coot coot force-pushed the coot/cardano-ledger-conway-1.8 branch 5 times, most recently from 283b3d7 to 8803de7 Compare September 8, 2023 07:18
@coot coot marked this pull request as ready for review September 8, 2023 07:18
@coot coot force-pushed the coot/cardano-ledger-conway-1.8 branch from 8803de7 to 9fc3a04 Compare September 8, 2023 07:27
@@ -551,6 +558,10 @@ instance ToJSON StakeCredential where
StakeCredentialByScript scriptHash ->
["stakingScriptHash" .= serialiseToRawBytesHexText scriptHash]

newtype DRepCredential = DRepCredential { unDRepCredential :: Shelley.Credential 'Shelley.DRepRole StandardCrypto }
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use the edger type directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that newtype wrappers can help you in the future protect upstream from breaking ledger changes.

Copy link
Contributor

@Jimbo4350 Jimbo4350 Sep 8, 2023

Choose a reason for hiding this comment

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

I want to as much as possible not maintain any additional types in cardano-api. The ledger team can wrap it in a newtype and expose that if they like.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that newtypes help with two things:

  • protect upstream libraries
  • hide unnecessary details (in this case not exposing two type parameters which are irrelevant for upstream users)

They also can simplify maintnance, since they limit what needs to changed in the provided API.

@coot coot force-pushed the coot/cardano-ledger-conway-1.8 branch from cf3fe93 to f72cc20 Compare September 11, 2023 08:28
@coot coot force-pushed the coot/cardano-ledger-conway-1.8 branch from f72cc20 to f74c2ec Compare September 11, 2023 08:30
* cardano-ledger-api-1.5.0.0
* cardano-ledger-conway-1.8
* ouroboros-consensus-0.9.0.0
* ouroboros-network-0.9.1
@coot coot force-pushed the coot/cardano-ledger-conway-1.8 branch from f74c2ec to 9a7c48d Compare September 11, 2023 10:41
This API was previously available in `cardano-cli`.
@coot coot force-pushed the coot/cardano-ledger-conway-1.8 branch from 123aca9 to 5b10b41 Compare September 11, 2023 13:05
@coot coot requested a review from Jimbo4350 September 11, 2023 22:04
@coot coot enabled auto-merge September 12, 2023 11:57
@coot coot dismissed Jimbo4350’s stale review September 12, 2023 11:57

The review comment was accomodated.

@coot coot added this pull request to the merge queue Sep 12, 2023
Merged via the queue into main with commit 9a0715d Sep 12, 2023
@coot coot deleted the coot/cardano-ledger-conway-1.8 branch September 12, 2023 12:25
newhoggy added a commit that referenced this pull request Mar 11, 2024
…n_shelleyStakeAddressRegistrationCertificateWithBuildRaw-test

New `hprop_golden_shelleyStakeAddressRegistrationCertificateWithBuildRaw` test
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.

5 participants