Skip to content

Commit 78c4b68

Browse files
committed
Move chaincode argument helpers to util
Change-Id: Iff28dc9f8b828a47978846741054599c02d3a39c Signed-off-by: Gabor Hosszu <[email protected]>
1 parent 8ea25a9 commit 78c4b68

File tree

14 files changed

+69
-70
lines changed

14 files changed

+69
-70
lines changed

bddtests/syschaincode/noop/chaincode_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"testing"
2222

2323
"github.com/golang/protobuf/proto"
24-
"github.com/hyperledger/fabric/core/chaincode/shim"
24+
"github.com/hyperledger/fabric/core/util"
2525
"github.com/hyperledger/fabric/protos"
2626
)
2727

@@ -116,7 +116,7 @@ func (ml mockLedger) GetTransactionByID(txID string) (*protos.Transaction, error
116116
if txID == "noSuchTX" {
117117
return nil, fmt.Errorf("Some error")
118118
}
119-
newCCIS := &protos.ChaincodeInvocationSpec{ChaincodeSpec: &protos.ChaincodeSpec{CtorMsg: &protos.ChaincodeInput{Args: shim.ToChaincodeArgs("execute", something)}}}
119+
newCCIS := &protos.ChaincodeInvocationSpec{ChaincodeSpec: &protos.ChaincodeSpec{CtorMsg: &protos.ChaincodeInput{Args: util.ToChaincodeArgs("execute", something)}}}
120120
pl, _ := proto.Marshal(newCCIS)
121121
return &protos.Transaction{Payload: pl}, nil
122122
}

core/chaincode/exectransaction_test.go

+26-27
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828

2929
"path/filepath"
3030

31-
"github.com/hyperledger/fabric/core/chaincode/shim"
3231
"github.com/hyperledger/fabric/core/container"
3332
"github.com/hyperledger/fabric/core/container/ccintf"
3433
"github.com/hyperledger/fabric/core/crypto"
@@ -339,7 +338,7 @@ func executeDeployTransaction(t *testing.T, url string) {
339338
var ctxt = context.Background()
340339

341340
f := "init"
342-
args := shim.ToChaincodeArgs(f, "a", "100", "b", "200")
341+
args := util.ToChaincodeArgs(f, "a", "100", "b", "200")
343342
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: &pb.ChaincodeID{Path: url}, CtorMsg: &pb.ChaincodeInput{Args: args}}
344343
_, err = deploy(ctxt, spec)
345344
chaincodeID := spec.ChaincodeID.Name
@@ -426,7 +425,7 @@ func checkFinalState(uuid string, chaincodeID string) error {
426425
func invokeExample02Transaction(ctxt context.Context, cID *pb.ChaincodeID, args []string, destroyImage bool) error {
427426

428427
f := "init"
429-
argsDeploy := shim.ToChaincodeArgs(f, "a", "100", "b", "200")
428+
argsDeploy := util.ToChaincodeArgs(f, "a", "100", "b", "200")
430429
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: argsDeploy}}
431430
_, err := deploy(ctxt, spec)
432431
chaincodeID := spec.ChaincodeID.Name
@@ -449,7 +448,7 @@ func invokeExample02Transaction(ctxt context.Context, cID *pb.ChaincodeID, args
449448

450449
f = "invoke"
451450
invokeArgs := append([]string{f}, args...)
452-
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: shim.ToChaincodeArgs(invokeArgs...)}}
451+
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: util.ToChaincodeArgs(invokeArgs...)}}
453452
_, uuid, _, err := invoke(ctxt, spec, pb.Transaction_CHAINCODE_INVOKE)
454453
if err != nil {
455454
return fmt.Errorf("Error invoking <%s>: %s", chaincodeID, err)
@@ -462,7 +461,7 @@ func invokeExample02Transaction(ctxt context.Context, cID *pb.ChaincodeID, args
462461

463462
// Test for delete state
464463
f = "delete"
465-
delArgs := shim.ToChaincodeArgs(f, "a")
464+
delArgs := util.ToChaincodeArgs(f, "a")
466465
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: delArgs}}
467466
_, uuid, _, err = invoke(ctxt, spec, pb.Transaction_CHAINCODE_INVOKE)
468467
if err != nil {
@@ -542,12 +541,12 @@ func exec(ctxt context.Context, chaincodeID string, numTrans int, numQueries int
542541
var spec *pb.ChaincodeSpec
543542
if typ == pb.Transaction_CHAINCODE_INVOKE {
544543
f := "invoke"
545-
args := shim.ToChaincodeArgs(f, "a", "b", "10")
544+
args := util.ToChaincodeArgs(f, "a", "b", "10")
546545

547546
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: &pb.ChaincodeID{Name: chaincodeID}, CtorMsg: &pb.ChaincodeInput{Args: args}}
548547
} else {
549548
f := "query"
550-
args := shim.ToChaincodeArgs(f, "a")
549+
args := util.ToChaincodeArgs(f, "a")
551550

552551
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: &pb.ChaincodeID{Name: chaincodeID}, CtorMsg: &pb.ChaincodeInput{Args: args}}
553552
}
@@ -617,7 +616,7 @@ func TestExecuteQuery(t *testing.T) {
617616

618617
cID := &pb.ChaincodeID{Path: url}
619618
f := "init"
620-
args := shim.ToChaincodeArgs(f, "a", "100", "b", "200")
619+
args := util.ToChaincodeArgs(f, "a", "100", "b", "200")
621620

622621
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: args}}
623622

