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

Update from fabric-protos-go to fabric-protos-go-apiv2 #80

Closed
jt-nti opened this issue Apr 18, 2023 · 1 comment · Fixed by #108
Closed

Update from fabric-protos-go to fabric-protos-go-apiv2 #80

jt-nti opened this issue Apr 18, 2023 · 1 comment · Fixed by #108
Assignees

Comments

@jt-nti
Copy link
Member

jt-nti commented Apr 18, 2023

fabric-protos-go uses deprecated Go protobuf APIs so it would be good to update to the newer fabric-protos-go-apiv2 module. Since mixing the different APIs can be problematic, for example hyperledger/fabric-protos#181, it would be sensible to release at v2.x using the new fabric-protos-go-apiv2, with the current v1.x releases sticking with fabric-protos-go.

tobigiwa added a commit to tobigiwa/fabric-chaincode-go that referenced this issue Sep 11, 2023
This commit contains dependency update from fabric-protos-go to fabric-protos-go-apiv2 (Resolves hyperledger#80) and "github.com/golang/protobuf"(deprecated) to "google.golang.org/protobuf". The changes in this commit are localised in the "shim folder" only and they include:

"github.com/golang/protobuf/proto" --> "google.golang.org/protobuf/proto"

pb "github.com/hyperledger/fabric-protos-go/peer" --> pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"

"github.com/golang/protobuf/ptypes/timestamp" --> timestamp "google.golang.org/protobuf/types/known/timestamppb"

"github.com/hyperledger/fabric-protos-go/ledger/queryresult" --> "github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"

peerpb "github.com/hyperledger/fabric-protos-go/peer" --> peerpb "github.com/hyperledger/fabric-protos-go-apiv2/peer"

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

now := ptypes.TimestampNow() --> now := timestamp.Now()

Import aliases are kept as it was so as not to affect the source code. I believe that are as far as the shim folder dependency is concerned.

Signed-off-by: tobigiwa <giwaoluwatobi@gmail.com>
tobigiwa added a commit to tobigiwa/fabric-chaincode-go that referenced this issue Sep 11, 2023
Signed-off-by: tobigiwa <giwaoluwatobi@gmail.com> This commit contains dependency update from fabric-protos-go to fabric-protos-go-apiv2 (Resolves hyperledger#80) and "github.com/golang/protobuf"(deprecated) to
"google.golang.org/protobuf". The changes in this commit are localised in the "shim folder" only and they include:
"github.com/golang/protobuf/proto" --> "google.golang.org/protobuf/proto"#
pb "github.com/hyperledger/fabric-protos-go/peer" --> pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"#
"github.com/golang/protobuf/ptypes/timestamp" --> timestamp "google.golang.org/protobuf/types/known/timestamppb"# "github.com/hyperledger/fabric-protos-go/ledger/queryresult" -->
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult" peerpb "github.com/hyperledger/fabric-protos-go/peer" --> peerpb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/hyperledger/fabric-protos-go/common" --> "github.com/hyperledger/fabric-protos-go-apiv2/common" now := ptypes.TimestampNow() --> now := timestamp.Now()
Import aliases are kept as it was so as not to affect the source code. I believe that are as far as the shim folder dependency is concerned.
tobigiwa added a commit to tobigiwa/fabric-chaincode-go that referenced this issue Sep 11, 2023
Signed-off-by: tobigiwa <giwaoluwatobi@gmail.com> This commit contains dependency update from fabric-protos-go to fabric-protos-go-apiv2 (Resolves hyperledger#80) and "github.com/golang/protobuf"(deprecated) to
"google.golang.org/protobuf". The changes in this commit are localised in the "pkg folder" only and they include:
"github.com/golang/protobuf/proto" --> "google.golang.org/protobuf/proto"# (use "git push" to publish your local commits)
pb "github.com/hyperledger/fabric-protos-go/peer" --> pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"# "github.com/hyperledger/fabric-protos-go/ledger/msp" -->
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/msp" "github.com/hyperledger/fabric-protos-go/common" --> "github.com/hyperledger/fabric-protos-go-apiv2/common"
Import aliases are kept as it was so as not to affect the source code. I believe that are as far as the pkg folder dependency is concerned.
tobigiwa added a commit to tobigiwa/fabric-chaincode-go that referenced this issue Sep 11, 2023
Removed deprecated package as direct dependency("github.com/golang/protobuf") and bumped up "github.com/hyperledger/fabric-protos-go" to github.com/hyperledger/fabric-protos-go-apiv2.  Ran `go get -u github.com/hyperledger/fabric-protos-go@none` and ran `go mod tidy`. It can be noticed that package "github.com/golang/protobuf" is still an indirect dependency used by google.golang.org/grpc/credentials v1.53.0, even the latest update v1.58.0 still does. This issue is from hyperledger#80.

Signed-off-by: tobigiwa <giwaoluwatobi@gmail.com>
tobigiwa added a commit to tobigiwa/fabric-chaincode-go that referenced this issue Sep 16, 2023
changes:
1)  The "AssertProtoEqual" was borrowed from: // https://github.com/hyperledger/fabric-gateway/blob/cd1bc1f3fcf007bd97244120d9a8d112153322cd/pkg/internal/test/transaction.go#L20-L22
which is more apt to test the protobufs of google.golang.org/protobuf/ implementation.

2) Also, added "\u00a0" has it was produced from the unmarshling of two functions

Finally, Resolves hyperledger#80.

Signed-off-by: tobigiwa <giwaoluwatobi@gmail.com>
tobigiwa added a commit to tobigiwa/fabric-chaincode-go that referenced this issue Sep 17, 2023
…fabric-protos-go to fabric-protos-go-apiv2 and "github.com/golang/protobuf"(deprecated) to "google.golang.org/protobuf

Bumped google.golang.org/protobuf to v1.31.0 from v1.5.2

It can be noticed that the package "github.com/golang/protobuf" is still an indirect dependency used by google.golang.org/grpc/credentials v1.53.0, even the latest update v1.58.0 still does.

Made sure all tests passed.

CHANGES INCLUDE:

	SOURCE CODE
The "AssertProtoEqual" was borrowed from: // https://github.com/hyperledger/fabric-gateway/blob/cd1bc1f3fcf007bd97244120d9a8d112153322cd/pkg/internal/test/transaction.go#L20-L22
which is more apt to test the Protobufs of google.golang.org/protobuf/ implementation. It replaced assertEqual.

now := ptypes.TimestampNow() --> now := timestamp.Now()

IMPORTS
All Import aliases are kept.
"github.com/golang/protobuf/proto" --> "google.golang.org/protobuf/proto"

pb "github.com/hyperledger/fabric-protos-go/peer" --> pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"

"github.com/golang/protobuf/ptypes/timestamp" --> timestamp "google.golang.org/protobuf/types/known/timestamppb"

"github.com/hyperledger/fabric-protos-go/ledger/queryresult" --> "github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"

"github.com/hyperledger/fabric-protos-go/ledger/msp" →
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/msp"
"github.com/hyperledger/fabric-protos-go/common" --> "github.com/hyperledger/fabric-protos-go-apiv2/common"

Signed-off-by: tobigiwa <giwaoluwatobi@gmail.com>
tobigiwa added a commit to tobigiwa/fabric-chaincode-go that referenced this issue Oct 2, 2023
…fabric-protos-go to fabric-protos-go-apiv2 and "github.com/golang/protobuf"(deprecated) to "google.golang.org/protobuf

Bumped google.golang.org/protobuf to v1.31.0 from v1.5.2

It can be noticed that the package "github.com/golang/protobuf" is still an indirect dependency used by google.golang.org/grpc/credentials v1.53.0, even the latest update v1.58.0 still does.

Made sure all tests passed.

CHANGES INCLUDE:

	SOURCE CODE
The "AssertProtoEqual" was borrowed from: // https://github.com/hyperledger/fabric-gateway/blob/cd1bc1f3fcf007bd97244120d9a8d112153322cd/pkg/internal/test/transaction.go#L20-L22
which is more apt to test the Protobufs of google.golang.org/protobuf/ implementation. It replaced assertEqual.

now := ptypes.TimestampNow() --> now := timestamp.Now()

IMPORTS
All Import aliases are kept.
"github.com/golang/protobuf/proto" --> "google.golang.org/protobuf/proto"

pb "github.com/hyperledger/fabric-protos-go/peer" --> pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"

"github.com/golang/protobuf/ptypes/timestamp" --> timestamp "google.golang.org/protobuf/types/known/timestamppb"

"github.com/hyperledger/fabric-protos-go/ledger/queryresult" --> "github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"

"github.com/hyperledger/fabric-protos-go/ledger/msp" →
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/msp"
"github.com/hyperledger/fabric-protos-go/common" --> "github.com/hyperledger/fabric-protos-go-apiv2/common"

Signed-off-by: tobigiwa <giwaoluwatobi@gmail.com>
@jt-nti
Copy link
Member Author

jt-nti commented Jan 15, 2024

See the main fabric APIv2 issue.

I would be in favor of updating all fabric repositories to APIv2 before Fabric v3 gets released (including Go chaincode repositories), if somebody tests and successfully proves that having a mixed set of Fabric v2.x orderers and peers (old protobuf) and new v3.x orderers and peers (new APIv2) works seamlessly. Any volunteers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment