Skip to content

Commit

Permalink
Upgrade go protobuf from 3-beta to 3
Browse files Browse the repository at this point in the history
We bump the vagrant devenv from 0.0.10 to 0.0.11 to pick
up the latest protoc binary.  Users will need to vagrant
destroy+up to work with this code.

This has been tested with a full unit-test/behave cycle
in both Jenkins and vagrant (after a destroy/up cycle).

https://jira.hyperledger.org/browse/FAB-108

Change-Id: I62bc7925379a7db86b58aa6cca5ddaeb1069456d
Signed-off-by: Yacov Manevich <yacovm@il.ibm.com>
Signed-off-by: Gregory Haskins <gregory.haskins@gmail.com>
  • Loading branch information
yacovm authored and ghaskins committed Sep 8, 2016
1 parent d8d33c2 commit 4fa1360
Show file tree
Hide file tree
Showing 718 changed files with 166,697 additions and 4,485 deletions.
4 changes: 2 additions & 2 deletions consensus/pbft/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ package pbft

import (
"fmt"
"google/protobuf"
"time"

"github.com/hyperledger/fabric/consensus"
"github.com/hyperledger/fabric/consensus/util/events"
pb "github.com/hyperledger/fabric/protos"

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/op/go-logging"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -242,7 +242,7 @@ func (op *obcBatch) sendBatch() events.Event {
func (op *obcBatch) txToReq(tx []byte) *Request {
now := time.Now()
req := &Request{
Timestamp: &google_protobuf.Timestamp{
Timestamp: &timestamp.Timestamp{
Seconds: now.Unix(),
Nanos: int32(now.UnixNano() % 1000000000),
},
Expand Down
352 changes: 269 additions & 83 deletions consensus/pbft/messages.pb.go

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions consensus/pbft/mock_utilities_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import (
"github.com/hyperledger/fabric/consensus/util/events"
"github.com/hyperledger/fabric/core/ledger/statemgmt"

gp "google/protobuf"

"github.com/golang/protobuf/ptypes/timestamp"
pb "github.com/hyperledger/fabric/protos"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -105,7 +104,7 @@ func createRunningPbftWithManager(id uint64, config *viper.Viper, stack innerSta
}

func createTx(tag int64) (tx *pb.Transaction) {
txTime := &gp.Timestamp{Seconds: tag, Nanos: 0}
txTime := &timestamp.Timestamp{Seconds: tag, Nanos: 0}
tx = &pb.Transaction{Type: pb.Transaction_CHAINCODE_DEPLOY,
Timestamp: txTime,
Payload: []byte(fmt.Sprint(tag)),
Expand Down
9 changes: 4 additions & 5 deletions core/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import (
"github.com/spf13/viper"
"golang.org/x/net/context"

"google/protobuf"

"github.com/golang/protobuf/ptypes/empty"
pb "github.com/hyperledger/fabric/protos"
)

Expand Down Expand Up @@ -55,21 +54,21 @@ func worker(id int, die chan struct{}) {
}

// GetStatus reports the status of the server
func (*ServerAdmin) GetStatus(context.Context, *google_protobuf.Empty) (*pb.ServerStatus, error) {
func (*ServerAdmin) GetStatus(context.Context, *empty.Empty) (*pb.ServerStatus, error) {
status := &pb.ServerStatus{Status: pb.ServerStatus_STARTED}
log.Debugf("returning status: %s", status)
return status, nil
}

// StartServer starts the server
func (*ServerAdmin) StartServer(context.Context, *google_protobuf.Empty) (*pb.ServerStatus, error) {
func (*ServerAdmin) StartServer(context.Context, *empty.Empty) (*pb.ServerStatus, error) {
status := &pb.ServerStatus{Status: pb.ServerStatus_STARTED}
log.Debugf("returning status: %s", status)
return status, nil
}

// StopServer stops the server
func (*ServerAdmin) StopServer(context.Context, *google_protobuf.Empty) (*pb.ServerStatus, error) {
func (*ServerAdmin) StopServer(context.Context, *empty.Empty) (*pb.ServerStatus, error) {
status := &pb.ServerStatus{Status: pb.ServerStatus_STOPPED}
log.Debugf("returning status: %s", status)

Expand Down
5 changes: 2 additions & 3 deletions core/chaincode/shim/chaincode.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ import (
"strconv"
"strings"

gp "google/protobuf"

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/hyperledger/fabric/core/chaincode/shim/crypto/attr"
"github.com/hyperledger/fabric/core/chaincode/shim/crypto/ecdsa"
"github.com/hyperledger/fabric/core/comm"
Expand Down Expand Up @@ -664,7 +663,7 @@ func (stub *ChaincodeStub) GetPayload() ([]byte, error) {
// GetTxTimestamp returns transaction created timestamp, which is currently
// taken from the peer receiving the transaction. Note that this timestamp
// may not be the same with the other peers' time.
func (stub *ChaincodeStub) GetTxTimestamp() (*gp.Timestamp, error) {
func (stub *ChaincodeStub) GetTxTimestamp() (*timestamp.Timestamp, error) {
return stub.securityContext.TxTimestamp, nil
}

Expand Down
5 changes: 2 additions & 3 deletions core/chaincode/shim/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ limitations under the License.
package shim

import (
gp "google/protobuf"

"github.com/golang/protobuf/ptypes/timestamp"
"github.com/hyperledger/fabric/core/chaincode/shim/crypto/attr"
)

Expand Down Expand Up @@ -155,7 +154,7 @@ type ChaincodeStubInterface interface {
// GetTxTimestamp returns transaction created timestamp, which is currently
// taken from the peer receiving the transaction. Note that this timestamp
// may not be the same with the other peers' time.
GetTxTimestamp() (*gp.Timestamp, error)
GetTxTimestamp() (*timestamp.Timestamp, error)

// SetEvent saves the event to be sent when a transaction is made part of a block
SetEvent(name string, payload []byte) error
Expand Down
5 changes: 2 additions & 3 deletions core/chaincode/shim/mockstub.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import (
"errors"
"strings"

gp "google/protobuf"

"github.com/golang/protobuf/ptypes/timestamp"
"github.com/hyperledger/fabric/core/chaincode/shim/crypto/attr"
"github.com/op/go-logging"
)
Expand Down Expand Up @@ -301,7 +300,7 @@ func (stub *MockStub) GetPayload() ([]byte, error) {
}

// Not implemented
func (stub *MockStub) GetTxTimestamp() (*gp.Timestamp, error) {
func (stub *MockStub) GetTxTimestamp() (*timestamp.Timestamp, error) {
return nil, nil
}

Expand Down
105 changes: 91 additions & 14 deletions core/chaincode/shim/table.pb.go

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

6 changes: 3 additions & 3 deletions core/comm/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const defaultTimeout = time.Second * 3
var commLogger = logging.MustGetLogger("comm")

// NewClientConnectionWithAddress Returns a new grpc.ClientConn to the given address.
func NewClientConnectionWithAddress(peerAddress string, block bool, tslEnabled bool, creds credentials.TransportAuthenticator) (*grpc.ClientConn, error) {
func NewClientConnectionWithAddress(peerAddress string, block bool, tslEnabled bool, creds credentials.TransportCredentials) (*grpc.ClientConn, error) {
var opts []grpc.DialOption
if tslEnabled {
opts = append(opts, grpc.WithTransportCredentials(creds))
Expand All @@ -35,12 +35,12 @@ func NewClientConnectionWithAddress(peerAddress string, block bool, tslEnabled b
}

// InitTLSForPeer returns TLS credentials for peer
func InitTLSForPeer() credentials.TransportAuthenticator {
func InitTLSForPeer() credentials.TransportCredentials {
var sn string
if viper.GetString("peer.tls.serverhostoverride") != "" {
sn = viper.GetString("peer.tls.serverhostoverride")
}
var creds credentials.TransportAuthenticator
var creds credentials.TransportCredentials
if viper.GetString("peer.tls.cert.file") != "" {
var err error
creds, err = credentials.NewClientTLSFromFile(viper.GetString("peer.tls.cert.file"), sn)
Expand Down
2 changes: 1 addition & 1 deletion core/container/dockercontroller/dockercontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (
"os"
"testing"

"github.com/fsouza/go-dockerclient"
"github.com/spf13/viper"

"github.com/fsouza/go-dockerclient"
"github.com/hyperledger/fabric/core/config"
"github.com/hyperledger/fabric/core/ledger/testutil"
)
Expand Down

0 comments on commit 4fa1360

Please sign in to comment.