@@ -763,7 +762,7 @@ func TestExecuteInvalidQuery(t *testing.T) {
763762

764763
cID := &pb.ChaincodeID{Path: url}
765764
f := "init"
766-
args := shim.ToChaincodeArgs(f, "a", "100")
765+
args := util.ToChaincodeArgs(f, "a", "100")
767766

768767
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: args}}
769768

@@ -780,7 +779,7 @@ func TestExecuteInvalidQuery(t *testing.T) {
780779
time.Sleep(time.Second)
781780

782781
f = "query"
783-
args = shim.ToChaincodeArgs(f, "b", "200")
782+
args = util.ToChaincodeArgs(f, "b", "200")
784783

785784
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: args}}
786785
// This query should fail as it attempts to put state
@@ -837,7 +836,7 @@ func TestChaincodeInvokeChaincode(t *testing.T) {
837836

838837
cID1 := &pb.ChaincodeID{Path: url1}
839838
f := "init"
840-
args := shim.ToChaincodeArgs(f, "a", "100", "b", "200")
839+
args := util.ToChaincodeArgs(f, "a", "100", "b", "200")
841840

842841
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID1, CtorMsg: &pb.ChaincodeInput{Args: args}}
843842

@@ -860,7 +859,7 @@ func TestChaincodeInvokeChaincode(t *testing.T) {
860859

861860
cID2 := &pb.ChaincodeID{Path: url2}
862861
f = "init"
863-
args = shim.ToChaincodeArgs(f, "e", "0")
862+
args = util.ToChaincodeArgs(f, "e", "0")
864863

865864
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
866865

@@ -879,7 +878,7 @@ func TestChaincodeInvokeChaincode(t *testing.T) {
879878

880879
// Invoke second chaincode, which will inturn invoke the first chaincode
881880
f = "invoke"
882-
args = shim.ToChaincodeArgs(f, "e", "1")
881+
args = util.ToChaincodeArgs(f, "e", "1")
883882

884883
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
885884
// Invoke chaincode
@@ -953,7 +952,7 @@ func TestChaincodeInvokeChaincodeErrorCase(t *testing.T) {
953952

954953
cID1 := &pb.ChaincodeID{Path: url1}
955954
f := "init"
956-
args := shim.ToChaincodeArgs(f, "a", "100", "b", "200")
955+
args := util.ToChaincodeArgs(f, "a", "100", "b", "200")
957956

958957
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID1, CtorMsg: &pb.ChaincodeInput{Args: args}}
959958

@@ -974,7 +973,7 @@ func TestChaincodeInvokeChaincodeErrorCase(t *testing.T) {
974973

975974
cID2 := &pb.ChaincodeID{Path: url2}
976975
f = "init"
977-
args = shim.ToChaincodeArgs(f)
976+
args = util.ToChaincodeArgs(f)
978977

979978
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
980979

@@ -993,7 +992,7 @@ func TestChaincodeInvokeChaincodeErrorCase(t *testing.T) {
993992

994993
// Invoke second chaincode, which will inturn invoke the first chaincode but pass bad params
995994
f = chaincodeID1
996-
args = shim.ToChaincodeArgs(f, "invoke", "a")
995+
args = util.ToChaincodeArgs(f, "invoke", "a")
997996

998997
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
999998
// Invoke chaincode
@@ -1030,7 +1029,7 @@ func chaincodeQueryChaincode(user string) error {
10301029

10311030
cID1 := &pb.ChaincodeID{Path: url1}
10321031
f := "init"
1033-
args := shim.ToChaincodeArgs(f, "a", "100", "b", "200")
1032+
args := util.ToChaincodeArgs(f, "a", "100", "b", "200")
10341033

10351034
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID1, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
10361035

@@ -1048,7 +1047,7 @@ func chaincodeQueryChaincode(user string) error {
10481047

10491048
cID2 := &pb.ChaincodeID{Path: url2}
10501049
f = "init"
1051-
args = shim.ToChaincodeArgs(f, "sum", "0")
1050+
args = util.ToChaincodeArgs(f, "sum", "0")
10521051

10531052
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
10541053

@@ -1064,7 +1063,7 @@ func chaincodeQueryChaincode(user string) error {
10641063

10651064
// Invoke second chaincode, which will inturn query the first chaincode
10661065
f = "invoke"
1067-
args = shim.ToChaincodeArgs(f, chaincodeID1, "sum")
1066+
args = util.ToChaincodeArgs(f, chaincodeID1, "sum")
10681067

10691068
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
10701069
// Invoke chaincode
@@ -1087,7 +1086,7 @@ func chaincodeQueryChaincode(user string) error {
10871086

10881087
// Query second chaincode, which will inturn query the first chaincode
10891088
f = "query"
1090-
args = shim.ToChaincodeArgs(f, chaincodeID1, "sum")
1089+
args = util.ToChaincodeArgs(f, chaincodeID1, "sum")
10911090

10921091
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
10931092
// Invoke chaincode
@@ -1176,7 +1175,7 @@ func TestChaincodeQueryChaincodeErrorCase(t *testing.T) {
11761175

11771176
cID1 := &pb.ChaincodeID{Path: url1}
11781177
f := "init"
1179-
args := shim.ToChaincodeArgs(f, "a", "100", "b", "200")
1178+
args := util.ToChaincodeArgs(f, "a", "100", "b", "200")
11801179

11811180
spec1 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID1, CtorMsg: &pb.ChaincodeInput{Args: args}}
11821181

@@ -1197,7 +1196,7 @@ func TestChaincodeQueryChaincodeErrorCase(t *testing.T) {
11971196

11981197
cID2 := &pb.ChaincodeID{Path: url2}
11991198
f = "init"
1200-
args = shim.ToChaincodeArgs(f)
1199+
args = util.ToChaincodeArgs(f)
12011200

12021201
spec2 := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
12031202

@@ -1216,7 +1215,7 @@ func TestChaincodeQueryChaincodeErrorCase(t *testing.T) {
12161215

12171216
// Invoke second chaincode, which will inturn invoke the first chaincode but pass bad params
12181217
f = chaincodeID1
1219-
args = shim.ToChaincodeArgs(f, "query", "c")
1218+
args = util.ToChaincodeArgs(f, "query", "c")
12201219

12211220
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}}
12221221
// Invoke chaincode
@@ -1340,7 +1339,7 @@ func TestRangeQuery(t *testing.T) {
13401339
cID := &pb.ChaincodeID{Path: url}
13411340

13421341
f := "init"
1343-
args := shim.ToChaincodeArgs(f)
1342+
args := util.ToChaincodeArgs(f)
13441343

13451344
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: args}}
13461345

@@ -1356,7 +1355,7 @@ func TestRangeQuery(t *testing.T) {
13561355

13571356
// Invoke second chaincode, which will inturn invoke the first chaincode
13581357
f = "keys"
1359-
args = shim.ToChaincodeArgs(f)
1358+
args = util.ToChaincodeArgs(f)
13601359

13611360
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: args}}
13621361
_, _, _, err = invoke(ctxt, spec, pb.Transaction_CHAINCODE_QUERY)
@@ -1411,7 +1410,7 @@ func TestGetEvent(t *testing.T) {
14111410

14121411
cID := &pb.ChaincodeID{Path: url}
14131412
f := "init"
1414-
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: shim.ToChaincodeArgs(f)}}
1413+
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: util.ToChaincodeArgs(f)}}
14151414

14161415
_, err = deploy(ctxt, spec)
14171416
chaincodeID := spec.ChaincodeID.Name
@@ -1425,7 +1424,7 @@ func TestGetEvent(t *testing.T) {
14251424

14261425
time.Sleep(time.Second)
14271426

1428-
args := shim.ToChaincodeArgs("", "i", "am", "satoshi")
1427+
args := util.ToChaincodeArgs("", "i", "am", "satoshi")
14291428

14301429
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID, CtorMsg: &pb.ChaincodeInput{Args: args}}
14311430

core/chaincode/platforms/car/test/car_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
"os"
2121
"testing"
2222

23-
"github.com/hyperledger/fabric/core/chaincode/shim"
2423
"github.com/hyperledger/fabric/core/config"
2524
"github.com/hyperledger/fabric/core/container"
25+
"github.com/hyperledger/fabric/core/util"
2626
pb "github.com/hyperledger/fabric/protos"
2727
)
2828

@@ -49,7 +49,7 @@ func TestCar_BuildImage(t *testing.T) {
4949
}
5050

5151
chaincodePath := cwd + "/org.hyperledger.chaincode.example02-0.1-SNAPSHOT.car"
52-
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_CAR, ChaincodeID: &pb.ChaincodeID{Path: chaincodePath}, CtorMsg: &pb.ChaincodeInput{Args: shim.ToChaincodeArgs("f")}}
52+
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_CAR, ChaincodeID: &pb.ChaincodeID{Path: chaincodePath}, CtorMsg: &pb.ChaincodeInput{Args: util.ToChaincodeArgs("f")}}
5353
if _, err := vm.BuildChaincodeContainer(spec); err != nil {
5454
t.Fail()
5555
t.Log(err)

core/chaincode/platforms/java/test/java_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
"os"
2121
"testing"
2222

23-
"github.com/hyperledger/fabric/core/chaincode/shim"
2423
"github.com/hyperledger/fabric/core/config"
2524
"github.com/hyperledger/fabric/core/container"
25+
"github.com/hyperledger/fabric/core/util"
2626
pb "github.com/hyperledger/fabric/protos"
2727
)
2828

