Uploaded image for project: 'Fabric'
  1. Fabric
  2. FAB-18409

Verify chaincode name user passes into service discovery endorsement query

    XMLWordPrintable

Details

    • Story
    • Status: Backlog
    • Medium
    • Resolution: Unresolved
    • None
    • None
    • fabric-peer
    • Unset
    • Unset
    • Unset

    Description

      If a user passes a illegal chaincode name into the service discovery endorsement query, service discovery will return a normal error stating that chaincode cant be found on the channel:

       

      2021-01-27 15:50:21.409 EST [discovery] chaincodeQuery -> ERRO 31d Failed constructing descriptor for chaincode chaincodes:<name:"cc_1.0.0" > ,: No metadata was found for chaincode cc_1.0.0 in channel mychannel

       User receives a less helpful message:

      server returned: failed constructing descriptor for chaincodes:<name:"cc_1.0.0" >

      But, `cc_1.0.0` is an illegal chaincode name. It would be more helpful to the user if the error stated that the input chaincode name was invalid.

      Chaincode names must start with an alphanumeric character and can only consist of alphanumerics, '_', and '-'.  (this is the validation message you get upon "peer chaincode install").

      We can use this opportunity to ensure the other inputs that take a chaincode name also validate the chaincode name is legal. For example I did a quick try with "peer chaincode query", and it also doesn't check for legal chaincode name:

       

      Error: endorsement failure during query. response: status:500 message:"make sure the chaincode cc_1.0.0 has been successfully defined on channel mychannel and try again: chaincode cc_1.0.0 not found" 

       

      Attachments

        Issue Links

          Activity

            People

              ankitm123 Ankit D Mohapatra
              denyeart David Enyeart
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: