Skip to content

Commit

Permalink
Merge "FAB-845 integrate next version of protos"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Yellick authored and Gerrit Code Review committed Oct 28, 2016
2 parents 597c944 + 157429c commit 35efa2b
Show file tree
Hide file tree
Showing 49 changed files with 2,102 additions and 1,765 deletions.
8 changes: 2 additions & 6 deletions bddtests/chaincode.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/util"
pb "github.com/hyperledger/fabric/protos"
putils "github.com/hyperledger/fabric/protos/utils"
)

func createChaincodeSpec(ccType string, path string, args [][]byte) *pb.ChaincodeSpec {
Expand All @@ -47,11 +48,6 @@ func createProposalForChaincode(ccChaincodeDeploymentSpec *pb.ChaincodeDeploymen
ChaincodeID: &pb.ChaincodeID{Name: "lccc"},
CtorMsg: &pb.ChaincodeInput{Args: [][]byte{[]byte("deploy"), []byte("default"), ccDeploymentSpecBytes}}}
lcChaincodeInvocationSpec := &pb.ChaincodeInvocationSpec{ChaincodeSpec: lcChaincodeSpec}
var ccLifecycleChaincodeInvocationSpecBytes []byte
if ccLifecycleChaincodeInvocationSpecBytes, err = proto.Marshal(lcChaincodeInvocationSpec); err != nil {
return nil, fmt.Errorf("Error creating proposal from ChaincodeDeploymentSpec: %s", err)
}
// make proposal
proposal = &pb.Proposal{Type: pb.Proposal_CHAINCODE, Id: createPropsalID(), Payload: ccLifecycleChaincodeInvocationSpecBytes}
return proposal, nil
return putils.CreateChaincodeProposal(lcChaincodeInvocationSpec)
}
94 changes: 47 additions & 47 deletions consensus/simplebft/simplebft.pb.go

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

12 changes: 7 additions & 5 deletions core/chaincode/chaincodeexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,21 @@ func createTx(typ pb.Transaction_Type, ccname string, args [][]byte) (*pb.Transa
}

func getCDSFromLCCC(ctxt context.Context, chainID string, chaincodeID string) ([]byte, error) {
return ExecuteChaincode(ctxt, pb.Transaction_CHAINCODE_INVOKE, string(DefaultChain), "lccc", [][]byte{[]byte("getdepspec"), []byte(chainID), []byte(chaincodeID)})
payload, _, err := ExecuteChaincode(ctxt, pb.Transaction_CHAINCODE_INVOKE, string(DefaultChain), "lccc", [][]byte{[]byte("getdepspec"), []byte(chainID), []byte(chaincodeID)})
return payload, err
}

// ExecuteChaincode executes a given chaincode given chaincode name and arguments
func ExecuteChaincode(ctxt context.Context, typ pb.Transaction_Type, chainname string, ccname string, args [][]byte) ([]byte, error) {
func ExecuteChaincode(ctxt context.Context, typ pb.Transaction_Type, chainname string, ccname string, args [][]byte) ([]byte, *pb.ChaincodeEvent, error) {
var tx *pb.Transaction
var err error
var b []byte
var ccevent *pb.ChaincodeEvent

tx, err = createTx(typ, ccname, args)
b, _, err = Execute(ctxt, GetChain(ChainName(chainname)), tx)
b, ccevent, err = Execute(ctxt, GetChain(ChainName(chainname)), tx)
if err != nil {
return nil, fmt.Errorf("Error deploying chaincode: %s", err)
return nil, nil, fmt.Errorf("Error deploying chaincode: %s", err)
}
return b, err
return b, ccevent, err
}
10 changes: 2 additions & 8 deletions core/chaincode/exectransaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/hyperledger/fabric/core/util"
"github.com/hyperledger/fabric/membersrvc/ca"
pb "github.com/hyperledger/fabric/protos"
putils "github.com/hyperledger/fabric/protos/utils"

"github.com/golang/protobuf/proto"
"github.com/spf13/viper"
Expand Down Expand Up @@ -178,17 +179,10 @@ func endTxSimulation(txsim ledger.TxSimulator, payload []byte, commit bool) erro
if txSimulationResults, err = txsim.GetTxSimulationResults(); err != nil {
return err
}
//create action bytes
action := &pb.Action{ProposalHash: util.ComputeCryptoHash([]byte("dummyProposal")), SimulationResult: txSimulationResults}
actionBytes, err := proto.Marshal(action)
tx, err := putils.CreateTx(pb.Header_CHAINCODE, util.ComputeCryptoHash([]byte("dummyProposal")), []byte("dummyCCEvents"), txSimulationResults, []*pb.Endorsement{&pb.Endorsement{}})
if err != nil {
return err
}
//create transaction with endorsed actions
tx := &pb.Transaction2{}
tx.EndorsedActions = []*pb.EndorsedAction{
&pb.EndorsedAction{ActionBytes: actionBytes, Endorsements: []*pb.Endorsement{&pb.Endorsement{Signature: []byte("--Endorsement signature--")}}, ProposalBytes: []byte{}}}

txBytes, err := proto.Marshal(tx)
if err != nil {
return err
Expand Down
47 changes: 24 additions & 23 deletions core/chaincode/shim/chaincode.pb.go

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

Loading

0 comments on commit 35efa2b

Please sign in to comment.