Skip to content

Commit cec8902

Browse files
refactor(fabric): create fabric protoutil package
This commit bundles the dependency on prototuils imported from fabric in a single package. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
1 parent 796d427 commit cec8902

File tree

19 files changed

+223
-21
lines changed

19 files changed

+223
-21
lines changed

integration/nwo/fabric/network/configblock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import (
1515
"github.com/hyperledger-labs/fabric-smart-client/integration/nwo/fabric/topology"
1616
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/proto"
1717
"github.com/hyperledger-labs/fabric-smart-client/platform/common/utils"
18+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/protoutil"
1819
"github.com/hyperledger/fabric-protos-go-apiv2/common"
1920
"github.com/hyperledger/fabric-protos-go-apiv2/msp"
2021
protosorderer "github.com/hyperledger/fabric-protos-go-apiv2/orderer"
21-
"github.com/hyperledger/fabric/protoutil"
2222
"github.com/onsi/gomega"
2323
"github.com/onsi/gomega/gbytes"
2424
"github.com/onsi/gomega/gexec"

integration/nwo/fabric/network/update.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors"
1414
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/proto"
1515
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
16-
"github.com/hyperledger/fabric/protoutil"
1716
)
1817

1918
func computePoliciesMapUpdate(original, updated map[string]*cb.ConfigPolicy) (readSet, writeSet, sameSet map[string]*cb.ConfigPolicy, updatedMembers bool) {
@@ -138,7 +137,12 @@ func computeGroupsMapUpdate(original, updated map[string]*cb.ConfigGroup) (readS
138137
continue
139138
}
140139
updatedMembers = true
141-
_, groupWriteSet, _ := computeGroupUpdate(protoutil.NewConfigGroup(), updatedGroup)
140+
emptyCnfGrp := &cb.ConfigGroup{
141+
Groups: make(map[string]*cb.ConfigGroup),
142+
Values: make(map[string]*cb.ConfigValue),
143+
Policies: make(map[string]*cb.ConfigPolicy),
144+
}
145+
_, groupWriteSet, _ := computeGroupUpdate(emptyCnfGrp, updatedGroup)
142146
writeSet[groupName] = &cb.ConfigGroup{
143147
Version: 0,
144148
ModPolicy: updatedGroup.ModPolicy,

platform/fabric/core/generic/chaincode/invoke.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import (
1919
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/services"
2020
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/transaction"
2121
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/driver"
22+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/protoutil"
2223
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/grpc"
2324
"github.com/hyperledger-labs/fabric-smart-client/platform/view/view"
2425
"github.com/hyperledger/fabric-protos-go-apiv2/common"
2526
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
26-
"github.com/hyperledger/fabric/protoutil"
2727
)
2828

2929
type Invoke struct {

platform/fabric/core/generic/committer/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import (
1414
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors"
1515
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/rwset"
1616
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/driver"
17+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/protoutil"
1718
"github.com/hyperledger/fabric-protos-go-apiv2/common"
18-
"github.com/hyperledger/fabric/protoutil"
1919
)
2020

2121
const ConfigTXPrefix = "configtx_"

platform/fabric/core/generic/committer/event.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ package committer
88

99
import (
1010
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors"
11-
11+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/protoutil"
1212
"github.com/hyperledger/fabric-protos-go-apiv2/common"
1313
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
14-
"github.com/hyperledger/fabric/protoutil"
1514
)
1615

1716
// ChaincodeEvent models the chaincode event details.

platform/fabric/core/generic/delivery/deliverclient.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import (
1616
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/fabricutils"
1717
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/core/generic/services"
1818
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/driver"
19+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/protoutil"
1920
grpc2 "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/grpc"
2021
"github.com/hyperledger/fabric-protos-go-apiv2/common"
2122
ab "github.com/hyperledger/fabric-protos-go-apiv2/orderer"
2223
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
23-
"github.com/hyperledger/fabric/protoutil"
2424
"google.golang.org/grpc"
2525
"google.golang.org/grpc/status"
2626
"google.golang.org/protobuf/types/known/timestamppb"

platform/fabric/core/generic/fabricutils/pr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ SPDX-License-Identifier: Apache-2.0
77
package fabricutils
88

99
import (
10+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/protoutil"
1011
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
1112
"github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/rwsetutil"
12-
"github.com/hyperledger/fabric/protoutil"
1313
)
1414

1515
// UnpackedProposalResponse contains the interesting artifacts from inside the proposal.

platform/fabric/core/generic/fabricutils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ import (
1414
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors"
1515
"github.com/hyperledger-labs/fabric-smart-client/platform/common/services/logging"
1616
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/driver"
17+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/protoutil"
1718
"github.com/hyperledger/fabric-protos-go-apiv2/common"
1819
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
19-
"github.com/hyperledger/fabric/protoutil"
2020
"go.uber.org/zap/zapcore"
2121
)
2222

platform/fabric/core/generic/membership/membership.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import (
1212

1313
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors"
1414
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/driver"
15+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/protoutil"
1516
"github.com/hyperledger-labs/fabric-smart-client/platform/view/services/grpc"
1617
"github.com/hyperledger-labs/fabric-smart-client/platform/view/view"
1718
"github.com/hyperledger/fabric-lib-go/bccsp/factory"
1819
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
1920
"github.com/hyperledger/fabric/common/channelconfig"
2021
"github.com/hyperledger/fabric/common/configtx"
2122
"github.com/hyperledger/fabric/msp"
22-
"github.com/hyperledger/fabric/protoutil"
2323
)
2424

2525
type Service struct {

platform/fabric/core/generic/rwset/envelope.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ package rwset
99
import (
1010
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/errors"
1111
"github.com/hyperledger-labs/fabric-smart-client/pkg/utils/proto"
12+
"github.com/hyperledger-labs/fabric-smart-client/platform/fabric/protoutil"
1213
"github.com/hyperledger/fabric-protos-go-apiv2/common"
1314
"github.com/hyperledger/fabric-protos-go-apiv2/peer"
14-
"github.com/hyperledger/fabric/protoutil"
1515
)
1616

1717
// TODO: remove this and merge with that in transaction

0 commit comments

Comments
 (0)