diff --git a/.changes/20260417_cardano_api_bump_cardano_ledger_core.yml b/.changes/20260417_cardano_api_bump_cardano_ledger_core.yml new file mode 100644 index 0000000000..29031d97ff --- /dev/null +++ b/.changes/20260417_cardano_api_bump_cardano_ledger_core.yml @@ -0,0 +1,6 @@ +project: cardano-api +pr: 1185 +kind: + - breaking +description: | + Bump `cardano-ledger-core` lower bound to `>=1.20` (required by `ouroboros-consensus-3.0.x`). diff --git a/.changes/20260417_cardano_api_remove_proto_lens_srp.yml b/.changes/20260417_cardano_api_remove_proto_lens_srp.yml new file mode 100644 index 0000000000..4521f6ef34 --- /dev/null +++ b/.changes/20260417_cardano_api_remove_proto_lens_srp.yml @@ -0,0 +1,7 @@ +project: cardano-api +pr: 1185 +kind: + - maintenance +description: | + Remove `proto-lens` source-repository-package now that `proto-lens >=0.7.1.7` is on Hackage. + Move the `cardano-rpc` protobuf generation check to a dedicated CI job using the nix dev shell. diff --git a/.changes/20260417_cardano_rpc_proto_lens_bump.yml b/.changes/20260417_cardano_rpc_proto_lens_bump.yml new file mode 100644 index 0000000000..d0656a6238 --- /dev/null +++ b/.changes/20260417_cardano_rpc_proto_lens_bump.yml @@ -0,0 +1,6 @@ +project: cardano-rpc +pr: 1185 +kind: + - compatible +description: | + Bump `proto-lens` lower bound to `>=0.7.1.7`. diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index bb2eb5fa3e..4f90b04da7 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -13,6 +13,9 @@ on: schedule: - cron: '0 0 */6 * *' +permissions: + contents: read + jobs: build: runs-on: ${{ matrix.sys.os }} @@ -95,32 +98,6 @@ jobs: cabal-store: ${{ steps.setup-haskell.outputs.cabal-store }} cache-version: ${{ env.CABAL_CACHE_VERSION }} - - name: '[Linux] [cardano-rpc] Install buf tool' - if: runner.os == 'Linux' - run: | - curl -sSL "https://github.com/bufbuild/buf/releases/latest/download/buf-Linux-x86_64" -o "/usr/local/bin/buf" - chmod +x /usr/local/bin/buf - - - name: '[Linux] [cardano-rpc] Install proto-lens-protoc tool' - if: runner.os == 'Linux' - run: cabal install proto-lens-protoc --installdir=$HOME/.local/bin - - - name: '[Linux] [cardano-rpc] Generate protobuf code' - if: runner.os == 'Linux' - working-directory: cardano-rpc - run: buf generate proto - - - name: '[Linux] [cardano-rpc] Check that generated files from proto definitions are up to date' - if: runner.os == 'Linux' - run: | - git add cardano-rpc/gen - if ! git diff --staged --quiet -- cardano-rpc/gen; then - echo "Generated files differ from repository files:" - git diff --staged --name-status -- cardano-rpc/gen - exit 1 - fi - echo "All generated files match repository files" - # Now we build. - name: Build all run: cabal build all --enable-tests @@ -149,14 +126,40 @@ jobs: # with: # limit-access-to-actor: true + check-proto-gen: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: cachix/install-nix-action@v30 + with: + extra_nix_config: | + accept-flake-config = true + + - uses: rrbutani/use-nix-shell-action@v1 + + - name: Regenerate protobuf code + working-directory: cardano-rpc + run: buf generate proto + + - name: Check that generated files from proto definitions are up to date + run: | + git add cardano-rpc/gen + if ! git diff --staged --quiet -- cardano-rpc/gen; then + echo "Generated files differ from repository files:" + git diff --staged --name-status -- cardano-rpc/gen + exit 1 + fi + echo "All generated files match repository files" + build-complete: - needs: [build] + needs: [build, check-proto-gen] if: ${{ always() }} runs-on: ubuntu-latest steps: - name: Check if any previous job failed run: | - if [[ "${{ needs.build.result }}" == "failure" ]]; then + if [[ "${{ needs.build.result }}" == "failure" || "${{ needs.check-proto-gen.result }}" == "failure" ]]; then # this ignores skipped dependencies echo 'Required jobs failed to build.' exit 1 diff --git a/cabal.project b/cabal.project index 918d442207..6bc4498438 100644 --- a/cabal.project +++ b/cabal.project @@ -13,8 +13,8 @@ repository cardano-haskell-packages -- See CONTRIBUTING for information about these, including some Nix commands -- you need to run if you change them index-state: - , hackage.haskell.org 2026-03-22T23:17:32Z - , cardano-haskell-packages 2026-04-09T12:05:18Z + , hackage.haskell.org 2026-04-17T09:20:55Z + , cardano-haskell-packages 2026-04-15T11:20:53Z active-repositories: , :rest @@ -144,27 +144,6 @@ if arch(wasm32) package digest flags: -pkg-config --- GHC 9.12 and later support in master -if impl(ghc >= 9.12) - source-repository-package - type: git - location: https://github.com/google/proto-lens - tag: 9b41fe0e10e8fe12ec508a3b361d0f0c2217c491 - --sha256: sha256-ruTbbUKVJBPANnm6puigtp26mmiVDd0jMpLfJLOuUpU= - subdir: - discrimination-ieee754 - proto-lens-arbitrary - proto-lens-benchmarks - proto-lens-discrimination - proto-lens-optparse - proto-lens-protobuf-types - proto-lens-protoc - proto-lens-runtime - proto-lens-setup - proto-lens-tests-dep - proto-lens-tests - proto-lens - -- IMPORTANT -- Do NOT add more source-repository-package stanzas here unless they are strictly -- temporary! Please read the section in CONTRIBUTING about updating dependencies. diff --git a/cardano-api/cardano-api.cabal b/cardano-api/cardano-api.cabal index 50b8a7856e..c019c86b57 100644 --- a/cardano-api/cardano-api.cabal +++ b/cardano-api/cardano-api.cabal @@ -146,7 +146,7 @@ library cardano-ledger-binary >=1.6, cardano-ledger-byron >=1.2, cardano-ledger-conway >=1.19, - cardano-ledger-core >=1.17 && <1.20, + cardano-ledger-core >=1.20, cardano-ledger-dijkstra >=0.1, cardano-ledger-mary >=1.8, cardano-ledger-shelley >=1.16, @@ -333,12 +333,12 @@ library gen cardano-binary >=1.6 && <1.9, cardano-crypto-class ^>=2.3, cardano-crypto-wrapper:testlib ^>=1.7, - cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib} >=1.8.1, + cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib}, cardano-ledger-byron:testlib, cardano-ledger-conway:testlib, - cardano-ledger-core:{cardano-ledger-core, testlib} >=1.17, - cardano-ledger-dijkstra:testlib >=0.1, - cardano-ledger-shelley >=1.13, + cardano-ledger-core:{cardano-ledger-core, testlib}, + cardano-ledger-dijkstra:testlib, + cardano-ledger-shelley, cardano-strict-containers, containers, filepath, diff --git a/cardano-rpc/cardano-rpc.cabal b/cardano-rpc/cardano-rpc.cabal index aa81ac5bc9..a8b74026c8 100644 --- a/cardano-rpc/cardano-rpc.cabal +++ b/cardano-rpc/cardano-rpc.cabal @@ -87,7 +87,7 @@ library generic-data, grapesy, grpc-spec, - proto-lens >=0.7.1.6, + proto-lens >=0.7.1.7, proto-lens-protobuf-types, random, rio, diff --git a/flake.lock b/flake.lock index 68d7570833..62a0d83905 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1775738777, - "narHash": "sha256-kM7FV8HjWVff1h5AIbn9L1pCcmv70um6A08kTaYQPUk=", + "lastModified": 1776254461, + "narHash": "sha256-kB2azmnVPcQ4pFBvXCc3iKlMuoLsaPRbVP0LfD5j2Zg=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "f3e1087aaa7ec8230913695ddabbaa5816e7bde8", + "rev": "d8156d61840f90f0721c396f0598652f7aaf402a", "type": "github" }, "original": { @@ -439,11 +439,11 @@ "hackageNix": { "flake": false, "locked": { - "lastModified": 1774314978, - "narHash": "sha256-KOTHleg8OJaSshqHmF9OFva6mKRPQWfSFAZr26TOemU=", + "lastModified": 1776418279, + "narHash": "sha256-f5k3OgWcbQkd+3cod1bWro4+YS9uIfVtw1kit4sIR1k=", "owner": "input-output-hk", "repo": "hackage.nix", - "rev": "a6d551576ac58b6f2188add5ace72314eb359df9", + "rev": "9bfd4439b2534c7766c8126228ae524fd97d3cee", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 58c8096471..f2848fd0b7 100644 --- a/flake.nix +++ b/flake.nix @@ -123,26 +123,6 @@ # We use cabalProject' to ensure we don't build the plan for # all systems. - # Fetch proto-lens with submodules and fix symlinks for plan and build phases - protoLensSrc = nixpkgs.fetchgit { - url = "https://github.com/google/proto-lens"; - rev = "9b41fe0e10e8fe12ec508a3b361d0f0c2217c491"; - sha256 = "sha256-ruTbbUKVJBPANnm6puigtp26mmiVDd0jMpLfJLOuUpU="; - fetchSubmodules = true; - }; - fixProtoLensSrc = nixpkgs.runCommand "proto-lens-fixed" {} '' - mkdir -p $out - cp -a ${protoLensSrc}/. $out/ - chmod -R +w $out - # Fix proto-lens-imports symlink in proto-lens - rm -rf $out/proto-lens/proto-lens-imports/google - cp -r ${protoLensSrc}/google/protobuf/src/google $out/proto-lens/proto-lens-imports/ - # Fix proto-src symlink in proto-lens-protobuf-types - rm -rf $out/proto-lens-protobuf-types/proto-src - cp -r ${protoLensSrc}/google/protobuf/src $out/proto-lens-protobuf-types/proto-src - chmod -R -w $out - ''; - cabalProject = nixpkgs.haskell-nix.cabalProject' ({config, ...}: { src = ./.; name = "cardano-api"; @@ -160,7 +140,6 @@ # inputMap = { "https://chap.intersectmbo.org/" = inputs.CHaP; - "https://github.com/google/proto-lens/9b41fe0e10e8fe12ec508a3b361d0f0c2217c491" = protoLensSrc; }; # Also currently needed to make `nix flake lock --update-input CHaP` work. cabalProjectLocal = '' @@ -189,6 +168,7 @@ ghcid = "0.8.9"; cabal-gild = "1.7.0.1"; fourmolu = "0.18.0.0"; + proto-lens-protoc = "latest"; haskell-language-server = { src = inputs.hls; configureArgs = "--disable-benchmarks --disable-tests"; @@ -209,7 +189,10 @@ shellcheck snappy protobuf - buf + # buf version must match `.github/workflows/haskell.yml` (buf is + # not backwards-compatible across minor versions for + # `buf generate` output). + unstable.buf blst inputs.cardano-dev.packages.${system}.herald (writeShellScriptBin "haskell-language-server-wrapper" ''exec haskell-language-server "$@"'') @@ -228,34 +211,6 @@ # package customizations as needed. Where cabal.project is not # specific enough, or doesn't allow setting these. modules = [ - # TODO remove this module when removing proto-lens SRP - # Override proto-lens source to use fixed symlinks (inputMap provides the fixed - # source for plan computation; this module provides it for the build phase) - ({ - lib, - config, - ... - }: let - protoLensPackages = [ - "proto-lens" - "proto-lens-arbitrary" - "proto-lens-discrimination" - "proto-lens-optparse" - "proto-lens-protobuf-types" - "proto-lens-protoc" - "proto-lens-runtime" - "proto-lens-setup" - "proto-lens-tests-dep" - "proto-lens-tests" - "discrimination-ieee754" - "proto-lens-benchmarks" - ]; - in { - packages = - lib.genAttrs - (builtins.filter (p: config.packages ? ${p}) protoLensPackages) - (p: {src = lib.mkForce (fixProtoLensSrc + "/${p}");}); - }) ({...}: { packages.cardano-api = { configureFlags = ["--ghc-option=-Werror"];