Skip to content

[dependency] Migrate to hyperledger/SmartBFT - #201

Merged
liran-funaro merged 2 commits into
hyperledger:mainfrom
tock-ibm:smartbft-migrate
Sep 30, 2026
Merged

liran-funaro merged 2 commits into
hyperledger:mainfrom
tock-ibm:smartbft-migrate

Conversation

@tock-ibm

@tock-ibm tock-ibm commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Type of change

  • Dependency update
  • Bug fix

Description

  • Replace github.com/hyperledger-labs/SmartBFT v1.0.1 with its new home
    github.com/hyperledger/SmartBFT v1.0.2, and bump testify, yaml, x/sync and
    google.golang.org/protobuf (v1.36.11 -> v1.36.12).
  • Regenerate all *.pb.go files; only the protoc-gen-go version header changes.
  • make proto no longer depends on the host setup:
    • fetch the well-known types (google/protobuf/*.proto) matching the installed
      protoc into .build/, instead of relying on /usr/include from libprotobuf-dev
      (which is unavailable on non-Debian hosts, e.g. RHEL);
    • run protoc-gen-go/protoc-gen-go-grpc from the go.mod tool directives via
      go tool, instead of whatever is in PATH.
  • make mocks puts the go.mod versions of counterfeiter, protoc-gen-go and
    protoc-gen-go-grpc first in PATH, so go generate output matches make proto.
  • make lint-proto runs api-linter via go tool.
  • Drop libprotobuf-dev from scripts/install-dev-dependencies.sh.

Additional details (Optional)

Verified in a clean Ubuntu 24.04 container by replaying the CI lint step
(make proto, make mocks, git diff --exit-code): no diff. Also verified on RHEL 9.

Related issues

@coveralls

coveralls commented Sep 29, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.023% (+0.02%) from 82.004% — tock-ibm:smartbft-migrate into hyperledger:main

Signed-off-by: Yoav Tock <TOCK@il.ibm.com>
@liran-funaro liran-funaro changed the title Migrate to hyperledger/SmarBFT Migrate to hyperledger/SmartBFT Sep 29, 2026
@liran-funaro liran-funaro changed the title Migrate to hyperledger/SmartBFT [dependency] Migrate to hyperledger/SmartBFT Sep 29, 2026
@liran-funaro
liran-funaro self-requested a review September 29, 2026 14:39
@liran-funaro liran-funaro added the dependencies Pull requests that update a dependency file label Sep 29, 2026
Comment thread Makefile Outdated
Comment on lines +172 to +173
@PATH="$(call go_tool_dir,counterfeiter):$(call go_tool_dir,protoc-gen-go):$(call go_tool_dir,protoc-gen-go-grpc):$$PATH" \
COUNTERFEITER_NO_GENERATE_WARNING=true go generate ./...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: the PATH can be pre calculated as a variable, then this will be a single row.
This will improve readability.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 037e4dd: the PATH is now a mocks_path variable, so the recipe is a single line.

Comment thread Makefile Outdated
project_dir := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
proto_flags ?=
fabric_protos_tag ?= $(shell go list -m -f '{{.Version}}' github.com/hyperledger/fabric-protos-go-apiv2)
protoc_version ?= $(shell protoc --version 2>/dev/null | awk '{print $$2}')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: this breaks for protoc 3.21.x, which is what Ubuntu 24.04 / Debian 12 ship via apt. It reports libprotoc 3.21.12, but the release tag is v21.12, so the includes download returns 404 (v3.21.12 → 404, v21.12 → 200). Older releases (v3.20.3, v3.19.4) keep the 3. prefix in the tag, and from v22 on the reported version matches the tag, so 3.21.x is the only mismatch.

Two options:

  1. Map 3.21.x to its tag:
Suggested change
protoc_version ?= $(shell protoc --version 2>/dev/null | awk '{print $$2}')
protoc_version ?= $(shell protoc --version 2>/dev/null | awk '{v=$$2; sub(/^3\.21\./,"21.",v); print v}')
  1. Always download the includes for the protoc version pinned in scripts/install-dev-dependencies.sh (35.1), instead of detecting the installed one. This removes the version mapping entirely, but the includes may not match the protoc that's actually installed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed (v3.21.12 → 404, v21.12 → 200). Went with option 1 in 037e4dd, plus a comment explaining the mapping. Option 2 could pair the includes with a different protoc than the one installed, so I kept the version detection.

Comment thread Makefile Outdated
Comment on lines +163 to +168
@mkdir -p ${BUILD_DIR}
@rm -rf ${PROTOC_INCLUDE_DIR} ${PROTOC_INCLUDE_DIR}.zip
@curl -fsSL -o ${PROTOC_INCLUDE_DIR}.zip ${PROTOC_INCLUDE_URL}
@unzip -q ${PROTOC_INCLUDE_DIR}.zip 'include/*' -d ${PROTOC_INCLUDE_DIR}.tmp
@mv ${PROTOC_INCLUDE_DIR}.tmp/include ${PROTOC_INCLUDE_DIR}
@rm -rf ${PROTOC_INCLUDE_DIR}.tmp ${PROTOC_INCLUDE_DIR}.zip

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: we can simplify the download to two commands. curl --create-dirs replaces the mkdir, and extracting the zip in place removes the .tmp directory, the mv and both rm -rf. unzip -o overwrites any leftover files, and the zip stays in the git-ignored .build/protoc@<version>/ directory, which make clean-deps removes.

Suggested change
@mkdir -p ${BUILD_DIR}
@rm -rf ${PROTOC_INCLUDE_DIR} ${PROTOC_INCLUDE_DIR}.zip
@curl -fsSL -o ${PROTOC_INCLUDE_DIR}.zip ${PROTOC_INCLUDE_URL}
@unzip -q ${PROTOC_INCLUDE_DIR}.zip 'include/*' -d ${PROTOC_INCLUDE_DIR}.tmp
@mv ${PROTOC_INCLUDE_DIR}.tmp/include ${PROTOC_INCLUDE_DIR}
@rm -rf ${PROTOC_INCLUDE_DIR}.tmp ${PROTOC_INCLUDE_DIR}.zip
@curl -fsSL --create-dirs -o ${PROTOC_INCLUDE_ROOT}/protoc.zip ${PROTOC_INCLUDE_URL}
@unzip -qo ${PROTOC_INCLUDE_ROOT}/protoc.zip 'include/*' -d ${PROTOC_INCLUDE_ROOT}

This needs the include dir to point at the include/ folder inside the extracted zip (lines 116-117):

PROTOC_INCLUDE_ROOT := ${BUILD_DIR}/protoc@${protoc_version}
PROTOC_INCLUDE_DIR := ${PROTOC_INCLUDE_ROOT}/include
PROTOC_INCLUDE_SENTINEL := ${PROTOC_INCLUDE_DIR}/google/protobuf/descriptor.proto

Trade-off: we lose the atomic .tmp + mv. If unzip is interrupted after writing descriptor.proto, later runs skip the download until .build/ is removed. That is unlikely, since the extraction takes under a second.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 037e4dd, with the PROTOC_INCLUDE_ROOT / PROTOC_INCLUDE_DIR split you suggested. One note: make clean-deps only removed the fabric-protos clone before, so I added ${PROTOC_INCLUDE_ROOT} to it as well.

- Map protoc 3.21.x to its release tag (v21.N) when fetching the well-known types.
- Simplify the download to `curl --create-dirs` + `unzip -o` in place.
- `make clean-deps` also removes the downloaded protoc includes.
- Pre-compute the `make mocks` PATH in a `mocks_path` variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Yoav Tock <TOCK@il.ibm.com>
@liran-funaro
liran-funaro merged commit 5c18784 into hyperledger:main Sep 30, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to hyperledger/SmartBFT

3 participants