@@ -28,7 +28,6 @@ import (
28
28
29
29
"path/filepath"
30
30
31
- "github.com/hyperledger/fabric/core/chaincode/shim"
32
31
"github.com/hyperledger/fabric/core/container"
33
32
"github.com/hyperledger/fabric/core/container/ccintf"
34
33
"github.com/hyperledger/fabric/core/crypto"
@@ -339,7 +338,7 @@ func executeDeployTransaction(t *testing.T, url string) {
339
338
var ctxt = context .Background ()
340
339
341
340
f := "init"
342
- args := shim .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
341
+ args := util .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
343
342
spec := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : & pb.ChaincodeID {Path : url }, CtorMsg : & pb.ChaincodeInput {Args : args }}
344
343
_ , err = deploy (ctxt , spec )
345
344
chaincodeID := spec .ChaincodeID .Name
@@ -426,7 +425,7 @@ func checkFinalState(uuid string, chaincodeID string) error {
426
425
func invokeExample02Transaction (ctxt context.Context , cID * pb.ChaincodeID , args []string , destroyImage bool ) error {
427
426
428
427
f := "init"
429
- argsDeploy := shim .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
428
+ argsDeploy := util .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
430
429
spec := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID , CtorMsg : & pb.ChaincodeInput {Args : argsDeploy }}
431
430
_ , err := deploy (ctxt , spec )
432
431
chaincodeID := spec .ChaincodeID .Name
@@ -449,7 +448,7 @@ func invokeExample02Transaction(ctxt context.Context, cID *pb.ChaincodeID, args
449
448
450
449
f = "invoke"
451
450
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 ... )}}
453
452
_ , uuid , _ , err := invoke (ctxt , spec , pb .Transaction_CHAINCODE_INVOKE )
454
453
if err != nil {
455
454
return fmt .Errorf ("Error invoking <%s>: %s" , chaincodeID , err )
@@ -462,7 +461,7 @@ func invokeExample02Transaction(ctxt context.Context, cID *pb.ChaincodeID, args
462
461
463
462
// Test for delete state
464
463
f = "delete"
465
- delArgs := shim .ToChaincodeArgs (f , "a" )
464
+ delArgs := util .ToChaincodeArgs (f , "a" )
466
465
spec = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID , CtorMsg : & pb.ChaincodeInput {Args : delArgs }}
467
466
_ , uuid , _ , err = invoke (ctxt , spec , pb .Transaction_CHAINCODE_INVOKE )
468
467
if err != nil {
@@ -542,12 +541,12 @@ func exec(ctxt context.Context, chaincodeID string, numTrans int, numQueries int
542
541
var spec * pb.ChaincodeSpec
543
542
if typ == pb .Transaction_CHAINCODE_INVOKE {
544
543
f := "invoke"
545
- args := shim .ToChaincodeArgs (f , "a" , "b" , "10" )
544
+ args := util .ToChaincodeArgs (f , "a" , "b" , "10" )
546
545
547
546
spec = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : & pb.ChaincodeID {Name : chaincodeID }, CtorMsg : & pb.ChaincodeInput {Args : args }}
548
547
} else {
549
548
f := "query"
550
- args := shim .ToChaincodeArgs (f , "a" )
549
+ args := util .ToChaincodeArgs (f , "a" )
551
550
552
551
spec = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : & pb.ChaincodeID {Name : chaincodeID }, CtorMsg : & pb.ChaincodeInput {Args : args }}
553
552
}
@@ -617,7 +616,7 @@ func TestExecuteQuery(t *testing.T) {
617
616
618
617
cID := & pb.ChaincodeID {Path : url }
619
618
f := "init"
620
- args := shim .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
619
+ args := util .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
621
620
622
621
spec := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID , CtorMsg : & pb.ChaincodeInput {Args : args }}
623
622
@@ -763,7 +762,7 @@ func TestExecuteInvalidQuery(t *testing.T) {
763
762
764
763
cID := & pb.ChaincodeID {Path : url }
765
764
f := "init"
766
- args := shim .ToChaincodeArgs (f , "a" , "100" )
765
+ args := util .ToChaincodeArgs (f , "a" , "100" )
767
766
768
767
spec := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID , CtorMsg : & pb.ChaincodeInput {Args : args }}
769
768
@@ -780,7 +779,7 @@ func TestExecuteInvalidQuery(t *testing.T) {
780
779
time .Sleep (time .Second )
781
780
782
781
f = "query"
783
- args = shim .ToChaincodeArgs (f , "b" , "200" )
782
+ args = util .ToChaincodeArgs (f , "b" , "200" )
784
783
785
784
spec = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID , CtorMsg : & pb.ChaincodeInput {Args : args }}
786
785
// This query should fail as it attempts to put state
@@ -837,7 +836,7 @@ func TestChaincodeInvokeChaincode(t *testing.T) {
837
836
838
837
cID1 := & pb.ChaincodeID {Path : url1 }
839
838
f := "init"
840
- args := shim .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
839
+ args := util .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
841
840
842
841
spec1 := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID1 , CtorMsg : & pb.ChaincodeInput {Args : args }}
843
842
@@ -860,7 +859,7 @@ func TestChaincodeInvokeChaincode(t *testing.T) {
860
859
861
860
cID2 := & pb.ChaincodeID {Path : url2 }
862
861
f = "init"
863
- args = shim .ToChaincodeArgs (f , "e" , "0" )
862
+ args = util .ToChaincodeArgs (f , "e" , "0" )
864
863
865
864
spec2 := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID2 , CtorMsg : & pb.ChaincodeInput {Args : args }}
866
865
@@ -879,7 +878,7 @@ func TestChaincodeInvokeChaincode(t *testing.T) {
879
878
880
879
// Invoke second chaincode, which will inturn invoke the first chaincode
881
880
f = "invoke"
882
- args = shim .ToChaincodeArgs (f , "e" , "1" )
881
+ args = util .ToChaincodeArgs (f , "e" , "1" )
883
882
884
883
spec2 = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID2 , CtorMsg : & pb.ChaincodeInput {Args : args }}
885
884
// Invoke chaincode
@@ -953,7 +952,7 @@ func TestChaincodeInvokeChaincodeErrorCase(t *testing.T) {
953
952
954
953
cID1 := & pb.ChaincodeID {Path : url1 }
955
954
f := "init"
956
- args := shim .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
955
+ args := util .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
957
956
958
957
spec1 := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID1 , CtorMsg : & pb.ChaincodeInput {Args : args }}
959
958
@@ -974,7 +973,7 @@ func TestChaincodeInvokeChaincodeErrorCase(t *testing.T) {
974
973
975
974
cID2 := & pb.ChaincodeID {Path : url2 }
976
975
f = "init"
977
- args = shim .ToChaincodeArgs (f )
976
+ args = util .ToChaincodeArgs (f )
978
977
979
978
spec2 := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID2 , CtorMsg : & pb.ChaincodeInput {Args : args }}
980
979
@@ -993,7 +992,7 @@ func TestChaincodeInvokeChaincodeErrorCase(t *testing.T) {
993
992
994
993
// Invoke second chaincode, which will inturn invoke the first chaincode but pass bad params
995
994
f = chaincodeID1
996
- args = shim .ToChaincodeArgs (f , "invoke" , "a" )
995
+ args = util .ToChaincodeArgs (f , "invoke" , "a" )
997
996
998
997
spec2 = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID2 , CtorMsg : & pb.ChaincodeInput {Args : args }}
999
998
// Invoke chaincode
@@ -1030,7 +1029,7 @@ func chaincodeQueryChaincode(user string) error {
1030
1029
1031
1030
cID1 := & pb.ChaincodeID {Path : url1 }
1032
1031
f := "init"
1033
- args := shim .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
1032
+ args := util .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
1034
1033
1035
1034
spec1 := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID1 , CtorMsg : & pb.ChaincodeInput {Args : args }, SecureContext : user }
1036
1035
@@ -1048,7 +1047,7 @@ func chaincodeQueryChaincode(user string) error {
1048
1047
1049
1048
cID2 := & pb.ChaincodeID {Path : url2 }
1050
1049
f = "init"
1051
- args = shim .ToChaincodeArgs (f , "sum" , "0" )
1050
+ args = util .ToChaincodeArgs (f , "sum" , "0" )
1052
1051
1053
1052
spec2 := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID2 , CtorMsg : & pb.ChaincodeInput {Args : args }, SecureContext : user }
1054
1053
@@ -1064,7 +1063,7 @@ func chaincodeQueryChaincode(user string) error {
1064
1063
1065
1064
// Invoke second chaincode, which will inturn query the first chaincode
1066
1065
f = "invoke"
1067
- args = shim .ToChaincodeArgs (f , chaincodeID1 , "sum" )
1066
+ args = util .ToChaincodeArgs (f , chaincodeID1 , "sum" )
1068
1067
1069
1068
spec2 = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID2 , CtorMsg : & pb.ChaincodeInput {Args : args }, SecureContext : user }
1070
1069
// Invoke chaincode
@@ -1087,7 +1086,7 @@ func chaincodeQueryChaincode(user string) error {
1087
1086
1088
1087
// Query second chaincode, which will inturn query the first chaincode
1089
1088
f = "query"
1090
- args = shim .ToChaincodeArgs (f , chaincodeID1 , "sum" )
1089
+ args = util .ToChaincodeArgs (f , chaincodeID1 , "sum" )
1091
1090
1092
1091
spec2 = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID2 , CtorMsg : & pb.ChaincodeInput {Args : args }, SecureContext : user }
1093
1092
// Invoke chaincode
@@ -1176,7 +1175,7 @@ func TestChaincodeQueryChaincodeErrorCase(t *testing.T) {
1176
1175
1177
1176
cID1 := & pb.ChaincodeID {Path : url1 }
1178
1177
f := "init"
1179
- args := shim .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
1178
+ args := util .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
1180
1179
1181
1180
spec1 := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID1 , CtorMsg : & pb.ChaincodeInput {Args : args }}
1182
1181
@@ -1197,7 +1196,7 @@ func TestChaincodeQueryChaincodeErrorCase(t *testing.T) {
1197
1196
1198
1197
cID2 := & pb.ChaincodeID {Path : url2 }
1199
1198
f = "init"
1200
- args = shim .ToChaincodeArgs (f )
1199
+ args = util .ToChaincodeArgs (f )
1201
1200
1202
1201
spec2 := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID2 , CtorMsg : & pb.ChaincodeInput {Args : args }}
1203
1202
@@ -1216,7 +1215,7 @@ func TestChaincodeQueryChaincodeErrorCase(t *testing.T) {
1216
1215
1217
1216
// Invoke second chaincode, which will inturn invoke the first chaincode but pass bad params
1218
1217
f = chaincodeID1
1219
- args = shim .ToChaincodeArgs (f , "query" , "c" )
1218
+ args = util .ToChaincodeArgs (f , "query" , "c" )
1220
1219
1221
1220
spec2 = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID2 , CtorMsg : & pb.ChaincodeInput {Args : args }}
1222
1221
// Invoke chaincode
@@ -1340,7 +1339,7 @@ func TestRangeQuery(t *testing.T) {
1340
1339
cID := & pb.ChaincodeID {Path : url }
1341
1340
1342
1341
f := "init"
1343
- args := shim .ToChaincodeArgs (f )
1342
+ args := util .ToChaincodeArgs (f )
1344
1343
1345
1344
spec := & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID , CtorMsg : & pb.ChaincodeInput {Args : args }}
1346
1345
@@ -1356,7 +1355,7 @@ func TestRangeQuery(t *testing.T) {
1356
1355
1357
1356
// Invoke second chaincode, which will inturn invoke the first chaincode
1358
1357
f = "keys"
1359
- args = shim .ToChaincodeArgs (f )
1358
+ args = util .ToChaincodeArgs (f )
1360
1359
1361
1360
spec = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID , CtorMsg : & pb.ChaincodeInput {Args : args }}
1362
1361
_ , _ , _ , err = invoke (ctxt , spec , pb .Transaction_CHAINCODE_QUERY )
@@ -1411,7 +1410,7 @@ func TestGetEvent(t *testing.T) {
1411
1410
1412
1411
cID := & pb.ChaincodeID {Path : url }
1413
1412
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 )}}
1415
1414
1416
1415
_ , err = deploy (ctxt , spec )
1417
1416
chaincodeID := spec .ChaincodeID .Name
@@ -1425,7 +1424,7 @@ func TestGetEvent(t *testing.T) {
1425
1424
1426
1425
time .Sleep (time .Second )
1427
1426
1428
- args := shim .ToChaincodeArgs ("" , "i" , "am" , "satoshi" )
1427
+ args := util .ToChaincodeArgs ("" , "i" , "am" , "satoshi" )
1429
1428
1430
1429
spec = & pb.ChaincodeSpec {Type : 1 , ChaincodeID : cID , CtorMsg : & pb.ChaincodeInput {Args : args }}
1431
1430
0 commit comments