Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add fabric-protos-go-apiv2 #66

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#SPDX-License-Identifier: Apache-2.0
.#*
*~
*#
/bin
/build
/.build
*.cov
/docs/build/*
.DS_Store
.*-dummy
.gradle
.idea
*.iml
*.log
.project
/release
report.xml
results.xml
.settings
.*.sw*
tags
.tags
TESTS*.xml
.tox/
.vagrant/
.vscode
6 changes: 3 additions & 3 deletions configtx/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"errors"
"fmt"

"github.com/golang/protobuf/proto"
cb "github.com/hyperledger/fabric-protos-go/common"
pb "github.com/hyperledger/fabric-protos-go/peer"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/protobuf/proto"
)

// Application is a copy of the orderer configuration with the addition of an anchor peers
Expand Down
6 changes: 3 additions & 3 deletions configtx/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import (
"math/big"
"testing"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/configtx/internal/policydsl"
"github.com/hyperledger/fabric-config/protolator"
"github.com/hyperledger/fabric-config/protolator/protoext/peerext"
cb "github.com/hyperledger/fabric-protos-go/common"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
. "github.com/onsi/gomega"
"google.golang.org/protobuf/proto"
)

func TestNewApplicationGroup(t *testing.T) {
Expand Down Expand Up @@ -106,7 +106,7 @@ func TestNewApplicationGroup(t *testing.T) {
expectedApplication := &cb.ConfigGroup{}
err = protolator.DeepUnmarshalJSON(bytes.NewBufferString(expectedApplicationGroup), expectedApplication)
gt.Expect(err).ToNot(HaveOccurred())
gt.Expect(applicationGroup).To(Equal(expectedApplication))
gt.Expect(proto.Equal(applicationGroup, expectedApplication)).To(BeTrue())
}

func TestNewApplicationGroupFailure(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions configtx/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"errors"
"fmt"

"github.com/golang/protobuf/proto"
cb "github.com/hyperledger/fabric-protos-go/common"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
"google.golang.org/protobuf/proto"
)

// capabilitiesValue returns the config definition for a set of capabilities.
Expand Down
2 changes: 1 addition & 1 deletion configtx/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"errors"
"fmt"

cb "github.com/hyperledger/fabric-protos-go/common"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
)

// ChannelGroup encapsulates the parts of the config that control channels.
Expand Down
2 changes: 1 addition & 1 deletion configtx/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

"github.com/hyperledger/fabric-config/protolator"
"github.com/hyperledger/fabric-config/protolator/protoext/commonext"
cb "github.com/hyperledger/fabric-protos-go/common"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
. "github.com/onsi/gomega"
)

Expand Down
17 changes: 7 additions & 10 deletions configtx/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ import (
"strconv"
"strings"

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
cb "github.com/hyperledger/fabric-protos-go/common"
mb "github.com/hyperledger/fabric-protos-go/msp"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"
)

// Channel is a channel configuration.
Expand Down Expand Up @@ -535,11 +534,9 @@ func newEnvelope(
// channelHeader creates a ChannelHeader.
func channelHeader(headerType cb.HeaderType, version int32, channelID string, epoch uint64) *cb.ChannelHeader {
return &cb.ChannelHeader{
Type: int32(headerType),
Version: version,
Timestamp: &timestamp.Timestamp{
Seconds: ptypes.TimestampNow().GetSeconds(),
},
Type: int32(headerType),
Version: version,
Timestamp: timestamppb.Now(),
ChannelId: channelID,
Epoch: epoch,
}
Expand Down
17 changes: 8 additions & 9 deletions configtx/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import (
"testing"

"github.com/hyperledger/fabric-config/configtx/orderer"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/protolator"
cb "github.com/hyperledger/fabric-protos-go/common"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
. "github.com/onsi/gomega"
"google.golang.org/protobuf/proto"
)

func TestNewConfigTx(t *testing.T) {
Expand Down Expand Up @@ -233,8 +232,8 @@ func TestNewCreateChannelTx(t *testing.T) {
err = proto.Unmarshal(expectedPayload.Data, &expectedData)
gt.Expect(err).NotTo(HaveOccurred())

expectedConfigUpdate := cb.ConfigUpdate{}
err = proto.Unmarshal(expectedData.ConfigUpdate, &expectedConfigUpdate)
expectedConfigUpdate := &cb.ConfigUpdate{}
err = proto.Unmarshal(expectedData.ConfigUpdate, expectedConfigUpdate)
gt.Expect(err).NotTo(HaveOccurred())

actualPayload := cb.Payload{}
Expand All @@ -249,11 +248,11 @@ func TestNewCreateChannelTx(t *testing.T) {
err = proto.Unmarshal(actualPayload.Data, &actualData)
gt.Expect(err).NotTo(HaveOccurred())

actualConfigUpdate := cb.ConfigUpdate{}
err = proto.Unmarshal(actualData.ConfigUpdate, &actualConfigUpdate)
actualConfigUpdate := &cb.ConfigUpdate{}
err = proto.Unmarshal(actualData.ConfigUpdate, actualConfigUpdate)
gt.Expect(err).NotTo(HaveOccurred())

gt.Expect(actualConfigUpdate).To(Equal(expectedConfigUpdate))
gt.Expect(proto.Equal(actualConfigUpdate, expectedConfigUpdate)).To(BeTrue())

// setting timestamps to match in ConfigUpdate
actualTimestamp := actualHeader.Timestamp
Expand All @@ -272,7 +271,7 @@ func TestNewCreateChannelTx(t *testing.T) {
expectedEnvelope.Payload, err = proto.Marshal(&expectedPayload)
gt.Expect(err).NotTo(HaveOccurred())

gt.Expect(envelope).To(Equal(&expectedEnvelope))
gt.Expect(proto.Equal(envelope, &expectedEnvelope)).To(BeTrue())
}

func TestNewCreateChannelTxFailure(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions configtx/consortiums.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"errors"
"fmt"

"github.com/golang/protobuf/proto"
cb "github.com/hyperledger/fabric-protos-go/common"
mb "github.com/hyperledger/fabric-protos-go/msp"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
"google.golang.org/protobuf/proto"
)

// Consortium is a group of non-orderer organizations used in channel transactions.
Expand Down
5 changes: 2 additions & 3 deletions configtx/consortiums_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ import (
"testing"

"github.com/hyperledger/fabric-config/configtx/orderer"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/protolator"
"github.com/hyperledger/fabric-config/protolator/protoext/commonext"
cb "github.com/hyperledger/fabric-protos-go/common"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
. "github.com/onsi/gomega"
"google.golang.org/protobuf/proto"
)

func TestNewConsortiumsGroup(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions configtx/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ import (
"testing"
"time"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/configtx"
"github.com/hyperledger/fabric-config/configtx/membership"
"github.com/hyperledger/fabric-config/configtx/orderer"
cb "github.com/hyperledger/fabric-protos-go/common"
mb "github.com/hyperledger/fabric-protos-go/msp"
ob "github.com/hyperledger/fabric-protos-go/orderer"
pb "github.com/hyperledger/fabric-protos-go/peer"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
ob "github.com/hyperledger/fabric-protos-go-apiv2/orderer"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
. "github.com/onsi/gomega"
"google.golang.org/protobuf/proto"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions configtx/internal/policydsl/policyparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"strings"

"github.com/Knetic/govaluate"
"github.com/golang/protobuf/proto"
cb "github.com/hyperledger/fabric-protos-go/common"
mb "github.com/hyperledger/fabric-protos-go/msp"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
"google.golang.org/protobuf/proto"
)

// Gate values
Expand Down
6 changes: 3 additions & 3 deletions configtx/internal/policydsl/policyparser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ package policydsl_test
import (
"testing"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/configtx/internal/policydsl"
cb "github.com/hyperledger/fabric-protos-go/common"
mb "github.com/hyperledger/fabric-protos-go/msp"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
"google.golang.org/protobuf/proto"

. "github.com/onsi/gomega"
)
Expand Down
6 changes: 3 additions & 3 deletions configtx/msp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (
"reflect"
"time"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/configtx/membership"
cb "github.com/hyperledger/fabric-protos-go/common"
mb "github.com/hyperledger/fabric-protos-go/msp"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
"google.golang.org/protobuf/proto"
)

// MSP is the configuration information for a Fabric MSP.
Expand Down
10 changes: 5 additions & 5 deletions configtx/msp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import (
"testing"
"time"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/configtx/membership"
"github.com/hyperledger/fabric-config/configtx/orderer"
"github.com/hyperledger/fabric-config/protolator"
cb "github.com/hyperledger/fabric-protos-go/common"
mb "github.com/hyperledger/fabric-protos-go/msp"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
. "github.com/onsi/gomega"
"google.golang.org/protobuf/proto"
)

func TestMSPConfigurationFailures(t *testing.T) {
Expand Down Expand Up @@ -275,7 +275,7 @@ func TestMSPToProto(t *testing.T) {

fabricMSPConfigProto, err := msp.toProto()
gt.Expect(err).NotTo(HaveOccurred())
gt.Expect(fabricMSPConfigProto).To(Equal(expectedFabricMSPConfigProto))
gt.Expect(proto.Equal(fabricMSPConfigProto, expectedFabricMSPConfigProto)).To(BeTrue())
}

func TestMSPToProtoNoNodeOUs(t *testing.T) {
Expand Down Expand Up @@ -328,7 +328,7 @@ func TestMSPToProtoNoNodeOUs(t *testing.T) {

fabricMSPConfigProto, err := msp.toProto()
gt.Expect(err).NotTo(HaveOccurred())
gt.Expect(fabricMSPConfigProto).To(Equal(expectedFabricMSPConfigProto))
gt.Expect(proto.Equal(fabricMSPConfigProto, expectedFabricMSPConfigProto)).To(BeTrue())
}

func TestParseCertificateFromBytesFailure(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions configtx/orderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"reflect"
"time"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/configtx/orderer"
cb "github.com/hyperledger/fabric-protos-go/common"
ob "github.com/hyperledger/fabric-protos-go/orderer"
eb "github.com/hyperledger/fabric-protos-go/orderer/etcdraft"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
ob "github.com/hyperledger/fabric-protos-go-apiv2/orderer"
eb "github.com/hyperledger/fabric-protos-go-apiv2/orderer/etcdraft"
"google.golang.org/protobuf/proto"
)

const (
Expand Down
14 changes: 7 additions & 7 deletions configtx/orderer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import (
"testing"
"time"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/configtx/orderer"
"github.com/hyperledger/fabric-config/protolator"
"github.com/hyperledger/fabric-config/protolator/protoext/ordererext"
cb "github.com/hyperledger/fabric-protos-go/common"
ob "github.com/hyperledger/fabric-protos-go/orderer"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
ob "github.com/hyperledger/fabric-protos-go-apiv2/orderer"
. "github.com/onsi/gomega"
"google.golang.org/protobuf/proto"
)

func TestNewOrdererGroup(t *testing.T) {
Expand Down Expand Up @@ -3755,14 +3755,14 @@ func TestRemoveOrdererPolicyFailures(t *testing.T) {

tests := []struct {
testName string
ordererGrpMod func(cb.ConfigGroup) *cb.ConfigGroup
ordererGrpMod func(*cb.ConfigGroup) *cb.ConfigGroup
policyName string
expectedErr string
}{
{
testName: "when removing blockvalidation policy",
ordererGrpMod: func(og cb.ConfigGroup) *cb.ConfigGroup {
return &og
ordererGrpMod: func(og *cb.ConfigGroup) *cb.ConfigGroup {
return proto.Clone(og).(*cb.ConfigGroup)
},
policyName: BlockValidationPolicyKey,
expectedErr: "BlockValidation policy must be defined",
Expand All @@ -3774,7 +3774,7 @@ func TestRemoveOrdererPolicyFailures(t *testing.T) {
t.Run(tt.testName, func(t *testing.T) {
gt := NewGomegaWithT(t)

ordererGroup := tt.ordererGrpMod(*ordererGroup)
ordererGroup := tt.ordererGrpMod(ordererGroup)
if ordererGroup == nil {
delete(config.ChannelGroup.Groups, OrdererGroupKey)
} else {
Expand Down
8 changes: 4 additions & 4 deletions configtx/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ package configtx
import (
"fmt"

"github.com/golang/protobuf/proto"
cb "github.com/hyperledger/fabric-protos-go/common"
mb "github.com/hyperledger/fabric-protos-go/msp"
pb "github.com/hyperledger/fabric-protos-go/peer"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/protobuf/proto"
)

// newOrgConfigGroup returns an config group for an organization.
Expand Down
6 changes: 3 additions & 3 deletions configtx/policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
"strconv"
"strings"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-config/configtx/internal/policydsl"
cb "github.com/hyperledger/fabric-protos-go/common"
mb "github.com/hyperledger/fabric-protos-go/msp"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
mb "github.com/hyperledger/fabric-protos-go-apiv2/msp"
"google.golang.org/protobuf/proto"
)

// getPolicies returns a map of Policy from given map of ConfigPolicy in organization config group.
Expand Down
4 changes: 2 additions & 2 deletions configtx/policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ package configtx
import (
"testing"

"github.com/golang/protobuf/proto"
cb "github.com/hyperledger/fabric-protos-go/common"
cb "github.com/hyperledger/fabric-protos-go-apiv2/common"
. "github.com/onsi/gomega"
"google.golang.org/protobuf/proto"
)

func TestPolicies(t *testing.T) {
Expand Down
Loading
Loading