Skip to content

Commit 7297be4

Browse files
[BREAKING] fxconfig: create MSP-based namespace policies (#59)
#### Type of change - Bug fix - New feature - Improvement (improvement to code, performance, etc) - Test update - Documentation update - Breaking change #### Description This PR introduces MSP-based namespace policies and adds new commands. We also bump the committer version from `v0.1.8` to `v0.1.9`. Summary - The `--channel` flag was removed. - The `--policy-ecdsa-threshold` flag was replaced by `--policy`. - Add `--wait` flag - Add `tx endorse` command - Add `tx merge` command - Add `tx submit` command For the full documentation see the new README.md in `tools/fxconfig/docs/` Note that the CLI API may still change until next release. #### Related issues Resolves #52 --------- Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
1 parent b353b61 commit 7297be4

107 files changed

Lines changed: 10362 additions & 3320 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.

go.mod

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ require (
1919
github.com/gorilla/handlers v1.5.1
2020
github.com/hyperledger/fabric-lib-go v1.1.3-0.20240523144151-25edd1eaf5f5
2121
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.7
22-
github.com/hyperledger/fabric-x-committer v0.1.8
23-
github.com/hyperledger/fabric-x-common v0.1.0
22+
github.com/hyperledger/fabric-x-committer v0.1.9
23+
github.com/hyperledger/fabric-x-common v0.1.1-0.20260219094834-26c5a49ed548
2424
github.com/spf13/cobra v1.10.2
2525
github.com/spf13/viper v1.21.0
2626
github.com/stretchr/testify v1.11.1
2727
github.com/testcontainers/testcontainers-go v0.40.0
28+
golang.org/x/sync v0.19.0
2829
golang.org/x/text v0.33.0
2930
google.golang.org/protobuf v1.36.11
3031
gopkg.in/yaml.v3 v3.0.1
@@ -80,14 +81,9 @@ require (
8081
github.com/hyperledger/aries-bbs-go v0.0.0-20240528084656-761671ea73bc // indirect
8182
github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2 // indirect
8283
github.com/inconshreveable/mousetrap v1.1.0 // indirect
83-
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
84-
github.com/jackc/pgconn v1.14.3 // indirect
85-
github.com/jackc/pgio v1.0.0 // indirect
8684
github.com/jackc/pgpassfile v1.0.0 // indirect
87-
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
8885
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
89-
github.com/jackc/pgtype v1.14.3 // indirect
90-
github.com/jackc/puddle v1.3.0 // indirect
86+
github.com/jackc/puddle/v2 v2.2.2 // indirect
9187
github.com/kilic/bls12-381 v0.1.0 // indirect
9288
github.com/klauspost/compress v1.18.0 // indirect
9389
github.com/kr/pretty v0.3.1 // indirect
@@ -105,6 +101,8 @@ require (
105101
github.com/moby/term v0.5.0 // indirect
106102
github.com/morikuni/aec v1.0.0 // indirect
107103
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
104+
github.com/nxadm/tail v1.4.11 // indirect
105+
github.com/onsi/ginkgo v1.16.5 // indirect
108106
github.com/onsi/gomega v1.38.2 // indirect
109107
github.com/opencontainers/go-digest v1.0.0 // indirect
110108
github.com/opencontainers/image-spec v1.1.1 // indirect
@@ -124,12 +122,14 @@ require (
124122
github.com/spf13/afero v1.15.0 // indirect
125123
github.com/spf13/cast v1.10.0 // indirect
126124
github.com/spf13/pflag v1.0.10 // indirect
125+
github.com/stretchr/objx v0.5.2 // indirect
127126
github.com/subosito/gotenv v1.6.0 // indirect
128127
github.com/sykesm/zap-logfmt v0.0.4 // indirect
128+
github.com/tedsuo/ifrit v0.0.0-20230516164442-7862c310ad26 // indirect
129129
github.com/tklauser/go-sysconf v0.3.12 // indirect
130130
github.com/tklauser/numcpus v0.6.1 // indirect
131131
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
132-
github.com/yugabyte/pgx/v4 v4.14.8 // indirect
132+
github.com/yugabyte/pgx/v5 v5.7.6-yb-1 // indirect
133133
github.com/yusufpapurcu/wmi v1.2.4 // indirect
134134
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
135135
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
@@ -145,10 +145,10 @@ require (
145145
go.yaml.in/yaml/v3 v3.0.4 // indirect
146146
golang.org/x/crypto v0.47.0 // indirect
147147
golang.org/x/net v0.49.0 // indirect
148-
golang.org/x/sync v0.19.0 // indirect
149148
golang.org/x/sys v0.40.0 // indirect
150149
golang.org/x/time v0.14.0 // indirect
151150
google.golang.org/genproto/googleapis/api v0.0.0-20260120221211-b8f7ae30c516 // indirect
152151
google.golang.org/genproto/googleapis/rpc v0.0.0-20260120174246-409b4a993575 // indirect
153152
google.golang.org/grpc v1.78.0 // indirect
153+
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
154154
)

go.sum

Lines changed: 1467 additions & 116 deletions
Large diffs are not rendered by default.

tools/fxconfig/cmd/config.go

Lines changed: 0 additions & 31 deletions
This file was deleted.

tools/fxconfig/cmd/info.go

Lines changed: 0 additions & 36 deletions
This file was deleted.

tools/fxconfig/cmd/main.go

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright IBM Corp. All Rights Reserved.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
// Package main provides the fxconfig CLI tool for managing Fabric-X namespaces.
6+
// It supports creating, updating, and listing namespaces with flexible policy configurations.
7+
package main
8+
9+
import (
10+
"context"
11+
"os"
12+
"os/signal"
13+
14+
fmsp "github.com/hyperledger/fabric-x-common/msp"
15+
"github.com/hyperledger/fabric-x/tools/fxconfig/internal/adapters"
16+
"github.com/hyperledger/fabric-x/tools/fxconfig/internal/app"
17+
cli "github.com/hyperledger/fabric-x/tools/fxconfig/internal/cli/v1"
18+
"github.com/hyperledger/fabric-x/tools/fxconfig/internal/client"
19+
"github.com/hyperledger/fabric-x/tools/fxconfig/internal/config"
20+
"github.com/hyperledger/fabric-x/tools/fxconfig/internal/msp"
21+
"github.com/hyperledger/fabric-x/tools/fxconfig/internal/provider"
22+
"github.com/hyperledger/fabric-x/tools/fxconfig/internal/validation"
23+
)
24+
25+
func main() {
26+
if err := run(); err != nil {
27+
os.Exit(1)
28+
}
29+
}
30+
31+
func run() error {
32+
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
33+
defer stop()
34+
35+
cliCtx := &cli.CLIContext{}
36+
37+
// setup our root command
38+
cmd := cli.NewRootCommand(
39+
cliCtx,
40+
// inject an application builder that is invoked once we have loaded the configuration
41+
func(cfg *config.Config) (app.Application, error) {
42+
vctx := validation.NewValidationContext()
43+
return &app.AdminApp{
44+
Validators: vctx,
45+
MspProvider: provider.New[fmsp.SigningIdentity, *config.MSPConfig](
46+
func(cfg *config.MSPConfig) (fmsp.SigningIdentity, error) {
47+
return msp.GetSignerIdentityFromMSP(*cfg)
48+
},
49+
&cfg.MSP,
50+
vctx,
51+
),
52+
QueryProvider: provider.New[adapters.QueryClient, *config.QueriesConfig](
53+
func(cfg *config.QueriesConfig) (adapters.QueryClient, error) {
54+
return client.NewQueryClient(*cfg)
55+
},
56+
&cfg.Queries,
57+
vctx,
58+
),
59+
OrdererProvider: provider.New[adapters.OrdererClient, *config.OrdererConfig](
60+
func(cfg *config.OrdererConfig) (adapters.OrdererClient, error) {
61+
return client.NewOrdererClient(*cfg)
62+
},
63+
&cfg.Orderer,
64+
vctx,
65+
),
66+
NotificationProvider: provider.New[adapters.NotificationClient, *config.NotificationsConfig](
67+
func(cfg *config.NotificationsConfig) (adapters.NotificationClient, error) {
68+
return client.NewNotificationClient(*cfg)
69+
},
70+
&cfg.Notifications,
71+
vctx,
72+
),
73+
}, nil
74+
},
75+
)
76+
77+
return cmd.ExecuteContext(ctx)
78+
}

tools/fxconfig/cmd/namespace.go

Lines changed: 0 additions & 32 deletions
This file was deleted.

tools/fxconfig/cmd/namespace_create.go

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)