Skip to content

Commit f61e6b2

Browse files
committed
Passing SignedProposal the chaincode execution
This change-set passes the SignedProposal to the chaincode execution engine for two reasons: 1. being able to apply ACL on CC2CC 2. passing signed proposal to chaincode, if needed. Change-Id: I994ee261e942b2714e2506a4ea417bd4004a5963 Signed-off-by: Angelo De Caro <[email protected]>
1 parent 9b64e7e commit f61e6b2

15 files changed

+88
-75
lines changed

core/chaincode/ccproviderimpl.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ func (c *ccProviderImpl) GetContext(ledger ledger.PeerLedger) (context.Context,
6767
// GetCCContext returns an interface that encapsulates a
6868
// chaincode context; the interface is required to avoid
6969
// referencing the chaincode package from the interface definition
70-
func (c *ccProviderImpl) GetCCContext(cid, name, version, txid string, syscc bool, prop *pb.Proposal) interface{} {
71-
ctx := ccprovider.NewCCContext(cid, name, version, txid, syscc, prop)
70+
func (c *ccProviderImpl) GetCCContext(cid, name, version, txid string, syscc bool, signedProp *pb.SignedProposal, prop *pb.Proposal) interface{} {
71+
ctx := ccprovider.NewCCContext(cid, name, version, txid, syscc, signedProp, prop)
7272
return &ccProviderContextImpl{ctx: ctx}
7373
}
7474

7575
// GetCCValidationInfoFromLCCC returns the VSCC and the policy listed in LCCC for the supplied chaincode
76-
func (c *ccProviderImpl) GetCCValidationInfoFromLCCC(ctxt context.Context, txid string, prop *pb.Proposal, chainID string, chaincodeID string) (string, []byte, error) {
76+
func (c *ccProviderImpl) GetCCValidationInfoFromLCCC(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) (string, []byte, error) {
7777
// LCCC does not have any notion about its own
7878
// endorsing policy - we should never call this
7979
// function with lccc as the chaincodeID
8080
if chaincodeID == "lccc" {
8181
panic("GetCCValidationInfoFromLCCC invoke for LCCC")
8282
}
8383

84-
data, err := GetChaincodeDataFromLCCC(ctxt, txid, prop, chainID, chaincodeID)
84+
data, err := GetChaincodeDataFromLCCC(ctxt, txid, signedProp, prop, chainID, chaincodeID)
8585
if err != nil {
8686
return "", nil, err
8787
}

core/chaincode/chaincode_support.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func (chaincodeSupport *ChaincodeSupport) sendReady(context context.Context, ccc
291291

292292
var notfy chan *pb.ChaincodeMessage
293293
var err error
294-
if notfy, err = chrte.handler.ready(context, cccid.ChainID, cccid.TxID, cccid.Proposal); err != nil {
294+
if notfy, err = chrte.handler.ready(context, cccid.ChainID, cccid.TxID, cccid.SignedProposal, cccid.Proposal); err != nil {
295295
return fmt.Errorf("Error sending %s: %s", pb.ChaincodeMessage_INIT, err)
296296
}
297297
if notfy != nil {
@@ -533,7 +533,7 @@ func (chaincodeSupport *ChaincodeSupport) Launch(context context.Context, cccid
533533
var depPayload []byte
534534

535535
//hopefully we are restarting from existing image and the deployed transaction exists
536-
depPayload, err = GetCDSFromLCCC(context, cccid.TxID, cccid.Proposal, cccid.ChainID, cID.Name)
536+
depPayload, err = GetCDSFromLCCC(context, cccid.TxID, cccid.SignedProposal, cccid.Proposal, cccid.ChainID, cID.Name)
537537
if err != nil {
538538
return cID, cMsg, fmt.Errorf("Could not get deployment transaction from LCCC for %s - %s", canName, err)
539539
}
@@ -642,7 +642,7 @@ func (chaincodeSupport *ChaincodeSupport) Execute(ctxt context.Context, cccid *c
642642

643643
var notfy chan *pb.ChaincodeMessage
644644
var err error
645-
if notfy, err = chrte.handler.sendExecuteMessage(ctxt, cccid.ChainID, msg, cccid.Proposal); err != nil {
645+
if notfy, err = chrte.handler.sendExecuteMessage(ctxt, cccid.ChainID, msg, cccid.SignedProposal, cccid.Proposal); err != nil {
646646
return nil, fmt.Errorf("Error sending %s: %s", msg.Type.String(), err)
647647
}
648648
var ccresp *pb.ChaincodeMessage

core/chaincode/chaincodeexec.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ func createCIS(ccname string, args [][]byte) (*pb.ChaincodeInvocationSpec, error
3939
}
4040

4141
// GetCDSFromLCCC gets chaincode deployment spec from LCCC
42-
func GetCDSFromLCCC(ctxt context.Context, txid string, prop *pb.Proposal, chainID string, chaincodeID string) ([]byte, error) {
42+
func GetCDSFromLCCC(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) ([]byte, error) {
4343
version := util.GetSysCCVersion()
44-
cccid := ccprovider.NewCCContext(chainID, "lccc", version, txid, true, prop)
44+
cccid := ccprovider.NewCCContext(chainID, "lccc", version, txid, true, signedProp, prop)
4545
res, _, err := ExecuteChaincode(ctxt, cccid, [][]byte{[]byte("getdepspec"), []byte(chainID), []byte(chaincodeID)})
4646
if err != nil {
4747
return nil, fmt.Errorf("Execute getdepspec(%s, %s) of LCCC error: %s", chainID, chaincodeID, err)
@@ -54,9 +54,9 @@ func GetCDSFromLCCC(ctxt context.Context, txid string, prop *pb.Proposal, chainI
5454
}
5555

5656
// GetChaincodeDataFromLCCC gets chaincode data from LCCC given name
57-
func GetChaincodeDataFromLCCC(ctxt context.Context, txid string, prop *pb.Proposal, chainID string, chaincodeID string) (*ccprovider.ChaincodeData, error) {
57+
func GetChaincodeDataFromLCCC(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) (*ccprovider.ChaincodeData, error) {
5858
version := util.GetSysCCVersion()
59-
cccid := ccprovider.NewCCContext(chainID, "lccc", version, txid, true, prop)
59+
cccid := ccprovider.NewCCContext(chainID, "lccc", version, txid, true, signedProp, prop)
6060
res, _, err := ExecuteChaincode(ctxt, cccid, [][]byte{[]byte("getccdata"), []byte(chainID), []byte(chaincodeID)})
6161
if err == nil {
6262
if res.Status != shim.OK {

core/chaincode/concurrency_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestExecuteConcurrentInvokes(t *testing.T) {
5454

5555
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeId: chaincodeID, Input: &pb.ChaincodeInput{Args: args}}
5656

57-
cccid := ccprovider.NewCCContext(chainID, "nkpi", "0", "", false, nil)
57+
cccid := ccprovider.NewCCContext(chainID, "nkpi", "0", "", false, nil, nil)
5858

5959
defer theChaincodeSupport.Stop(ctxt, cccid, &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec})
6060

core/chaincode/exectransaction_test.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ func deploy2(ctx context.Context, cccid *ccprovider.CCContext, chaincodeDeployme
288288
ccprovider.PutChaincodeIntoFS(chaincodeDeploymentSpec)
289289

290290
sysCCVers := util.GetSysCCVersion()
291-
lcccid := ccprovider.NewCCContext(cccid.ChainID, cis.ChaincodeSpec.ChaincodeId.Name, sysCCVers, uuid, true, nil)
291+
lcccid := ccprovider.NewCCContext(cccid.ChainID, cis.ChaincodeSpec.ChaincodeId.Name, sysCCVers, uuid, true, nil, nil)
292292

293293
//write to lccc
294294
if _, _, err = ExecuteWithErrorFilter(ctx, lcccid, cis); err != nil {
@@ -331,7 +331,7 @@ func invokeWithVersion(ctx context.Context, chainID string, version string, spec
331331
}
332332
}()
333333

334-
cccid := ccprovider.NewCCContext(chainID, chaincodeInvocationSpec.ChaincodeSpec.ChaincodeId.Name, version, uuid, false, nil)
334+
cccid := ccprovider.NewCCContext(chainID, chaincodeInvocationSpec.ChaincodeSpec.ChaincodeId.Name, version, uuid, false, nil, nil)
335335
retval, ccevt, err = ExecuteWithErrorFilter(ctx, cccid, chaincodeInvocationSpec)
336336
if err != nil {
337337
return nil, uuid, nil, fmt.Errorf("Error invoking chaincode: %s", err)
@@ -362,7 +362,7 @@ func executeDeployTransaction(t *testing.T, chainID string, name string, url str
362362
args := util.ToChaincodeArgs(f, "a", "100", "b", "200")
363363
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeId: &pb.ChaincodeID{Name: name, Path: url, Version: "0"}, Input: &pb.ChaincodeInput{Args: args}}
364364

365-
cccid := ccprovider.NewCCContext(chainID, name, "0", "", false, nil)
365+
cccid := ccprovider.NewCCContext(chainID, name, "0", "", false, nil, nil)
366366

367367
_, err = deploy(ctxt, cccid, spec, 0)
368368

@@ -389,7 +389,7 @@ func chaincodeQueryChaincode(chainID string, user string) error {
389389

390390
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID1, Input: &pb.ChaincodeInput{Args: args}}
391391

392-
cccid1 := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil)
392+
cccid1 := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil, nil)
393393

394394
var nextBlockNumber uint64
395395

@@ -413,7 +413,7 @@ func chaincodeQueryChaincode(chainID string, user string) error {
413413

414414
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID2, Input: &pb.ChaincodeInput{Args: args}}
415415

416-
cccid2 := ccprovider.NewCCContext(chainID, "example05", "0", "", false, nil)
416+
cccid2 := ccprovider.NewCCContext(chainID, "example05", "0", "", false, nil, nil)
417417

418418
_, err = deploy(ctxt, cccid2, spec2, nextBlockNumber)
419419
nextBlockNumber++
@@ -618,7 +618,7 @@ func TestExecuteInvokeTransaction(t *testing.T) {
618618

619619
var ctxt = context.Background()
620620

621-
cccid := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil)
621+
cccid := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil, nil)
622622
url := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
623623
chaincodeID := &pb.ChaincodeID{Name: "example02", Path: url, Version: "0"}
624624

@@ -652,7 +652,7 @@ func TestExecuteInvokeInvalidTransaction(t *testing.T) {
652652
url := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
653653
chaincodeID := &pb.ChaincodeID{Name: "example02", Path: url, Version: "0"}
654654

655-
cccid := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil)
655+
cccid := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil, nil)
656656

657657
//FAIL, FAIL!
658658
args := []string{"x", "-1"}
@@ -709,7 +709,7 @@ func chaincodeInvokeChaincode(t *testing.T, chainID string, user string) (err er
709709

710710
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID1, Input: &pb.ChaincodeInput{Args: args}}
711711

712-
cccid1 := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil)
712+
cccid1 := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil, nil)
713713

714714
var nextBlockNumber uint64
715715

@@ -736,7 +736,7 @@ func chaincodeInvokeChaincode(t *testing.T, chainID string, user string) (err er
736736

737737
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID2, Input: &pb.ChaincodeInput{Args: args}}
738738

739-
cccid2 := ccprovider.NewCCContext(chainID, "example04", "0", "", false, nil)
739+
cccid2 := ccprovider.NewCCContext(chainID, "example04", "0", "", false, nil, nil)
740740

741741
_, err = deploy(ctxt, cccid2, spec2, nextBlockNumber)
742742
nextBlockNumber++
@@ -812,7 +812,7 @@ func TestChaincodeInvokeChaincodeErrorCase(t *testing.T) {
812812

813813
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID1, Input: &pb.ChaincodeInput{Args: args}}
814814

815-
cccid1 := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil)
815+
cccid1 := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil, nil)
816816

817817
var nextBlockNumber uint64
818818

@@ -837,7 +837,7 @@ func TestChaincodeInvokeChaincodeErrorCase(t *testing.T) {
837837

838838
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID2, Input: &pb.ChaincodeInput{Args: args}}
839839

840-
cccid2 := ccprovider.NewCCContext(chainID, "pthru", "0", "", false, nil)
840+
cccid2 := ccprovider.NewCCContext(chainID, "pthru", "0", "", false, nil, nil)
841841

842842
_, err = deploy(ctxt, cccid2, spec2, nextBlockNumber)
843843
nextBlockNumber++
@@ -903,7 +903,7 @@ func TestQueries(t *testing.T) {
903903

904904
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID, Input: &pb.ChaincodeInput{Args: args}}
905905

906-
cccid := ccprovider.NewCCContext(chainID, "tmap", "0", "", false, nil)
906+
cccid := ccprovider.NewCCContext(chainID, "tmap", "0", "", false, nil, nil)
907907

908908
var nextBlockNumber uint64
909909
_, err = deploy(ctxt, cccid, spec, nextBlockNumber)
@@ -1003,7 +1003,7 @@ func TestGetEvent(t *testing.T) {
10031003
f := "init"
10041004
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID, Input: &pb.ChaincodeInput{Args: util.ToChaincodeArgs(f)}}
10051005

1006-
cccid := ccprovider.NewCCContext(chainID, "esender", "0", "", false, nil)
1006+
cccid := ccprovider.NewCCContext(chainID, "esender", "0", "", false, nil, nil)
10071007
var nextBlockNumber uint64
10081008
_, err = deploy(ctxt, cccid, spec, nextBlockNumber)
10091009
nextBlockNumber++
@@ -1073,7 +1073,7 @@ func TestChaincodeQueryChaincodeUsingInvoke(t *testing.T) {
10731073

10741074
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID1, Input: &pb.ChaincodeInput{Args: args}}
10751075

1076-
cccid1 := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil)
1076+
cccid1 := ccprovider.NewCCContext(chainID, "example02", "0", "", false, nil, nil)
10771077
var nextBlockNumber uint64
10781078
_, err = deploy(ctxt, cccid1, spec1, nextBlockNumber)
10791079
nextBlockNumber++
@@ -1096,7 +1096,7 @@ func TestChaincodeQueryChaincodeUsingInvoke(t *testing.T) {
10961096

10971097
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeId: cID2, Input: &pb.ChaincodeInput{Args: args}}
10981098

1099-
cccid2 := ccprovider.NewCCContext(chainID, "example05", "0", "", false, nil)
1099+
cccid2 := ccprovider.NewCCContext(chainID, "example05", "0", "", false, nil, nil)
11001100

11011101
_, err = deploy(ctxt, cccid2, spec2, nextBlockNumber)
11021102
nextBlockNumber++

core/chaincode/handler.go

+21-13
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type MessageHandler interface {
5454

5555
type transactionContext struct {
5656
chainID string
57+
signedProp *pb.SignedProposal
5758
proposal *pb.Proposal
5859
responseNotifier chan *pb.ChaincodeMessage
5960

@@ -181,7 +182,7 @@ func (handler *Handler) serialSendAsync(msg *pb.ChaincodeMessage, errc chan erro
181182
}()
182183
}
183184

184-
func (handler *Handler) createTxContext(ctxt context.Context, chainID string, txid string, prop *pb.Proposal) (*transactionContext, error) {
185+
func (handler *Handler) createTxContext(ctxt context.Context, chainID string, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal) (*transactionContext, error) {
185186
if handler.txCtxs == nil {
186187
return nil, fmt.Errorf("cannot create notifier for txid:%s", txid)
187188
}
@@ -190,7 +191,7 @@ func (handler *Handler) createTxContext(ctxt context.Context, chainID string, tx
190191
if handler.txCtxs[txid] != nil {
191192
return nil, fmt.Errorf("txid:%s exists", txid)
192193
}
193-
txctx := &transactionContext{chainID: chainID, proposal: prop, responseNotifier: make(chan *pb.ChaincodeMessage, 1),
194+
txctx := &transactionContext{chainID: chainID, signedProp: signedProp, proposal: prop, responseNotifier: make(chan *pb.ChaincodeMessage, 1),
194195
queryIteratorMap: make(map[string]commonledger.ResultsIterator)}
195196
handler.txCtxs[txid] = txctx
196197
txctx.txsimulator = getTxSimulator(ctxt)
@@ -233,7 +234,7 @@ func (handler *Handler) deleteQueryIterator(txContext *transactionContext, txid
233234
}
234235

235236
// Check if the transactor is allow to call this chaincode on this channel
236-
func (handler *Handler) checkACL(proposal *pb.Proposal, calledCC *ccParts) *pb.ChaincodeMessage {
237+
func (handler *Handler) checkACL(signedProp *pb.SignedProposal, proposal *pb.Proposal, calledCC *ccParts) *pb.ChaincodeMessage {
237238
// TODO: Decide what to pass in to verify that this transactor can access this
238239
// channel (chID) and chaincode (ccID). Very likely we need the signedProposal
239240
// which contains the sig and creator cert
@@ -1249,7 +1250,7 @@ func (handler *Handler) enterBusyState(e *fsm.Event, state string) {
12491250
shorttxid(msg.Txid), calledCcParts.name, calledCcParts.suffix)
12501251
}
12511252

1252-
triggerNextStateMsg = handler.checkACL(txContext.proposal, calledCcParts)
1253+
triggerNextStateMsg = handler.checkACL(txContext.signedProp, txContext.proposal, calledCcParts)
12531254
if triggerNextStateMsg != nil {
12541255
return
12551256
}
@@ -1286,15 +1287,15 @@ func (handler *Handler) enterBusyState(e *fsm.Event, state string) {
12861287

12871288
//Call LCCC to get the called chaincode artifacts
12881289
var cd *ccprovider.ChaincodeData
1289-
cd, err = GetChaincodeDataFromLCCC(ctxt, msg.Txid, txContext.proposal, calledCcParts.suffix, calledCcParts.name)
1290+
cd, err = GetChaincodeDataFromLCCC(ctxt, msg.Txid, txContext.signedProp, txContext.proposal, calledCcParts.suffix, calledCcParts.name)
12901291
if err != nil {
12911292
payload := []byte(err.Error())
12921293
chaincodeLogger.Debugf("[%s]Failed to get chaincoed data (%s) for invoked chaincode. Sending %s",
12931294
shorttxid(msg.Txid), err, pb.ChaincodeMessage_ERROR)
12941295
triggerNextStateMsg = &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Payload: payload, Txid: msg.Txid}
12951296
return
12961297
}
1297-
cccid := ccprovider.NewCCContext(calledCcParts.suffix, calledCcParts.name, cd.Version, msg.Txid, false, txContext.proposal)
1298+
cccid := ccprovider.NewCCContext(calledCcParts.suffix, calledCcParts.name, cd.Version, msg.Txid, false, txContext.signedProp, txContext.proposal)
12981299

12991300
// Launch the new chaincode if not already running
13001301
if chaincodeLogger.IsEnabledFor(logging.DEBUG) {
@@ -1373,27 +1374,33 @@ func (handler *Handler) enterEndState(e *fsm.Event, state string) {
13731374
e.Cancel(fmt.Errorf("Entered end state"))
13741375
}
13751376

1376-
func (handler *Handler) setChaincodeProposal(prop *pb.Proposal, msg *pb.ChaincodeMessage) error {
1377+
func (handler *Handler) setChaincodeProposal(signedProp *pb.SignedProposal, prop *pb.Proposal, msg *pb.ChaincodeMessage) error {
13771378
chaincodeLogger.Debug("Setting chaincode proposal context...")
13781379
if prop != nil {
13791380
chaincodeLogger.Debug("Proposal different from nil. Creating chaincode proposal context...")
13801381

1382+
// Check that also signedProp is different from nil
1383+
if signedProp == nil {
1384+
return fmt.Errorf("Failed getting proposal context. Signed proposal is nil.")
1385+
}
1386+
13811387
msg.Proposal = prop
13821388
}
13831389
return nil
13841390
}
13851391

13861392
//move to ready
1387-
func (handler *Handler) ready(ctxt context.Context, chainID string, txid string, prop *pb.Proposal) (chan *pb.ChaincodeMessage, error) {
1388-
txctx, funcErr := handler.createTxContext(ctxt, chainID, txid, prop)
1393+
func (handler *Handler) ready(ctxt context.Context, chainID string, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal) (chan *pb.ChaincodeMessage, error) {
1394+
txctx, funcErr := handler.createTxContext(ctxt, chainID, txid, signedProp, prop)
13891395
if funcErr != nil {
13901396
return nil, funcErr
13911397
}
13921398

13931399
chaincodeLogger.Debug("sending READY")
13941400
ccMsg := &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_READY, Txid: txid}
13951401

1396-
if err := handler.setChaincodeProposal(prop, ccMsg); err != nil {
1402+
//if security is disabled the context elements will just be nil
1403+
if err := handler.setChaincodeProposal(signedProp, prop, ccMsg); err != nil {
13971404
return nil, err
13981405
}
13991406

@@ -1448,16 +1455,17 @@ func filterError(errFromFSMEvent error) error {
14481455
return nil
14491456
}
14501457

1451-
func (handler *Handler) sendExecuteMessage(ctxt context.Context, chainID string, msg *pb.ChaincodeMessage, prop *pb.Proposal) (chan *pb.ChaincodeMessage, error) {
1452-
txctx, err := handler.createTxContext(ctxt, chainID, msg.Txid, prop)
1458+
func (handler *Handler) sendExecuteMessage(ctxt context.Context, chainID string, msg *pb.ChaincodeMessage, signedProp *pb.SignedProposal, prop *pb.Proposal) (chan *pb.ChaincodeMessage, error) {
1459+
txctx, err := handler.createTxContext(ctxt, chainID, msg.Txid, signedProp, prop)
14531460
if err != nil {
14541461
return nil, err
14551462
}
14561463
if chaincodeLogger.IsEnabledFor(logging.DEBUG) {
14571464
chaincodeLogger.Debugf("[%s]Inside sendExecuteMessage. Message %s", shorttxid(msg.Txid), msg.Type.String())
14581465
}
14591466

1460-
if err = handler.setChaincodeProposal(prop, msg); err != nil {
1467+
//if security is disabled the context elements will just be nil
1468+
if err = handler.setChaincodeProposal(signedProp, prop, msg); err != nil {
14611469
return nil, err
14621470
}
14631471

core/chaincode/multichains_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestExecuteInvokeOnManyChains(t *testing.T) {
4242

4343
args := []string{"a", "b", "10"}
4444
for _, c := range chains {
45-
cccid := ccprovider.NewCCContext(c, "example02", "0", "", false, nil)
45+
cccid := ccprovider.NewCCContext(c, "example02", "0", "", false, nil, nil)
4646
err = invokeExample02Transaction(ctxt, cccid, chaincodeID, args, false)
4747
if err != nil {
4848
t.Fail()

core/chaincode/systemchaincode_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func deploySampleSysCC(t *testing.T, ctxt context.Context, chainID string) error
108108
_, _, _, err := invokeWithVersion(ctxt, chainID, sysCCVers, spec, nextBlockNumber)
109109
nextBlockNumber++
110110

111-
cccid := ccprovider.NewCCContext(chainID, "sample_syscc", sysCCVers, "", true, nil)
111+
cccid := ccprovider.NewCCContext(chainID, "sample_syscc", sysCCVers, "", true, nil, nil)
112112
cdsforStop := &pb.ChaincodeDeploymentSpec{ExecEnv: 1, ChaincodeSpec: spec}
113113
if err != nil {
114114
theChaincodeSupport.Stop(ctxt, cccid, cdsforStop)

0 commit comments

Comments
 (0)