Skip to content

Commit 6d268de

Browse files
committed
protobuf refactoring + cascading services refactoring and update
Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
1 parent f82df20 commit 6d268de

12,466 files changed

Lines changed: 62896 additions & 56736 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,4 +257,15 @@ docs-serve:
257257
.PHONY: docs-build
258258
# Build the static documentation site for production
259259
docs-build:
260-
mkdocs build --strict
260+
mkdocs build --strict
261+
262+
.PHONY: protos-format
263+
protos-format: ## Run buf format to fix protobuf files
264+
@echo "Fixing protobuf formatting..."
265+
@buf format -w
266+
267+
.PHONY: protos
268+
# generate protobuf files
269+
protos:
270+
@echo "Generating protobuf files..."
271+
@buf generate

buf.gen.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: v2
2+
plugins:
3+
- local: protoc-gen-go
4+
out: .
5+
opt:
6+
- module=github.com/hyperledger-labs/fabric-token-sdk

buf.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: v2
2+
modules:
3+
- path: token/core/fabtoken/protos/v1
4+
- path: token/core/zkatdlog/nogh/protos/v1
5+
- path: token/driver/protos/v1
6+
- path: token/services/identity/x509/crypto/protos/v1
7+
- path: token/services/identity/idemix/crypto/protos
8+
lint:
9+
use:
10+
- STANDARD
11+
- PACKAGE_DIRECTORY_MATCH
12+
- PACKAGE_VERSION_SUFFIX
13+
- FIELD_LOWER_SNAKE_CASE
14+
- ENUM_ZERO_VALUE_SUFFIX
15+
- ENUM_VALUE_PREFIX
16+
- COMMENTS # Enforce documentation standards
17+
except:
18+
- PACKAGE_DIRECTORY_MATCH
19+
- PACKAGE_SAME_GO_PACKAGE
20+
ignore:
21+
- token/services/identity/idemix/crypto/protos/idemix_config.proto
22+
breaking:
23+
use:
24+
- FILE

checks.mk

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
.PHONY: checks
2-
checks: licensecheck gofmt goimports govet misspell ineffassign staticcheck
2+
checks: licensecheck gofmt goimports govet misspell ineffassign staticcheck protos-lint buf-format
33

44
.PHONY: licensecheck
55
licensecheck:
66
@echo Running license check
7-
@find . -path './.git' -prune -o -name '*.go' -print | xargs addlicense -check || (echo "Missing license headers"; exit 1)
7+
@find . -path './.git' -prune -o -name '*.go' -not -name '*.pb.go' -print | xargs addlicense -check || (echo "Missing license headers"; exit 1)
88

99
.PHONY: gofmt
1010
gofmt:
1111
@echo Running gofmt
1212
@{ \
13-
OUTPUT="$$(find . -path './.git' -prune -o -name '*.go' -print | xargs gofmt -l -s || true)"; \
13+
OUTPUT="$$(find . -path './.git' -prune -o -name '*.go' -not -name '*.pb.go' -print | xargs gofmt -l -s || true)"; \
1414
if [ -n "$$OUTPUT" ]; then \
1515
echo "The following gofmt issues were flagged:"; \
1616
echo "$$OUTPUT"; \
@@ -23,7 +23,7 @@ gofmt:
2323
goimports:
2424
@echo Running goimports
2525
@{ \
26-
OUTPUT="$$(find . -path './.git' -prune -o -name '*.go' -print | xargs goimports -l || true)"; \
26+
OUTPUT="$$(find . -path './.git' -prune -o -name '*.go' -not -name '*.pb.go' -print | xargs goimports -l || true)"; \
2727
if [ -n "$$OUTPUT" ]; then \
2828
echo "The following files contain goimports errors"; \
2929
echo "$$OUTPUT"; \
@@ -71,6 +71,12 @@ ineffassign:
7171
@echo Running ineffassign
7272
@ineffassign $(shell go list -f '{{.Dir}}' ./...)
7373

74+
.PHONY: protos-lint
75+
protos-lint:
76+
@echo "Linting protobuf files..."
77+
@buf lint
7478

75-
76-
79+
.PHONY: buf-format
80+
buf-format:
81+
@echo "Checking protobuf formatting..."
82+
@buf format -d --exit-code

cmd/artifactgen/go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,7 @@ github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
14051405
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
14061406
github.com/quic-go/quic-go v0.59.1 h1:0Gmua0HW1Tv7ANR7hUYwRyD0MG5OJfgvYSZasGZzBic=
14071407
github.com/quic-go/quic-go v0.59.1/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
1408+
github.com/quic-go/quic-go v0.59.1/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
14081409
github.com/quic-go/webtransport-go v0.10.0 h1:LqXXPOXuETY5Xe8ITdGisBzTYmUOy5eSj+9n4hLTjHI=
14091410
github.com/quic-go/webtransport-go v0.10.0/go.mod h1:LeGIXr5BQKE3UsynwVBeQrU1TPrbh73MGoC6jd+V7ow=
14101411
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=

cmd/token_validation_service/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ require (
206206
github.com/prometheus/common v0.67.5 // indirect
207207
github.com/prometheus/procfs v0.20.1 // indirect
208208
github.com/quic-go/qpack v0.6.0 // indirect
209-
github.com/quic-go/quic-go v0.59.0 // indirect
209+
github.com/quic-go/quic-go v0.59.1 // indirect
210210
github.com/quic-go/webtransport-go v0.10.0 // indirect
211211
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
212212
github.com/rogpeppe/go-internal v1.14.1 // indirect

cmd/token_validation_service/go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,8 +1393,8 @@ github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEy
13931393
github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
13941394
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
13951395
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
1396-
github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw=
1397-
github.com/quic-go/quic-go v0.59.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
1396+
github.com/quic-go/quic-go v0.59.1 h1:0Gmua0HW1Tv7ANR7hUYwRyD0MG5OJfgvYSZasGZzBic=
1397+
github.com/quic-go/quic-go v0.59.1/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
13981398
github.com/quic-go/webtransport-go v0.10.0 h1:LqXXPOXuETY5Xe8ITdGisBzTYmUOy5eSj+9n4hLTjHI=
13991399
github.com/quic-go/webtransport-go v0.10.0/go.mod h1:LeGIXr5BQKE3UsynwVBeQrU1TPrbh73MGoC6jd+V7ow=
14001400
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
@@ -1476,8 +1476,8 @@ github.com/sykesm/zap-logfmt v0.0.4 h1:U2WzRvmIWG1wDLCFY3sz8UeEmsdHQjHFNlIdmroVF
14761476
github.com/sykesm/zap-logfmt v0.0.4/go.mod h1:AuBd9xQjAe3URrWT1BBDk2v2onAZHkZkWRMiYZXiZWA=
14771477
github.com/tedsuo/ifrit v0.0.0-20260418191334-846868129986 h1:etGVMUNp4ZYI0EoO7MxUKTG187RK8tbwIijDcXtSeL4=
14781478
github.com/tedsuo/ifrit v0.0.0-20260418191334-846868129986/go.mod h1:b0WkuWMdITecmKiTvZnmIffiXD+P1TUysIxv8Mm4m/s=
1479-
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
1480-
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
1479+
github.com/tidwall/gjson v1.19.0 h1:xwxm7n691Uf3u5OFjzngavjGTh55KX5q/9w9xHW88JU=
1480+
github.com/tidwall/gjson v1.19.0/go.mod h1:V37/opeE/JbLUOfH0QTXiNez2l0RUjYUhpT4szFQAfc=
14811481
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
14821482
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
14831483
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=

cmd/tokengen/cobra/pp/fabtokenv1/gen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var (
3333
// Auditors is the list of auditor MSP directories containing the corresponding auditor certificate.
3434
Auditors []string
3535
// Version allows the caller of tokengen to override the version number put in the public parameters.
36-
Version uint
36+
Version uint32
3737
// Extras allows the caller to add extra parameters to the public parameters.
3838
Extras []string
3939
)
@@ -46,7 +46,7 @@ func Cmd() *cobra.Command {
4646
flags.BoolVarP(&GenerateCCPackage, "cc", "", false, "generate chaincode package")
4747
flags.StringSliceVarP(&Auditors, "auditors", "a", nil, "list of auditor MSP directories containing the corresponding auditor certificate")
4848
flags.StringSliceVarP(&Issuers, "issuers", "s", nil, "list of issuer MSP directories containing the corresponding issuer certificate")
49-
flags.UintVarP(&Version, "version", "v", 0, "allows the caller of tokengen to override the version number put in the public params")
49+
flags.Uint32VarP(&Version, "version", "v", 0, "allows the caller of tokengen to override the version number put in the public params")
5050
flags.StringArrayVarP(&Extras, "extra", "x", []string{}, "extra data in key=value format, where value is the path to a file containing the data to load and store in the key")
5151

5252
return cobraCommand

cmd/tokengen/cobra/pp/zkatdlognoghv1/gen.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type GeneratorArgs struct {
3939
// Aries is a flag to indicate that aries should be used as backend for idemix
4040
Aries bool
4141
// Version allows the caller of tokengen to override the version number put in the public params
42-
Version uint
42+
Version uint32
4343
}
4444

4545
var (
@@ -59,7 +59,7 @@ var (
5959
// Aries is a flag to indicate that aries should be used as backend for idemix
6060
Aries bool
6161
// Version allows the caller of tokengen to override the version number put in the public params
62-
Version uint
62+
Version uint32
6363
// Extras allows the caller to add extra parameters to the public parameters
6464
Extras []string
6565
)
@@ -75,7 +75,7 @@ func Cmd() *cobra.Command {
7575
flags.StringVarP(&IdemixMSPDir, "idemix", "i", "", "idemix msp dir")
7676
flags.Uint64VarP(&BitLength, "bits", "b", 64, "bits is used to define the maximum quantity a token can contain")
7777
flags.BoolVarP(&Aries, "aries", "r", false, "flag to indicate that aries should be used as backend for idemix")
78-
flags.UintVarP(&Version, "version", "v", 0, "allows the caller of tokengen to override the version number put in the public params")
78+
flags.Uint32VarP(&Version, "version", "v", 0, "allows the caller of tokengen to override the version number put in the public params")
7979
flags.StringArrayVarP(&Extras, "extra", "x", []string{}, "extra data in key=value format, where value is the path to a file containing the data to load and store in the key")
8080

8181
return cobraCommand

cmd/tokengen/cobra/pp/zkatdlognoghv1/update.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type UpdateArgs struct {
3333
// Auditors is the list of auditor MSP directories containing the corresponding auditor certificate
3434
Auditors []string
3535
// Version allows the caller of tokengen to override the version number put in the public params
36-
Version uint
36+
Version uint32
3737
}
3838

3939
// UpdateCmd returns the Cobra Command for updating public parameters.
@@ -44,7 +44,7 @@ func UpdateCmd() *cobra.Command {
4444
flags.StringVarP(&OutputDir, "output", "o", ".", "output folder")
4545
flags.StringSliceVarP(&Auditors, "auditors", "a", nil, "list of auditor MSP directories containing the corresponding auditor certificate")
4646
flags.StringSliceVarP(&Issuers, "issuers", "s", nil, "list of issuer MSP directories containing the corresponding issuer certificate")
47-
flags.UintVarP(&Version, "version", "v", 0, "allows the caller of tokengen to override the version number put in the public params")
47+
flags.Uint32VarP(&Version, "version", "v", 0, "allows the caller of tokengen to override the version number put in the public params")
4848
flags.StringArrayVarP(&Extras, "extra", "x", []string{}, "extra data in key=value format, where is the path to a file containing the data to load and store in the key")
4949

5050
return cmd

0 commit comments

Comments
 (0)