@@ -42,7 +42,7 @@ func TestJava_BuildImage(t *testing.T) {
4242

4343
chaincodePath := "../../../shim/java"
4444
//TODO find a better way to launch example java chaincode
45-
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_JAVA, ChaincodeID: &pb.ChaincodeID{Path: chaincodePath}, CtorMsg: &pb.ChaincodeInput{Args: shim.ToChaincodeArgs("f")}}
45+
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_JAVA, ChaincodeID: &pb.ChaincodeID{Path: chaincodePath}, CtorMsg: &pb.ChaincodeInput{Args: util.ToChaincodeArgs("f")}}
4646
if _, err := vm.BuildChaincodeContainer(spec); err != nil {
4747
t.Fail()
4848
t.Log(err)

core/chaincode/shim/chaincode.go

-16
Original file line numberDiff line numberDiff line change
@@ -1017,19 +1017,3 @@ func (c *ChaincodeLogger) Errorf(format string, args ...interface{}) {
10171017
func (c *ChaincodeLogger) Criticalf(format string, args ...interface{}) {
10181018
c.logger.Criticalf(format, args...)
10191019
}
1020-
1021-
func ToChaincodeArgs(args ...string) [][]byte {
1022-
bargs := make([][]byte, len(args))
1023-
for i, arg := range args {
1024-
bargs[i] = []byte(arg)
1025-
}
1026-
return bargs
1027-
}
1028-
1029-
func ArrayToChaincodeArgs(args []string) [][]byte {
1030-
bargs := make([][]byte, len(args))
1031-
for i, arg := range args {
1032-
bargs[i] = []byte(arg)
1033-
}
1034-
return bargs
1035-
}

core/container/vm_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
"os"
2525
"testing"
2626

27-
"github.com/hyperledger/fabric/core/chaincode/shim"
2827
cutil "github.com/hyperledger/fabric/core/container/util"
28+
"github.com/hyperledger/fabric/core/util"
2929
pb "github.com/hyperledger/fabric/protos"
3030
"golang.org/x/net/context"
3131
)
@@ -74,7 +74,7 @@ func TestVM_BuildImage_ChaincodeLocal(t *testing.T) {
7474
}
7575
// Build the spec
7676
chaincodePath := "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example01"
77-
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_GOLANG, ChaincodeID: &pb.ChaincodeID{Path: chaincodePath}, CtorMsg: &pb.ChaincodeInput{Args: shim.ToChaincodeArgs("f")}}
77+
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_GOLANG, ChaincodeID: &pb.ChaincodeID{Path: chaincodePath}, CtorMsg: &pb.ChaincodeInput{Args: util.ToChaincodeArgs("f")}}
7878
if _, err := vm.BuildChaincodeContainer(spec); err != nil {
7979
t.Fail()
8080
t.Log(err)
@@ -91,7 +91,7 @@ func TestVM_BuildImage_ChaincodeRemote(t *testing.T) {
9191
}
9292
// Build the spec
9393
chaincodePath := "https://github.com/prjayach/chaincode_examples/chaincode_example02"
94-
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_GOLANG, ChaincodeID: &pb.ChaincodeID{Path: chaincodePath}, CtorMsg: &pb.ChaincodeInput{Args: shim.ToChaincodeArgs("f")}}
94+
spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_GOLANG, ChaincodeID: &pb.ChaincodeID{Path: chaincodePath}, CtorMsg: &pb.ChaincodeInput{Args: util.ToChaincodeArgs("f")}}
9595
if _, err := vm.BuildChaincodeContainer(spec); err != nil {
9696
t.Fail()
9797
t.Log(err)

core/ledger/blockchain_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"testing"
2121
"time"
2222

23-
"github.com/hyperledger/fabric/core/chaincode/shim"
2423
"github.com/hyperledger/fabric/core/ledger/testutil"
2524
"github.com/hyperledger/fabric/core/util"
2625
"github.com/hyperledger/fabric/protos"
@@ -59,7 +58,7 @@ func TestBlockChain_SingleBlock(t *testing.T) {
5958
// Create the Chaincode specification
6059
chaincodeSpec := &protos.ChaincodeSpec{Type: protos.ChaincodeSpec_GOLANG,
6160
ChaincodeID: &protos.ChaincodeID{Path: "Contracts"},
62-
CtorMsg: &protos.ChaincodeInput{Args: shim.ToChaincodeArgs("Initialize", "param1")}}
61+
CtorMsg: &protos.ChaincodeInput{Args: util.ToChaincodeArgs("Initialize", "param1")}}
6362
chaincodeDeploymentSepc := &protos.ChaincodeDeploymentSpec{ChaincodeSpec: chaincodeSpec}
6463
uuid := testutil.GenerateID(t)
6564
newChaincodeTx, err := protos.NewChaincodeDeployTransaction(chaincodeDeploymentSepc, uuid)

core/system_chaincode/systemchaincode_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
"time"
2525

2626
"github.com/hyperledger/fabric/core/chaincode"
27-
"github.com/hyperledger/fabric/core/chaincode/shim"
2827
"github.com/hyperledger/fabric/core/db"
2928
"github.com/hyperledger/fabric/core/ledger"
3029
"github.com/hyperledger/fabric/core/system_chaincode/api"
@@ -122,7 +121,7 @@ func TestExecuteDeploySysChaincode(t *testing.T) {
122121

123122
url := "github.com/hyperledger/fabric/core/system_chaincode/sample_syscc"
124123
f := "putval"
125-
args := shim.ToChaincodeArgs(f, "greeting", "hey there")
124+
args := util.ToChaincodeArgs(f, "greeting", "hey there")
126125

127126
spec := &pb.ChaincodeSpec{Type: 1, ChaincodeID: &pb.ChaincodeID{Name: "sample_syscc", Path: url}, CtorMsg: &pb.ChaincodeInput{Args: args}}
128127
_, _, _, err = invoke(ctxt, spec, pb.Transaction_CHAINCODE_INVOKE)
@@ -134,7 +133,7 @@ func TestExecuteDeploySysChaincode(t *testing.T) {
134133
}
135134

136135
f = "getval"
137-
args = shim.ToChaincodeArgs(f, "greeting")
136+
args = util.ToChaincodeArgs(f, "greeting")
138137
spec = &pb.ChaincodeSpec{Type: 1, ChaincodeID: &pb.ChaincodeID{Name: "sample_syscc", Path: url}, CtorMsg: &pb.ChaincodeInput{Args: args}}
139138
_, _, _, err = invoke(ctxt, spec, pb.Transaction_CHAINCODE_QUERY)
140139
if err != nil {

0 commit comments

Comments
 (0)