hyperledger-bevel / bevel-operator-fabric

Hyperledger Fabric Kubernetes operator - Hyperledger Fabric operator for Kubernetes (v2.3, v2.4 and v2.5, soon 3.0)
https://hyperledger-bevel.github.io/bevel-operator-fabric/
Apache License 2.0
278 stars 93 forks source link

Add transient map arg to chaincode invoke&query #195

Closed fthrslntgy closed 1 year ago

fthrslntgy commented 1 year ago

What this PR does / why we need it:

In fabric peer chaincode (https://github.com/hyperledger/fabric/blob/main/internal/peer/chaincode), users can set transient map with argument --transient. In code -> https://github.com/hyperledger/fabric/blob/58b6dc3651e99db7e3eaa61285cac4c5b3cdef4d/internal/peer/chaincode/common.go#L579

There is no equivalent parameter in kubectl hlf chaincode. This pr solves that.

Which issue(s) this PR fixes:

There is not any issue related with this problem.

Does this PR introduce a user-facing change?

Yes, users can set transient map in chaincode query&invoke comamnds.

Usage:

It can be used with -t parameter in kubectl hlf chaincode invoke/query commands. Example for creating bid in https://github.com/hyperledger/fabric-samples/blob/main/auction-simple chaincode:

kubectl hlf chaincode invoke --config=resources/network.yaml \
    --user=admin --peer=org1-peer0.default \
    --chaincode=auction-simple --channel=demo \
    --fcn=Bid -a "auction_id_test"
    -t= "{\"bid\":{\"objectType\": \"bid\", \"price\": 250, \"org\": \"Org1MSP\", \"bidder\": \"admin\"}}
fthrslntgy commented 1 year ago

@sownak @dviejokfs Transient map is necessary for some common chaincodes like https://github.com/hyperledger/fabric-samples/tree/main/auction-simple/chaincode-go. I need this pr for develop auction rest API application with golang. Could you please speed up review pr process?

adityajoshi12 commented 1 year ago

Thanks for the PR @fthrslntgy, can you also add an example of how to pass the transient field with this PR.

fthrslntgy commented 1 year ago

Thanks for the PR @fthrslntgy, can you also add an example of how to pass the transient field with this PR.

Sure, where should i add examples? I couldn't find example or test codes in kubectl-hlf path of repository.

adityajoshi12 commented 1 year ago

Thanks for the PR @fthrslntgy, can you also add an example of how to pass the transient field with this PR.

Sure, where should i add examples? I couldn't find example or test codes in kubectl-hlf path of repository.

You can add in the PR description.

fthrslntgy commented 1 year ago

Thanks for the PR @fthrslntgy, can you also add an example of how to pass the transient field with this PR.

Sure, where should i add examples? I couldn't find example or test codes in kubectl-hlf path of repository.

You can add in the PR description.

Its done

adityajoshi12 commented 1 year ago

@fthrslntgy can you check the failing testcase?

fthrslntgy commented 1 year ago

@fthrslntgy can you check the failing testcase?

i think i fixed it with commit https://github.com/hyperledger/bevel-operator-fabric/pull/195/commits/a855d4ab60de6a5ea74f4d983d5254eaf2949390