diff --git a/bddtests/compose-defaults.yml b/bddtests/compose-defaults.yml index b81f378d7e7..62d85d83837 100644 --- a/bddtests/compose-defaults.yml +++ b/bddtests/compose-defaults.yml @@ -6,12 +6,12 @@ services: image: hyperledger/fabric-peer environment: - CORE_PEER_ADDRESSAUTODETECT=true - - CORE_VM_ENDPOINT=http://172.17.0.1:2375 - # TODO: This is currently required due to BUG in variant logic based upon log level. +# - CORE_VM_ENDPOINT=http://172.17.0.1:2375 - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_NETWORKID=${CORE_PEER_NETWORKID} volumes: - ./volumes/peer:/var/hyperledger/bddtests/volumes/peer + - /var/run/docker.sock:/var/run/docker.sock # Script will wait until membersrvc is up (if it exists) before starting # $$GOPATH (double dollar) required to prevent docker-compose doing its own # substitution before the value gets to the container diff --git a/bddtests/features/bootstrap.feature b/bddtests/features/bootstrap.feature index 2ab1475a164..c3fa2017892 100644 --- a/bddtests/features/bootstrap.feature +++ b/bddtests/features/bootstrap.feature @@ -82,9 +82,9 @@ Feature: Bootstrap And the ordererBootstrapAdmin runs the channel template tool to create the orderer configuration template "template1" for application developers using orderer "orderer0" And the ordererBootstrapAdmin distributes orderer configuration template "template1" and chain creation policy name "chainCreatePolicy1" - And the following application developers are defined for peer organizations - | Developer | ChainCreationPolicyName | Organization | - | dev0Org0 | chainCreatePolicy1 | peerOrg0 | + And the following application developers are defined for peer organizations and each saves their cert as alias + | Developer | ChainCreationPolicyName | Organization | AliasSavedUnder | + | dev0Org0 | chainCreatePolicy1 | peerOrg0 | dev0Org0App1 | # Need Consortium MSP info and # need to add the ChannelWriters ConfigItem (using ChannelWriters ref name), @@ -102,6 +102,7 @@ Feature: Bootstrap | peer2Signer | peer2 | peerOrg1 | # TODO: grab the peer orgs from template1 and put into Murali's MSP info SCIs. + # Entry point for creating a channel from existing templates And the user "dev0Org0" creates a signedConfigEnvelope "createChannelSignedConfigEnvelope1" | ChannelID | Template | Chain Creation Policy Name | Anchors | | com.acme.blockchain.jdoe.Channel1 | template1 | chainCreatePolicy1 | anchors1 | @@ -125,25 +126,63 @@ Feature: Bootstrap Then user "dev0Org0" should get a delivery "genesisBlockForMyNewChannel" from "orderer0" of "1" blocks with "1" messages within "1" seconds - When user "dev0Org0" request to join channel using genesis block "genesisBlockForMyNewChannel" on peer "peer0" with result "joinChannelResult" - | Developer | ChainCreationPolicyName | Organization | - | dev0Org0 | chainCreatePolicy1 | peerOrg0 | + # This is entry point for joining an existing channel + When user "dev0Org0" using cert alias "dev0Org0App1" requests to join channel using genesis block "genesisBlockForMyNewChannel" on peers with result "joinChannelResult" + | Peer | + | peer0 | + | peer2 | - Then user "dev0Org0" expects result code for "joinChannelResult" of "200" + Then user "dev0Org0" expects result code for "joinChannelResult" of "200" from peers: + | Peer | + | peer0 | + | peer2 | - # TODO: Add the channel name!! - When user "binhn" creates a chaincode spec "cc_spec" of type "GOLANG" for chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with args + # Entry point for invoking on an existing channel + When user "dev0Org0" creates a chaincode spec "cc_spec" with name "example02" of type "GOLANG" for chaincode "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02" with args | funcName | arg1 | arg2 | arg3 | arg4 | | init | a | 100 | b | 200 | - And user "binhn" creates a deployment spec "cc_deploy_spec" using chaincode spec "cc_spec" and devops on peer "vp0" - And user "binhn" creates a deployment proposal "proposal1" using chaincode deployment spec "cc_deploy_spec" - And user "binhn" sends proposal "proposal1" to endorsers with timeout of "20" seconds: - | peer0 | - And user "binhn" stores their last result as "proposal1Responses" - Then user "binhn" expects proposal responses "proposal1Responses" with status "200" from endorsers: - | peer0 | + #And user "binhn" creates a deployment spec "cc_deploy_spec" using chaincode spec "cc_spec" and devops on peer "vp0" + #And user "binhn" creates a deployment proposal "proposal1" using chaincode deployment spec "cc_deploy_spec" + + # Under the covers, create a deployment spec, etc. + And user "dev0Org0" using cert alias "dev0Org0App1" creates a deployment proposal "proposal1" for channel "com.acme.blockchain.jdoe.Channel1" using chaincode spec "cc_spec" + + And user "dev0Org0" sends proposal "proposal1" to endorsers with timeout of "30" seconds with proposal responses "deploymentProposalResponses": + | Endorser | + | peer0 | + | peer2 | + + + Then user "dev0Org0" expects proposal responses "deploymentProposalResponses" with status "200" from endorsers: + | Endorser | + | peer0 | + | peer2 | + + And user "dev0Org0" expects proposal responses "deploymentProposalResponses" each have the same value from endorsers: + | Endorser | + | peer0 | + | peer2 | + + When user "dev0Org0" creates a transaction "deploymentTransaction1" from proposal responses "deploymentProposalResponses" + + And the user "dev0Org0" broadcasts transaction "deploymentTransaction1" on channel "com.acme.blockchain.jdoe.Channel1" to orderer "orderer0" + + # Sleep as the deliver takes a bit + And I wait "2" seconds + + When user "dev0Org0" connects to deliver function on orderer "orderer0" + And user "dev0Org0" sends deliver a seek request on orderer "orderer0" with properties: + | ChainId | Start | End | + | com.acme.blockchain.jdoe.Channel1 | 1 | 1 | + + Then user "dev0Org0" should get a delivery "deploymentTransaction11Block" from "orderer0" of "1" blocks with "1" messages within "1" seconds + + # TODO: Add a peer query stanza here + + + # TODO: Once events are working, consider listen event listener as well. Examples: Orderer Options | ComposeFile | Waittime | PolicyType | ConsensusType | diff --git a/bddtests/peer/chaincode_pb2.py b/bddtests/peer/chaincode_pb2.py index aad78b14e54..d066d61b1d0 100644 --- a/bddtests/peer/chaincode_pb2.py +++ b/bddtests/peer/chaincode_pb2.py @@ -22,7 +22,7 @@ name='peer/chaincode.proto', package='protos', syntax='proto3', - serialized_pb=_b('\n\x14peer/chaincode.proto\x12\x06protos\x1a\x19peer/chaincodeevent.proto\x1a\x1fgoogle/protobuf/timestamp.proto\")\n\x0b\x43haincodeID\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\"\x1e\n\x0e\x43haincodeInput\x12\x0c\n\x04\x61rgs\x18\x01 \x03(\x0c\"\xbf\x02\n\rChaincodeSpec\x12(\n\x04type\x18\x01 \x01(\x0e\x32\x1a.protos.ChaincodeSpec.Type\x12(\n\x0b\x63haincodeID\x18\x02 \x01(\x0b\x32\x13.protos.ChaincodeID\x12\'\n\x07\x63torMsg\x18\x03 \x01(\x0b\x32\x16.protos.ChaincodeInput\x12\x0f\n\x07timeout\x18\x04 \x01(\x05\x12:\n\x14\x63onfidentialityLevel\x18\x05 \x01(\x0e\x32\x1c.protos.ConfidentialityLevel\x12\x10\n\x08metadata\x18\x06 \x01(\x0c\x12\x12\n\nattributes\x18\x07 \x03(\t\">\n\x04Type\x12\r\n\tUNDEFINED\x10\x00\x12\n\n\x06GOLANG\x10\x01\x12\x08\n\x04NODE\x10\x02\x12\x07\n\x03\x43\x41R\x10\x03\x12\x08\n\x04JAVA\x10\x04\"\x86\x02\n\x17\x43haincodeDeploymentSpec\x12,\n\rchaincodeSpec\x18\x01 \x01(\x0b\x32\x15.protos.ChaincodeSpec\x12\x31\n\reffectiveDate\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x13\n\x0b\x63odePackage\x18\x03 \x01(\x0c\x12\x45\n\x07\x65xecEnv\x18\x04 \x01(\x0e\x32\x34.protos.ChaincodeDeploymentSpec.ExecutionEnvironment\".\n\x14\x45xecutionEnvironment\x12\n\n\x06\x44OCKER\x10\x00\x12\n\n\x06SYSTEM\x10\x01\"`\n\x17\x43haincodeInvocationSpec\x12,\n\rchaincodeSpec\x18\x01 \x01(\x0b\x32\x15.protos.ChaincodeSpec\x12\x17\n\x0fidGenerationAlg\x18\x02 \x01(\t\"\xe3\x03\n\x10\x43haincodeMessage\x12+\n\x04type\x18\x01 \x01(\x0e\x32\x1d.protos.ChaincodeMessage.Type\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\x12\x0c\n\x04txid\x18\x04 \x01(\t\x12.\n\x0e\x63haincodeEvent\x18\x06 \x01(\x0b\x32\x16.protos.ChaincodeEvent\"\xa3\x02\n\x04Type\x12\r\n\tUNDEFINED\x10\x00\x12\x0c\n\x08REGISTER\x10\x01\x12\x0e\n\nREGISTERED\x10\x02\x12\x08\n\x04INIT\x10\x03\x12\t\n\x05READY\x10\x04\x12\x0f\n\x0bTRANSACTION\x10\x05\x12\r\n\tCOMPLETED\x10\x06\x12\t\n\x05\x45RROR\x10\x07\x12\r\n\tGET_STATE\x10\x08\x12\r\n\tPUT_STATE\x10\t\x12\r\n\tDEL_STATE\x10\n\x12\x14\n\x10INVOKE_CHAINCODE\x10\x0b\x12\x0c\n\x08RESPONSE\x10\r\x12\x15\n\x11RANGE_QUERY_STATE\x10\x0e\x12\x1a\n\x16RANGE_QUERY_STATE_NEXT\x10\x0f\x12\x1b\n\x17RANGE_QUERY_STATE_CLOSE\x10\x10\x12\r\n\tKEEPALIVE\x10\x11\"*\n\x0cPutStateInfo\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c\"3\n\x0fRangeQueryState\x12\x10\n\x08startKey\x18\x01 \x01(\t\x12\x0e\n\x06\x65ndKey\x18\x02 \x01(\t\"!\n\x13RangeQueryStateNext\x12\n\n\x02ID\x18\x01 \x01(\t\"\"\n\x14RangeQueryStateClose\x12\n\n\x02ID\x18\x01 \x01(\t\"5\n\x17RangeQueryStateKeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c\"n\n\x17RangeQueryStateResponse\x12\x36\n\rkeysAndValues\x18\x01 \x03(\x0b\x32\x1f.protos.RangeQueryStateKeyValue\x12\x0f\n\x07hasMore\x18\x02 \x01(\x08\x12\n\n\x02ID\x18\x03 \x01(\t*4\n\x14\x43onfidentialityLevel\x12\n\n\x06PUBLIC\x10\x00\x12\x10\n\x0c\x43ONFIDENTIAL\x10\x01\x32X\n\x10\x43haincodeSupport\x12\x44\n\x08Register\x12\x18.protos.ChaincodeMessage\x1a\x18.protos.ChaincodeMessage\"\x00(\x01\x30\x01\x42\x43\n\x16org.hyperledger.protosZ)github.com/hyperledger/fabric/protos/peerb\x06proto3') + serialized_pb=_b('\n\x14peer/chaincode.proto\x12\x06protos\x1a\x19peer/chaincodeevent.proto\x1a\x1fgoogle/protobuf/timestamp.proto\")\n\x0b\x43haincodeID\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\"\x1e\n\x0e\x43haincodeInput\x12\x0c\n\x04\x61rgs\x18\x01 \x03(\x0c\"\xdb\x01\n\rChaincodeSpec\x12(\n\x04type\x18\x01 \x01(\x0e\x32\x1a.protos.ChaincodeSpec.Type\x12(\n\x0b\x63haincodeID\x18\x02 \x01(\x0b\x32\x13.protos.ChaincodeID\x12%\n\x05input\x18\x03 \x01(\x0b\x32\x16.protos.ChaincodeInput\x12\x0f\n\x07timeout\x18\x04 \x01(\x05\">\n\x04Type\x12\r\n\tUNDEFINED\x10\x00\x12\n\n\x06GOLANG\x10\x01\x12\x08\n\x04NODE\x10\x02\x12\x07\n\x03\x43\x41R\x10\x03\x12\x08\n\x04JAVA\x10\x04\"\x86\x02\n\x17\x43haincodeDeploymentSpec\x12,\n\rchaincodeSpec\x18\x01 \x01(\x0b\x32\x15.protos.ChaincodeSpec\x12\x31\n\reffectiveDate\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x13\n\x0b\x63odePackage\x18\x03 \x01(\x0c\x12\x45\n\x07\x65xecEnv\x18\x04 \x01(\x0e\x32\x34.protos.ChaincodeDeploymentSpec.ExecutionEnvironment\".\n\x14\x45xecutionEnvironment\x12\n\n\x06\x44OCKER\x10\x00\x12\n\n\x06SYSTEM\x10\x01\"`\n\x17\x43haincodeInvocationSpec\x12,\n\rchaincodeSpec\x18\x01 \x01(\x0b\x32\x15.protos.ChaincodeSpec\x12\x17\n\x0fidGenerationAlg\x18\x02 \x01(\t\">\n\x18\x43haincodeProposalContext\x12\x0f\n\x07\x63reator\x18\x01 \x01(\x0c\x12\x11\n\ttransient\x18\x02 \x01(\x0c\"\xab\x04\n\x10\x43haincodeMessage\x12+\n\x04type\x18\x01 \x01(\x0e\x32\x1d.protos.ChaincodeMessage.Type\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\x12\x0c\n\x04txid\x18\x04 \x01(\t\x12\x39\n\x0fproposalContext\x18\x05 \x01(\x0b\x32 .protos.ChaincodeProposalContext\x12.\n\x0e\x63haincodeEvent\x18\x06 \x01(\x0b\x32\x16.protos.ChaincodeEvent\"\xb0\x02\n\x04Type\x12\r\n\tUNDEFINED\x10\x00\x12\x0c\n\x08REGISTER\x10\x01\x12\x0e\n\nREGISTERED\x10\x02\x12\x08\n\x04INIT\x10\x03\x12\t\n\x05READY\x10\x04\x12\x0f\n\x0bTRANSACTION\x10\x05\x12\r\n\tCOMPLETED\x10\x06\x12\t\n\x05\x45RROR\x10\x07\x12\r\n\tGET_STATE\x10\x08\x12\r\n\tPUT_STATE\x10\t\x12\r\n\tDEL_STATE\x10\n\x12\x14\n\x10INVOKE_CHAINCODE\x10\x0b\x12\x0c\n\x08RESPONSE\x10\r\x12\x15\n\x11RANGE_QUERY_STATE\x10\x0e\x12\x17\n\x13\x45XECUTE_QUERY_STATE\x10\x0f\x12\x14\n\x10QUERY_STATE_NEXT\x10\x10\x12\x15\n\x11QUERY_STATE_CLOSE\x10\x11\x12\r\n\tKEEPALIVE\x10\x12\"*\n\x0cPutStateInfo\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c\"3\n\x0fRangeQueryState\x12\x10\n\x08startKey\x18\x01 \x01(\t\x12\x0e\n\x06\x65ndKey\x18\x02 \x01(\t\"\"\n\x11\x45xecuteQueryState\x12\r\n\x05query\x18\x01 \x01(\t\"\x1c\n\x0eQueryStateNext\x12\n\n\x02ID\x18\x01 \x01(\t\"\x1d\n\x0fQueryStateClose\x12\n\n\x02ID\x18\x01 \x01(\t\"0\n\x12QueryStateKeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c\"d\n\x12QueryStateResponse\x12\x31\n\rkeysAndValues\x18\x01 \x03(\x0b\x32\x1a.protos.QueryStateKeyValue\x12\x0f\n\x07hasMore\x18\x02 \x01(\x08\x12\n\n\x02ID\x18\x03 \x01(\t*4\n\x14\x43onfidentialityLevel\x12\n\n\x06PUBLIC\x10\x00\x12\x10\n\x0c\x43ONFIDENTIAL\x10\x01\x32X\n\x10\x43haincodeSupport\x12\x44\n\x08Register\x12\x18.protos.ChaincodeMessage\x1a\x18.protos.ChaincodeMessage\"\x00(\x01\x30\x01\x42\x43\n\x16org.hyperledger.protosZ)github.com/hyperledger/fabric/protos/peerb\x06proto3') , dependencies=[peer_dot_chaincodeevent__pb2.DESCRIPTOR,google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -44,8 +44,8 @@ ], containing_type=None, options=None, - serialized_start=1673, - serialized_end=1725, + serialized_start=1720, + serialized_end=1772, ) _sym_db.RegisterEnumDescriptor(_CONFIDENTIALITYLEVEL) @@ -83,8 +83,8 @@ ], containing_type=None, options=None, - serialized_start=425, - serialized_end=487, + serialized_start=325, + serialized_end=387, ) _sym_db.RegisterEnumDescriptor(_CHAINCODESPEC_TYPE) @@ -105,8 +105,8 @@ ], containing_type=None, options=None, - serialized_start=706, - serialized_end=752, + serialized_start=606, + serialized_end=652, ) _sym_db.RegisterEnumDescriptor(_CHAINCODEDEPLOYMENTSPEC_EXECUTIONENVIRONMENT) @@ -173,22 +173,26 @@ options=None, type=None), _descriptor.EnumValueDescriptor( - name='RANGE_QUERY_STATE_NEXT', index=14, number=15, + name='EXECUTE_QUERY_STATE', index=14, number=15, options=None, type=None), _descriptor.EnumValueDescriptor( - name='RANGE_QUERY_STATE_CLOSE', index=15, number=16, + name='QUERY_STATE_NEXT', index=15, number=16, options=None, type=None), _descriptor.EnumValueDescriptor( - name='KEEPALIVE', index=16, number=17, + name='QUERY_STATE_CLOSE', index=16, number=17, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='KEEPALIVE', index=17, number=18, options=None, type=None), ], containing_type=None, options=None, - serialized_start=1045, - serialized_end=1336, + serialized_start=1068, + serialized_end=1372, ) _sym_db.RegisterEnumDescriptor(_CHAINCODEMESSAGE_TYPE) @@ -284,7 +288,7 @@ is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='ctorMsg', full_name='protos.ChaincodeSpec.ctorMsg', index=2, + name='input', full_name='protos.ChaincodeSpec.input', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -297,27 +301,6 @@ message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), - _descriptor.FieldDescriptor( - name='confidentialityLevel', full_name='protos.ChaincodeSpec.confidentialityLevel', index=4, - number=5, type=14, cpp_type=8, label=1, - has_default_value=False, default_value=0, - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='metadata', full_name='protos.ChaincodeSpec.metadata', index=5, - number=6, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='attributes', full_name='protos.ChaincodeSpec.attributes', index=6, - number=7, type=9, cpp_type=9, label=3, - has_default_value=False, default_value=[], - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), ], extensions=[ ], @@ -332,7 +315,7 @@ oneofs=[ ], serialized_start=168, - serialized_end=487, + serialized_end=387, ) @@ -384,8 +367,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=490, - serialized_end=752, + serialized_start=390, + serialized_end=652, ) @@ -422,8 +405,46 @@ extension_ranges=[], oneofs=[ ], - serialized_start=754, - serialized_end=850, + serialized_start=654, + serialized_end=750, +) + + +_CHAINCODEPROPOSALCONTEXT = _descriptor.Descriptor( + name='ChaincodeProposalContext', + full_name='protos.ChaincodeProposalContext', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='creator', full_name='protos.ChaincodeProposalContext.creator', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='transient', full_name='protos.ChaincodeProposalContext.transient', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=752, + serialized_end=814, ) @@ -463,7 +484,14 @@ is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='chaincodeEvent', full_name='protos.ChaincodeMessage.chaincodeEvent', index=4, + name='proposalContext', full_name='protos.ChaincodeMessage.proposalContext', index=4, + number=5, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='chaincodeEvent', full_name='protos.ChaincodeMessage.chaincodeEvent', index=5, number=6, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -482,8 +510,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=853, - serialized_end=1336, + serialized_start=817, + serialized_end=1372, ) @@ -520,8 +548,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1338, - serialized_end=1380, + serialized_start=1374, + serialized_end=1416, ) @@ -558,20 +586,51 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1382, - serialized_end=1433, + serialized_start=1418, + serialized_end=1469, +) + + +_EXECUTEQUERYSTATE = _descriptor.Descriptor( + name='ExecuteQueryState', + full_name='protos.ExecuteQueryState', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='query', full_name='protos.ExecuteQueryState.query', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1471, + serialized_end=1505, ) -_RANGEQUERYSTATENEXT = _descriptor.Descriptor( - name='RangeQueryStateNext', - full_name='protos.RangeQueryStateNext', +_QUERYSTATENEXT = _descriptor.Descriptor( + name='QueryStateNext', + full_name='protos.QueryStateNext', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='ID', full_name='protos.RangeQueryStateNext.ID', index=0, + name='ID', full_name='protos.QueryStateNext.ID', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, @@ -589,20 +648,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1435, - serialized_end=1468, + serialized_start=1507, + serialized_end=1535, ) -_RANGEQUERYSTATECLOSE = _descriptor.Descriptor( - name='RangeQueryStateClose', - full_name='protos.RangeQueryStateClose', +_QUERYSTATECLOSE = _descriptor.Descriptor( + name='QueryStateClose', + full_name='protos.QueryStateClose', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='ID', full_name='protos.RangeQueryStateClose.ID', index=0, + name='ID', full_name='protos.QueryStateClose.ID', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, @@ -620,27 +679,27 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1470, - serialized_end=1504, + serialized_start=1537, + serialized_end=1566, ) -_RANGEQUERYSTATEKEYVALUE = _descriptor.Descriptor( - name='RangeQueryStateKeyValue', - full_name='protos.RangeQueryStateKeyValue', +_QUERYSTATEKEYVALUE = _descriptor.Descriptor( + name='QueryStateKeyValue', + full_name='protos.QueryStateKeyValue', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='key', full_name='protos.RangeQueryStateKeyValue.key', index=0, + name='key', full_name='protos.QueryStateKeyValue.key', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='value', full_name='protos.RangeQueryStateKeyValue.value', index=1, + name='value', full_name='protos.QueryStateKeyValue.value', index=1, number=2, type=12, cpp_type=9, label=1, has_default_value=False, default_value=_b(""), message_type=None, enum_type=None, containing_type=None, @@ -658,34 +717,34 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1506, - serialized_end=1559, + serialized_start=1568, + serialized_end=1616, ) -_RANGEQUERYSTATERESPONSE = _descriptor.Descriptor( - name='RangeQueryStateResponse', - full_name='protos.RangeQueryStateResponse', +_QUERYSTATERESPONSE = _descriptor.Descriptor( + name='QueryStateResponse', + full_name='protos.QueryStateResponse', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='keysAndValues', full_name='protos.RangeQueryStateResponse.keysAndValues', index=0, + name='keysAndValues', full_name='protos.QueryStateResponse.keysAndValues', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='hasMore', full_name='protos.RangeQueryStateResponse.hasMore', index=1, + name='hasMore', full_name='protos.QueryStateResponse.hasMore', index=1, number=2, type=8, cpp_type=7, label=1, has_default_value=False, default_value=False, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), _descriptor.FieldDescriptor( - name='ID', full_name='protos.RangeQueryStateResponse.ID', index=2, + name='ID', full_name='protos.QueryStateResponse.ID', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, @@ -703,14 +762,13 @@ extension_ranges=[], oneofs=[ ], - serialized_start=1561, - serialized_end=1671, + serialized_start=1618, + serialized_end=1718, ) _CHAINCODESPEC.fields_by_name['type'].enum_type = _CHAINCODESPEC_TYPE _CHAINCODESPEC.fields_by_name['chaincodeID'].message_type = _CHAINCODEID -_CHAINCODESPEC.fields_by_name['ctorMsg'].message_type = _CHAINCODEINPUT -_CHAINCODESPEC.fields_by_name['confidentialityLevel'].enum_type = _CONFIDENTIALITYLEVEL +_CHAINCODESPEC.fields_by_name['input'].message_type = _CHAINCODEINPUT _CHAINCODESPEC_TYPE.containing_type = _CHAINCODESPEC _CHAINCODEDEPLOYMENTSPEC.fields_by_name['chaincodeSpec'].message_type = _CHAINCODESPEC _CHAINCODEDEPLOYMENTSPEC.fields_by_name['effectiveDate'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP @@ -719,21 +777,24 @@ _CHAINCODEINVOCATIONSPEC.fields_by_name['chaincodeSpec'].message_type = _CHAINCODESPEC _CHAINCODEMESSAGE.fields_by_name['type'].enum_type = _CHAINCODEMESSAGE_TYPE _CHAINCODEMESSAGE.fields_by_name['timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_CHAINCODEMESSAGE.fields_by_name['proposalContext'].message_type = _CHAINCODEPROPOSALCONTEXT _CHAINCODEMESSAGE.fields_by_name['chaincodeEvent'].message_type = peer_dot_chaincodeevent__pb2._CHAINCODEEVENT _CHAINCODEMESSAGE_TYPE.containing_type = _CHAINCODEMESSAGE -_RANGEQUERYSTATERESPONSE.fields_by_name['keysAndValues'].message_type = _RANGEQUERYSTATEKEYVALUE +_QUERYSTATERESPONSE.fields_by_name['keysAndValues'].message_type = _QUERYSTATEKEYVALUE DESCRIPTOR.message_types_by_name['ChaincodeID'] = _CHAINCODEID DESCRIPTOR.message_types_by_name['ChaincodeInput'] = _CHAINCODEINPUT DESCRIPTOR.message_types_by_name['ChaincodeSpec'] = _CHAINCODESPEC DESCRIPTOR.message_types_by_name['ChaincodeDeploymentSpec'] = _CHAINCODEDEPLOYMENTSPEC DESCRIPTOR.message_types_by_name['ChaincodeInvocationSpec'] = _CHAINCODEINVOCATIONSPEC +DESCRIPTOR.message_types_by_name['ChaincodeProposalContext'] = _CHAINCODEPROPOSALCONTEXT DESCRIPTOR.message_types_by_name['ChaincodeMessage'] = _CHAINCODEMESSAGE DESCRIPTOR.message_types_by_name['PutStateInfo'] = _PUTSTATEINFO DESCRIPTOR.message_types_by_name['RangeQueryState'] = _RANGEQUERYSTATE -DESCRIPTOR.message_types_by_name['RangeQueryStateNext'] = _RANGEQUERYSTATENEXT -DESCRIPTOR.message_types_by_name['RangeQueryStateClose'] = _RANGEQUERYSTATECLOSE -DESCRIPTOR.message_types_by_name['RangeQueryStateKeyValue'] = _RANGEQUERYSTATEKEYVALUE -DESCRIPTOR.message_types_by_name['RangeQueryStateResponse'] = _RANGEQUERYSTATERESPONSE +DESCRIPTOR.message_types_by_name['ExecuteQueryState'] = _EXECUTEQUERYSTATE +DESCRIPTOR.message_types_by_name['QueryStateNext'] = _QUERYSTATENEXT +DESCRIPTOR.message_types_by_name['QueryStateClose'] = _QUERYSTATECLOSE +DESCRIPTOR.message_types_by_name['QueryStateKeyValue'] = _QUERYSTATEKEYVALUE +DESCRIPTOR.message_types_by_name['QueryStateResponse'] = _QUERYSTATERESPONSE DESCRIPTOR.enum_types_by_name['ConfidentialityLevel'] = _CONFIDENTIALITYLEVEL ChaincodeID = _reflection.GeneratedProtocolMessageType('ChaincodeID', (_message.Message,), dict( @@ -771,6 +832,13 @@ )) _sym_db.RegisterMessage(ChaincodeInvocationSpec) +ChaincodeProposalContext = _reflection.GeneratedProtocolMessageType('ChaincodeProposalContext', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEPROPOSALCONTEXT, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeProposalContext) + )) +_sym_db.RegisterMessage(ChaincodeProposalContext) + ChaincodeMessage = _reflection.GeneratedProtocolMessageType('ChaincodeMessage', (_message.Message,), dict( DESCRIPTOR = _CHAINCODEMESSAGE, __module__ = 'peer.chaincode_pb2' @@ -792,33 +860,40 @@ )) _sym_db.RegisterMessage(RangeQueryState) -RangeQueryStateNext = _reflection.GeneratedProtocolMessageType('RangeQueryStateNext', (_message.Message,), dict( - DESCRIPTOR = _RANGEQUERYSTATENEXT, +ExecuteQueryState = _reflection.GeneratedProtocolMessageType('ExecuteQueryState', (_message.Message,), dict( + DESCRIPTOR = _EXECUTEQUERYSTATE, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.ExecuteQueryState) + )) +_sym_db.RegisterMessage(ExecuteQueryState) + +QueryStateNext = _reflection.GeneratedProtocolMessageType('QueryStateNext', (_message.Message,), dict( + DESCRIPTOR = _QUERYSTATENEXT, __module__ = 'peer.chaincode_pb2' - # @@protoc_insertion_point(class_scope:protos.RangeQueryStateNext) + # @@protoc_insertion_point(class_scope:protos.QueryStateNext) )) -_sym_db.RegisterMessage(RangeQueryStateNext) +_sym_db.RegisterMessage(QueryStateNext) -RangeQueryStateClose = _reflection.GeneratedProtocolMessageType('RangeQueryStateClose', (_message.Message,), dict( - DESCRIPTOR = _RANGEQUERYSTATECLOSE, +QueryStateClose = _reflection.GeneratedProtocolMessageType('QueryStateClose', (_message.Message,), dict( + DESCRIPTOR = _QUERYSTATECLOSE, __module__ = 'peer.chaincode_pb2' - # @@protoc_insertion_point(class_scope:protos.RangeQueryStateClose) + # @@protoc_insertion_point(class_scope:protos.QueryStateClose) )) -_sym_db.RegisterMessage(RangeQueryStateClose) +_sym_db.RegisterMessage(QueryStateClose) -RangeQueryStateKeyValue = _reflection.GeneratedProtocolMessageType('RangeQueryStateKeyValue', (_message.Message,), dict( - DESCRIPTOR = _RANGEQUERYSTATEKEYVALUE, +QueryStateKeyValue = _reflection.GeneratedProtocolMessageType('QueryStateKeyValue', (_message.Message,), dict( + DESCRIPTOR = _QUERYSTATEKEYVALUE, __module__ = 'peer.chaincode_pb2' - # @@protoc_insertion_point(class_scope:protos.RangeQueryStateKeyValue) + # @@protoc_insertion_point(class_scope:protos.QueryStateKeyValue) )) -_sym_db.RegisterMessage(RangeQueryStateKeyValue) +_sym_db.RegisterMessage(QueryStateKeyValue) -RangeQueryStateResponse = _reflection.GeneratedProtocolMessageType('RangeQueryStateResponse', (_message.Message,), dict( - DESCRIPTOR = _RANGEQUERYSTATERESPONSE, +QueryStateResponse = _reflection.GeneratedProtocolMessageType('QueryStateResponse', (_message.Message,), dict( + DESCRIPTOR = _QUERYSTATERESPONSE, __module__ = 'peer.chaincode_pb2' - # @@protoc_insertion_point(class_scope:protos.RangeQueryStateResponse) + # @@protoc_insertion_point(class_scope:protos.QueryStateResponse) )) -_sym_db.RegisterMessage(RangeQueryStateResponse) +_sym_db.RegisterMessage(QueryStateResponse) DESCRIPTOR.has_options = True diff --git a/bddtests/peer/configuration_pb2.py b/bddtests/peer/configuration_pb2.py index d4fe390de68..eaa0525d43b 100644 --- a/bddtests/peer/configuration_pb2.py +++ b/bddtests/peer/configuration_pb2.py @@ -19,7 +19,7 @@ name='peer/configuration.proto', package='protos', syntax='proto3', - serialized_pb=_b('\n\x18peer/configuration.proto\x12\x06protos\"5\n\x0b\x41nchorPeers\x12&\n\nanchorPees\x18\x01 \x03(\x0b\x32\x12.protos.AnchorPeer\"6\n\nAnchorPeer\x12\x0c\n\x04Host\x18\x01 \x01(\t\x12\x0c\n\x04Port\x18\x02 \x01(\x05\x12\x0c\n\x04\x43\x65rt\x18\x03 \x01(\x0c\x42+Z)github.com/hyperledger/fabric/protos/peerb\x06proto3') + serialized_pb=_b('\n\x18peer/configuration.proto\x12\x06protos\"6\n\x0b\x41nchorPeers\x12\'\n\x0b\x61nchorPeers\x18\x01 \x03(\x0b\x32\x12.protos.AnchorPeer\"6\n\nAnchorPeer\x12\x0c\n\x04Host\x18\x01 \x01(\t\x12\x0c\n\x04Port\x18\x02 \x01(\x05\x12\x0c\n\x04\x43\x65rt\x18\x03 \x01(\x0c\x42+Z)github.com/hyperledger/fabric/protos/peerb\x06proto3') ) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -34,7 +34,7 @@ containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='anchorPees', full_name='protos.AnchorPeers.anchorPees', index=0, + name='anchorPeers', full_name='protos.AnchorPeers.anchorPeers', index=0, number=1, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, @@ -53,7 +53,7 @@ oneofs=[ ], serialized_start=36, - serialized_end=89, + serialized_end=90, ) @@ -97,11 +97,11 @@ extension_ranges=[], oneofs=[ ], - serialized_start=91, - serialized_end=145, + serialized_start=92, + serialized_end=146, ) -_ANCHORPEERS.fields_by_name['anchorPees'].message_type = _ANCHORPEER +_ANCHORPEERS.fields_by_name['anchorPeers'].message_type = _ANCHORPEER DESCRIPTOR.message_types_by_name['AnchorPeers'] = _ANCHORPEERS DESCRIPTOR.message_types_by_name['AnchorPeer'] = _ANCHORPEER diff --git a/bddtests/peer/fabric_proposal_pb2.py b/bddtests/peer/fabric_proposal_pb2.py deleted file mode 100644 index 8f46a449557..00000000000 --- a/bddtests/peer/fabric_proposal_pb2.py +++ /dev/null @@ -1,141 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: peer/fabric_proposal.proto - -import sys -_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -from google.protobuf import descriptor_pb2 -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='peer/fabric_proposal.proto', - package='protos', - syntax='proto3', - serialized_pb=_b('\n\x1apeer/fabric_proposal.proto\x12\x06protos\":\n\x0eSignedProposal\x12\x15\n\rproposalBytes\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c\">\n\x08Proposal\x12\x0e\n\x06header\x18\x01 \x01(\x0c\x12\x0f\n\x07payload\x18\x02 \x01(\x0c\x12\x11\n\textension\x18\x03 \x01(\x0c\x42+Z)github.com/hyperledger/fabric/protos/peerb\x06proto3') -) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - - - - -_SIGNEDPROPOSAL = _descriptor.Descriptor( - name='SignedProposal', - full_name='protos.SignedProposal', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='proposalBytes', full_name='protos.SignedProposal.proposalBytes', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='signature', full_name='protos.SignedProposal.signature', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=38, - serialized_end=96, -) - - -_PROPOSAL = _descriptor.Descriptor( - name='Proposal', - full_name='protos.Proposal', - filename=None, - file=DESCRIPTOR, - containing_type=None, - fields=[ - _descriptor.FieldDescriptor( - name='header', full_name='protos.Proposal.header', index=0, - number=1, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='payload', full_name='protos.Proposal.payload', index=1, - number=2, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - _descriptor.FieldDescriptor( - name='extension', full_name='protos.Proposal.extension', index=2, - number=3, type=12, cpp_type=9, label=1, - has_default_value=False, default_value=_b(""), - message_type=None, enum_type=None, containing_type=None, - is_extension=False, extension_scope=None, - options=None), - ], - extensions=[ - ], - nested_types=[], - enum_types=[ - ], - options=None, - is_extendable=False, - syntax='proto3', - extension_ranges=[], - oneofs=[ - ], - serialized_start=98, - serialized_end=160, -) - -DESCRIPTOR.message_types_by_name['SignedProposal'] = _SIGNEDPROPOSAL -DESCRIPTOR.message_types_by_name['Proposal'] = _PROPOSAL - -SignedProposal = _reflection.GeneratedProtocolMessageType('SignedProposal', (_message.Message,), dict( - DESCRIPTOR = _SIGNEDPROPOSAL, - __module__ = 'peer.fabric_proposal_pb2' - # @@protoc_insertion_point(class_scope:protos.SignedProposal) - )) -_sym_db.RegisterMessage(SignedProposal) - -Proposal = _reflection.GeneratedProtocolMessageType('Proposal', (_message.Message,), dict( - DESCRIPTOR = _PROPOSAL, - __module__ = 'peer.fabric_proposal_pb2' - # @@protoc_insertion_point(class_scope:protos.Proposal) - )) -_sym_db.RegisterMessage(Proposal) - - -DESCRIPTOR.has_options = True -DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z)github.com/hyperledger/fabric/protos/peer')) -try: - # THESE ELEMENTS WILL BE DEPRECATED. - # Please use the generated *_pb2_grpc.py files instead. - import grpc - from grpc.framework.common import cardinality - from grpc.framework.interfaces.face import utilities as face_utilities - from grpc.beta import implementations as beta_implementations - from grpc.beta import interfaces as beta_interfaces -except ImportError: - pass -# @@protoc_insertion_point(module_scope) diff --git a/bddtests/peer/fabric_service_pb2.py b/bddtests/peer/fabric_service_pb2.py deleted file mode 100644 index 9c582bbaacc..00000000000 --- a/bddtests/peer/fabric_service_pb2.py +++ /dev/null @@ -1,140 +0,0 @@ -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: peer/fabric_service.proto - -import sys -_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database -from google.protobuf import descriptor_pb2 -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from peer import fabric_proposal_pb2 as peer_dot_fabric__proposal__pb2 -from peer import fabric_proposal_response_pb2 as peer_dot_fabric__proposal__response__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name='peer/fabric_service.proto', - package='protos', - syntax='proto3', - serialized_pb=_b('\n\x19peer/fabric_service.proto\x12\x06protos\x1a\x1apeer/fabric_proposal.proto\x1a#peer/fabric_proposal_response.proto2Q\n\x08\x45ndorser\x12\x45\n\x0fProcessProposal\x12\x16.protos.SignedProposal\x1a\x18.protos.ProposalResponse\"\x00\x42+Z)github.com/hyperledger/fabric/protos/peerb\x06proto3') - , - dependencies=[peer_dot_fabric__proposal__pb2.DESCRIPTOR,peer_dot_fabric__proposal__response__pb2.DESCRIPTOR,]) -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - - - - - -DESCRIPTOR.has_options = True -DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z)github.com/hyperledger/fabric/protos/peer')) -try: - # THESE ELEMENTS WILL BE DEPRECATED. - # Please use the generated *_pb2_grpc.py files instead. - import grpc - from grpc.framework.common import cardinality - from grpc.framework.interfaces.face import utilities as face_utilities - from grpc.beta import implementations as beta_implementations - from grpc.beta import interfaces as beta_interfaces - - - class EndorserStub(object): - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ProcessProposal = channel.unary_unary( - '/protos.Endorser/ProcessProposal', - request_serializer=peer_dot_fabric__proposal__pb2.SignedProposal.SerializeToString, - response_deserializer=peer_dot_fabric__proposal__response__pb2.ProposalResponse.FromString, - ) - - - class EndorserServicer(object): - - def ProcessProposal(self, request, context): - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - - def add_EndorserServicer_to_server(servicer, server): - rpc_method_handlers = { - 'ProcessProposal': grpc.unary_unary_rpc_method_handler( - servicer.ProcessProposal, - request_deserializer=peer_dot_fabric__proposal__pb2.SignedProposal.FromString, - response_serializer=peer_dot_fabric__proposal__response__pb2.ProposalResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'protos.Endorser', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - class BetaEndorserServicer(object): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This class was generated - only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" - def ProcessProposal(self, request, context): - context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) - - - class BetaEndorserStub(object): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This class was generated - only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" - def ProcessProposal(self, request, timeout, metadata=None, with_call=False, protocol_options=None): - raise NotImplementedError() - ProcessProposal.future = None - - - def beta_create_Endorser_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This function was - generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" - request_deserializers = { - ('protos.Endorser', 'ProcessProposal'): peer_dot_fabric__proposal__pb2.SignedProposal.FromString, - } - response_serializers = { - ('protos.Endorser', 'ProcessProposal'): peer_dot_fabric__proposal__response__pb2.ProposalResponse.SerializeToString, - } - method_implementations = { - ('protos.Endorser', 'ProcessProposal'): face_utilities.unary_unary_inline(servicer.ProcessProposal), - } - server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) - return beta_implementations.server(method_implementations, options=server_options) - - - def beta_create_Endorser_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): - """The Beta API is deprecated for 0.15.0 and later. - - It is recommended to use the GA API (classes and functions in this - file not marked beta) for all further purposes. This function was - generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" - request_serializers = { - ('protos.Endorser', 'ProcessProposal'): peer_dot_fabric__proposal__pb2.SignedProposal.SerializeToString, - } - response_deserializers = { - ('protos.Endorser', 'ProcessProposal'): peer_dot_fabric__proposal__response__pb2.ProposalResponse.FromString, - } - cardinalities = { - 'ProcessProposal': cardinality.Cardinality.UNARY_UNARY, - } - stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) - return beta_implementations.dynamic_stub(channel, 'protos.Endorser', cardinalities, options=stub_options) -except ImportError: - pass -# @@protoc_insertion_point(module_scope) diff --git a/bddtests/peer/peer_pb2.py b/bddtests/peer/peer_pb2.py new file mode 100644 index 00000000000..1f5154b6937 --- /dev/null +++ b/bddtests/peer/peer_pb2.py @@ -0,0 +1,291 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: peer/peer.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from peer import proposal_pb2 as peer_dot_proposal__pb2 +from peer import proposal_response_pb2 as peer_dot_proposal__response__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='peer/peer.proto', + package='protos', + syntax='proto3', + serialized_pb=_b('\n\x0fpeer/peer.proto\x12\x06protos\x1a\x13peer/proposal.proto\x1a\x1cpeer/proposal_response.proto\"\x16\n\x06PeerID\x12\x0c\n\x04name\x18\x01 \x01(\t\";\n\x0cPeerEndpoint\x12\x1a\n\x02ID\x18\x01 \x01(\x0b\x32\x0e.protos.PeerID\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\"U\n\x0e\x42lockchainInfo\x12\x0e\n\x06height\x18\x01 \x01(\x04\x12\x18\n\x10\x63urrentBlockHash\x18\x02 \x01(\x0c\x12\x19\n\x11previousBlockHash\x18\x03 \x01(\x0c\x32Q\n\x08\x45ndorser\x12\x45\n\x0fProcessProposal\x12\x16.protos.SignedProposal\x1a\x18.protos.ProposalResponse\"\x00\x42+Z)github.com/hyperledger/fabric/protos/peerb\x06proto3') + , + dependencies=[peer_dot_proposal__pb2.DESCRIPTOR,peer_dot_proposal__response__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_PEERID = _descriptor.Descriptor( + name='PeerID', + full_name='protos.PeerID', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='protos.PeerID.name', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=78, + serialized_end=100, +) + + +_PEERENDPOINT = _descriptor.Descriptor( + name='PeerEndpoint', + full_name='protos.PeerEndpoint', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ID', full_name='protos.PeerEndpoint.ID', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='address', full_name='protos.PeerEndpoint.address', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=102, + serialized_end=161, +) + + +_BLOCKCHAININFO = _descriptor.Descriptor( + name='BlockchainInfo', + full_name='protos.BlockchainInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='height', full_name='protos.BlockchainInfo.height', index=0, + number=1, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='currentBlockHash', full_name='protos.BlockchainInfo.currentBlockHash', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='previousBlockHash', full_name='protos.BlockchainInfo.previousBlockHash', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=163, + serialized_end=248, +) + +_PEERENDPOINT.fields_by_name['ID'].message_type = _PEERID +DESCRIPTOR.message_types_by_name['PeerID'] = _PEERID +DESCRIPTOR.message_types_by_name['PeerEndpoint'] = _PEERENDPOINT +DESCRIPTOR.message_types_by_name['BlockchainInfo'] = _BLOCKCHAININFO + +PeerID = _reflection.GeneratedProtocolMessageType('PeerID', (_message.Message,), dict( + DESCRIPTOR = _PEERID, + __module__ = 'peer.peer_pb2' + # @@protoc_insertion_point(class_scope:protos.PeerID) + )) +_sym_db.RegisterMessage(PeerID) + +PeerEndpoint = _reflection.GeneratedProtocolMessageType('PeerEndpoint', (_message.Message,), dict( + DESCRIPTOR = _PEERENDPOINT, + __module__ = 'peer.peer_pb2' + # @@protoc_insertion_point(class_scope:protos.PeerEndpoint) + )) +_sym_db.RegisterMessage(PeerEndpoint) + +BlockchainInfo = _reflection.GeneratedProtocolMessageType('BlockchainInfo', (_message.Message,), dict( + DESCRIPTOR = _BLOCKCHAININFO, + __module__ = 'peer.peer_pb2' + # @@protoc_insertion_point(class_scope:protos.BlockchainInfo) + )) +_sym_db.RegisterMessage(BlockchainInfo) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z)github.com/hyperledger/fabric/protos/peer')) +try: + # THESE ELEMENTS WILL BE DEPRECATED. + # Please use the generated *_pb2_grpc.py files instead. + import grpc + from grpc.framework.common import cardinality + from grpc.framework.interfaces.face import utilities as face_utilities + from grpc.beta import implementations as beta_implementations + from grpc.beta import interfaces as beta_interfaces + + + class EndorserStub(object): + """-------- the Endorser service ------------ + + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.ProcessProposal = channel.unary_unary( + '/protos.Endorser/ProcessProposal', + request_serializer=peer_dot_proposal__pb2.SignedProposal.SerializeToString, + response_deserializer=peer_dot_proposal__response__pb2.ProposalResponse.FromString, + ) + + + class EndorserServicer(object): + """-------- the Endorser service ------------ + + """ + + def ProcessProposal(self, request, context): + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + + def add_EndorserServicer_to_server(servicer, server): + rpc_method_handlers = { + 'ProcessProposal': grpc.unary_unary_rpc_method_handler( + servicer.ProcessProposal, + request_deserializer=peer_dot_proposal__pb2.SignedProposal.FromString, + response_serializer=peer_dot_proposal__response__pb2.ProposalResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'protos.Endorser', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + class BetaEndorserServicer(object): + """The Beta API is deprecated for 0.15.0 and later. + + It is recommended to use the GA API (classes and functions in this + file not marked beta) for all further purposes. This class was generated + only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" + """-------- the Endorser service ------------ + + """ + def ProcessProposal(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + + + class BetaEndorserStub(object): + """The Beta API is deprecated for 0.15.0 and later. + + It is recommended to use the GA API (classes and functions in this + file not marked beta) for all further purposes. This class was generated + only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" + """-------- the Endorser service ------------ + + """ + def ProcessProposal(self, request, timeout, metadata=None, with_call=False, protocol_options=None): + raise NotImplementedError() + ProcessProposal.future = None + + + def beta_create_Endorser_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + """The Beta API is deprecated for 0.15.0 and later. + + It is recommended to use the GA API (classes and functions in this + file not marked beta) for all further purposes. This function was + generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" + request_deserializers = { + ('protos.Endorser', 'ProcessProposal'): peer_dot_proposal__pb2.SignedProposal.FromString, + } + response_serializers = { + ('protos.Endorser', 'ProcessProposal'): peer_dot_proposal__response__pb2.ProposalResponse.SerializeToString, + } + method_implementations = { + ('protos.Endorser', 'ProcessProposal'): face_utilities.unary_unary_inline(servicer.ProcessProposal), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + + + def beta_create_Endorser_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + """The Beta API is deprecated for 0.15.0 and later. + + It is recommended to use the GA API (classes and functions in this + file not marked beta) for all further purposes. This function was + generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" + request_serializers = { + ('protos.Endorser', 'ProcessProposal'): peer_dot_proposal__pb2.SignedProposal.SerializeToString, + } + response_deserializers = { + ('protos.Endorser', 'ProcessProposal'): peer_dot_proposal__response__pb2.ProposalResponse.FromString, + } + cardinalities = { + 'ProcessProposal': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'protos.Endorser', cardinalities, options=stub_options) +except ImportError: + pass +# @@protoc_insertion_point(module_scope) diff --git a/bddtests/peer/fabric_service_pb2_grpc.py b/bddtests/peer/peer_pb2_grpc.py similarity index 61% rename from bddtests/peer/fabric_service_pb2_grpc.py rename to bddtests/peer/peer_pb2_grpc.py index 00acffe1fcd..e636cb188f3 100644 --- a/bddtests/peer/fabric_service_pb2_grpc.py +++ b/bddtests/peer/peer_pb2_grpc.py @@ -2,11 +2,14 @@ from grpc.framework.common import cardinality from grpc.framework.interfaces.face import utilities as face_utilities -import peer.fabric_proposal_pb2 as peer_dot_fabric__proposal__pb2 -import peer.fabric_proposal_response_pb2 as peer_dot_fabric__proposal__response__pb2 +import peer.proposal_pb2 as peer_dot_proposal__pb2 +import peer.proposal_response_pb2 as peer_dot_proposal__response__pb2 class EndorserStub(object): + """-------- the Endorser service ------------ + + """ def __init__(self, channel): """Constructor. @@ -16,12 +19,15 @@ def __init__(self, channel): """ self.ProcessProposal = channel.unary_unary( '/protos.Endorser/ProcessProposal', - request_serializer=peer_dot_fabric__proposal__pb2.SignedProposal.SerializeToString, - response_deserializer=peer_dot_fabric__proposal__response__pb2.ProposalResponse.FromString, + request_serializer=peer_dot_proposal__pb2.SignedProposal.SerializeToString, + response_deserializer=peer_dot_proposal__response__pb2.ProposalResponse.FromString, ) class EndorserServicer(object): + """-------- the Endorser service ------------ + + """ def ProcessProposal(self, request, context): context.set_code(grpc.StatusCode.UNIMPLEMENTED) @@ -33,8 +39,8 @@ def add_EndorserServicer_to_server(servicer, server): rpc_method_handlers = { 'ProcessProposal': grpc.unary_unary_rpc_method_handler( servicer.ProcessProposal, - request_deserializer=peer_dot_fabric__proposal__pb2.SignedProposal.FromString, - response_serializer=peer_dot_fabric__proposal__response__pb2.ProposalResponse.SerializeToString, + request_deserializer=peer_dot_proposal__pb2.SignedProposal.FromString, + response_serializer=peer_dot_proposal__response__pb2.ProposalResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( diff --git a/bddtests/peer/proposal_pb2.py b/bddtests/peer/proposal_pb2.py new file mode 100644 index 00000000000..3a3aaba4e8f --- /dev/null +++ b/bddtests/peer/proposal_pb2.py @@ -0,0 +1,291 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: peer/proposal.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from peer import chaincode_pb2 as peer_dot_chaincode__pb2 +from peer import proposal_response_pb2 as peer_dot_proposal__response__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='peer/proposal.proto', + package='protos', + syntax='proto3', + serialized_pb=_b('\n\x13peer/proposal.proto\x12\x06protos\x1a\x14peer/chaincode.proto\x1a\x1cpeer/proposal_response.proto\":\n\x0eSignedProposal\x12\x15\n\rproposalBytes\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c\">\n\x08Proposal\x12\x0e\n\x06header\x18\x01 \x01(\x0c\x12\x0f\n\x07payload\x18\x02 \x01(\x0c\x12\x11\n\textension\x18\x03 \x01(\x0c\"_\n\x18\x43haincodeHeaderExtension\x12\x19\n\x11payloadVisibility\x18\x01 \x01(\x0c\x12(\n\x0b\x63haincodeID\x18\x02 \x01(\x0b\x32\x13.protos.ChaincodeID\"<\n\x18\x43haincodeProposalPayload\x12\r\n\x05Input\x18\x01 \x01(\x0c\x12\x11\n\tTransient\x18\x02 \x01(\x0c\"V\n\x0f\x43haincodeAction\x12\x0f\n\x07results\x18\x01 \x01(\x0c\x12\x0e\n\x06\x65vents\x18\x02 \x01(\x0c\x12\"\n\x08response\x18\x03 \x01(\x0b\x32\x10.protos.ResponseB+Z)github.com/hyperledger/fabric/protos/peerb\x06proto3') + , + dependencies=[peer_dot_chaincode__pb2.DESCRIPTOR,peer_dot_proposal__response__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_SIGNEDPROPOSAL = _descriptor.Descriptor( + name='SignedProposal', + full_name='protos.SignedProposal', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='proposalBytes', full_name='protos.SignedProposal.proposalBytes', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='signature', full_name='protos.SignedProposal.signature', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=83, + serialized_end=141, +) + + +_PROPOSAL = _descriptor.Descriptor( + name='Proposal', + full_name='protos.Proposal', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='header', full_name='protos.Proposal.header', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='payload', full_name='protos.Proposal.payload', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='extension', full_name='protos.Proposal.extension', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=143, + serialized_end=205, +) + + +_CHAINCODEHEADEREXTENSION = _descriptor.Descriptor( + name='ChaincodeHeaderExtension', + full_name='protos.ChaincodeHeaderExtension', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='payloadVisibility', full_name='protos.ChaincodeHeaderExtension.payloadVisibility', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='chaincodeID', full_name='protos.ChaincodeHeaderExtension.chaincodeID', index=1, + number=2, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=207, + serialized_end=302, +) + + +_CHAINCODEPROPOSALPAYLOAD = _descriptor.Descriptor( + name='ChaincodeProposalPayload', + full_name='protos.ChaincodeProposalPayload', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Input', full_name='protos.ChaincodeProposalPayload.Input', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='Transient', full_name='protos.ChaincodeProposalPayload.Transient', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=304, + serialized_end=364, +) + + +_CHAINCODEACTION = _descriptor.Descriptor( + name='ChaincodeAction', + full_name='protos.ChaincodeAction', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='results', full_name='protos.ChaincodeAction.results', index=0, + number=1, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='events', full_name='protos.ChaincodeAction.events', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=_b(""), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='response', full_name='protos.ChaincodeAction.response', index=2, + number=3, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=366, + serialized_end=452, +) + +_CHAINCODEHEADEREXTENSION.fields_by_name['chaincodeID'].message_type = peer_dot_chaincode__pb2._CHAINCODEID +_CHAINCODEACTION.fields_by_name['response'].message_type = peer_dot_proposal__response__pb2._RESPONSE +DESCRIPTOR.message_types_by_name['SignedProposal'] = _SIGNEDPROPOSAL +DESCRIPTOR.message_types_by_name['Proposal'] = _PROPOSAL +DESCRIPTOR.message_types_by_name['ChaincodeHeaderExtension'] = _CHAINCODEHEADEREXTENSION +DESCRIPTOR.message_types_by_name['ChaincodeProposalPayload'] = _CHAINCODEPROPOSALPAYLOAD +DESCRIPTOR.message_types_by_name['ChaincodeAction'] = _CHAINCODEACTION + +SignedProposal = _reflection.GeneratedProtocolMessageType('SignedProposal', (_message.Message,), dict( + DESCRIPTOR = _SIGNEDPROPOSAL, + __module__ = 'peer.proposal_pb2' + # @@protoc_insertion_point(class_scope:protos.SignedProposal) + )) +_sym_db.RegisterMessage(SignedProposal) + +Proposal = _reflection.GeneratedProtocolMessageType('Proposal', (_message.Message,), dict( + DESCRIPTOR = _PROPOSAL, + __module__ = 'peer.proposal_pb2' + # @@protoc_insertion_point(class_scope:protos.Proposal) + )) +_sym_db.RegisterMessage(Proposal) + +ChaincodeHeaderExtension = _reflection.GeneratedProtocolMessageType('ChaincodeHeaderExtension', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEHEADEREXTENSION, + __module__ = 'peer.proposal_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeHeaderExtension) + )) +_sym_db.RegisterMessage(ChaincodeHeaderExtension) + +ChaincodeProposalPayload = _reflection.GeneratedProtocolMessageType('ChaincodeProposalPayload', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEPROPOSALPAYLOAD, + __module__ = 'peer.proposal_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeProposalPayload) + )) +_sym_db.RegisterMessage(ChaincodeProposalPayload) + +ChaincodeAction = _reflection.GeneratedProtocolMessageType('ChaincodeAction', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEACTION, + __module__ = 'peer.proposal_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeAction) + )) +_sym_db.RegisterMessage(ChaincodeAction) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z)github.com/hyperledger/fabric/protos/peer')) +try: + # THESE ELEMENTS WILL BE DEPRECATED. + # Please use the generated *_pb2_grpc.py files instead. + import grpc + from grpc.framework.common import cardinality + from grpc.framework.interfaces.face import utilities as face_utilities + from grpc.beta import implementations as beta_implementations + from grpc.beta import interfaces as beta_interfaces +except ImportError: + pass +# @@protoc_insertion_point(module_scope) diff --git a/bddtests/peer/fabric_proposal_pb2_grpc.py b/bddtests/peer/proposal_pb2_grpc.py similarity index 100% rename from bddtests/peer/fabric_proposal_pb2_grpc.py rename to bddtests/peer/proposal_pb2_grpc.py diff --git a/bddtests/peer/fabric_proposal_response_pb2.py b/bddtests/peer/proposal_response_pb2.py similarity index 86% rename from bddtests/peer/fabric_proposal_response_pb2.py rename to bddtests/peer/proposal_response_pb2.py index e30e46eccc8..358cc4b38f5 100644 --- a/bddtests/peer/fabric_proposal_response_pb2.py +++ b/bddtests/peer/proposal_response_pb2.py @@ -1,5 +1,5 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! -# source: peer/fabric_proposal_response.proto +# source: peer/proposal_response.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) @@ -17,10 +17,10 @@ DESCRIPTOR = _descriptor.FileDescriptor( - name='peer/fabric_proposal_response.proto', + name='peer/proposal_response.proto', package='protos', syntax='proto3', - serialized_pb=_b('\n#peer/fabric_proposal_response.proto\x12\x06protos\x1a\x1fgoogle/protobuf/timestamp.proto\"\xb1\x01\n\x10ProposalResponse\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\"\n\x08response\x18\x04 \x01(\x0b\x32\x10.protos.Response\x12\x0f\n\x07payload\x18\x05 \x01(\x0c\x12(\n\x0b\x65ndorsement\x18\x06 \x01(\x0b\x32\x13.protos.Endorsement\"<\n\x08Response\x12\x0e\n\x06status\x18\x01 \x01(\x05\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\"B\n\x17ProposalResponsePayload\x12\x14\n\x0cproposalHash\x18\x01 \x01(\x0c\x12\x11\n\textension\x18\x02 \x01(\x0c\"2\n\x0b\x45ndorsement\x12\x10\n\x08\x65ndorser\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x42+Z)github.com/hyperledger/fabric/protos/peerb\x06proto3') + serialized_pb=_b('\n\x1cpeer/proposal_response.proto\x12\x06protos\x1a\x1fgoogle/protobuf/timestamp.proto\"\xb1\x01\n\x10ProposalResponse\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\"\n\x08response\x18\x04 \x01(\x0b\x32\x10.protos.Response\x12\x0f\n\x07payload\x18\x05 \x01(\x0c\x12(\n\x0b\x65ndorsement\x18\x06 \x01(\x0b\x32\x13.protos.Endorsement\"<\n\x08Response\x12\x0e\n\x06status\x18\x01 \x01(\x05\x12\x0f\n\x07message\x18\x02 \x01(\t\x12\x0f\n\x07payload\x18\x03 \x01(\x0c\"B\n\x17ProposalResponsePayload\x12\x14\n\x0cproposalHash\x18\x01 \x01(\x0c\x12\x11\n\textension\x18\x02 \x01(\x0c\"2\n\x0b\x45ndorsement\x12\x10\n\x08\x65ndorser\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c\x42+Z)github.com/hyperledger/fabric/protos/peerb\x06proto3') , dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -82,8 +82,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=81, - serialized_end=258, + serialized_start=74, + serialized_end=251, ) @@ -127,8 +127,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=260, - serialized_end=320, + serialized_start=253, + serialized_end=313, ) @@ -165,8 +165,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=322, - serialized_end=388, + serialized_start=315, + serialized_end=381, ) @@ -203,8 +203,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=390, - serialized_end=440, + serialized_start=383, + serialized_end=433, ) _PROPOSALRESPONSE.fields_by_name['timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP @@ -217,28 +217,28 @@ ProposalResponse = _reflection.GeneratedProtocolMessageType('ProposalResponse', (_message.Message,), dict( DESCRIPTOR = _PROPOSALRESPONSE, - __module__ = 'peer.fabric_proposal_response_pb2' + __module__ = 'peer.proposal_response_pb2' # @@protoc_insertion_point(class_scope:protos.ProposalResponse) )) _sym_db.RegisterMessage(ProposalResponse) Response = _reflection.GeneratedProtocolMessageType('Response', (_message.Message,), dict( DESCRIPTOR = _RESPONSE, - __module__ = 'peer.fabric_proposal_response_pb2' + __module__ = 'peer.proposal_response_pb2' # @@protoc_insertion_point(class_scope:protos.Response) )) _sym_db.RegisterMessage(Response) ProposalResponsePayload = _reflection.GeneratedProtocolMessageType('ProposalResponsePayload', (_message.Message,), dict( DESCRIPTOR = _PROPOSALRESPONSEPAYLOAD, - __module__ = 'peer.fabric_proposal_response_pb2' + __module__ = 'peer.proposal_response_pb2' # @@protoc_insertion_point(class_scope:protos.ProposalResponsePayload) )) _sym_db.RegisterMessage(ProposalResponsePayload) Endorsement = _reflection.GeneratedProtocolMessageType('Endorsement', (_message.Message,), dict( DESCRIPTOR = _ENDORSEMENT, - __module__ = 'peer.fabric_proposal_response_pb2' + __module__ = 'peer.proposal_response_pb2' # @@protoc_insertion_point(class_scope:protos.Endorsement) )) _sym_db.RegisterMessage(Endorsement) diff --git a/bddtests/peer/fabric_proposal_response_pb2_grpc.py b/bddtests/peer/proposal_response_pb2_grpc.py similarity index 100% rename from bddtests/peer/fabric_proposal_response_pb2_grpc.py rename to bddtests/peer/proposal_response_pb2_grpc.py diff --git a/bddtests/steps/bdd_grpc_util.py b/bddtests/steps/bdd_grpc_util.py index bfee25f43ff..0b7e2deb981 100644 --- a/bddtests/steps/bdd_grpc_util.py +++ b/bddtests/steps/bdd_grpc_util.py @@ -23,7 +23,7 @@ import bdd_test_util -from grpc.beta import implementations +import grpc def getSecretForUserRegistration(userRegistration): return devops_pb2.Secret(enrollId=userRegistration.secretMsg['enrollId'],enrollSecret=userRegistration.secretMsg['enrollSecret']) @@ -45,7 +45,7 @@ def getTxResult(context, enrollId): return txResult def getGRPCChannel(ipAddress): - channel = implementations.insecure_channel(ipAddress, 7051) + channel = grpc.insecure_channel("{0}:{1}".format(ipAddress, 7051), options = [('grpc.max_message_length', 100*1024*1024)]) print("Returning GRPC for address: {0}".format(ipAddress)) return channel diff --git a/bddtests/steps/bootstrap_impl.py b/bddtests/steps/bootstrap_impl.py index 5eeddb75f0a..d1b0e767857 100644 --- a/bddtests/steps/bootstrap_impl.py +++ b/bddtests/steps/bootstrap_impl.py @@ -167,12 +167,15 @@ def step_impl(context, userName, createChannelSignedConfigEnvelope): # txConfigEnvelope = bootstrap_util.createConfigTxEnvelope(chainId=channelID, signedConfigEnvelope=signedConfigEnvelope) -@given(u'the following application developers are defined for peer organizations') +@given(u'the following application developers are defined for peer organizations and each saves their cert as alias') def step_impl(context): assert 'table' in context, "Expected table with triplet of Developer/ChainCreationPolicyName/Organization" directory = bootstrap_util.getDirectory(context) for row in context.table.rows: - directory.registerOrdererAdminTuple(row['Developer'], row['ChainCreationPolicyName'], row['Organization']) + userName = row['Developer'] + nodeAdminNamedTuple = directory.registerOrdererAdminTuple(userName, row['ChainCreationPolicyName'], row['Organization']) + user = directory.getUser(userName) + user.tags[row['AliasSavedUnder']] = nodeAdminNamedTuple @given(u'the user "{userName}" collects signatures for signedConfigEnvelope "{createChannelSignedConfigEnvelopeName}" from peer orgs') def step_impl(context, userName, createChannelSignedConfigEnvelopeName): @@ -231,23 +234,22 @@ def step_impl(context, userName, deliveryName, composeService, expectedBlocks, n assert len(blocks) == int(expectedBlocks), "Expected {0} blocks, received {1}".format(expectedBlocks, len(blocks)) user.tags[deliveryName] = blocks -@when(u'user "{userName}" request to join channel using genesis block "{genisisBlockName}" on peer "{composeService}" with result "{joinChannelResult}"') -def step_impl(context, userName, genisisBlockName, composeService, joinChannelResult): +@when(u'user "{userName}" using cert alias "{certAlias}" requests to join channel using genesis block "{genisisBlockName}" on peers with result "{joinChannelResult}"') +def step_impl(context, userName, certAlias, genisisBlockName, joinChannelResult): timeout = 10 directory = bootstrap_util.getDirectory(context) user = directory.getUser(userName) - # Collect the cert tuple information - row = context.table.rows[0] - signersCert = directory.findCertByTuple(row['Developer'], row['ChainCreationPolicyName'], row['Organization']) + # Find the cert using the cert tuple information saved for the user under certAlias + signersCert = directory.findCertForNodeAdminTuple(user.tags[certAlias]) # Retrieve the genesis block from the returned value of deliver (Will be list with first block as genesis block) genesisBlock = user.tags[genisisBlockName][0] ccSpec = endorser_util.getChaincodeSpec("GOLANG", "", "cscc", ["JoinChain", genesisBlock.SerializeToString()]) - proposal = endorser_util.createInvokeProposalForBDD(ccSpec=ccSpec, chainID="",signersCert=signersCert, Mspid="DEFAULT") + proposal = endorser_util.createInvokeProposalForBDD(ccSpec=ccSpec, chainID="",signersCert=signersCert, Mspid="DEFAULT", type="CONFIGURATION_TRANSACTION") signedProposal = endorser_util.signProposal(proposal=proposal, entity=user, signersCert=signersCert) # Send proposal to each specified endorser, waiting 'timeout' seconds for response/error - endorsers = [composeService] + endorsers = [row['Peer'] for row in context.table.rows] proposalResponseFutures = [endorserStub.ProcessProposal.future(signedProposal, int(timeout)) for endorserStub in endorser_util.getEndorserStubs(context, endorsers)] resultsDict = dict(zip(endorsers, [respFuture.result() for respFuture in proposalResponseFutures])) user.tags[joinChannelResult] = resultsDict @@ -271,14 +273,14 @@ def step_impl(context, chainCreationPolicyNames, ordererSystemChainIdName): chainCreationPolicyNamesConfigItem = bootstrap_util.createChainCreationPolicyNames(context, chainCreationPolicyNames=policyNames, chaindId=ordererSystemChainIdGUUID) ordererBootstrapAdmin.tags[chainCreationPolicyNames] = [chainCreationPolicyNamesConfigItem] -@then(u'user "{userName}" expects result code for "{proposalResponseName}" of "{proposalResponseResultCode}"') +@then(u'user "{userName}" expects result code for "{proposalResponseName}" of "{proposalResponseResultCode}" from peers') def step_impl(context, userName, proposalResponseName, proposalResponseResultCode): directory = bootstrap_util.getDirectory(context) user = directory.getUser(userName=userName) - proposalResponse = user.tags[proposalResponseName] + peerToProposalResponseDict = user.tags[proposalResponseName] + unexpectedResponses = [(composeService,proposalResponse) for composeService, proposalResponse in peerToProposalResponseDict.items() if proposalResponse.response.payload != proposalResponseResultCode] print("ProposalResponse: \n{0}\n".format(proposalResponse)) print("") - raise NotImplementedError(u'STEP: Then user "dev0Org0" expects result code for "joinChannelResult" of "200"') @given(u'the user "{userName}" creates an peer anchor set "{anchorSetName}" for channel "{channelName}" for orgs') def step_impl(context, userName, anchorSetName, channelName): diff --git a/bddtests/steps/bootstrap_util.py b/bddtests/steps/bootstrap_util.py index 08e855186b5..3cfdea6323a 100644 --- a/bddtests/steps/bootstrap_util.py +++ b/bddtests/steps/bootstrap_util.py @@ -22,6 +22,9 @@ from OpenSSL import crypto from OpenSSL import rand import ecdsa +import shutil + +from slugify import slugify from collections import namedtuple from enum import Enum @@ -46,6 +49,67 @@ # Type to represent tuple of user, nodeName, ogranization NodeAdminTuple = namedtuple("NodeAdminTuple", ['user', 'nodeName', 'organization']) +class ContextHelper: + + def __init__(self, context): + self.context = context + self.guuid = GetUUID() + + def getGuuid(self): + return self.guuid + + def getTmpPath(self): + pathToReturn = "tmp" + if not os.path.isdir(pathToReturn): + os.makedirs(pathToReturn) + return pathToReturn + + def getCachePath(self): + pathToReturn = os.path.join(self.getTmpPath(), "cache") + if not os.path.isdir(pathToReturn): + os.makedirs(pathToReturn) + return pathToReturn + + + def getTmpProjectPath(self): + pathToReturn = os.path.join(self.getTmpPath(), self.guuid) + if not os.path.isdir(pathToReturn): + os.makedirs(pathToReturn) + return pathToReturn + + def getTmpPathForName(self, name, copyFromCache=False): + 'Returns the tmp path for a file, and a flag indicating if the file exists. Will also check in the cache and copy to tmp if copyFromCache==True' + slugifiedName = slugify(name) + tmpPath = os.path.join(self.getTmpProjectPath(), slugifiedName) + fileExists = False + if os.path.isfile(tmpPath): + # file already exists in tmp path, return path and exists flag + fileExists = True + elif copyFromCache: + # See if the file exists in cache, and copy over to project folder. + cacheFilePath = os.path.join(self.getCachePath(), slugifiedName) + if os.path.isfile(cacheFilePath): + shutil.copy(cacheFilePath, tmpPath) + fileExists = True + return (tmpPath, fileExists) + + def copyToCache(self, name): + srcPath, fileExists = self.getTmpPathForName(name, copyFromCache=False) + assert fileExists, "Tried to copy source file to cache, but file not found for: {0}".format(srcPath) + # Now copy to the cache if it does not already exist + cacheFilePath = os.path.join(self.getCachePath(), slugify(name)) + if not os.path.isfile(cacheFilePath): + shutil.copy(srcPath, cacheFilePath) + + + def isConfigEnabled(self, configName): + return self.context.config.userdata.get(configName, "false") == "true" + + @classmethod + def GetHelper(cls, context): + if not "contextHelper" in context: + context.contextHelper = ContextHelper(context) + return context.contextHelper def GetUUID(): return compose.Composition.GetUUID() @@ -144,6 +208,11 @@ def createCertRequest(self, nodeName): #print("request => {0}".format(crypto.dump_certificate_request(crypto.FILETYPE_PEM, req))) return req + def computeHash(self, data): + s = self.hashfunc() + s.update(data) + return s.digest() + def sign(self, dataAsBytearray): return self.ecdsaSigningKey.sign(dataAsBytearray, hashfunc=self.hashfunc, sigencode=self.sigencode) @@ -261,6 +330,7 @@ def registerOrdererAdminTuple(self, userName, ordererName, organizationName): # Verify the certificate, returns None if it can validate the certificate store_ctx.verify_certificate() self.ordererAdminTuples[ordererAdminTuple] = userCert + return ordererAdminTuple class AuthDSLHelper: @@ -291,6 +361,7 @@ class BootstrapHelper: KEY_ACCEPT_ALL_POLICY = "AcceptAllPolicy" KEY_INGRESS_POLICY = "IngressPolicyNames" KEY_EGRESS_POLICY = "EgressPolicyNames" + KEY_HASHING_ALGORITHM = "HashingAlgorithm" KEY_BATCH_SIZE = "BatchSize" KEY_BATCH_TIMEOUT = "BatchTimeout" KEY_CREATIONPOLICY = "CreationPolicy" @@ -372,6 +443,13 @@ def encodeMspInfo(self, mspUniqueId, ciValue): value=ciValue.SerializeToString()) return self.signConfigItem(configItem) + def encodeHashingAlgorithm(self, hashingAlgorithm="SHAKE256"): + configItem = self.getConfigItem( + commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Chain"), + key=BootstrapHelper.KEY_HASHING_ALGORITHM, + value=common_dot_configuration_pb2.HashingAlgorithm(name=hashingAlgorithm).SerializeToString()) + return self.signConfigItem(configItem) + def encodeBatchSize(self): configItem = self.getConfigItem( commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Orderer"), @@ -506,7 +584,7 @@ def getSignedAnchorConfigItems(context, chainId, nodeAdminTuples): anchorPeers = peer_dot_configuration_pb2.AnchorPeers() for nodeAdminTuple in nodeAdminTuples: - anchorPeer = anchorPeers.anchorPees.add() + anchorPeer = anchorPeers.anchorPeers.add() anchorPeer.Host=nodeAdminTuple.nodeName anchorPeer.Port=5611 anchorPeer.Cert=crypto.dump_certificate(crypto.FILETYPE_PEM, directory.findCertForNodeAdminTuple(nodeAdminTuple)) @@ -531,6 +609,11 @@ def createSignedConfigItems(context, chainId, consensusType, signedConfigItems = # assert len(directory.ordererAdminTuples) > 0, "No orderer admin tuples defined!!!" bootstrapHelper = BootstrapHelper(chainId = chainId, consensusType=consensusType) configItems = signedConfigItems + configItems.append(bootstrapHelper.encodeHashingAlgorithm()) + + # configItems.append(bootstrapHelper.encodeBlockDataHashingStructure()) + # configItems.append(bootstrapHelper.encodeOrdererAddresses()) + configItems.append(bootstrapHelper.encodeBatchSize()) configItems.append(bootstrapHelper.encodeBatchTimeout()) configItems.append(bootstrapHelper.encodeConsensusType()) diff --git a/bddtests/steps/endorser_impl.py b/bddtests/steps/endorser_impl.py index c8861386e63..331270623b4 100644 --- a/bddtests/steps/endorser_impl.py +++ b/bddtests/steps/endorser_impl.py @@ -13,66 +13,104 @@ # limitations under the License. # +import os import endorser_util import bdd_grpc_util import bdd_test_util +import bootstrap_util import devops_pb2 -@when(u'user "{enrollId}" creates a chaincode spec "{ccSpecAlias}" of type "{ccType}" for chaincode "{chaincodePath}" with args') -def step_impl(context, enrollId, ccType, chaincodePath, ccSpecAlias): - userRegistration = bdd_test_util.getUserRegistration(context, enrollId) - args = bdd_grpc_util.getArgsFromContextForUser(context, enrollId) - ccSpec = endorser_util.getChaincodeSpec(ccType, chaincodePath, bdd_grpc_util.toStringArray(args)) +@when(u'user "{userName}" creates a chaincode spec "{ccSpecAlias}" with name "{chaincodeName}" of type "{ccType}" for chaincode "{chaincodePath}" with args') +def step_impl(context, userName, ccType, chaincodeName, chaincodePath, ccSpecAlias): + directory = bootstrap_util.getDirectory(context=context) + user = directory.getUser(userName) + args = bootstrap_util.getArgsFromContextForUser(context, userName) + ccSpec = endorser_util.getChaincodeSpec(ccType=ccType, path=chaincodePath, name=chaincodeName, args=bdd_grpc_util.toStringArray(args)) print("ccSpec = {0}".format(ccSpec)) - userRegistration.tags[ccSpecAlias] = ccSpec - - -@when(u'user "{enrollId}" creates a deployment spec "{ccDeploymentSpecAlias}" using chaincode spec "{ccSpecAlias}" and devops on peer "{devopsComposeService}"') -def step_impl(context, enrollId, ccDeploymentSpecAlias, ccSpecAlias, devopsComposeService): - userRegistration = bdd_test_util.getUserRegistration(context, enrollId) - assert ccSpecAlias in userRegistration.tags, "ChaincodeSpec alias '{0}' not found for user '{1}'".format(ccSpecAlias, enrollId) - - ipAddress = bdd_test_util.ipFromContainerNamePart(devopsComposeService, context.compose_containers) - channel = bdd_grpc_util.getGRPCChannel(ipAddress) - devopsStub = devops_pb2.beta_create_Devops_stub(channel) - deploymentSpec = devopsStub.Build(userRegistration.tags[ccSpecAlias],20) - userRegistration.tags[ccDeploymentSpecAlias] = deploymentSpec - - -@when(u'user "{enrollId}" creates a deployment proposal "{proposalAlias}" using chaincode deployment spec "{ccDeploymentSpecAlias}"') -def step_impl(context, enrollId, proposalAlias, ccDeploymentSpecAlias): - userRegistration = bdd_test_util.getUserRegistration(context, enrollId) - assert ccDeploymentSpecAlias in userRegistration.tags, "ChaincodeDeploymentSpec alias '{0}' not found for user '{1}'".format(ccDeploymentSpecAlias, enrollId) - ccDeploymentSpec = userRegistration.tags[ccDeploymentSpecAlias] - proposal = endorser_util.createDeploymentProposalForBDD(ccDeploymentSpec) - assert not proposalAlias in userRegistration.tags, "Proposal alias '{0}' already exists for '{1}'".format(proposalAlias, enrollId) - userRegistration.tags[proposalAlias] = proposal - - - -@when(u'user "{enrollId}" sends proposal "{proposalAlias}" to endorsers with timeout of "{timeout}" seconds') -def step_impl(context, enrollId, proposalAlias, timeout): - assert 'table' in context, "Expected table of endorsers" - userRegistration = bdd_test_util.getUserRegistration(context, enrollId) - assert proposalAlias in userRegistration.tags, "Proposal alias '{0}' not found for user '{1}'".format(proposalAlias, enrollId) - proposal = userRegistration.tags[proposalAlias] - - # Send proposal to each specified endorser, waiting 'timeout' seconds for response/error - endorsers = context.table.headings - proposalResponseFutures = [endorserStub.ProcessProposal.future(proposal, int(timeout)) for endorserStub in endorser_util.getEndorserStubs(context, endorsers)] - resultsDict = dict(zip(endorsers, [respFuture.result() for respFuture in proposalResponseFutures])) - userRegistration.lastResult = resultsDict - - -@then(u'user "{enrollId}" expects proposal responses "{proposalResponsesAlias}" with status "{statusCode}" from endorsers') -def step_impl(context, enrollId, proposalResponsesAlias, statusCode): - assert 'table' in context, "Expected table of endorsers" - userRegistration = bdd_test_util.getUserRegistration(context, enrollId) - # Make sure proposalResponseAlias not already defined - assert proposalResponsesAlias in userRegistration.tags, "Expected proposal responses at tag '{0}', for user '{1}'".format(proposalResponsesAlias, enrollId) - proposalRespDict = userRegistration.tags[proposalResponsesAlias] - - # Loop through endorser proposal Responses - endorsers = context.table.headings - for respSatusCode in [proposalRespDict[endorser].response.status for endorser in endorsers]: - assert int(statusCode) == respSatusCode, "Expected proposal response status code of {0} from {1}, received {2}".format(statusCode, endorser, respSatusCode) + user.tags[ccSpecAlias] = ccSpec + + +@when(u'user "{userName}" creates a deployment spec "{ccDeploymentSpecAlias}" using chaincode spec "{ccSpecAlias}" and devops on peer "{devopsComposeService}"') +def step_impl(context, userName, ccDeploymentSpecAlias, ccSpecAlias, devopsComposeService): + directory = bootstrap_util.getDirectory(context=context) + user = directory.getUser(userName=userName) + assert ccSpecAlias in user.tags, "ChaincodeSpec alias '{0}' not found for user '{1}'".format(ccSpecAlias, userName) + + ipAddress = bdd_test_util.ipFromContainerNamePart(devopsComposeService, context.compose_containers) + channel = bdd_grpc_util.getGRPCChannel(ipAddress) + devopsStub = devops_pb2.beta_create_Devops_stub(channel) + deploymentSpec = devopsStub.Build(user.tags[ccSpecAlias],20) + user.tags[ccDeploymentSpecAlias] = deploymentSpec + + +@when(u'user "{userName}" using cert alias "{certAlias}" creates a deployment proposal "{proposalAlias}" for channel "{channelName}" using chaincode spec "{ccSpecAlias}"') +def step_impl(context, userName, certAlias, proposalAlias, channelName, ccSpecAlias): + directory = bootstrap_util.getDirectory(context=context) + user = directory.getUser(userName=userName) + assert ccSpecAlias in user.tags, "ChaincodeSpec alias '{0}' not found for user '{1}'".format(ccSpecAlias, userName) + ccSpec = user.tags[ccSpecAlias] + + + ccDeploymentSpec = endorser_util.createDeploymentSpec(context=context, ccSpec=ccSpec) + lcChaincodeSpec = endorser_util.createDeploymentChaincodeSpecForBDD(ccDeploymentSpec=ccDeploymentSpec, chainID=str(channelName)) + # Find the cert using the cert tuple information saved for the user under certAlias + nodeAdminTuple = user.tags[certAlias] + signersCert = directory.findCertForNodeAdminTuple(nodeAdminTuple) + mspID = nodeAdminTuple.organization + + proposal = endorser_util.createInvokeProposalForBDD(ccSpec=lcChaincodeSpec, chainID=channelName,signersCert=signersCert, Mspid=mspID, type="ENDORSER_TRANSACTION") + + signedProposal = endorser_util.signProposal(proposal=proposal, entity=user, signersCert=signersCert) + + # proposal = endorser_util.createDeploymentProposalForBDD(ccDeploymentSpec) + assert not proposalAlias in user.tags, "Proposal alias '{0}' already exists for '{1}'".format(proposalAlias, userName) + user.tags[proposalAlias] = signedProposal + + + +@when(u'user "{userName}" sends proposal "{proposalAlias}" to endorsers with timeout of "{timeout}" seconds with proposal responses "{proposalResponsesAlias}"') +def step_impl(context, userName, proposalAlias, timeout, proposalResponsesAlias): + assert 'table' in context, "Expected table of endorsers" + directory = bootstrap_util.getDirectory(context=context) + user = directory.getUser(userName=userName) + + assert proposalAlias in user.tags, "Proposal alias '{0}' not found for user '{1}'".format(proposalAlias, userName) + signedProposal = user.tags[proposalAlias] + + # Send proposal to each specified endorser, waiting 'timeout' seconds for response/error + endorsers = [row['Endorser'] for row in context.table.rows] + endorserStubs = endorser_util.getEndorserStubs(context, endorsers) + proposalResponseFutures = [endorserStub.ProcessProposal.future(signedProposal, int(timeout)) for endorserStub in endorserStubs] + resultsDict = dict(zip(endorsers, [respFuture.result() for respFuture in proposalResponseFutures])) + user.tags[proposalResponsesAlias] = resultsDict + + +@then(u'user "{userName}" expects proposal responses "{proposalResponsesAlias}" with status "{statusCode}" from endorsers') +def step_impl(context, userName, proposalResponsesAlias, statusCode): + assert 'table' in context, "Expected table of endorsers" + directory = bootstrap_util.getDirectory(context=context) + user = directory.getUser(userName=userName) + # Make sure proposalResponseAlias not already defined + assert proposalResponsesAlias in user.tags, "Expected proposal responses at tag '{0}', for user '{1}'".format(proposalResponsesAlias, userName) + proposalRespDict = user.tags[proposalResponsesAlias] + + # Loop through endorser proposal Responses + endorsers = [row['Endorser'] for row in context.table.rows] + print("Endorsers = {0}, rsults keys = {1}".format(endorsers, proposalRespDict.keys())) + for respSatusCode in [proposalRespDict[endorser].response.status for endorser in endorsers]: + assert int(statusCode) == respSatusCode, "Expected proposal response status code of {0} from {1}, received {2}".format(statusCode, endorser, respSatusCode) + +@then(u'user "{userName}" expects proposal responses "{proposalResponsesAlias}" each have the same value from endorsers') +def step_impl(context, userName, proposalResponsesAlias): + directory = bootstrap_util.getDirectory(context=context) + user = directory.getUser(userName=userName) + assert proposalResponsesAlias in user.tags, "Expected proposal responses at tag '{0}', for user '{1}'".format(proposalResponsesAlias, userName) + proposalRespDict = user.tags[proposalResponsesAlias] + assert len(proposalRespDict) > 0, "Expected at least 1 proposal response, found none in proposal responses dictionary" + if len(proposalRespDict) == 1: + pass + else: + endorsers = [row['Endorser'] for row in context.table.rows] + endorserToProposalResponseHashDict = dict(zip(endorsers, [user.computeHash(proposalRespDict[endorser].payload) for endorser in endorsers])) + setOfHashes = set(endorserToProposalResponseHashDict.values()) + assert len(setOfHashes) == 1, "Hashes from endorsers did NOT match: {0}".format(endorserToProposalResponseHashDict) diff --git a/bddtests/steps/endorser_util.py b/bddtests/steps/endorser_util.py index 5f7e385dee0..9a2061a2be6 100644 --- a/bddtests/steps/endorser_util.py +++ b/bddtests/steps/endorser_util.py @@ -1,12 +1,13 @@ -import fabric_next_pb2 +import os +import json import bdd_test_util import bdd_grpc_util import bootstrap_util from peer import chaincode_pb2 from peer import chaincode_proposal_pb2 -from peer import fabric_proposal_pb2 -from peer import fabric_service_pb2 +from peer import proposal_pb2 +from peer import peer_pb2_grpc import identities_pb2 from common import common_pb2 as common_dot_common_pb2 @@ -17,13 +18,13 @@ def getChaincodeSpec(ccType, path, name, args): # make chaincode spec for chaincode to be deployed ccSpec = chaincode_pb2.ChaincodeSpec(type=chaincode_pb2.ChaincodeSpec.Type.Value(ccType), chaincodeID = chaincode_pb2.ChaincodeID(path=path, name=name), - ctorMsg = chaincode_pb2.ChaincodeInput(args = args)) + input = chaincode_pb2.ChaincodeInput(args = args)) return ccSpec def createPropsalId(): return 'TODO proposal Id' -def createInvokeProposalForBDD(ccSpec, chainID, signersCert, Mspid): +def createInvokeProposalForBDD(ccSpec, chainID, signersCert, Mspid, type): "Returns a deployment proposal of chaincode type" lc_chaincode_invocation_spec = chaincode_pb2.ChaincodeInvocationSpec(chaincodeSpec = ccSpec) @@ -34,7 +35,7 @@ def createInvokeProposalForBDD(ccSpec, chainID, signersCert, Mspid): bootstrapHelper = bootstrap_util.BootstrapHelper(chainId=chainID) - chainHdr = bootstrapHelper.makeChainHeader(type=common_dot_common_pb2.HeaderType.Value("CONFIGURATION_TRANSACTION"), + chainHdr = bootstrapHelper.makeChainHeader(type=common_dot_common_pb2.HeaderType.Value(type), txID=bootstrap_util.GetUUID(), extension=ccHdrExt.SerializeToString()) serializedIdentity = identities_pb2.SerializedIdentity(Mspid=Mspid, IdBytes=crypto.dump_certificate(crypto.FILETYPE_PEM, signersCert)) @@ -44,7 +45,8 @@ def createInvokeProposalForBDD(ccSpec, chainID, signersCert, Mspid): header = common_dot_common_pb2.Header(chainHeader=chainHdr, signatureHeader=sigHdr) # make proposal - proposal = fabric_proposal_pb2.Proposal(header=header.SerializeToString(), payload=ccProposalPayload.SerializeToString()) + proposal = proposal_pb2.Proposal(header=header.SerializeToString(), payload=ccProposalPayload.SerializeToString()) + return proposal @@ -72,26 +74,54 @@ def signProposal(proposal, entity, signersCert): print("Proposal Bytes signature= \n{0}\n\n".format(binascii.hexlify(bytearray(signature)))) print("") - signedProposal = fabric_proposal_pb2.SignedProposal(proposalBytes=proposalBytes, signature=signature) + signedProposal = proposal_pb2.SignedProposal(proposalBytes=proposalBytes, signature=signature) return signedProposal -def createDeploymentProposalForBDD(ccDeploymentSpec): +def createDeploymentChaincodeSpecForBDD(ccDeploymentSpec, chainID): "Returns a deployment proposal of chaincode type" lc_chaincode_spec = chaincode_pb2.ChaincodeSpec(type = chaincode_pb2.ChaincodeSpec.GOLANG, chaincodeID = chaincode_pb2.ChaincodeID(name="lccc"), - ctorMsg = chaincode_pb2.ChaincodeInput(args = ['deploy', 'default', ccDeploymentSpec.SerializeToString()])) - lc_chaincode_invocation_spec = chaincode_pb2.ChaincodeInvocationSpec(chaincodeSpec = lc_chaincode_spec) - # make proposal - proposal = fabric_next_pb2.Proposal(type = fabric_next_pb2.Proposal.CHAINCODE, id = createPropsalId()) - proposal.payload = lc_chaincode_invocation_spec.SerializeToString() - return proposal + input = chaincode_pb2.ChaincodeInput(args = ['deploy', chainID, ccDeploymentSpec.SerializeToString()])) + return lc_chaincode_spec def getEndorserStubs(context, composeServices): - stubs = [] - for composeService in composeServices: - ipAddress = bdd_test_util.ipFromContainerNamePart(composeService, context.compose_containers) - channel = bdd_grpc_util.getGRPCChannel(ipAddress) - newEndorserStub = fabric_service_pb2.beta_create_Endorser_stub(channel) - stubs.append(newEndorserStub) - return stubs + stubs = [] + for composeService in composeServices: + ipAddress = bdd_test_util.ipFromContainerNamePart(composeService, context.compose_containers) + channel = bdd_grpc_util.getGRPCChannel(ipAddress) + newEndorserStub = peer_pb2_grpc.EndorserStub(channel) + stubs.append(newEndorserStub) + return stubs + +def getExample02ChaincodeSpec(): + return getChaincodeSpec("GOLANG", "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02", "example02", ["init","a","100","b","200"]) + + + +def _createDeploymentSpecAsFile(ccSpec, outputPath): + '''peer chaincode package -n myCC -c '{"Args":["init","a","100","b","200"]}' -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 --logging-level=DEBUG test.file''' + myEnv = os.environ.copy() + myEnv['CORE_PEER_MSPCONFIGPATH'] = "./../msp/sampleConfig" + nameArgs = ["-n", ccSpec.chaincodeID.name] + ctorArgs = ["-c", json.dumps({'Args' : [item for item in ccSpec.input.args]})] + pathArgs = ["-p", ccSpec.chaincodeID.path] + output, error, returncode = \ + bdd_test_util.cli_call(["peer","chaincode","package"] + nameArgs + ctorArgs + pathArgs + [outputPath], expect_success=True, env=myEnv) + return output + + +def createDeploymentSpec(context, ccSpec): + contextHelper = bootstrap_util.ContextHelper.GetHelper(context=context) + cacheDeploymentSpec = contextHelper.isConfigEnabled("cache-deployment-spec") + fileName = "deploymentspec_{0}".format(ccSpec.chaincodeID.name) + outputPath, fileExists = contextHelper.getTmpPathForName(name=fileName, + copyFromCache=cacheDeploymentSpec) + if not fileExists: + _createDeploymentSpecAsFile(ccSpec=ccSpec, outputPath=outputPath) + if cacheDeploymentSpec: + contextHelper.copyToCache(fileName) + ccDeploymentSpec = chaincode_pb2.ChaincodeDeploymentSpec() + with open(outputPath, 'rb') as f: + ccDeploymentSpec.ParseFromString(f.read()) + return ccDeploymentSpec diff --git a/bddtests/steps/peer_basic_impl.py b/bddtests/steps/peer_basic_impl.py index 901f64fae2a..374f753cad5 100644 --- a/bddtests/steps/peer_basic_impl.py +++ b/bddtests/steps/peer_basic_impl.py @@ -28,6 +28,7 @@ import bdd_test_util import compose +import bootstrap_util CORE_REST_PORT = 7050 JSONRPC_VERSION = "2.0" @@ -69,7 +70,7 @@ def getDockerComposeFileArgsFromYamlFile(compose_yaml): @given(u'we compose "{composeYamlFile}"') def step_impl(context, composeYamlFile): # time.sleep(10) # Should be replaced with a definitive interlock guaranteeing that all peers/membersrvc are ready - composition = compose.Composition(context, composeYamlFile) + composition = compose.Composition(context, composeYamlFile, projectName=bootstrap_util.ContextHelper.GetHelper(context=context).getGuuid()) context.compose_containers = composition.containerDataList context.composition = composition diff --git a/msp/identities.go b/msp/identities.go index 5db3b9bc324..501569ef8dd 100644 --- a/msp/identities.go +++ b/msp/identities.go @@ -20,11 +20,9 @@ import ( "crypto/rand" "crypto/x509" "encoding/hex" - "fmt" - "encoding/pem" - "errors" + "fmt" "github.com/golang/protobuf/proto" "github.com/hyperledger/fabric/bccsp" diff --git a/msp/mgmt/config.go b/msp/mgmt/config.go index 68e0421b015..1f96557602a 100644 --- a/msp/mgmt/config.go +++ b/msp/mgmt/config.go @@ -136,11 +136,6 @@ func (bh *MSPConfigHandler) CommitConfig() { // ProposeConfig called when config is added to a proposal func (bh *MSPConfigHandler) ProposeConfig(configItem *common.ConfigurationItem) error { - // we expect MSP type of config items - if configItem.Key != msputils.MSPKey { - return fmt.Errorf("Expected config item key %s, got %s", msputils.MSPKey, configItem.Key) - } - mspconfig := &mspprotos.MSPConfig{} err := proto.Unmarshal(configItem.Value, mspconfig) if err != nil { diff --git a/peer/chaincode/chaincode.go b/peer/chaincode/chaincode.go index 29e48046f54..31c546602ca 100644 --- a/peer/chaincode/chaincode.go +++ b/peer/chaincode/chaincode.go @@ -58,6 +58,7 @@ func Cmd(cf *ChaincodeCmdFactory) *cobra.Command { chaincodeCmd.AddCommand(invokeCmd(cf)) chaincodeCmd.AddCommand(queryCmd(cf)) chaincodeCmd.AddCommand(upgradeCmd(cf)) + chaincodeCmd.AddCommand(packageCmd(cf)) return chaincodeCmd } diff --git a/peer/chaincode/package.go b/peer/chaincode/package.go new file mode 100644 index 00000000000..1955e3060a5 --- /dev/null +++ b/peer/chaincode/package.go @@ -0,0 +1,71 @@ +/* +Copyright IBM Corp. 2017 All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package chaincode + +import ( + "fmt" + + "io/ioutil" + + "github.com/golang/protobuf/proto" + "github.com/spf13/cobra" +) + +// deployCmd returns the cobra command for Chaincode Deploy +func packageCmd(cf *ChaincodeCmdFactory) *cobra.Command { + chaincodeDeployCmd = &cobra.Command{ + Use: "package", + Short: fmt.Sprintf("Package the specified chaincode into a deployment spec."), + Long: fmt.Sprintf(`Package the specified chaincode into a deployment spec.`), + ValidArgs: []string{"1"}, + RunE: func(cmd *cobra.Command, args []string) error { + return chaincodePackage(cmd, args, cf) + }, + } + + return chaincodeDeployCmd +} + +// chaincodeDeploy deploys the chaincode. On success, the chaincode name +// (hash) is printed to STDOUT for use by subsequent chaincode-related CLI +// commands. +func chaincodePackage(cmd *cobra.Command, args []string, cf *ChaincodeCmdFactory) error { + var err error + spec, err := getChaincodeSpecification(cmd) + if err != nil { + return err + } + + cds, err := getChaincodeBytes(spec) + if err != nil { + return fmt.Errorf("Error getting chaincode code %s: %s", chainFuncName, err) + } + + cdsBytes, err := proto.Marshal(cds) + if err != nil { + return fmt.Errorf("Error marshalling chaincode deployment spec : %s", err) + } + logger.Debugf("Packaged chaincode into deployment spec of size <%d>, with args = %v", len(cdsBytes), args) + fileToWrite := args[0] + err = ioutil.WriteFile(fileToWrite, cdsBytes, 0700) + if err != nil { + logger.Errorf("Failed writing deployment spec to file [%s]: [%s]", fileToWrite, err) + return err + } + + return err +}