Skip to content

Commit

Permalink
Dependency updates (hyperledger#76)
Browse files Browse the repository at this point in the history
* Bump Go to 1.19

Bump Go to 1.19.

Signed-off-by: David Enyeart <[email protected]>

* Update dependencies

Update dependencies.

Signed-off-by: David Enyeart <[email protected]>

---------

Signed-off-by: David Enyeart <[email protected]>
  • Loading branch information
denyeart authored Feb 28, 2023
1 parent 7bc6fa0 commit b84622b
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 162 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18.x
go-version: 1.19.x
- uses: actions/checkout@v2
with:
fetch-depth: 1
Expand All @@ -31,4 +31,3 @@ jobs:
run: ci/scripts/lint.sh
- name: Run tests
run: go test -race ./...

18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module github.com/hyperledger/fabric-chaincode-go

go 1.17
go 1.19

require (
github.com/golang/protobuf v1.5.2
github.com/hyperledger/fabric-protos-go v0.0.0-20220613214546-bf864f01d75e
github.com/stretchr/testify v1.8.0
google.golang.org/grpc v1.48.0
github.com/hyperledger/fabric-protos-go v0.3.0
github.com/stretchr/testify v1.8.2
google.golang.org/grpc v1.53.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20220718134204-073382fd740c // indirect
google.golang.org/protobuf v1.28.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
151 changes: 18 additions & 133 deletions go.sum

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions shim/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ const (
// peer as server
var peerAddress = flag.String("peer.address", "", "peer address")

//this separates the chaincode stream interface establishment
//so we can replace it with a mock peer stream
// this separates the chaincode stream interface establishment
// so we can replace it with a mock peer stream
type peerStreamGetter func(name string) (ClientStream, error)

//UTs to setup mock peer stream getter
// UTs to setup mock peer stream getter
var streamGetter peerStreamGetter

//the non-mock user CC stream establishment func
// the non-mock user CC stream establishment func
func userChaincodeStreamGetter(name string) (ClientStream, error) {
if *peerAddress == "" {
return nil, errors.New("flag 'peer.address' must be set")
Expand Down
14 changes: 7 additions & 7 deletions shim/stub.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,12 +441,12 @@ func (s *ChaincodeStub) GetHistoryForKey(key string) (HistoryQueryIteratorInterf
return &HistoryQueryIterator{CommonIterator: &CommonIterator{s.handler, s.ChannelID, s.TxID, response, 0}}, nil
}

//CreateCompositeKey documentation can be found in interfaces.go
// CreateCompositeKey documentation can be found in interfaces.go
func (s *ChaincodeStub) CreateCompositeKey(objectType string, attributes []string) (string, error) {
return CreateCompositeKey(objectType, attributes)
}

//SplitCompositeKey documentation can be found in interfaces.go
// SplitCompositeKey documentation can be found in interfaces.go
func (s *ChaincodeStub) SplitCompositeKey(compositeKey string) (string, []string, error) {
return splitCompositeKey(compositeKey)
}
Expand Down Expand Up @@ -491,10 +491,10 @@ func validateCompositeKeyAttribute(str string) error {
return nil
}

//To ensure that simple keys do not go into composite key namespace,
//we validate simplekey to check whether the key starts with 0x00 (which
//is the namespace for compositeKey). This helps in avoding simple/composite
//key collisions.
// To ensure that simple keys do not go into composite key namespace,
// we validate simplekey to check whether the key starts with 0x00 (which
// is the namespace for compositeKey). This helps in avoding simple/composite
// key collisions.
func validateSimpleKeys(simpleKeys ...string) error {
for _, key := range simpleKeys {
if len(key) > 0 && key[0] == compositeKeyNamespace[0] {
Expand All @@ -504,7 +504,7 @@ func validateSimpleKeys(simpleKeys ...string) error {
return nil
}

//GetStateByPartialCompositeKey documentation can be found in interfaces.go
// GetStateByPartialCompositeKey documentation can be found in interfaces.go
func (s *ChaincodeStub) GetStateByPartialCompositeKey(objectType string, attributes []string) (StateQueryIteratorInterface, error) {
collection := ""
startKey, endKey, err := s.createRangeKeysForPartialCompositeKey(objectType, attributes)
Expand Down
6 changes: 3 additions & 3 deletions shim/stub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestNewChaincodeStub(t *testing.T) {
{signedProposal: proto.Clone(validSignedProposal).(*peerpb.SignedProposal)},
{
signedProposal: &peerpb.SignedProposal{ProposalBytes: []byte("garbage")},
expectedErr: "failed to extract Proposal from SignedProposal: proto:\u00a0cannot parse invalid wire-format data",
expectedErr: "failed to extract Proposal from SignedProposal: proto: cannot parse invalid wire-format data",
},
{
signedProposal: &peerpb.SignedProposal{},
Expand Down Expand Up @@ -215,11 +215,11 @@ func TestChaincodeStubGetTxTimestamp(t *testing.T) {
ChannelHeader: []byte("garbage-channel-header"),
}),
},
expectedErr: "error unmarshaling ChannelHeader: proto:\u00a0cannot parse invalid wire-format data",
expectedErr: "error unmarshaling ChannelHeader: proto: cannot parse invalid wire-format data",
},
{
proposal: &peerpb.Proposal{Header: []byte("garbage-header")},
expectedErr: "error unmarshaling Header: proto:\u00a0cannot parse invalid wire-format data",
expectedErr: "error unmarshaling Header: proto: cannot parse invalid wire-format data",
},
}

Expand Down
8 changes: 4 additions & 4 deletions shimtest/mockstub.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ func (stub *MockStub) GetStateByRange(startKey, endKey string) (shim.StateQueryI
return NewMockStateRangeQueryIterator(stub, startKey, endKey), nil
}

//To ensure that simple keys do not go into composite key namespace,
//we validate simplekey to check whether the key starts with 0x00 (which
//is the namespace for compositeKey). This helps in avoding simple/composite
//key collisions.
// To ensure that simple keys do not go into composite key namespace,
// we validate simplekey to check whether the key starts with 0x00 (which
// is the namespace for compositeKey). This helps in avoding simple/composite
// key collisions.
func validateSimpleKeys(simpleKeys ...string) error {
for _, key := range simpleKeys {
if len(key) > 0 && key[0] == compositeKeyNamespace[0] {
Expand Down

0 comments on commit b84622b

Please sign in to comment.