Skip to content

Commit 05cd63b

Browse files
committed
Remove proto-lens SRP
1 parent 779f539 commit 05cd63b

9 files changed

Lines changed: 66 additions & 113 deletions
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
project: cardano-api
2+
pr: 1185
3+
kind:
4+
- breaking
5+
description: |
6+
Bump `cardano-ledger-core` lower bound to `>=1.20` (required by `ouroboros-consensus-3.0.x`).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
project: cardano-api
2+
pr: 1185
3+
kind:
4+
- maintenance
5+
description: |
6+
Remove `proto-lens` source-repository-package now that `proto-lens >=0.7.1.7` is on Hackage.
7+
Move the `cardano-rpc` protobuf generation check to a dedicated CI job using the nix dev shell.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
project: cardano-rpc
2+
pr: 1185
3+
kind:
4+
- compatible
5+
description: |
6+
Bump `proto-lens` lower bound to `>=0.7.1.7`.

.github/workflows/haskell.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -95,32 +95,6 @@ jobs:
9595
cabal-store: ${{ steps.setup-haskell.outputs.cabal-store }}
9696
cache-version: ${{ env.CABAL_CACHE_VERSION }}
9797

98-
- name: '[Linux] [cardano-rpc] Install buf tool'
99-
if: runner.os == 'Linux'
100-
run: |
101-
curl -sSL "https://github.com/bufbuild/buf/releases/latest/download/buf-Linux-x86_64" -o "/usr/local/bin/buf"
102-
chmod +x /usr/local/bin/buf
103-
104-
- name: '[Linux] [cardano-rpc] Install proto-lens-protoc tool'
105-
if: runner.os == 'Linux'
106-
run: cabal install proto-lens-protoc --installdir=$HOME/.local/bin
107-
108-
- name: '[Linux] [cardano-rpc] Generate protobuf code'
109-
if: runner.os == 'Linux'
110-
working-directory: cardano-rpc
111-
run: buf generate proto
112-
113-
- name: '[Linux] [cardano-rpc] Check that generated files from proto definitions are up to date'
114-
if: runner.os == 'Linux'
115-
run: |
116-
git add cardano-rpc/gen
117-
if ! git diff --staged --quiet -- cardano-rpc/gen; then
118-
echo "Generated files differ from repository files:"
119-
git diff --staged --name-status -- cardano-rpc/gen
120-
exit 1
121-
fi
122-
echo "All generated files match repository files"
123-
12498
# Now we build.
12599
- name: Build all
126100
run: cabal build all --enable-tests
@@ -149,14 +123,40 @@ jobs:
149123
# with:
150124
# limit-access-to-actor: true
151125

126+
check-proto-gen:
127+
runs-on: ubuntu-latest
128+
steps:
129+
- uses: actions/checkout@v4
130+
131+
- uses: cachix/install-nix-action@v30
132+
with:
133+
extra_nix_config: |
134+
accept-flake-config = true
135+
136+
- uses: rrbutani/use-nix-shell-action@v1
137+
138+
- name: Regenerate protobuf code
139+
working-directory: cardano-rpc
140+
run: buf generate proto
141+
142+
- name: Check that generated files from proto definitions are up to date
143+
run: |
144+
git add cardano-rpc/gen
145+
if ! git diff --staged --quiet -- cardano-rpc/gen; then
146+
echo "Generated files differ from repository files:"
147+
git diff --staged --name-status -- cardano-rpc/gen
148+
exit 1
149+
fi
150+
echo "All generated files match repository files"
151+
152152
build-complete:
153-
needs: [build]
153+
needs: [build, check-proto-gen]
154154
if: ${{ always() }}
155155
runs-on: ubuntu-latest
156156
steps:
157157
- name: Check if any previous job failed
158158
run: |
159-
if [[ "${{ needs.build.result }}" == "failure" ]]; then
159+
if [[ "${{ needs.build.result }}" == "failure" || "${{ needs.check-proto-gen.result }}" == "failure" ]]; then
160160
# this ignores skipped dependencies
161161
echo 'Required jobs failed to build.'
162162
exit 1

cabal.project

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ repository cardano-haskell-packages
1313
-- See CONTRIBUTING for information about these, including some Nix commands
1414
-- you need to run if you change them
1515
index-state:
16-
, hackage.haskell.org 2026-03-22T23:17:32Z
17-
, cardano-haskell-packages 2026-04-09T12:05:18Z
16+
, hackage.haskell.org 2026-04-17T09:20:55Z
17+
, cardano-haskell-packages 2026-04-15T11:20:53Z
1818

1919
active-repositories:
2020
, :rest
@@ -144,27 +144,6 @@ if arch(wasm32)
144144
package digest
145145
flags: -pkg-config
146146

147-
-- GHC 9.12 and later support in master
148-
if impl(ghc >= 9.12)
149-
source-repository-package
150-
type: git
151-
location: https://github.com/google/proto-lens
152-
tag: 9b41fe0e10e8fe12ec508a3b361d0f0c2217c491
153-
--sha256: sha256-ruTbbUKVJBPANnm6puigtp26mmiVDd0jMpLfJLOuUpU=
154-
subdir:
155-
discrimination-ieee754
156-
proto-lens-arbitrary
157-
proto-lens-benchmarks
158-
proto-lens-discrimination
159-
proto-lens-optparse
160-
proto-lens-protobuf-types
161-
proto-lens-protoc
162-
proto-lens-runtime
163-
proto-lens-setup
164-
proto-lens-tests-dep
165-
proto-lens-tests
166-
proto-lens
167-
168147
-- IMPORTANT
169148
-- Do NOT add more source-repository-package stanzas here unless they are strictly
170149
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

cardano-api/cardano-api.cabal

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ library
146146
cardano-ledger-binary >=1.6,
147147
cardano-ledger-byron >=1.2,
148148
cardano-ledger-conway >=1.19,
149-
cardano-ledger-core >=1.17 && <1.20,
149+
cardano-ledger-core >=1.20,
150150
cardano-ledger-dijkstra >=0.1,
151151
cardano-ledger-mary >=1.8,
152152
cardano-ledger-shelley >=1.16,
@@ -333,12 +333,12 @@ library gen
333333
cardano-binary >=1.6 && <1.9,
334334
cardano-crypto-class ^>=2.3,
335335
cardano-crypto-wrapper:testlib ^>=1.7,
336-
cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib} >=1.8.1,
336+
cardano-ledger-alonzo:{cardano-ledger-alonzo, testlib},
337337
cardano-ledger-byron:testlib,
338338
cardano-ledger-conway:testlib,
339-
cardano-ledger-core:{cardano-ledger-core, testlib} >=1.17,
340-
cardano-ledger-dijkstra:testlib >=0.1,
341-
cardano-ledger-shelley >=1.13,
339+
cardano-ledger-core:{cardano-ledger-core, testlib},
340+
cardano-ledger-dijkstra:testlib,
341+
cardano-ledger-shelley,
342342
cardano-strict-containers,
343343
containers,
344344
filepath,

cardano-rpc/cardano-rpc.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ library
8787
generic-data,
8888
grapesy,
8989
grpc-spec,
90-
proto-lens >=0.7.1.6,
90+
proto-lens >=0.7.1.7,
9191
proto-lens-protobuf-types,
9292
random,
9393
rio,

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -123,26 +123,6 @@
123123

124124
# We use cabalProject' to ensure we don't build the plan for
125125
# all systems.
126-
# Fetch proto-lens with submodules and fix symlinks for plan and build phases
127-
protoLensSrc = nixpkgs.fetchgit {
128-
url = "https://github.com/google/proto-lens";
129-
rev = "9b41fe0e10e8fe12ec508a3b361d0f0c2217c491";
130-
sha256 = "sha256-ruTbbUKVJBPANnm6puigtp26mmiVDd0jMpLfJLOuUpU=";
131-
fetchSubmodules = true;
132-
};
133-
fixProtoLensSrc = nixpkgs.runCommand "proto-lens-fixed" {} ''
134-
mkdir -p $out
135-
cp -a ${protoLensSrc}/. $out/
136-
chmod -R +w $out
137-
# Fix proto-lens-imports symlink in proto-lens
138-
rm -rf $out/proto-lens/proto-lens-imports/google
139-
cp -r ${protoLensSrc}/google/protobuf/src/google $out/proto-lens/proto-lens-imports/
140-
# Fix proto-src symlink in proto-lens-protobuf-types
141-
rm -rf $out/proto-lens-protobuf-types/proto-src
142-
cp -r ${protoLensSrc}/google/protobuf/src $out/proto-lens-protobuf-types/proto-src
143-
chmod -R -w $out
144-
'';
145-
146126
cabalProject = nixpkgs.haskell-nix.cabalProject' ({config, ...}: {
147127
src = ./.;
148128
name = "cardano-api";
@@ -160,7 +140,6 @@
160140
#
161141
inputMap = {
162142
"https://chap.intersectmbo.org/" = inputs.CHaP;
163-
"https://github.com/google/proto-lens/9b41fe0e10e8fe12ec508a3b361d0f0c2217c491" = protoLensSrc;
164143
};
165144
# Also currently needed to make `nix flake lock --update-input CHaP` work.
166145
cabalProjectLocal = ''
@@ -189,6 +168,7 @@
189168
ghcid = "0.8.9";
190169
cabal-gild = "1.7.0.1";
191170
fourmolu = "0.18.0.0";
171+
proto-lens-protoc = "latest";
192172
haskell-language-server = {
193173
src = inputs.hls;
194174
configureArgs = "--disable-benchmarks --disable-tests";
@@ -209,7 +189,10 @@
209189
shellcheck
210190
snappy
211191
protobuf
212-
buf
192+
# buf version must match `.github/workflows/haskell.yml` (buf is
193+
# not backwards-compatible across minor versions for
194+
# `buf generate` output).
195+
unstable.buf
213196
blst
214197
inputs.cardano-dev.packages.${system}.herald
215198
(writeShellScriptBin "haskell-language-server-wrapper" ''exec haskell-language-server "$@"'')
@@ -228,34 +211,6 @@
228211
# package customizations as needed. Where cabal.project is not
229212
# specific enough, or doesn't allow setting these.
230213
modules = [
231-
# TODO remove this module when removing proto-lens SRP
232-
# Override proto-lens source to use fixed symlinks (inputMap provides the fixed
233-
# source for plan computation; this module provides it for the build phase)
234-
({
235-
lib,
236-
config,
237-
...
238-
}: let
239-
protoLensPackages = [
240-
"proto-lens"
241-
"proto-lens-arbitrary"
242-
"proto-lens-discrimination"
243-
"proto-lens-optparse"
244-
"proto-lens-protobuf-types"
245-
"proto-lens-protoc"
246-
"proto-lens-runtime"
247-
"proto-lens-setup"
248-
"proto-lens-tests-dep"
249-
"proto-lens-tests"
250-
"discrimination-ieee754"
251-
"proto-lens-benchmarks"
252-
];
253-
in {
254-
packages =
255-
lib.genAttrs
256-
(builtins.filter (p: config.packages ? ${p}) protoLensPackages)
257-
(p: {src = lib.mkForce (fixProtoLensSrc + "/${p}");});
258-
})
259214
({...}: {
260215
packages.cardano-api = {
261216
configureFlags = ["--ghc-option=-Werror"];

0 commit comments

Comments
 (0)