Skip to content

Commit

Permalink
Dependency update: Resolves hyperledger#80
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
tobigiwa committed Sep 11, 2023
1 parent ecc6191 commit c648f31
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion shim/chaincodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"errors"

"github.com/hyperledger/fabric-chaincode-go/shim/internal"
pb "github.com/hyperledger/fabric-protos-go/peer"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"

"google.golang.org/grpc/keepalive"
)
Expand Down
4 changes: 2 additions & 2 deletions shim/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"fmt"
"sync"

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

type state string
Expand Down
2 changes: 1 addition & 1 deletion shim/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"github.com/hyperledger/fabric-chaincode-go/shim/internal/mock"
peerpb "github.com/hyperledger/fabric-protos-go/peer"
peerpb "github.com/hyperledger/fabric-protos-go-apiv2/peer"

"github.com/stretchr/testify/assert"
)
Expand Down
6 changes: 3 additions & 3 deletions shim/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package shim

import (
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
pb "github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
timestamp "google.golang.org/protobuf/types/known/timestamppb"
)

// Chaincode interface must be implemented by all chaincodes. The fabric runs
Expand Down
2 changes: 1 addition & 1 deletion shim/internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"crypto/tls"
"time"

peerpb "github.com/hyperledger/fabric-protos-go/peer"
peerpb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
Expand Down
2 changes: 1 addition & 1 deletion shim/internal/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"
"time"

pb "github.com/hyperledger/fabric-protos-go/peer"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"google.golang.org/grpc/keepalive"
Expand Down
2 changes: 1 addition & 1 deletion shim/internal/mock/client_stream.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion shim/internal/mock/peer_chaincode_stream.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion shim/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package shim

import (
pb "github.com/hyperledger/fabric-protos-go/peer"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions shim/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"os"
"unicode/utf8"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-chaincode-go/shim/internal"
peerpb "github.com/hyperledger/fabric-protos-go/peer"
peerpb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/protobuf/proto"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion shim/shim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"

"github.com/hyperledger/fabric-chaincode-go/shim/internal/mock"
peerpb "github.com/hyperledger/fabric-protos-go/peer"
peerpb "github.com/hyperledger/fabric-protos-go-apiv2/peer"

"github.com/stretchr/testify/assert"
)
Expand Down
10 changes: 5 additions & 5 deletions shim/stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"os"
"unicode/utf8"

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
pb "github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/protobuf/proto"
timestamp "google.golang.org/protobuf/types/known/timestamppb"
)

// ChaincodeStub is an object passed to chaincode for shim side handling of
Expand Down
13 changes: 6 additions & 7 deletions shim/stub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import (
"os"
"testing"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-chaincode-go/shim/internal/mock"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
peerpb "github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/common"
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"
peerpb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/protobuf/proto"

"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/stretchr/testify/assert"
timestamp "google.golang.org/protobuf/types/known/timestamppb"
)

func toChaincodeArgs(args ...string) [][]byte {
Expand Down Expand Up @@ -193,7 +192,7 @@ func TestChaincodeStubAccessors(t *testing.T) {
}

func TestChaincodeStubGetTxTimestamp(t *testing.T) {
now := ptypes.TimestampNow()
now := timestamp.Now()
tests := []struct {
proposal *peerpb.Proposal
ts *timestamp.Timestamp
Expand Down
2 changes: 1 addition & 1 deletion shimtest/mock/chaincode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions shimtest/mockstub.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ import (
"strings"
"unicode/utf8"

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/hyperledger/fabric-chaincode-go/shim"
"github.com/hyperledger/fabric-protos-go/ledger/queryresult"
pb "github.com/hyperledger/fabric-protos-go/peer"
"github.com/hyperledger/fabric-protos-go-apiv2/ledger/queryresult"
pb "github.com/hyperledger/fabric-protos-go-apiv2/peer"
"google.golang.org/protobuf/proto"
timestamp "google.golang.org/protobuf/types/known/timestamppb"
)

const (
Expand Down Expand Up @@ -121,7 +120,7 @@ func (stub *MockStub) GetFunctionAndParameters() (function string, params []stri
func (stub *MockStub) MockTransactionStart(txid string) {
stub.TxID = txid
stub.setSignedProposal(&pb.SignedProposal{})
stub.setTxTimestamp(ptypes.TimestampNow())
stub.setTxTimestamp(timestamp.Now())
}

// MockTransactionEnd End a mocked transaction, clearing the UUID.
Expand Down

0 comments on commit c648f31

Please sign in to comment.