From f14cd84711e055d05c726f87642cf919a04b7ef0 Mon Sep 17 00:00:00 2001 From: jeffgarratt Date: Tue, 17 Jan 2017 10:39:19 -0500 Subject: [PATCH] [FAB-1141] Added join channel to bootstrap.feature Join channel invocation is created and sent to endorser. Now join works!! Local MSP config is now read from core.yaml variable peer.mspConfigPath protos/utils/blockutils.go now use correct Configuratio Item type of MSP. Chaned peer.mspConfigPath to "/etc/hyperledger/fabric/msp/sampleconfig". Changed msp function to NOT use JSON encoding/decoding. Changed msp to check for type of configuration item vs name. Added preferredMaxBytes to Batchsize orderer config. Regenerated orderer configuration.proto. Copied the cacerts to the admincerts for local MSP setup per @ASO recommendation for now. Signing is now performed at entity level and uses sha256 digest with ASN1 encoding for signature. Generated proto files for peer protos. Changed cert in SerializedIdentity from ASN1 encoding to PEM. Set the chainId to empty string for join request. Regenerated orderer configuration proto. Generated MSP config protos. Now add MSP Config items to channel create transaction. Now add Anchor peers config items to channel create transaction. Fixed msp tests to use the blockutils msp config path lookup mechanism, and now uses the proper Type setting in the MSPConfig proto structure. Change-Id: I507c490df41ff003306f5210905418cec9108b8c Signed-off-by: jeffgarratt --- bddtests/common/configuration_pb2.py | 209 +++- bddtests/features/bootstrap.feature | 64 +- bddtests/identities_pb2.py | 88 ++ bddtests/identities_pb2_grpc.py | 4 + bddtests/msp/__init__.py | 1 + bddtests/msp/mspconfig_pb2.py | 249 +++++ bddtests/msp/mspconfig_pb2_grpc.py | 4 + bddtests/orderer/configuration_pb2.py | 97 +- bddtests/peer/__init__.py | 0 bddtests/peer/chaincode_pb2.py | 942 ++++++++++++++++++ bddtests/peer/chaincode_pb2_grpc.py | 48 + bddtests/peer/chaincode_proposal_pb2.py | 183 ++++ bddtests/peer/chaincode_proposal_pb2_grpc.py | 4 + bddtests/peer/chaincodeevent_pb2.py | 102 ++ bddtests/peer/chaincodeevent_pb2_grpc.py | 4 + bddtests/peer/configuration_pb2.py | 135 +++ bddtests/peer/configuration_pb2_grpc.py | 4 + bddtests/peer/fabric_proposal_pb2.py | 141 +++ bddtests/peer/fabric_proposal_pb2_grpc.py | 4 + bddtests/peer/fabric_proposal_response_pb2.py | 259 +++++ .../peer/fabric_proposal_response_pb2_grpc.py | 4 + bddtests/peer/fabric_service_pb2.py | 140 +++ bddtests/peer/fabric_service_pb2_grpc.py | 42 + bddtests/steps/bootstrap_impl.py | 104 +- bddtests/steps/bootstrap_util.py | 250 +++-- bddtests/steps/endorser_util.py | 73 +- bddtests/steps/orderer_util.py | 4 +- core/peer/msp/peermsp_test.go | 10 +- msp/configbuilder.go | 7 +- msp/identities.go | 5 + msp/mspimpl.go | 4 +- peer/core.yaml | 2 +- peer/main.go | 10 +- protos/msp/testutils/testutils.go | 2 +- protos/msp/utils/utils.go | 3 +- protos/utils/blockutils.go | 12 +- 36 files changed, 3011 insertions(+), 203 deletions(-) create mode 100644 bddtests/identities_pb2.py create mode 100644 bddtests/identities_pb2_grpc.py create mode 100644 bddtests/msp/__init__.py create mode 100644 bddtests/msp/mspconfig_pb2.py create mode 100644 bddtests/msp/mspconfig_pb2_grpc.py create mode 100644 bddtests/peer/__init__.py create mode 100644 bddtests/peer/chaincode_pb2.py create mode 100644 bddtests/peer/chaincode_pb2_grpc.py create mode 100644 bddtests/peer/chaincode_proposal_pb2.py create mode 100644 bddtests/peer/chaincode_proposal_pb2_grpc.py create mode 100644 bddtests/peer/chaincodeevent_pb2.py create mode 100644 bddtests/peer/chaincodeevent_pb2_grpc.py create mode 100644 bddtests/peer/configuration_pb2.py create mode 100644 bddtests/peer/configuration_pb2_grpc.py create mode 100644 bddtests/peer/fabric_proposal_pb2.py create mode 100644 bddtests/peer/fabric_proposal_pb2_grpc.py create mode 100644 bddtests/peer/fabric_proposal_response_pb2.py create mode 100644 bddtests/peer/fabric_proposal_response_pb2_grpc.py create mode 100644 bddtests/peer/fabric_service_pb2.py create mode 100644 bddtests/peer/fabric_service_pb2_grpc.py diff --git a/bddtests/common/configuration_pb2.py b/bddtests/common/configuration_pb2.py index aaeaf98a4f7..a8bf9328156 100644 --- a/bddtests/common/configuration_pb2.py +++ b/bddtests/common/configuration_pb2.py @@ -14,15 +14,16 @@ from common import common_pb2 as common_dot_common__pb2 +from common import msp_principal_pb2 as common_dot_msp__principal__pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='common/configuration.proto', package='common', syntax='proto3', - serialized_pb=_b('\n\x1a\x63ommon/configuration.proto\x12\x06\x63ommon\x1a\x13\x63ommon/common.proto\"G\n\x15\x43onfigurationEnvelope\x12.\n\x05Items\x18\x01 \x03(\x0b\x32\x1f.common.SignedConfigurationItem\"h\n\x17SignedConfigurationItem\x12\x19\n\x11\x43onfigurationItem\x18\x01 \x01(\x0c\x12\x32\n\nSignatures\x18\x02 \x03(\x0b\x32\x1e.common.ConfigurationSignature\"\x84\x02\n\x11\x43onfigurationItem\x12#\n\x06Header\x18\x01 \x01(\x0b\x32\x13.common.ChainHeader\x12\x39\n\x04Type\x18\x02 \x01(\x0e\x32+.common.ConfigurationItem.ConfigurationType\x12\x14\n\x0cLastModified\x18\x03 \x01(\x04\x12\x1a\n\x12ModificationPolicy\x18\x04 \x01(\t\x12\x0b\n\x03Key\x18\x05 \x01(\t\x12\r\n\x05Value\x18\x06 \x01(\x0c\"A\n\x11\x43onfigurationType\x12\n\n\x06Policy\x10\x00\x12\t\n\x05\x43hain\x10\x01\x12\x0b\n\x07Orderer\x10\x02\x12\x08\n\x04Peer\x10\x03\"D\n\x16\x43onfigurationSignature\x12\x17\n\x0fsignatureHeader\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c\"Y\n\x06Policy\x12\x0c\n\x04type\x18\x01 \x01(\x05\x12\x0e\n\x06policy\x18\x02 \x01(\x0c\"1\n\nPolicyType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\r\n\tSIGNATURE\x10\x01\x12\x07\n\x03MSP\x10\x02\"g\n\x17SignaturePolicyEnvelope\x12\x0f\n\x07Version\x18\x01 \x01(\x05\x12\'\n\x06Policy\x18\x02 \x01(\x0b\x32\x17.common.SignaturePolicy\x12\x12\n\nIdentities\x18\x03 \x03(\x0c\"\x9d\x01\n\x0fSignaturePolicy\x12\x12\n\x08SignedBy\x18\x01 \x01(\x05H\x00\x12.\n\x04\x46rom\x18\x02 \x01(\x0b\x32\x1e.common.SignaturePolicy.NOutOfH\x00\x1a>\n\x06NOutOf\x12\t\n\x01N\x18\x01 \x01(\x05\x12)\n\x08Policies\x18\x02 \x03(\x0b\x32\x17.common.SignaturePolicyB\x06\n\x04TypeB-Z+github.com/hyperledger/fabric/protos/commonb\x06proto3') + serialized_pb=_b('\n\x1a\x63ommon/configuration.proto\x12\x06\x63ommon\x1a\x13\x63ommon/common.proto\x1a\x1a\x63ommon/msp_principal.proto\"G\n\x15\x43onfigurationEnvelope\x12.\n\x05Items\x18\x01 \x03(\x0b\x32\x1f.common.SignedConfigurationItem\"A\n\x15\x43onfigurationTemplate\x12(\n\x05Items\x18\x01 \x03(\x0b\x32\x19.common.ConfigurationItem\"h\n\x17SignedConfigurationItem\x12\x19\n\x11\x43onfigurationItem\x18\x01 \x01(\x0c\x12\x32\n\nSignatures\x18\x02 \x03(\x0b\x32\x1e.common.ConfigurationSignature\"\x8d\x02\n\x11\x43onfigurationItem\x12#\n\x06Header\x18\x01 \x01(\x0b\x32\x13.common.ChainHeader\x12\x39\n\x04Type\x18\x02 \x01(\x0e\x32+.common.ConfigurationItem.ConfigurationType\x12\x14\n\x0cLastModified\x18\x03 \x01(\x04\x12\x1a\n\x12ModificationPolicy\x18\x04 \x01(\t\x12\x0b\n\x03Key\x18\x05 \x01(\t\x12\r\n\x05Value\x18\x06 \x01(\x0c\"J\n\x11\x43onfigurationType\x12\n\n\x06Policy\x10\x00\x12\t\n\x05\x43hain\x10\x01\x12\x0b\n\x07Orderer\x10\x02\x12\x08\n\x04Peer\x10\x03\x12\x07\n\x03MSP\x10\x04\"D\n\x16\x43onfigurationSignature\x12\x17\n\x0fsignatureHeader\x18\x01 \x01(\x0c\x12\x11\n\tsignature\x18\x02 \x01(\x0c\"Y\n\x06Policy\x12\x0c\n\x04type\x18\x01 \x01(\x05\x12\x0e\n\x06policy\x18\x02 \x01(\x0c\"1\n\nPolicyType\x12\x0b\n\x07UNKNOWN\x10\x00\x12\r\n\tSIGNATURE\x10\x01\x12\x07\n\x03MSP\x10\x02\"}\n\x17SignaturePolicyEnvelope\x12\x0f\n\x07Version\x18\x01 \x01(\x05\x12\'\n\x06Policy\x18\x02 \x01(\x0b\x32\x17.common.SignaturePolicy\x12(\n\nIdentities\x18\x03 \x03(\x0b\x32\x14.common.MSPPrincipal\"\x9d\x01\n\x0fSignaturePolicy\x12\x12\n\x08SignedBy\x18\x01 \x01(\x05H\x00\x12.\n\x04\x46rom\x18\x02 \x01(\x0b\x32\x1e.common.SignaturePolicy.NOutOfH\x00\x1a>\n\x06NOutOf\x12\t\n\x01N\x18\x01 \x01(\x05\x12)\n\x08Policies\x18\x02 \x03(\x0b\x32\x17.common.SignaturePolicyB\x06\n\x04Type\" \n\x10HashingAlgorithm\x12\x0c\n\x04name\x18\x01 \x01(\t\"*\n\x19\x42lockDataHashingStructure\x12\r\n\x05width\x18\x01 \x01(\r\"%\n\x10OrdererAddresses\x12\x11\n\taddresses\x18\x01 \x03(\tB-Z+github.com/hyperledger/fabric/protos/commonb\x06proto3') , - dependencies=[common_dot_common__pb2.DESCRIPTOR,]) + dependencies=[common_dot_common__pb2.DESCRIPTOR,common_dot_msp__principal__pb2.DESCRIPTOR,]) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -49,11 +50,15 @@ name='Peer', index=3, number=3, options=None, type=None), + _descriptor.EnumValueDescriptor( + name='MSP', index=4, number=4, + options=None, + type=None), ], containing_type=None, options=None, - serialized_start=434, - serialized_end=499, + serialized_start=529, + serialized_end=603, ) _sym_db.RegisterEnumDescriptor(_CONFIGURATIONITEM_CONFIGURATIONTYPE) @@ -78,8 +83,8 @@ ], containing_type=None, options=None, - serialized_start=611, - serialized_end=660, + serialized_start=715, + serialized_end=764, ) _sym_db.RegisterEnumDescriptor(_POLICY_POLICYTYPE) @@ -110,8 +115,39 @@ extension_ranges=[], oneofs=[ ], - serialized_start=59, - serialized_end=130, + serialized_start=87, + serialized_end=158, +) + + +_CONFIGURATIONTEMPLATE = _descriptor.Descriptor( + name='ConfigurationTemplate', + full_name='common.ConfigurationTemplate', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Items', full_name='common.ConfigurationTemplate.Items', 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), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=160, + serialized_end=225, ) @@ -148,8 +184,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=132, - serialized_end=236, + serialized_start=227, + serialized_end=331, ) @@ -215,8 +251,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=239, - serialized_end=499, + serialized_start=334, + serialized_end=603, ) @@ -253,8 +289,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=501, - serialized_end=569, + serialized_start=605, + serialized_end=673, ) @@ -292,8 +328,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=571, - serialized_end=660, + serialized_start=675, + serialized_end=764, ) @@ -320,7 +356,7 @@ options=None), _descriptor.FieldDescriptor( name='Identities', full_name='common.SignaturePolicyEnvelope.Identities', index=2, - number=3, type=12, cpp_type=9, label=3, + number=3, 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, @@ -337,8 +373,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=662, - serialized_end=765, + serialized_start=766, + serialized_end=891, ) @@ -375,8 +411,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=855, - serialized_end=917, + serialized_start=981, + serialized_end=1043, ) _SIGNATUREPOLICY = _descriptor.Descriptor( @@ -415,17 +451,112 @@ name='Type', full_name='common.SignaturePolicy.Type', index=0, containing_type=None, fields=[]), ], - serialized_start=768, - serialized_end=925, + serialized_start=894, + serialized_end=1051, +) + + +_HASHINGALGORITHM = _descriptor.Descriptor( + name='HashingAlgorithm', + full_name='common.HashingAlgorithm', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='name', full_name='common.HashingAlgorithm.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=1053, + serialized_end=1085, +) + + +_BLOCKDATAHASHINGSTRUCTURE = _descriptor.Descriptor( + name='BlockDataHashingStructure', + full_name='common.BlockDataHashingStructure', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='width', full_name='common.BlockDataHashingStructure.width', index=0, + number=1, type=13, cpp_type=3, 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), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1087, + serialized_end=1129, +) + + +_ORDERERADDRESSES = _descriptor.Descriptor( + name='OrdererAddresses', + full_name='common.OrdererAddresses', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='addresses', full_name='common.OrdererAddresses.addresses', index=0, + number=1, 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=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=1131, + serialized_end=1168, ) _CONFIGURATIONENVELOPE.fields_by_name['Items'].message_type = _SIGNEDCONFIGURATIONITEM +_CONFIGURATIONTEMPLATE.fields_by_name['Items'].message_type = _CONFIGURATIONITEM _SIGNEDCONFIGURATIONITEM.fields_by_name['Signatures'].message_type = _CONFIGURATIONSIGNATURE _CONFIGURATIONITEM.fields_by_name['Header'].message_type = common_dot_common__pb2._CHAINHEADER _CONFIGURATIONITEM.fields_by_name['Type'].enum_type = _CONFIGURATIONITEM_CONFIGURATIONTYPE _CONFIGURATIONITEM_CONFIGURATIONTYPE.containing_type = _CONFIGURATIONITEM _POLICY_POLICYTYPE.containing_type = _POLICY _SIGNATUREPOLICYENVELOPE.fields_by_name['Policy'].message_type = _SIGNATUREPOLICY +_SIGNATUREPOLICYENVELOPE.fields_by_name['Identities'].message_type = common_dot_msp__principal__pb2._MSPPRINCIPAL _SIGNATUREPOLICY_NOUTOF.fields_by_name['Policies'].message_type = _SIGNATUREPOLICY _SIGNATUREPOLICY_NOUTOF.containing_type = _SIGNATUREPOLICY _SIGNATUREPOLICY.fields_by_name['From'].message_type = _SIGNATUREPOLICY_NOUTOF @@ -436,12 +567,16 @@ _SIGNATUREPOLICY.fields_by_name['From']) _SIGNATUREPOLICY.fields_by_name['From'].containing_oneof = _SIGNATUREPOLICY.oneofs_by_name['Type'] DESCRIPTOR.message_types_by_name['ConfigurationEnvelope'] = _CONFIGURATIONENVELOPE +DESCRIPTOR.message_types_by_name['ConfigurationTemplate'] = _CONFIGURATIONTEMPLATE DESCRIPTOR.message_types_by_name['SignedConfigurationItem'] = _SIGNEDCONFIGURATIONITEM DESCRIPTOR.message_types_by_name['ConfigurationItem'] = _CONFIGURATIONITEM DESCRIPTOR.message_types_by_name['ConfigurationSignature'] = _CONFIGURATIONSIGNATURE DESCRIPTOR.message_types_by_name['Policy'] = _POLICY DESCRIPTOR.message_types_by_name['SignaturePolicyEnvelope'] = _SIGNATUREPOLICYENVELOPE DESCRIPTOR.message_types_by_name['SignaturePolicy'] = _SIGNATUREPOLICY +DESCRIPTOR.message_types_by_name['HashingAlgorithm'] = _HASHINGALGORITHM +DESCRIPTOR.message_types_by_name['BlockDataHashingStructure'] = _BLOCKDATAHASHINGSTRUCTURE +DESCRIPTOR.message_types_by_name['OrdererAddresses'] = _ORDERERADDRESSES ConfigurationEnvelope = _reflection.GeneratedProtocolMessageType('ConfigurationEnvelope', (_message.Message,), dict( DESCRIPTOR = _CONFIGURATIONENVELOPE, @@ -450,6 +585,13 @@ )) _sym_db.RegisterMessage(ConfigurationEnvelope) +ConfigurationTemplate = _reflection.GeneratedProtocolMessageType('ConfigurationTemplate', (_message.Message,), dict( + DESCRIPTOR = _CONFIGURATIONTEMPLATE, + __module__ = 'common.configuration_pb2' + # @@protoc_insertion_point(class_scope:common.ConfigurationTemplate) + )) +_sym_db.RegisterMessage(ConfigurationTemplate) + SignedConfigurationItem = _reflection.GeneratedProtocolMessageType('SignedConfigurationItem', (_message.Message,), dict( DESCRIPTOR = _SIGNEDCONFIGURATIONITEM, __module__ = 'common.configuration_pb2' @@ -500,6 +642,27 @@ _sym_db.RegisterMessage(SignaturePolicy) _sym_db.RegisterMessage(SignaturePolicy.NOutOf) +HashingAlgorithm = _reflection.GeneratedProtocolMessageType('HashingAlgorithm', (_message.Message,), dict( + DESCRIPTOR = _HASHINGALGORITHM, + __module__ = 'common.configuration_pb2' + # @@protoc_insertion_point(class_scope:common.HashingAlgorithm) + )) +_sym_db.RegisterMessage(HashingAlgorithm) + +BlockDataHashingStructure = _reflection.GeneratedProtocolMessageType('BlockDataHashingStructure', (_message.Message,), dict( + DESCRIPTOR = _BLOCKDATAHASHINGSTRUCTURE, + __module__ = 'common.configuration_pb2' + # @@protoc_insertion_point(class_scope:common.BlockDataHashingStructure) + )) +_sym_db.RegisterMessage(BlockDataHashingStructure) + +OrdererAddresses = _reflection.GeneratedProtocolMessageType('OrdererAddresses', (_message.Message,), dict( + DESCRIPTOR = _ORDERERADDRESSES, + __module__ = 'common.configuration_pb2' + # @@protoc_insertion_point(class_scope:common.OrdererAddresses) + )) +_sym_db.RegisterMessage(OrdererAddresses) + DESCRIPTOR.has_options = True DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z+github.com/hyperledger/fabric/protos/common')) diff --git a/bddtests/features/bootstrap.feature b/bddtests/features/bootstrap.feature index f75f6a6c946..2ab1475a164 100644 --- a/bddtests/features/bootstrap.feature +++ b/bddtests/features/bootstrap.feature @@ -11,7 +11,7 @@ Feature: Bootstrap As a blockchain entrepreneur I want to bootstrap a new blockchain network -# @doNotDecompose + @doNotDecompose Scenario Outline: Bootstrap a development network with 1 peer and 1 orderer, each having a single independent root of trust (No COP) #creates 1 self-signed key/cert pair per orderer organization Given the orderer network has organizations: @@ -33,22 +33,39 @@ Feature: Bootstrap And the ordererBootstrapAdmin generates a GUUID to identify the orderer system chain and refer to it by name as "OrdererSystemChainId" # Actually creating proto ordere_dot_confoiguration.ChainCreators + # Creates SignedConfigItems + # Policy And the ordererBootstrapAdmin creates a chain creators policy "chainCreatePolicy1" (network name) for peer orgs who wish to form a network using orderer system chain "OrdererSystemChainId": | Organization | | peerOrg0 | | peerOrg1 | | peerOrg2 | + # Creates SignedConfigItems + And the ordererBoostrapAdmin creates the chain creation policy names "chainCreationPolicyNames" signedConfigurationItem for orderer system chain "OrdererSystemChainId" with policies: + |PolicyName | + |chainCreatePolicy1 | + + + # Creates SignedConfigItems + And the ordererBoostrapAdmin creates MSP Configuration Items "mspConfigItems1" for orderer system chain "OrdererSystemChainId" for every MSP referenced by the policies: + |PolicyName | + |chainCreatePolicy1 | + # Order info includes orderer admin/orderer information and address (host:port) from previous steps # Only the peer organizations can vary. - And the ordererBootstrapAdmin creates the genesis block for chain "OrdererSystemChainId" for network config policy "" and consensus "" using chain creators policy "chainCreatePolicy1" + And the ordererBootstrapAdmin creates the genesis block for chain "OrdererSystemChainId" for network config policy "" and consensus "" using chain creators policies: + | SignedConfigItemsName | + | chainCreatePolicy1 | + | chainCreationPolicyNames | + | mspConfigItems1 | - And the orderer admins inspect and approve the genesis block for chain "" + And the orderer admins inspect and approve the genesis block for chain "OrdererSystemChainId" # to be used for setting the orderer genesis block path parameter in composition - And the orderer admins use the genesis block for chain "" to configure orderers + And the orderer admins use the genesis block for chain "OrdererSystemChainId" to configure orderers # We now have an orderer network with NO peers. Now need to configure and start the peer network # This can be currently automated through folder creation of the proper form and placing PEMs. @@ -56,8 +73,8 @@ Feature: Bootstrap | User | Peer | Organization | | peer0Signer | peer0 | peerOrg0 | | peer1Signer | peer1 | peerOrg0 | - | peer2Signer | peer2 | peerOrg0 | - | peer3Signer | peer3 | peerOrg0 | + | peer2Signer | peer2 | peerOrg1 | + | peer3Signer | peer3 | peerOrg1 | And we compose "" @@ -79,10 +96,15 @@ Feature: Bootstrap | peerOrg0 | | peerOrg1 | + And the user "dev0Org0" creates an peer anchor set "anchors1" for channel "com.acme.blockchain.jdoe.Channel1" for orgs: + | User | Peer | Organization | + | peer0Signer | peer0 | peerOrg0 | + | peer2Signer | peer2 | peerOrg1 | + # TODO: grab the peer orgs from template1 and put into Murali's MSP info SCIs. And the user "dev0Org0" creates a signedConfigEnvelope "createChannelSignedConfigEnvelope1" - | ChannelID | Template | Chain Creation Policy Name | - | com.acme.blockchain.jdoe.Channel1 | template1 | chainCreatePolicy1 | + | ChannelID | Template | Chain Creation Policy Name | Anchors | + | com.acme.blockchain.jdoe.Channel1 | template1 | chainCreatePolicy1 | anchors1 | And the user "dev0Org0" collects signatures for signedConfigEnvelope "createChannelSignedConfigEnvelope1" from peer orgs: | Organization | @@ -98,25 +120,19 @@ Feature: Bootstrap 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 | Retries | RetryWaitInSecs | - | com.acme.blockchain.jdoe.Channel1 | 0 | 0 | 3 | 1 | - Then user "dev0Org0" should get a delivery "genesisBlockForMyNewChannel" from "orderer0" of "1" blocks with "1" messages within "1" seconds + | ChainId | Start | End | + | com.acme.blockchain.jdoe.Channel1 | 0 | 0 | + Then user "dev0Org0" should get a delivery "genesisBlockForMyNewChannel" from "orderer0" of "1" blocks with "1" messages within "1" seconds - # This is really a CSCC chaincode invocation. Expect 200 response - And channel admin creates a configTxProposal and asks for endorsement from "peer0" - And channel admin creates a configTxProposal and asks for endorsement from "peer1" - - When channel admin - - And peer admins get the genesis block for chain 'chain1' from chainBoostrapAdmin - And the peer admins inspect and approve the genesis block for chain 'chain1' + When user "dev0Org0" request to join channel using genesis block "genesisBlockForMyNewChannel" on peer "peer0" with result "joinChannelResult" + | Developer | ChainCreationPolicyName | Organization | + | dev0Org0 | chainCreatePolicy1 | peerOrg0 | - And the peer admins use the genesis block for chain 'chain1' to configure peers - And I wait "1" seconds - And user "binhn" registers with peer organization "peerOrg0" + Then user "dev0Org0" expects result code for "joinChannelResult" of "200" + # 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 | funcName | arg1 | arg2 | arg3 | arg4 | | init | a | 100 | b | 200 | @@ -130,5 +146,5 @@ Feature: Bootstrap Examples: Orderer Options - | ComposeFile | Waittime | OrdererSystemChainId |PolicyType | ConsensusType | - | docker-compose-next-4.yml | 60 | test_chainid |unanimous | solo | + | ComposeFile | Waittime | PolicyType | ConsensusType | + | docker-compose-next-4.yml | 60 | unanimous | solo | diff --git a/bddtests/identities_pb2.py b/bddtests/identities_pb2.py new file mode 100644 index 00000000000..6f39097538f --- /dev/null +++ b/bddtests/identities_pb2.py @@ -0,0 +1,88 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: identities.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='identities.proto', + package='msp', + syntax='proto3', + serialized_pb=_b('\n\x10identities.proto\x12\x03msp\"4\n\x12SerializedIdentity\x12\r\n\x05Mspid\x18\x01 \x01(\t\x12\x0f\n\x07IdBytes\x18\x02 \x01(\x0c\x42#Z!github.com/hyperledger/fabric/mspb\x06proto3') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_SERIALIZEDIDENTITY = _descriptor.Descriptor( + name='SerializedIdentity', + full_name='msp.SerializedIdentity', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Mspid', full_name='msp.SerializedIdentity.Mspid', 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='IdBytes', full_name='msp.SerializedIdentity.IdBytes', 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=25, + serialized_end=77, +) + +DESCRIPTOR.message_types_by_name['SerializedIdentity'] = _SERIALIZEDIDENTITY + +SerializedIdentity = _reflection.GeneratedProtocolMessageType('SerializedIdentity', (_message.Message,), dict( + DESCRIPTOR = _SERIALIZEDIDENTITY, + __module__ = 'identities_pb2' + # @@protoc_insertion_point(class_scope:msp.SerializedIdentity) + )) +_sym_db.RegisterMessage(SerializedIdentity) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z!github.com/hyperledger/fabric/msp')) +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/identities_pb2_grpc.py b/bddtests/identities_pb2_grpc.py new file mode 100644 index 00000000000..c374a4d7d5b --- /dev/null +++ b/bddtests/identities_pb2_grpc.py @@ -0,0 +1,4 @@ +import grpc +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + diff --git a/bddtests/msp/__init__.py b/bddtests/msp/__init__.py new file mode 100644 index 00000000000..8d1c8b69c3f --- /dev/null +++ b/bddtests/msp/__init__.py @@ -0,0 +1 @@ + diff --git a/bddtests/msp/mspconfig_pb2.py b/bddtests/msp/mspconfig_pb2.py new file mode 100644 index 00000000000..5e1ef462504 --- /dev/null +++ b/bddtests/msp/mspconfig_pb2.py @@ -0,0 +1,249 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: msp/mspconfig.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='msp/mspconfig.proto', + package='msp', + syntax='proto3', + serialized_pb=_b('\n\x13msp/mspconfig.proto\x12\x03msp\")\n\tMSPConfig\x12\x0c\n\x04Type\x18\x01 \x01(\x05\x12\x0e\n\x06\x43onfig\x18\x02 \x01(\x0c\"\x8d\x01\n\x0f\x46\x61\x62ricMSPConfig\x12\x0c\n\x04Name\x18\x01 \x01(\t\x12\x11\n\tRootCerts\x18\x02 \x03(\x0c\x12\x0e\n\x06\x41\x64mins\x18\x03 \x03(\x0c\x12\x16\n\x0eRevocationList\x18\x04 \x03(\x0c\x12\x31\n\x0fSigningIdentity\x18\x05 \x01(\x0b\x32\x18.msp.SigningIdentityInfo\"P\n\x13SigningIdentityInfo\x12\x14\n\x0cPublicSigner\x18\x01 \x01(\x0c\x12#\n\rPrivateSigner\x18\x02 \x01(\x0b\x32\x0c.msp.KeyInfo\"5\n\x07KeyInfo\x12\x15\n\rKeyIdentifier\x18\x01 \x01(\t\x12\x13\n\x0bKeyMaterial\x18\x02 \x01(\x0c\x42*Z(github.com/hyperledger/fabric/protos/mspb\x06proto3') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_MSPCONFIG = _descriptor.Descriptor( + name='MSPConfig', + full_name='msp.MSPConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Type', full_name='msp.MSPConfig.Type', index=0, + number=1, type=5, cpp_type=1, 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='Config', full_name='msp.MSPConfig.Config', 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=28, + serialized_end=69, +) + + +_FABRICMSPCONFIG = _descriptor.Descriptor( + name='FabricMSPConfig', + full_name='msp.FabricMSPConfig', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Name', full_name='msp.FabricMSPConfig.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), + _descriptor.FieldDescriptor( + name='RootCerts', full_name='msp.FabricMSPConfig.RootCerts', index=1, + number=2, type=12, 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), + _descriptor.FieldDescriptor( + name='Admins', full_name='msp.FabricMSPConfig.Admins', index=2, + number=3, type=12, 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), + _descriptor.FieldDescriptor( + name='RevocationList', full_name='msp.FabricMSPConfig.RevocationList', index=3, + number=4, type=12, 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), + _descriptor.FieldDescriptor( + name='SigningIdentity', full_name='msp.FabricMSPConfig.SigningIdentity', 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), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=72, + serialized_end=213, +) + + +_SIGNINGIDENTITYINFO = _descriptor.Descriptor( + name='SigningIdentityInfo', + full_name='msp.SigningIdentityInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='PublicSigner', full_name='msp.SigningIdentityInfo.PublicSigner', 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='PrivateSigner', full_name='msp.SigningIdentityInfo.PrivateSigner', 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=215, + serialized_end=295, +) + + +_KEYINFO = _descriptor.Descriptor( + name='KeyInfo', + full_name='msp.KeyInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='KeyIdentifier', full_name='msp.KeyInfo.KeyIdentifier', 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='KeyMaterial', full_name='msp.KeyInfo.KeyMaterial', 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=297, + serialized_end=350, +) + +_FABRICMSPCONFIG.fields_by_name['SigningIdentity'].message_type = _SIGNINGIDENTITYINFO +_SIGNINGIDENTITYINFO.fields_by_name['PrivateSigner'].message_type = _KEYINFO +DESCRIPTOR.message_types_by_name['MSPConfig'] = _MSPCONFIG +DESCRIPTOR.message_types_by_name['FabricMSPConfig'] = _FABRICMSPCONFIG +DESCRIPTOR.message_types_by_name['SigningIdentityInfo'] = _SIGNINGIDENTITYINFO +DESCRIPTOR.message_types_by_name['KeyInfo'] = _KEYINFO + +MSPConfig = _reflection.GeneratedProtocolMessageType('MSPConfig', (_message.Message,), dict( + DESCRIPTOR = _MSPCONFIG, + __module__ = 'msp.mspconfig_pb2' + # @@protoc_insertion_point(class_scope:msp.MSPConfig) + )) +_sym_db.RegisterMessage(MSPConfig) + +FabricMSPConfig = _reflection.GeneratedProtocolMessageType('FabricMSPConfig', (_message.Message,), dict( + DESCRIPTOR = _FABRICMSPCONFIG, + __module__ = 'msp.mspconfig_pb2' + # @@protoc_insertion_point(class_scope:msp.FabricMSPConfig) + )) +_sym_db.RegisterMessage(FabricMSPConfig) + +SigningIdentityInfo = _reflection.GeneratedProtocolMessageType('SigningIdentityInfo', (_message.Message,), dict( + DESCRIPTOR = _SIGNINGIDENTITYINFO, + __module__ = 'msp.mspconfig_pb2' + # @@protoc_insertion_point(class_scope:msp.SigningIdentityInfo) + )) +_sym_db.RegisterMessage(SigningIdentityInfo) + +KeyInfo = _reflection.GeneratedProtocolMessageType('KeyInfo', (_message.Message,), dict( + DESCRIPTOR = _KEYINFO, + __module__ = 'msp.mspconfig_pb2' + # @@protoc_insertion_point(class_scope:msp.KeyInfo) + )) +_sym_db.RegisterMessage(KeyInfo) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('Z(github.com/hyperledger/fabric/protos/msp')) +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/msp/mspconfig_pb2_grpc.py b/bddtests/msp/mspconfig_pb2_grpc.py new file mode 100644 index 00000000000..c374a4d7d5b --- /dev/null +++ b/bddtests/msp/mspconfig_pb2_grpc.py @@ -0,0 +1,4 @@ +import grpc +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + diff --git a/bddtests/orderer/configuration_pb2.py b/bddtests/orderer/configuration_pb2.py index 1fa1a0fb21b..508056002bb 100644 --- a/bddtests/orderer/configuration_pb2.py +++ b/bddtests/orderer/configuration_pb2.py @@ -20,7 +20,7 @@ name='orderer/configuration.proto', package='orderer', syntax='proto3', - serialized_pb=_b('\n\x1borderer/configuration.proto\x12\x07orderer\x1a\x13\x63ommon/common.proto\"\x1d\n\rConsensusType\x12\x0c\n\x04type\x18\x01 \x01(\t\">\n\tBatchSize\x12\x17\n\x0fmaxMessageCount\x18\x01 \x01(\r\x12\x18\n\x10\x61\x62soluteMaxBytes\x18\x02 \x01(\r\"\x1f\n\x0c\x42\x61tchTimeout\x12\x0f\n\x07timeout\x18\x01 \x01(\t\"0\n\x0e\x43reationPolicy\x12\x0e\n\x06policy\x18\x01 \x01(\t\x12\x0e\n\x06\x64igest\x18\x02 \x01(\x0c\"\x1d\n\rIngressPolicy\x12\x0c\n\x04name\x18\x01 \x01(\t\"\x1c\n\x0c\x45gressPolicy\x12\x0c\n\x04name\x18\x01 \x01(\t\"!\n\rChainCreators\x12\x10\n\x08policies\x18\x01 \x03(\t\"\x1f\n\x0cKafkaBrokers\x12\x0f\n\x07\x62rokers\x18\x01 \x03(\tB.Z,github.com/hyperledger/fabric/protos/ordererb\x06proto3') + serialized_pb=_b('\n\x1borderer/configuration.proto\x12\x07orderer\x1a\x13\x63ommon/common.proto\"\x1d\n\rConsensusType\x12\x0c\n\x04type\x18\x01 \x01(\t\"Y\n\tBatchSize\x12\x17\n\x0fmaxMessageCount\x18\x01 \x01(\r\x12\x18\n\x10\x61\x62soluteMaxBytes\x18\x02 \x01(\r\x12\x19\n\x11preferredMaxBytes\x18\x03 \x01(\r\"\x1f\n\x0c\x42\x61tchTimeout\x12\x0f\n\x07timeout\x18\x01 \x01(\t\"0\n\x0e\x43reationPolicy\x12\x0e\n\x06policy\x18\x01 \x01(\t\x12\x0e\n\x06\x64igest\x18\x02 \x01(\x0c\"#\n\x12IngressPolicyNames\x12\r\n\x05names\x18\x01 \x03(\t\"\"\n\x11\x45gressPolicyNames\x12\r\n\x05names\x18\x01 \x03(\t\")\n\x18\x43hainCreationPolicyNames\x12\r\n\x05names\x18\x01 \x03(\t\"\x1f\n\x0cKafkaBrokers\x12\x0f\n\x07\x62rokers\x18\x01 \x03(\tB.Z,github.com/hyperledger/fabric/protos/ordererb\x06proto3') , dependencies=[common_dot_common__pb2.DESCRIPTOR,]) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -80,6 +80,13 @@ message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), + _descriptor.FieldDescriptor( + name='preferredMaxBytes', full_name='orderer.BatchSize.preferredMaxBytes', index=2, + number=3, type=13, cpp_type=3, 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), ], extensions=[ ], @@ -93,7 +100,7 @@ oneofs=[ ], serialized_start=92, - serialized_end=154, + serialized_end=181, ) @@ -123,8 +130,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=156, - serialized_end=187, + serialized_start=183, + serialized_end=214, ) @@ -161,22 +168,22 @@ extension_ranges=[], oneofs=[ ], - serialized_start=189, - serialized_end=237, + serialized_start=216, + serialized_end=264, ) -_INGRESSPOLICY = _descriptor.Descriptor( - name='IngressPolicy', - full_name='orderer.IngressPolicy', +_INGRESSPOLICYNAMES = _descriptor.Descriptor( + name='IngressPolicyNames', + full_name='orderer.IngressPolicyNames', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='name', full_name='orderer.IngressPolicy.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), + name='names', full_name='orderer.IngressPolicyNames.names', index=0, + number=1, 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), @@ -192,22 +199,22 @@ extension_ranges=[], oneofs=[ ], - serialized_start=239, - serialized_end=268, + serialized_start=266, + serialized_end=301, ) -_EGRESSPOLICY = _descriptor.Descriptor( - name='EgressPolicy', - full_name='orderer.EgressPolicy', +_EGRESSPOLICYNAMES = _descriptor.Descriptor( + name='EgressPolicyNames', + full_name='orderer.EgressPolicyNames', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='name', full_name='orderer.EgressPolicy.name', index=0, - number=1, type=9, cpp_type=9, label=1, - has_default_value=False, default_value=_b("").decode('utf-8'), + name='names', full_name='orderer.EgressPolicyNames.names', index=0, + number=1, 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), @@ -223,20 +230,20 @@ extension_ranges=[], oneofs=[ ], - serialized_start=270, - serialized_end=298, + serialized_start=303, + serialized_end=337, ) -_CHAINCREATORS = _descriptor.Descriptor( - name='ChainCreators', - full_name='orderer.ChainCreators', +_CHAINCREATIONPOLICYNAMES = _descriptor.Descriptor( + name='ChainCreationPolicyNames', + full_name='orderer.ChainCreationPolicyNames', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name='policies', full_name='orderer.ChainCreators.policies', index=0, + name='names', full_name='orderer.ChainCreationPolicyNames.names', index=0, number=1, type=9, cpp_type=9, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, @@ -254,8 +261,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=300, - serialized_end=333, + serialized_start=339, + serialized_end=380, ) @@ -285,17 +292,17 @@ extension_ranges=[], oneofs=[ ], - serialized_start=335, - serialized_end=366, + serialized_start=382, + serialized_end=413, ) DESCRIPTOR.message_types_by_name['ConsensusType'] = _CONSENSUSTYPE DESCRIPTOR.message_types_by_name['BatchSize'] = _BATCHSIZE DESCRIPTOR.message_types_by_name['BatchTimeout'] = _BATCHTIMEOUT DESCRIPTOR.message_types_by_name['CreationPolicy'] = _CREATIONPOLICY -DESCRIPTOR.message_types_by_name['IngressPolicy'] = _INGRESSPOLICY -DESCRIPTOR.message_types_by_name['EgressPolicy'] = _EGRESSPOLICY -DESCRIPTOR.message_types_by_name['ChainCreators'] = _CHAINCREATORS +DESCRIPTOR.message_types_by_name['IngressPolicyNames'] = _INGRESSPOLICYNAMES +DESCRIPTOR.message_types_by_name['EgressPolicyNames'] = _EGRESSPOLICYNAMES +DESCRIPTOR.message_types_by_name['ChainCreationPolicyNames'] = _CHAINCREATIONPOLICYNAMES DESCRIPTOR.message_types_by_name['KafkaBrokers'] = _KAFKABROKERS ConsensusType = _reflection.GeneratedProtocolMessageType('ConsensusType', (_message.Message,), dict( @@ -326,26 +333,26 @@ )) _sym_db.RegisterMessage(CreationPolicy) -IngressPolicy = _reflection.GeneratedProtocolMessageType('IngressPolicy', (_message.Message,), dict( - DESCRIPTOR = _INGRESSPOLICY, +IngressPolicyNames = _reflection.GeneratedProtocolMessageType('IngressPolicyNames', (_message.Message,), dict( + DESCRIPTOR = _INGRESSPOLICYNAMES, __module__ = 'orderer.configuration_pb2' - # @@protoc_insertion_point(class_scope:orderer.IngressPolicy) + # @@protoc_insertion_point(class_scope:orderer.IngressPolicyNames) )) -_sym_db.RegisterMessage(IngressPolicy) +_sym_db.RegisterMessage(IngressPolicyNames) -EgressPolicy = _reflection.GeneratedProtocolMessageType('EgressPolicy', (_message.Message,), dict( - DESCRIPTOR = _EGRESSPOLICY, +EgressPolicyNames = _reflection.GeneratedProtocolMessageType('EgressPolicyNames', (_message.Message,), dict( + DESCRIPTOR = _EGRESSPOLICYNAMES, __module__ = 'orderer.configuration_pb2' - # @@protoc_insertion_point(class_scope:orderer.EgressPolicy) + # @@protoc_insertion_point(class_scope:orderer.EgressPolicyNames) )) -_sym_db.RegisterMessage(EgressPolicy) +_sym_db.RegisterMessage(EgressPolicyNames) -ChainCreators = _reflection.GeneratedProtocolMessageType('ChainCreators', (_message.Message,), dict( - DESCRIPTOR = _CHAINCREATORS, +ChainCreationPolicyNames = _reflection.GeneratedProtocolMessageType('ChainCreationPolicyNames', (_message.Message,), dict( + DESCRIPTOR = _CHAINCREATIONPOLICYNAMES, __module__ = 'orderer.configuration_pb2' - # @@protoc_insertion_point(class_scope:orderer.ChainCreators) + # @@protoc_insertion_point(class_scope:orderer.ChainCreationPolicyNames) )) -_sym_db.RegisterMessage(ChainCreators) +_sym_db.RegisterMessage(ChainCreationPolicyNames) KafkaBrokers = _reflection.GeneratedProtocolMessageType('KafkaBrokers', (_message.Message,), dict( DESCRIPTOR = _KAFKABROKERS, diff --git a/bddtests/peer/__init__.py b/bddtests/peer/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/bddtests/peer/chaincode_pb2.py b/bddtests/peer/chaincode_pb2.py new file mode 100644 index 00000000000..aad78b14e54 --- /dev/null +++ b/bddtests/peer/chaincode_pb2.py @@ -0,0 +1,942 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: peer/chaincode.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf.internal import enum_type_wrapper +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 chaincodeevent_pb2 as peer_dot_chaincodeevent__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + 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') + , + dependencies=[peer_dot_chaincodeevent__pb2.DESCRIPTOR,google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +_CONFIDENTIALITYLEVEL = _descriptor.EnumDescriptor( + name='ConfidentialityLevel', + full_name='protos.ConfidentialityLevel', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='PUBLIC', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CONFIDENTIAL', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=1673, + serialized_end=1725, +) +_sym_db.RegisterEnumDescriptor(_CONFIDENTIALITYLEVEL) + +ConfidentialityLevel = enum_type_wrapper.EnumTypeWrapper(_CONFIDENTIALITYLEVEL) +PUBLIC = 0 +CONFIDENTIAL = 1 + + +_CHAINCODESPEC_TYPE = _descriptor.EnumDescriptor( + name='Type', + full_name='protos.ChaincodeSpec.Type', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNDEFINED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GOLANG', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='NODE', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='CAR', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='JAVA', index=4, number=4, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=425, + serialized_end=487, +) +_sym_db.RegisterEnumDescriptor(_CHAINCODESPEC_TYPE) + +_CHAINCODEDEPLOYMENTSPEC_EXECUTIONENVIRONMENT = _descriptor.EnumDescriptor( + name='ExecutionEnvironment', + full_name='protos.ChaincodeDeploymentSpec.ExecutionEnvironment', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='DOCKER', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='SYSTEM', index=1, number=1, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=706, + serialized_end=752, +) +_sym_db.RegisterEnumDescriptor(_CHAINCODEDEPLOYMENTSPEC_EXECUTIONENVIRONMENT) + +_CHAINCODEMESSAGE_TYPE = _descriptor.EnumDescriptor( + name='Type', + full_name='protos.ChaincodeMessage.Type', + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name='UNDEFINED', index=0, number=0, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='REGISTER', index=1, number=1, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='REGISTERED', index=2, number=2, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INIT', index=3, number=3, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='READY', index=4, number=4, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='TRANSACTION', index=5, number=5, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='COMPLETED', index=6, number=6, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='ERROR', index=7, number=7, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='GET_STATE', index=8, number=8, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='PUT_STATE', index=9, number=9, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='DEL_STATE', index=10, number=10, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='INVOKE_CHAINCODE', index=11, number=11, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RESPONSE', index=12, number=13, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RANGE_QUERY_STATE', index=13, number=14, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RANGE_QUERY_STATE_NEXT', index=14, number=15, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='RANGE_QUERY_STATE_CLOSE', index=15, number=16, + options=None, + type=None), + _descriptor.EnumValueDescriptor( + name='KEEPALIVE', index=16, number=17, + options=None, + type=None), + ], + containing_type=None, + options=None, + serialized_start=1045, + serialized_end=1336, +) +_sym_db.RegisterEnumDescriptor(_CHAINCODEMESSAGE_TYPE) + + +_CHAINCODEID = _descriptor.Descriptor( + name='ChaincodeID', + full_name='protos.ChaincodeID', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='path', full_name='protos.ChaincodeID.path', 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='name', full_name='protos.ChaincodeID.name', 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=92, + serialized_end=133, +) + + +_CHAINCODEINPUT = _descriptor.Descriptor( + name='ChaincodeInput', + full_name='protos.ChaincodeInput', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='args', full_name='protos.ChaincodeInput.args', index=0, + number=1, type=12, 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=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=135, + serialized_end=165, +) + + +_CHAINCODESPEC = _descriptor.Descriptor( + name='ChaincodeSpec', + full_name='protos.ChaincodeSpec', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='protos.ChaincodeSpec.type', index=0, + number=1, 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='chaincodeID', full_name='protos.ChaincodeSpec.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), + _descriptor.FieldDescriptor( + name='ctorMsg', full_name='protos.ChaincodeSpec.ctorMsg', 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), + _descriptor.FieldDescriptor( + name='timeout', full_name='protos.ChaincodeSpec.timeout', index=3, + number=4, type=5, cpp_type=1, 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='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=[ + ], + nested_types=[], + enum_types=[ + _CHAINCODESPEC_TYPE, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=168, + serialized_end=487, +) + + +_CHAINCODEDEPLOYMENTSPEC = _descriptor.Descriptor( + name='ChaincodeDeploymentSpec', + full_name='protos.ChaincodeDeploymentSpec', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='chaincodeSpec', full_name='protos.ChaincodeDeploymentSpec.chaincodeSpec', 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='effectiveDate', full_name='protos.ChaincodeDeploymentSpec.effectiveDate', 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), + _descriptor.FieldDescriptor( + name='codePackage', full_name='protos.ChaincodeDeploymentSpec.codePackage', 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), + _descriptor.FieldDescriptor( + name='execEnv', full_name='protos.ChaincodeDeploymentSpec.execEnv', index=3, + number=4, 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), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _CHAINCODEDEPLOYMENTSPEC_EXECUTIONENVIRONMENT, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=490, + serialized_end=752, +) + + +_CHAINCODEINVOCATIONSPEC = _descriptor.Descriptor( + name='ChaincodeInvocationSpec', + full_name='protos.ChaincodeInvocationSpec', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='chaincodeSpec', full_name='protos.ChaincodeInvocationSpec.chaincodeSpec', 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='idGenerationAlg', full_name='protos.ChaincodeInvocationSpec.idGenerationAlg', 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=754, + serialized_end=850, +) + + +_CHAINCODEMESSAGE = _descriptor.Descriptor( + name='ChaincodeMessage', + full_name='protos.ChaincodeMessage', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='protos.ChaincodeMessage.type', index=0, + number=1, 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='timestamp', full_name='protos.ChaincodeMessage.timestamp', 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), + _descriptor.FieldDescriptor( + name='payload', full_name='protos.ChaincodeMessage.payload', 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), + _descriptor.FieldDescriptor( + name='txid', full_name='protos.ChaincodeMessage.txid', index=3, + number=4, 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='chaincodeEvent', full_name='protos.ChaincodeMessage.chaincodeEvent', index=4, + 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, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _CHAINCODEMESSAGE_TYPE, + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=853, + serialized_end=1336, +) + + +_PUTSTATEINFO = _descriptor.Descriptor( + name='PutStateInfo', + full_name='protos.PutStateInfo', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='protos.PutStateInfo.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.PutStateInfo.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, + 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=1338, + serialized_end=1380, +) + + +_RANGEQUERYSTATE = _descriptor.Descriptor( + name='RangeQueryState', + full_name='protos.RangeQueryState', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='startKey', full_name='protos.RangeQueryState.startKey', 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='endKey', full_name='protos.RangeQueryState.endKey', 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=1382, + serialized_end=1433, +) + + +_RANGEQUERYSTATENEXT = _descriptor.Descriptor( + name='RangeQueryStateNext', + full_name='protos.RangeQueryStateNext', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ID', full_name='protos.RangeQueryStateNext.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, + 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=1435, + serialized_end=1468, +) + + +_RANGEQUERYSTATECLOSE = _descriptor.Descriptor( + name='RangeQueryStateClose', + full_name='protos.RangeQueryStateClose', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='ID', full_name='protos.RangeQueryStateClose.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, + 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=1470, + serialized_end=1504, +) + + +_RANGEQUERYSTATEKEYVALUE = _descriptor.Descriptor( + name='RangeQueryStateKeyValue', + full_name='protos.RangeQueryStateKeyValue', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='protos.RangeQueryStateKeyValue.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, + 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=1506, + serialized_end=1559, +) + + +_RANGEQUERYSTATERESPONSE = _descriptor.Descriptor( + name='RangeQueryStateResponse', + full_name='protos.RangeQueryStateResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='keysAndValues', full_name='protos.RangeQueryStateResponse.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, + 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, + 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, + 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=1561, + serialized_end=1671, +) + +_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_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 +_CHAINCODEDEPLOYMENTSPEC.fields_by_name['execEnv'].enum_type = _CHAINCODEDEPLOYMENTSPEC_EXECUTIONENVIRONMENT +_CHAINCODEDEPLOYMENTSPEC_EXECUTIONENVIRONMENT.containing_type = _CHAINCODEDEPLOYMENTSPEC +_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['chaincodeEvent'].message_type = peer_dot_chaincodeevent__pb2._CHAINCODEEVENT +_CHAINCODEMESSAGE_TYPE.containing_type = _CHAINCODEMESSAGE +_RANGEQUERYSTATERESPONSE.fields_by_name['keysAndValues'].message_type = _RANGEQUERYSTATEKEYVALUE +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['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.enum_types_by_name['ConfidentialityLevel'] = _CONFIDENTIALITYLEVEL + +ChaincodeID = _reflection.GeneratedProtocolMessageType('ChaincodeID', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEID, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeID) + )) +_sym_db.RegisterMessage(ChaincodeID) + +ChaincodeInput = _reflection.GeneratedProtocolMessageType('ChaincodeInput', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEINPUT, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeInput) + )) +_sym_db.RegisterMessage(ChaincodeInput) + +ChaincodeSpec = _reflection.GeneratedProtocolMessageType('ChaincodeSpec', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODESPEC, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeSpec) + )) +_sym_db.RegisterMessage(ChaincodeSpec) + +ChaincodeDeploymentSpec = _reflection.GeneratedProtocolMessageType('ChaincodeDeploymentSpec', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEDEPLOYMENTSPEC, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeDeploymentSpec) + )) +_sym_db.RegisterMessage(ChaincodeDeploymentSpec) + +ChaincodeInvocationSpec = _reflection.GeneratedProtocolMessageType('ChaincodeInvocationSpec', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEINVOCATIONSPEC, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeInvocationSpec) + )) +_sym_db.RegisterMessage(ChaincodeInvocationSpec) + +ChaincodeMessage = _reflection.GeneratedProtocolMessageType('ChaincodeMessage', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEMESSAGE, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeMessage) + )) +_sym_db.RegisterMessage(ChaincodeMessage) + +PutStateInfo = _reflection.GeneratedProtocolMessageType('PutStateInfo', (_message.Message,), dict( + DESCRIPTOR = _PUTSTATEINFO, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.PutStateInfo) + )) +_sym_db.RegisterMessage(PutStateInfo) + +RangeQueryState = _reflection.GeneratedProtocolMessageType('RangeQueryState', (_message.Message,), dict( + DESCRIPTOR = _RANGEQUERYSTATE, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.RangeQueryState) + )) +_sym_db.RegisterMessage(RangeQueryState) + +RangeQueryStateNext = _reflection.GeneratedProtocolMessageType('RangeQueryStateNext', (_message.Message,), dict( + DESCRIPTOR = _RANGEQUERYSTATENEXT, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.RangeQueryStateNext) + )) +_sym_db.RegisterMessage(RangeQueryStateNext) + +RangeQueryStateClose = _reflection.GeneratedProtocolMessageType('RangeQueryStateClose', (_message.Message,), dict( + DESCRIPTOR = _RANGEQUERYSTATECLOSE, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.RangeQueryStateClose) + )) +_sym_db.RegisterMessage(RangeQueryStateClose) + +RangeQueryStateKeyValue = _reflection.GeneratedProtocolMessageType('RangeQueryStateKeyValue', (_message.Message,), dict( + DESCRIPTOR = _RANGEQUERYSTATEKEYVALUE, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.RangeQueryStateKeyValue) + )) +_sym_db.RegisterMessage(RangeQueryStateKeyValue) + +RangeQueryStateResponse = _reflection.GeneratedProtocolMessageType('RangeQueryStateResponse', (_message.Message,), dict( + DESCRIPTOR = _RANGEQUERYSTATERESPONSE, + __module__ = 'peer.chaincode_pb2' + # @@protoc_insertion_point(class_scope:protos.RangeQueryStateResponse) + )) +_sym_db.RegisterMessage(RangeQueryStateResponse) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\026org.hyperledger.protosZ)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 ChaincodeSupportStub(object): + """Interface that provides support to chaincode execution. ChaincodeContext + provides the context necessary for the server to respond appropriately. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Register = channel.stream_stream( + '/protos.ChaincodeSupport/Register', + request_serializer=ChaincodeMessage.SerializeToString, + response_deserializer=ChaincodeMessage.FromString, + ) + + + class ChaincodeSupportServicer(object): + """Interface that provides support to chaincode execution. ChaincodeContext + provides the context necessary for the server to respond appropriately. + """ + + def Register(self, request_iterator, context): + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + + def add_ChaincodeSupportServicer_to_server(servicer, server): + rpc_method_handlers = { + 'Register': grpc.stream_stream_rpc_method_handler( + servicer.Register, + request_deserializer=ChaincodeMessage.FromString, + response_serializer=ChaincodeMessage.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'protos.ChaincodeSupport', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + class BetaChaincodeSupportServicer(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.""" + """Interface that provides support to chaincode execution. ChaincodeContext + provides the context necessary for the server to respond appropriately. + """ + def Register(self, request_iterator, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + + + class BetaChaincodeSupportStub(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.""" + """Interface that provides support to chaincode execution. ChaincodeContext + provides the context necessary for the server to respond appropriately. + """ + def Register(self, request_iterator, timeout, metadata=None, with_call=False, protocol_options=None): + raise NotImplementedError() + + + def beta_create_ChaincodeSupport_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.ChaincodeSupport', 'Register'): ChaincodeMessage.FromString, + } + response_serializers = { + ('protos.ChaincodeSupport', 'Register'): ChaincodeMessage.SerializeToString, + } + method_implementations = { + ('protos.ChaincodeSupport', 'Register'): face_utilities.stream_stream_inline(servicer.Register), + } + 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_ChaincodeSupport_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.ChaincodeSupport', 'Register'): ChaincodeMessage.SerializeToString, + } + response_deserializers = { + ('protos.ChaincodeSupport', 'Register'): ChaincodeMessage.FromString, + } + cardinalities = { + 'Register': cardinality.Cardinality.STREAM_STREAM, + } + 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.ChaincodeSupport', cardinalities, options=stub_options) +except ImportError: + pass +# @@protoc_insertion_point(module_scope) diff --git a/bddtests/peer/chaincode_pb2_grpc.py b/bddtests/peer/chaincode_pb2_grpc.py new file mode 100644 index 00000000000..a08334218d9 --- /dev/null +++ b/bddtests/peer/chaincode_pb2_grpc.py @@ -0,0 +1,48 @@ +import grpc +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + +import peer.chaincode_pb2 as peer_dot_chaincode__pb2 +import peer.chaincode_pb2 as peer_dot_chaincode__pb2 + + +class ChaincodeSupportStub(object): + """Interface that provides support to chaincode execution. ChaincodeContext + provides the context necessary for the server to respond appropriately. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Register = channel.stream_stream( + '/protos.ChaincodeSupport/Register', + request_serializer=peer_dot_chaincode__pb2.ChaincodeMessage.SerializeToString, + response_deserializer=peer_dot_chaincode__pb2.ChaincodeMessage.FromString, + ) + + +class ChaincodeSupportServicer(object): + """Interface that provides support to chaincode execution. ChaincodeContext + provides the context necessary for the server to respond appropriately. + """ + + def Register(self, request_iterator, context): + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_ChaincodeSupportServicer_to_server(servicer, server): + rpc_method_handlers = { + 'Register': grpc.stream_stream_rpc_method_handler( + servicer.Register, + request_deserializer=peer_dot_chaincode__pb2.ChaincodeMessage.FromString, + response_serializer=peer_dot_chaincode__pb2.ChaincodeMessage.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'protos.ChaincodeSupport', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/bddtests/peer/chaincode_proposal_pb2.py b/bddtests/peer/chaincode_proposal_pb2.py new file mode 100644 index 00000000000..08cd365f41f --- /dev/null +++ b/bddtests/peer/chaincode_proposal_pb2.py @@ -0,0 +1,183 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: peer/chaincode_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 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='peer/chaincode_proposal.proto', + package='protos', + syntax='proto3', + serialized_pb=_b('\n\x1dpeer/chaincode_proposal.proto\x12\x06protos\x1a\x14peer/chaincode.proto\"_\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\"2\n\x0f\x43haincodeAction\x12\x0f\n\x07results\x18\x01 \x01(\x0c\x12\x0e\n\x06\x65vents\x18\x02 \x01(\x0c\x42+Z)github.com/hyperledger/fabric/protos/peerb\x06proto3') + , + dependencies=[peer_dot_chaincode__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_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=63, + serialized_end=158, +) + + +_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=160, + serialized_end=220, +) + + +_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), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=222, + serialized_end=272, +) + +_CHAINCODEHEADEREXTENSION.fields_by_name['chaincodeID'].message_type = peer_dot_chaincode__pb2._CHAINCODEID +DESCRIPTOR.message_types_by_name['ChaincodeHeaderExtension'] = _CHAINCODEHEADEREXTENSION +DESCRIPTOR.message_types_by_name['ChaincodeProposalPayload'] = _CHAINCODEPROPOSALPAYLOAD +DESCRIPTOR.message_types_by_name['ChaincodeAction'] = _CHAINCODEACTION + +ChaincodeHeaderExtension = _reflection.GeneratedProtocolMessageType('ChaincodeHeaderExtension', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEHEADEREXTENSION, + __module__ = 'peer.chaincode_proposal_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeHeaderExtension) + )) +_sym_db.RegisterMessage(ChaincodeHeaderExtension) + +ChaincodeProposalPayload = _reflection.GeneratedProtocolMessageType('ChaincodeProposalPayload', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEPROPOSALPAYLOAD, + __module__ = 'peer.chaincode_proposal_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeProposalPayload) + )) +_sym_db.RegisterMessage(ChaincodeProposalPayload) + +ChaincodeAction = _reflection.GeneratedProtocolMessageType('ChaincodeAction', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEACTION, + __module__ = 'peer.chaincode_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/chaincode_proposal_pb2_grpc.py b/bddtests/peer/chaincode_proposal_pb2_grpc.py new file mode 100644 index 00000000000..c374a4d7d5b --- /dev/null +++ b/bddtests/peer/chaincode_proposal_pb2_grpc.py @@ -0,0 +1,4 @@ +import grpc +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + diff --git a/bddtests/peer/chaincodeevent_pb2.py b/bddtests/peer/chaincodeevent_pb2.py new file mode 100644 index 00000000000..4583be914b0 --- /dev/null +++ b/bddtests/peer/chaincodeevent_pb2.py @@ -0,0 +1,102 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: peer/chaincodeevent.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/chaincodeevent.proto', + package='protos', + syntax='proto3', + serialized_pb=_b('\n\x19peer/chaincodeevent.proto\x12\x06protos\"W\n\x0e\x43haincodeEvent\x12\x13\n\x0b\x63haincodeID\x18\x01 \x01(\t\x12\x0c\n\x04txID\x18\x02 \x01(\t\x12\x11\n\teventName\x18\x03 \x01(\t\x12\x0f\n\x07payload\x18\x04 \x01(\x0c\x42\x43\n\x16org.hyperledger.protosZ)github.com/hyperledger/fabric/protos/peerb\x06proto3') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_CHAINCODEEVENT = _descriptor.Descriptor( + name='ChaincodeEvent', + full_name='protos.ChaincodeEvent', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='chaincodeID', full_name='protos.ChaincodeEvent.chaincodeID', 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='txID', full_name='protos.ChaincodeEvent.txID', 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), + _descriptor.FieldDescriptor( + name='eventName', full_name='protos.ChaincodeEvent.eventName', 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, + is_extension=False, extension_scope=None, + options=None), + _descriptor.FieldDescriptor( + name='payload', full_name='protos.ChaincodeEvent.payload', index=3, + number=4, 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=37, + serialized_end=124, +) + +DESCRIPTOR.message_types_by_name['ChaincodeEvent'] = _CHAINCODEEVENT + +ChaincodeEvent = _reflection.GeneratedProtocolMessageType('ChaincodeEvent', (_message.Message,), dict( + DESCRIPTOR = _CHAINCODEEVENT, + __module__ = 'peer.chaincodeevent_pb2' + # @@protoc_insertion_point(class_scope:protos.ChaincodeEvent) + )) +_sym_db.RegisterMessage(ChaincodeEvent) + + +DESCRIPTOR.has_options = True +DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\n\026org.hyperledger.protosZ)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/chaincodeevent_pb2_grpc.py b/bddtests/peer/chaincodeevent_pb2_grpc.py new file mode 100644 index 00000000000..c374a4d7d5b --- /dev/null +++ b/bddtests/peer/chaincodeevent_pb2_grpc.py @@ -0,0 +1,4 @@ +import grpc +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + diff --git a/bddtests/peer/configuration_pb2.py b/bddtests/peer/configuration_pb2.py new file mode 100644 index 00000000000..d4fe390de68 --- /dev/null +++ b/bddtests/peer/configuration_pb2.py @@ -0,0 +1,135 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: peer/configuration.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/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') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_ANCHORPEERS = _descriptor.Descriptor( + name='AnchorPeers', + full_name='protos.AnchorPeers', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='anchorPees', full_name='protos.AnchorPeers.anchorPees', 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), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=36, + serialized_end=89, +) + + +_ANCHORPEER = _descriptor.Descriptor( + name='AnchorPeer', + full_name='protos.AnchorPeer', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='Host', full_name='protos.AnchorPeer.Host', 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='Port', full_name='protos.AnchorPeer.Port', index=1, + number=2, type=5, cpp_type=1, 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='Cert', full_name='protos.AnchorPeer.Cert', 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=91, + serialized_end=145, +) + +_ANCHORPEERS.fields_by_name['anchorPees'].message_type = _ANCHORPEER +DESCRIPTOR.message_types_by_name['AnchorPeers'] = _ANCHORPEERS +DESCRIPTOR.message_types_by_name['AnchorPeer'] = _ANCHORPEER + +AnchorPeers = _reflection.GeneratedProtocolMessageType('AnchorPeers', (_message.Message,), dict( + DESCRIPTOR = _ANCHORPEERS, + __module__ = 'peer.configuration_pb2' + # @@protoc_insertion_point(class_scope:protos.AnchorPeers) + )) +_sym_db.RegisterMessage(AnchorPeers) + +AnchorPeer = _reflection.GeneratedProtocolMessageType('AnchorPeer', (_message.Message,), dict( + DESCRIPTOR = _ANCHORPEER, + __module__ = 'peer.configuration_pb2' + # @@protoc_insertion_point(class_scope:protos.AnchorPeer) + )) +_sym_db.RegisterMessage(AnchorPeer) + + +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/configuration_pb2_grpc.py b/bddtests/peer/configuration_pb2_grpc.py new file mode 100644 index 00000000000..c374a4d7d5b --- /dev/null +++ b/bddtests/peer/configuration_pb2_grpc.py @@ -0,0 +1,4 @@ +import grpc +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + diff --git a/bddtests/peer/fabric_proposal_pb2.py b/bddtests/peer/fabric_proposal_pb2.py new file mode 100644 index 00000000000..8f46a449557 --- /dev/null +++ b/bddtests/peer/fabric_proposal_pb2.py @@ -0,0 +1,141 @@ +# 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_proposal_pb2_grpc.py b/bddtests/peer/fabric_proposal_pb2_grpc.py new file mode 100644 index 00000000000..c374a4d7d5b --- /dev/null +++ b/bddtests/peer/fabric_proposal_pb2_grpc.py @@ -0,0 +1,4 @@ +import grpc +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + diff --git a/bddtests/peer/fabric_proposal_response_pb2.py b/bddtests/peer/fabric_proposal_response_pb2.py new file mode 100644 index 00000000000..e30e46eccc8 --- /dev/null +++ b/bddtests/peer/fabric_proposal_response_pb2.py @@ -0,0 +1,259 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: peer/fabric_proposal_response.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 google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='peer/fabric_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') + , + dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,]) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_PROPOSALRESPONSE = _descriptor.Descriptor( + name='ProposalResponse', + full_name='protos.ProposalResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='version', full_name='protos.ProposalResponse.version', index=0, + number=1, type=5, cpp_type=1, 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='timestamp', full_name='protos.ProposalResponse.timestamp', 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), + _descriptor.FieldDescriptor( + name='response', full_name='protos.ProposalResponse.response', index=2, + number=4, 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='payload', full_name='protos.ProposalResponse.payload', index=3, + number=5, 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='endorsement', full_name='protos.ProposalResponse.endorsement', index=4, + 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, + 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=81, + serialized_end=258, +) + + +_RESPONSE = _descriptor.Descriptor( + name='Response', + full_name='protos.Response', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='status', full_name='protos.Response.status', index=0, + number=1, type=5, cpp_type=1, 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='message', full_name='protos.Response.message', 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), + _descriptor.FieldDescriptor( + name='payload', full_name='protos.Response.payload', 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=260, + serialized_end=320, +) + + +_PROPOSALRESPONSEPAYLOAD = _descriptor.Descriptor( + name='ProposalResponsePayload', + full_name='protos.ProposalResponsePayload', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='proposalHash', full_name='protos.ProposalResponsePayload.proposalHash', 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='extension', full_name='protos.ProposalResponsePayload.extension', 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=322, + serialized_end=388, +) + + +_ENDORSEMENT = _descriptor.Descriptor( + name='Endorsement', + full_name='protos.Endorsement', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='endorser', full_name='protos.Endorsement.endorser', 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.Endorsement.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=390, + serialized_end=440, +) + +_PROPOSALRESPONSE.fields_by_name['timestamp'].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_PROPOSALRESPONSE.fields_by_name['response'].message_type = _RESPONSE +_PROPOSALRESPONSE.fields_by_name['endorsement'].message_type = _ENDORSEMENT +DESCRIPTOR.message_types_by_name['ProposalResponse'] = _PROPOSALRESPONSE +DESCRIPTOR.message_types_by_name['Response'] = _RESPONSE +DESCRIPTOR.message_types_by_name['ProposalResponsePayload'] = _PROPOSALRESPONSEPAYLOAD +DESCRIPTOR.message_types_by_name['Endorsement'] = _ENDORSEMENT + +ProposalResponse = _reflection.GeneratedProtocolMessageType('ProposalResponse', (_message.Message,), dict( + DESCRIPTOR = _PROPOSALRESPONSE, + __module__ = 'peer.fabric_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' + # @@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' + # @@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' + # @@protoc_insertion_point(class_scope:protos.Endorsement) + )) +_sym_db.RegisterMessage(Endorsement) + + +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_response_pb2_grpc.py b/bddtests/peer/fabric_proposal_response_pb2_grpc.py new file mode 100644 index 00000000000..c374a4d7d5b --- /dev/null +++ b/bddtests/peer/fabric_proposal_response_pb2_grpc.py @@ -0,0 +1,4 @@ +import grpc +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + diff --git a/bddtests/peer/fabric_service_pb2.py b/bddtests/peer/fabric_service_pb2.py new file mode 100644 index 00000000000..9c582bbaacc --- /dev/null +++ b/bddtests/peer/fabric_service_pb2.py @@ -0,0 +1,140 @@ +# 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/fabric_service_pb2_grpc.py b/bddtests/peer/fabric_service_pb2_grpc.py new file mode 100644 index 00000000000..00acffe1fcd --- /dev/null +++ b/bddtests/peer/fabric_service_pb2_grpc.py @@ -0,0 +1,42 @@ +import grpc +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 + + +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,)) diff --git a/bddtests/steps/bootstrap_impl.py b/bddtests/steps/bootstrap_impl.py index ba6523b2164..8da248e97b1 100644 --- a/bddtests/steps/bootstrap_impl.py +++ b/bddtests/steps/bootstrap_impl.py @@ -13,7 +13,8 @@ # limitations under the License. # - +import bdd_grpc_util +import endorser_util import bdd_test_util import bootstrap_util import orderer_util @@ -66,14 +67,20 @@ def step_impl(context): # Simply create the user bootstrap_util.getOrdererBootstrapAdmin(context, shouldCreate=True) -@given(u'the ordererBootstrapAdmin creates the genesis block for chain "{ordererSystemChainId}" for network config policy "{networkConfigPolicy}" and consensus "{consensusType}" using chain creators policy "{chainCreatorPolicyNames}"') -def step_impl(context, ordererSystemChainId, networkConfigPolicy, consensusType, chainCreatorPolicyNames): +@given(u'the ordererBootstrapAdmin creates the genesis block for chain "{ordererSystemChainIdName}" for network config policy "{networkConfigPolicy}" and consensus "{consensusType}" using chain creators policies') +def step_impl(context, ordererSystemChainIdName, networkConfigPolicy, consensusType): ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context) - # Retrieve the chainCreators config items required for now (tuple). - chainCreatorsSignedConfigItems = ordererBootstrapAdmin.tags[chainCreatorPolicyNames] - ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainId] + ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName] + # Now collect the named signed config items + signedConfigItems =[] + for row in context.table.rows: + signedConfigItemName = row['SignedConfigItemsName'] + signedConfigItems += ordererBootstrapAdmin.tags[signedConfigItemName] - (genesisBlock,envelope) = bootstrap_util.createGenesisBlock(context, ordererSystemChainIdGUUID, consensusType, signedConfigItems=list(chainCreatorsSignedConfigItems)) + # Concatenate signedConfigItems + + # Construct block + (genesisBlock,envelope) = bootstrap_util.createGenesisBlock(context, ordererSystemChainIdGUUID, consensusType, signedConfigItems=signedConfigItems) bootstrap_util.OrdererGensisBlockCompositionCallback(context, genesisBlock) bootstrap_util.PeerCompositionCallback(context) @@ -96,16 +103,19 @@ def step_impl(context, ordererSystemChainId): @given(u'the ordererBootstrapAdmin creates a chain creators policy "{chainCreatePolicyName}" (network name) for peer orgs who wish to form a network using orderer system chain "{ordererSystemChainId}"') def step_impl(context, chainCreatePolicyName, ordererSystemChainId): directory = bootstrap_util.getDirectory(context) + + ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context) ordererSystemChainIdGuuid = ordererBootstrapAdmin.tags[ordererSystemChainId] # Collect the orgs from the table orgNames = [row['Organization'] for row in context.table.rows] + bootstrap_util.addOrdererBootstrapAdminOrgReferences(context, chainCreatePolicyName, orgNames) - (chainCreationPolicyNamesSignedConfigItem, chainCreatorsOrgsPolicySignedConfigItem) = \ + chainCreatorsOrgsPolicySignedConfigItem = \ bootstrap_util.createChainCreatorsPolicy(context=context, chainCreatePolicyName=chainCreatePolicyName, chaindId=ordererSystemChainIdGuuid, orgNames=orgNames) - ordererBootstrapAdmin.tags[chainCreatePolicyName] = (chainCreationPolicyNamesSignedConfigItem, chainCreatorsOrgsPolicySignedConfigItem) + ordererBootstrapAdmin.tags[chainCreatePolicyName] = [chainCreatorsOrgsPolicySignedConfigItem] @given(u'the ordererBootstrapAdmin runs the channel template tool to create the orderer configuration template "{templateName}" for application developers using orderer "{ordererComposeService}"') @@ -120,9 +130,11 @@ def step_impl(context): @given(u'the user "{userName}" creates a peer template "{templateName}" with chaincode deployment policy using chain creation policy name "{chainCreatePolicyName}" and peer organizations') def step_impl(context, userName, templateName, chainCreatePolicyName): + ' At the moment, only really defining MSP Config Items (NOT SIGNED)' directory = bootstrap_util.getDirectory(context) user = directory.getUser(userName) - pass + user.tags[templateName] = [directory.getOrganization(row['Organization']) for row in context.table.rows] + @given(u'the user "{userName}" creates a signedConfigEnvelope "{createChannelSignedConfigEnvelope}"') def step_impl(context, userName, createChannelSignedConfigEnvelope): @@ -130,13 +142,20 @@ def step_impl(context, userName, createChannelSignedConfigEnvelope): user = directory.getUser(userName) ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context) - muralisRequiredSignedConfigItems = [] channelID = context.table.rows[0]["ChannelID"] chainCreationPolicyName = context.table.rows[0]["Chain Creation Policy Name"] + templateName = context.table.rows[0]["Template"] + # Loop through templates referenced orgs + mspOrgNames = [org.name for org in user.tags[templateName]] + signedMspConfigItems = bootstrap_util.getSignedMSPConfigItems(context=context, chainId=channelID, orgNames=mspOrgNames) + + # Add the anchors signed config Items + anchorSignedConfigItemsName = context.table.rows[0]["Anchors"] + signedAnchorsConfigItems = user.tags[anchorSignedConfigItemsName] # Intermediate step until template tool is ready - signedConfigItems = bootstrap_util.createSignedConfigItems(context, channelID, "solo", signedConfigItems=muralisRequiredSignedConfigItems) + signedConfigItems = bootstrap_util.createSignedConfigItems(context, channelID, "solo", signedConfigItems=signedMspConfigItems + signedAnchorsConfigItems) #NOTE: Conidered passing signing key for appDeveloper, but decided that the peer org signatures they need to collect subsequently should be proper way signedConfigEnvelope = bootstrap_util.signInitialChainConfig(signedConfigItems=signedConfigItems, chainId=channelID, chainCreationPolicyName=chainCreationPolicyName) @@ -166,8 +185,8 @@ def step_impl(context, userName, createChannelSignedConfigEnvelopeName): for row in context.table.rows: org = directory.getOrganization(row['Organization']) assert bootstrap_util.Network.Peer in org.networks, "Organization '{0}' not in Peer network".format(org.name) - bootstrap_util.BootstrapHelper.addSignatureToSignedConfigItem(signedConfigEnvelope.Items[0], (org.ecdsaSigningKey, org.getSelfSignedCert())) - print("Signatures for signedConfigEnvelope:\n {0}\n".format(signedConfigEnvelope.Items[0])) + bootstrap_util.BootstrapHelper.addSignatureToSignedConfigItem(signedConfigEnvelope.Items[0], (org, org.getSelfSignedCert())) + # print("Signatures for signedConfigEnvelope:\n {0}\n".format(signedConfigEnvelope.Items[0])) @given(u'the user "{userName}" creates config Tx "{configTxName}" using signedConfigEnvelope "{createChannelSignedConfigEnvelopeName}"') def step_impl(context, userName, configTxName, createChannelSignedConfigEnvelopeName): @@ -210,3 +229,60 @@ def step_impl(context, userName, deliveryName, composeService, expectedBlocks, n # Verify block count 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): + 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']) + + # 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") + signedProposal = endorser_util.signProposal(proposal=proposal, entity=user, signersCert=signersCert) + + # Send proposal to each specified endorser, waiting 'timeout' seconds for response/error + endorsers = [composeService] + 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 + + + +@given(u'the ordererBoostrapAdmin creates MSP Configuration Items "{mspConfigItemsName}" for orderer system chain "{ordererSystemChainIdName}" for every MSP referenced by the policies') +def step_impl(context, ordererSystemChainIdName, mspConfigItemsName): + assert 'table' in context, "Expected table of policy names" + directory = bootstrap_util.getDirectory(context) + ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context) + ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName] + mspSignedConfigItems = bootstrap_util.getMspConfigItemsForPolicyNames(context, chainId=ordererSystemChainIdGUUID, policyNames=[row['PolicyName'] for row in context.table.rows]) + ordererBootstrapAdmin.tags[mspConfigItemsName] = mspSignedConfigItems + +@given(u'the ordererBoostrapAdmin creates the chain creation policy names "{chainCreationPolicyNames}" signedConfigurationItem for orderer system chain "{ordererSystemChainIdName}" with policies') +def step_impl(context, chainCreationPolicyNames, ordererSystemChainIdName): + ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context) + ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName] + policyNames = [row['PolicyName'] for row in context.table.rows] + chainCreationPolicyNamesConfigItem = bootstrap_util.createChainCreationPolicyNames(context, chainCreationPolicyNames=policyNames, chaindId=ordererSystemChainIdGUUID) + ordererBootstrapAdmin.tags[chainCreationPolicyNames] = [chainCreationPolicyNamesConfigItem] + +@then(u'user "{userName}" expects result code for "{proposalResponseName}" of "{proposalResponseResultCode}"') +def step_impl(context, userName, proposalResponseName, proposalResponseResultCode): + directory = bootstrap_util.getDirectory(context) + user = directory.getUser(userName=userName) + proposalResponse = user.tags[proposalResponseName] + 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): + directory = bootstrap_util.getDirectory(context) + user = directory.getUser(userName=userName) + nodeAdminTuples = [directory.findNodeAdminTuple(row['User'], row['Peer'], row['Organization']) for row in context.table.rows] + user.tags[anchorSetName] = bootstrap_util.getSignedAnchorConfigItems(context=context, chainId=channelName, nodeAdminTuples=nodeAdminTuples) diff --git a/bddtests/steps/bootstrap_util.py b/bddtests/steps/bootstrap_util.py index 30ae2980d71..a993ab20a05 100644 --- a/bddtests/steps/bootstrap_util.py +++ b/bddtests/steps/bootstrap_util.py @@ -21,7 +21,7 @@ from OpenSSL import crypto from OpenSSL import rand -from ecdsa import SigningKey, NIST384p, NIST256p +import ecdsa from collections import namedtuple from enum import Enum @@ -30,12 +30,15 @@ from common import common_pb2 as common_dot_common_pb2 from common import configuration_pb2 as common_dot_configuration_pb2 from common import msp_principal_pb2 +from msp import mspconfig_pb2 +from peer import configuration_pb2 as peer_dot_configuration_pb2 # import orderer from orderer import configuration_pb2 as orderer_dot_configuration_pb2 import orderer_util import os +import re import shutil import compose import uuid @@ -55,10 +58,9 @@ def createRSAKey(): assert pk.check()==True return pk -def createECDSAKey(curve=NIST384p): +def createECDSAKey(curve=ecdsa.NIST256p): #Create ECDSA key - # sk = SigningKey.generate(curve=NIST384p) - sk = SigningKey.generate(curve=NIST256p) + sk = ecdsa.SigningKey.generate(curve=curve) return sk @@ -131,14 +133,24 @@ def __init__(self, name): #Create a ECDSA key, then a crypto pKey from the DER for usage with cert requests, etc. self.ecdsaSigningKey = createECDSAKey() self.pKey = crypto.load_privatekey(crypto.FILETYPE_ASN1, self.ecdsaSigningKey.to_der()) + # Signing related ecdsa config + self.hashfunc = hashlib.sha256 + self.sigencode=ecdsa.util.sigencode_der_canonize + self.sigdecode=ecdsa.util.sigdecode_der + def createCertRequest(self, nodeName): req = createCertRequest(self.pKey, CN=nodeName) - print("request => {0}".format(crypto.dump_certificate_request(crypto.FILETYPE_PEM, req))) + #print("request => {0}".format(crypto.dump_certificate_request(crypto.FILETYPE_PEM, req))) return req def sign(self, dataAsBytearray): - return self.ecdsaSigningKey.sign(dataAsBytearray) + return self.ecdsaSigningKey.sign(dataAsBytearray, hashfunc=self.hashfunc, sigencode=self.sigencode) + + def verifySignature(self, signature, signersCert, data): + 'Will verify the signature of an entity based upon public cert' + vk = ecdsa.VerifyingKey.from_der(crypto.dump_publickey(crypto.FILETYPE_ASN1, signersCert.get_pubkey())) + assert vk.verify(signature, data, hashfunc=self.hashfunc, sigdecode=self.sigdecode), "Invalid signature!!" class User(Entity, orderer_util.UserRegistration): @@ -164,6 +176,20 @@ def __init__(self, name): def getSelfSignedCert(self): return self.signedCert + def getMSPConfig(self): + certPemsList = [crypto.dump_certificate(crypto.FILETYPE_PEM, self.getSelfSignedCert())] + # For now, admin certs and CA certs are the same per @ASO + adminCerts = certPemsList + cacerts = adminCerts + # Currently only 1 component, CN= + # name = self.getSelfSignedCert().get_subject().getComponents()[0][1] + name = self.name + fabricMSPConfig = mspconfig_pb2.FabricMSPConfig(Admins=adminCerts, RootCerts=cacerts, Name=name) + mspConfig = mspconfig_pb2.MSPConfig(Config=fabricMSPConfig.SerializeToString(), Type=0) + return mspConfig + + pass + def createCertificate(self, certReq): numYrs = 1 return createCertificate(certReq, (self.signedCert, self.pKey), 1000, (0, 60*60*24*365*numYrs)) @@ -202,6 +228,19 @@ def getOrganization(self, orgName, shouldCreate = False): self.organizations[orgName] = Organization(orgName) return self.organizations[orgName] + def findCertByTuple(self, userName, contextName, orgName): + ordererAdminTuple = NodeAdminTuple(user = userName, nodeName = contextName, organization = orgName) + return self.ordererAdminTuples[ordererAdminTuple] + + def findCertForNodeAdminTuple(self, nodeAdminTuple): + assert nodeAdminTuple in self.ordererAdminTuples, "Node admin tuple not found for: {0}".format(nodeAdminTuple) + return self.ordererAdminTuples[nodeAdminTuple] + + def findNodeAdminTuple(self, userName, contextName, orgName): + nodeAdminTuple = NodeAdminTuple(user = userName, nodeName = contextName, organization = orgName) + assert nodeAdminTuple in self.ordererAdminTuples, "Node admin tuple not found for: {0}".format(nodeAdminTuple) + return nodeAdminTuple + def registerOrdererAdminTuple(self, userName, ordererName, organizationName): ' Assign the user as orderer admin' ordererAdminTuple = NodeAdminTuple(user = userName, nodeName = ordererName, organization = organizationName) @@ -221,8 +260,6 @@ def registerOrdererAdminTuple(self, userName, ordererName, organizationName): store_ctx = crypto.X509StoreContext(store, userCert) # Verify the certificate, returns None if it can validate the certificate store_ctx.verify_certificate() - - print("new Certificate for '{0}' on orderer '{1}' signed by '{2}': \n{3}".format(userName, ordererName, organizationName, crypto.dump_certificate(crypto.FILETYPE_PEM, userCert))) self.ordererAdminTuples[ordererAdminTuple] = userCert @@ -250,26 +287,31 @@ def NOutOf(cls, n, policies): class BootstrapHelper: KEY_CONSENSUS_TYPE = "ConsensusType" - KEY_CHAIN_CREATORS = "ChainCreators" + KEY_CHAIN_CREATION_POLICY_NAMES = "ChainCreationPolicyNames" KEY_ACCEPT_ALL_POLICY = "AcceptAllPolicy" - KEY_INGRESS_POLICY = "IngressPolicy" - KEY_EGRESS_POLICY = "EgressPolicy" + KEY_INGRESS_POLICY = "IngressPolicyNames" + KEY_EGRESS_POLICY = "EgressPolicyNames" KEY_BATCH_SIZE = "BatchSize" + KEY_BATCH_TIMEOUT = "BatchTimeout" KEY_CREATIONPOLICY = "CreationPolicy" + KEY_MSP_INFO = "MSP" + KEY_ANCHOR_PEERS = "AnchorPeers" - DEFAULT_MODIFICATION_POLICY_ID = "DefaultModificationPolicy" + KEY_NEW_CONFIGURATION_ITEM_POLICY = "NewConfigurationItemPolicy" DEFAULT_CHAIN_CREATORS = [KEY_ACCEPT_ALL_POLICY] DEFAULT_NONCE_SIZE = 24 - def __init__(self, chainId = "TestChain", lastModified = 0, msgVersion = 1, epoch = 0, consensusType = "solo", batchSize = 10, absoluteMaxBytes=100000000, signers=[]): + def __init__(self, chainId = "TestChain", lastModified = 0, msgVersion = 1, epoch = 0, consensusType = "solo", batchSize = 10, batchTimeout="10s", absoluteMaxBytes=100000000, preferredMaxBytes=512*1024, signers=[]): self.chainId = str(chainId) self.lastModified = lastModified self.msgVersion = msgVersion self.epoch = epoch self.consensusType = consensusType self.batchSize = batchSize + self.batchTimeout = batchTimeout self.absoluteMaxBytes = absoluteMaxBytes + self.preferredMaxBytes = preferredMaxBytes self.signers = signers @classmethod @@ -277,30 +319,29 @@ def getNonce(cls): return rand.bytes(BootstrapHelper.DEFAULT_NONCE_SIZE) @classmethod - def addSignatureToSignedConfigItem(cls, signedConfigItem, (signingKey, cert)): + def addSignatureToSignedConfigItem(cls, signedConfigItem, (entity, cert)): sigHeader = common_dot_common_pb2.SignatureHeader(creator=crypto.dump_certificate(crypto.FILETYPE_ASN1,cert),nonce=BootstrapHelper.getNonce()) sigHeaderBytes = sigHeader.SerializeToString() # Signature over the concatenation of configurationItem bytes and signatureHeader bytes - signature = signingKey.sign(signedConfigItem.ConfigurationItem + sigHeaderBytes) + signature = entity.sign(signedConfigItem.ConfigurationItem + sigHeaderBytes) # Now add new signature to Signatures repeated field newConfigSig = signedConfigItem.Signatures.add() newConfigSig.signatureHeader=sigHeaderBytes newConfigSig.signature=signature - def makeChainHeader(self, type = common_dot_common_pb2.HeaderType.Value("CONFIGURATION_ITEM"), version = 1, + def makeChainHeader(self, type = common_dot_common_pb2.HeaderType.Value("CONFIGURATION_ITEM"), txID = "", extension='', version = 1, timestamp = timestamp_pb2.Timestamp(seconds = int(time.time()), nanos = 0)): return common_dot_common_pb2.ChainHeader(type = type, version = version, timestamp = timestamp, chainID = self.chainId, - epoch = self.epoch) + epoch = self.epoch, + txID = txID, + extension = extension) def makeSignatureHeader(self, serializeCertChain, nonce): - return common_dot_common_pb2.ChainHeader(type = type, - version = version, - timestamp = timestamp, - chainID = self.chainId, - epoch = self.epoch) + return common_dot_common_pb2.SignatureHeader(creator = serializeCertChain, + nonce = nonce) def signConfigItem(self, configItem): signedConfigItem = common_dot_configuration_pb2.SignedConfigurationItem(ConfigurationItem=configItem.SerializeToString(), Signatures=None) @@ -311,16 +352,38 @@ def getConfigItem(self, commonConfigType, key, value): Header=self.makeChainHeader(type=common_dot_common_pb2.HeaderType.Value("CONFIGURATION_ITEM")), Type=commonConfigType, LastModified=self.lastModified, - ModificationPolicy=BootstrapHelper.DEFAULT_MODIFICATION_POLICY_ID, + ModificationPolicy=BootstrapHelper.KEY_NEW_CONFIGURATION_ITEM_POLICY, Key=key, Value=value) return configItem + + def encodeAnchorInfo(self, ciValue): + configItem = self.getConfigItem( + commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Peer"), + key=BootstrapHelper.KEY_ANCHOR_PEERS, + value=ciValue.SerializeToString()) + return self.signConfigItem(configItem) + + def encodeMspInfo(self, mspUniqueId, ciValue): + configItem = self.getConfigItem( + commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("MSP"), + key=mspUniqueId, + value=ciValue.SerializeToString()) + return self.signConfigItem(configItem) + def encodeBatchSize(self): configItem = self.getConfigItem( commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Orderer"), key=BootstrapHelper.KEY_BATCH_SIZE, - value=orderer_dot_configuration_pb2.BatchSize(maxMessageCount=self.batchSize, absoluteMaxBytes=self.absoluteMaxBytes).SerializeToString()) + value=orderer_dot_configuration_pb2.BatchSize(maxMessageCount=self.batchSize, absoluteMaxBytes=self.absoluteMaxBytes, preferredMaxBytes=self.preferredMaxBytes).SerializeToString()) + return self.signConfigItem(configItem) + + def encodeBatchTimeout(self): + configItem = self.getConfigItem( + commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Orderer"), + key=BootstrapHelper.KEY_BATCH_TIMEOUT, + value=orderer_dot_configuration_pb2.BatchTimeout(timeout=self.batchTimeout).SerializeToString()) return self.signConfigItem(configItem) def encodeConsensusType(self): @@ -330,14 +393,14 @@ def encodeConsensusType(self): value=orderer_dot_configuration_pb2.ConsensusType(type=self.consensusType).SerializeToString()) return self.signConfigItem(configItem) - def encodeChainCreators(self, ciValue = orderer_dot_configuration_pb2.ChainCreators(policies=DEFAULT_CHAIN_CREATORS).SerializeToString()): + def encodeChainCreators(self, ciValue = orderer_dot_configuration_pb2.ChainCreationPolicyNames(names=DEFAULT_CHAIN_CREATORS).SerializeToString()): configItem = self.getConfigItem( commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Orderer"), - key=BootstrapHelper.KEY_CHAIN_CREATORS, + key=BootstrapHelper.KEY_CHAIN_CREATION_POLICY_NAMES, value=ciValue) return self.signConfigItem(configItem) - def encodePolicy(self, key, policy=common_dot_configuration_pb2.Policy(type=1, policy=AuthDSLHelper.Envelope(signaturePolicy=AuthDSLHelper.NOutOf(0,[]), identities=[]).SerializeToString())): + def encodePolicy(self, key, policy=common_dot_configuration_pb2.Policy(type=common_dot_configuration_pb2.Policy.PolicyType.Value("SIGNATURE"), policy=AuthDSLHelper.Envelope(signaturePolicy=AuthDSLHelper.NOutOf(0,[]), identities=[]).SerializeToString())): configItem = self.getConfigItem( commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Policy"), key=key, @@ -349,14 +412,14 @@ def encodeEgressPolicy(self): configItem = self.getConfigItem( commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Orderer"), key=BootstrapHelper.KEY_EGRESS_POLICY, - value=orderer_dot_configuration_pb2.EgressPolicy(name=BootstrapHelper.KEY_ACCEPT_ALL_POLICY).SerializeToString()) + value=orderer_dot_configuration_pb2.EgressPolicyNames(names=[BootstrapHelper.KEY_ACCEPT_ALL_POLICY]).SerializeToString()) return self.signConfigItem(configItem) def encodeIngressPolicy(self): configItem = self.getConfigItem( commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Orderer"), key=BootstrapHelper.KEY_INGRESS_POLICY, - value=orderer_dot_configuration_pb2.IngressPolicy(name=BootstrapHelper.KEY_ACCEPT_ALL_POLICY).SerializeToString()) + value=orderer_dot_configuration_pb2.IngressPolicyNames(names=[BootstrapHelper.KEY_ACCEPT_ALL_POLICY]).SerializeToString()) return self.signConfigItem(configItem) def encodeAcceptAllPolicy(self): @@ -369,7 +432,7 @@ def encodeAcceptAllPolicy(self): def lockDefaultModificationPolicy(self): configItem = self.getConfigItem( commonConfigType=common_dot_configuration_pb2.ConfigurationItem.ConfigurationType.Value("Policy"), - key=BootstrapHelper.DEFAULT_MODIFICATION_POLICY_ID, + key=BootstrapHelper.KEY_NEW_CONFIGURATION_ITEM_POLICY, value=common_dot_configuration_pb2.Policy(type=1, policy=AuthDSLHelper.Envelope(signaturePolicy=AuthDSLHelper.NOutOf(1,[]), identities=[]).SerializeToString()).SerializeToString()) return self.signConfigItem(configItem) @@ -412,12 +475,64 @@ def getOrdererBootstrapAdmin(context, shouldCreate=False): ordererBootstrapAdmin = directory.getUser(userName="ordererBootstrapAdmin", shouldCreate=shouldCreate) return ordererBootstrapAdmin +def addOrdererBootstrapAdminOrgReferences(context, policyName, orgNames): + 'Adds a key/value pair of policyName/[orgName,...]' + directory = getDirectory(context) + ordererBootstrapAdmin = directory.getUser(userName="ordererBootstrapAdmin", shouldCreate=False) + if not 'OrgReferences' in ordererBootstrapAdmin.tags: + ordererBootstrapAdmin.tags['OrgReferences'] = {} + policyNameToOrgNamesDict = ordererBootstrapAdmin.tags['OrgReferences'] + assert not policyName in policyNameToOrgNamesDict, "PolicyName '{0}' already registered with ordererBootstrapAdmin".format(policyName) + policyNameToOrgNamesDict[policyName] = orgNames + return policyNameToOrgNamesDict + +def getOrdererBootstrapAdminOrgReferences(context): + directory = getDirectory(context) + ordererBootstrapAdmin = directory.getUser(userName="ordererBootstrapAdmin", shouldCreate=False) + if not 'OrgReferences' in ordererBootstrapAdmin.tags: + ordererBootstrapAdmin.tags['OrgReferences'] = {} + return ordererBootstrapAdmin.tags['OrgReferences'] + +def getSignedMSPConfigItems(context, chainId, orgNames): + directory = getDirectory(context) + bootstrapHelper = BootstrapHelper(chainId=chainId) + orgs = [directory.getOrganization(orgName) for orgName in orgNames] + mspSignedConfigItems = [bootstrapHelper.encodeMspInfo(org.name, org.getMSPConfig()) for org in orgs] + return mspSignedConfigItems + +def getSignedAnchorConfigItems(context, chainId, nodeAdminTuples): + directory = getDirectory(context) + bootstrapHelper = BootstrapHelper(chainId=chainId) + + anchorPeers = peer_dot_configuration_pb2.AnchorPeers() + for nodeAdminTuple in nodeAdminTuples: + anchorPeer = anchorPeers.anchorPees.add() + anchorPeer.Host=nodeAdminTuple.nodeName + anchorPeer.Port=5611 + anchorPeer.Cert=crypto.dump_certificate(crypto.FILETYPE_PEM, directory.findCertForNodeAdminTuple(nodeAdminTuple)) + + anchorsSignedConfigItems = [bootstrapHelper.encodeAnchorInfo(anchorPeers)] + return anchorsSignedConfigItems + + +def getMspConfigItemsForPolicyNames(context, chainId, policyNames): + directory = getDirectory(context) + ordererBootstrapAdmin = getOrdererBootstrapAdmin(context) + policyNameToOrgNamesDict = getOrdererBootstrapAdminOrgReferences(context) + # Get unique set of org names and return set of signed MSP ConfigItems + orgNamesReferenced = list(set([orgName for policyName in policyNames for orgName in policyNameToOrgNamesDict[policyName]])) + orgNamesReferenced.sort() + return getSignedMSPConfigItems(context=context, chainId=chainId, orgNames=orgNamesReferenced) + + + def createSignedConfigItems(context, chainId, consensusType, signedConfigItems = []): # directory = getDirectory(context) # assert len(directory.ordererAdminTuples) > 0, "No orderer admin tuples defined!!!" bootstrapHelper = BootstrapHelper(chainId = chainId, consensusType=consensusType) configItems = signedConfigItems configItems.append(bootstrapHelper.encodeBatchSize()) + configItems.append(bootstrapHelper.encodeBatchTimeout()) configItems.append(bootstrapHelper.encodeConsensusType()) configItems.append(bootstrapHelper.encodeAcceptAllPolicy()) configItems.append(bootstrapHelper.encodeIngressPolicy()) @@ -455,32 +570,8 @@ def createGenesisBlock(context, chainId, consensusType, signedConfigItems = []): configItems = createSignedConfigItems(context, chainId, consensusType, signedConfigItems = signedConfigItems) bootstrapHelper = BootstrapHelper(chainId = chainId, consensusType=consensusType) - # configItems = signedConfigItems - # configItems.append(bootstrapHelper.encodeBatchSize()) - # configItems.append(bootstrapHelper.encodeConsensusType()) - # configItems.append(bootstrapHelper.encodeAcceptAllPolicy()) - # configItems.append(bootstrapHelper.encodeIngressPolicy()) - # configItems.append(bootstrapHelper.encodeEgressPolicy()) - # configItems.append(bootstrapHelper.lockDefaultModificationPolicy()) configEnvelope = common_dot_configuration_pb2.ConfigurationEnvelope(Items=configItems) - - # payloadChainHeader = bootstrapHelper.makeChainHeader(type=common_dot_common_pb2.HeaderType.Value("CONFIGURATION_TRANSACTION")) - # - # #Now the SignatureHeader - # serializedCreatorCertChain = None - # nonce = None - # payloadSignatureHeader = common_dot_common_pb2.SignatureHeader( - # creator=serializedCreatorCertChain, - # nonce=bootstrapHelper.getNonce(), - # ) - # - # payloadHeader = common_dot_common_pb2.Header( - # chainHeader=payloadChainHeader, - # signatureHeader=payloadSignatureHeader, - # ) - # payload = common_dot_common_pb2.Payload(header=payloadHeader, data=configEnvelope.SerializeToString()) - # envelope = common_dot_common_pb2.Envelope(payload=payload.SerializeToString(), signature=None) envelope = createConfigTxEnvelope(chainId, configEnvelope) blockData = common_dot_common_pb2.BlockData(Data=[envelope.SerializeToString()]) @@ -587,6 +678,12 @@ def composing(self, composition, context): with open("{0}/cacerts/{1}.pem".format(localMspConfigPath, peerOrg.name), "w") as f: f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, peerOrg.getSelfSignedCert())) + # Loop through directory and place Peer Organization Certs into admincerts folder + #TODO: revisit this, ASO recommended for now + for peerOrg in [org for orgName,org in directory.organizations.items() if Network.Peer in org.networks]: + with open("{0}/admincerts/{1}.pem".format(localMspConfigPath, peerOrg.name), "w") as f: + f.write(crypto.dump_certificate(crypto.FILETYPE_PEM, peerOrg.getSelfSignedCert())) + # Find the peer signer Tuple for this peer and add to signcerts folder for pnt, cert in [(peerNodeTuple,cert) for peerNodeTuple,cert in directory.ordererAdminTuples.items() if peerService in peerNodeTuple.user and "signer" in peerNodeTuple.user.lower()]: # Put the PEM file in the signcerts folder @@ -608,13 +705,17 @@ def getEnv(self, composition, context, env): localMspConfigPath = self.getLocalMspConfigPath(composition, peerService, pathType=PathType.Container) env["{0}_CORE_PEER_MSPCFGPATH".format(peerService.upper())]=localMspConfigPath -def createChainCreatorsPolicy(context, chainCreatePolicyName, chaindId, orgNames): - 'Creates the chain Creator Policy with name' +def createChainCreationPolicyNames(context, chainCreationPolicyNames, chaindId): directory = getDirectory(context) bootstrapHelper = BootstrapHelper(chainId = chaindId) - chainCreationPolicyNamesSignedConfigItem = bootstrapHelper.encodeChainCreators(ciValue = orderer_dot_configuration_pb2.ChainCreators(policies=[chainCreatePolicyName]).SerializeToString()) + chainCreationPolicyNamesSignedConfigItem = bootstrapHelper.encodeChainCreators(ciValue = orderer_dot_configuration_pb2.ChainCreationPolicyNames(names=chainCreationPolicyNames).SerializeToString()) + return chainCreationPolicyNamesSignedConfigItem +def createChainCreatorsPolicy(context, chainCreatePolicyName, chaindId, orgNames): + 'Creates the chain Creator Policy with name' + directory = getDirectory(context) + bootstrapHelper = BootstrapHelper(chainId = chaindId) # This represents the domain of organization which can create channels for the orderer # First create org MSPPrincicpal @@ -623,12 +724,12 @@ def createChainCreatorsPolicy(context, chainCreatePolicyName, chaindId, orgNames mspPrincipalList = [] for org in [directory.getOrganization(orgName) for orgName in orgNames]: mspPrincipalList.append(msp_principal_pb2.MSPPrincipal(PrincipalClassification=msp_principal_pb2.MSPPrincipal.Classification.Value("ByIdentity"), - Principal=crypto.dump_certificate(crypto.FILETYPE_ASN1, org.getSelfSignedCert())).SerializeToString()) - - chainCreatorsOrgsPolicySignedConfigItem = bootstrapHelper.encodePolicy(key=chainCreatePolicyName , policy=common_dot_configuration_pb2.Policy(type=1, policy=AuthDSLHelper.Envelope(signaturePolicy=AuthDSLHelper.NOutOf(0,[]), identities=mspPrincipalList).SerializeToString())) - print("signed Config Item:\n{0}\n".format(chainCreationPolicyNamesSignedConfigItem)) - print("chain Creation orgs signed Config Item:\n{0}\n".format(chainCreatorsOrgsPolicySignedConfigItem)) - return (chainCreationPolicyNamesSignedConfigItem, chainCreatorsOrgsPolicySignedConfigItem) + Principal=crypto.dump_certificate(crypto.FILETYPE_ASN1, org.getSelfSignedCert()))) + policyTypeSig = common_dot_configuration_pb2.Policy.PolicyType.Value("SIGNATURE") + chainCreatorsOrgsPolicySignedConfigItem = bootstrapHelper.encodePolicy(key=chainCreatePolicyName , policy=common_dot_configuration_pb2.Policy(type=policyTypeSig, policy=AuthDSLHelper.Envelope(signaturePolicy=AuthDSLHelper.NOutOf(0,[]), identities=mspPrincipalList).SerializeToString())) + # print("signed Config Item:\n{0}\n".format(chainCreationPolicyNamesSignedConfigItem)) + #print("chain Creation orgs signed Config Item:\n{0}\n".format(chainCreatorsOrgsPolicySignedConfigItem)) + return chainCreatorsOrgsPolicySignedConfigItem def setOrdererBootstrapGenesisBlock(genesisBlock): 'Responsible for setting the GensisBlock for the Orderer nodes upon composition' @@ -637,3 +738,26 @@ def broadcastCreateChannelConfigTx(context, composeService, chainId, configTxEnv dataFunc = lambda x: configTxEnvelope user.broadcastMessages(context=context,numMsgsToBroadcast=1,composeService=composeService, chainID=chainId ,dataFunc=dataFunc, chainHeaderType=common_dot_common_pb2.CONFIGURATION_TRANSACTION) + +def getArgsFromContextForUser(context, userName): + directory = getDirectory(context) + # Update the chaincodeSpec ctorMsg for invoke + args = [] + if 'table' in context: + if context.table: + # There are function arguments + user = directory.getUser(context, userName) + # Allow the user to specify expressions referencing tags in the args list + pattern = re.compile('\{(.*)\}$') + for arg in context.table[0].cells: + m = pattern.match(arg) + if m: + # tagName reference found in args list + tagName = m.groups()[0] + # make sure the tagName is found in the users tags + assert tagName in user.tags, "TagName '{0}' not found for user '{1}'".format(tagName, user.getUserName()) + args.append(user.tags[tagName]) + else: + #No tag referenced, pass the arg + args.append(arg) + return args diff --git a/bddtests/steps/endorser_util.py b/bddtests/steps/endorser_util.py index 74c4e75a4c2..5f7e385dee0 100644 --- a/bddtests/steps/endorser_util.py +++ b/bddtests/steps/endorser_util.py @@ -1,18 +1,81 @@ -import chaincode_pb2 + import fabric_next_pb2 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 +import identities_pb2 + +from common import common_pb2 as common_dot_common_pb2 + +from OpenSSL import crypto -def getChaincodeSpec(ccType, path, args): +def getChaincodeSpec(ccType, path, name, args): # make chaincode spec for chaincode to be deployed - ccSpec = chaincode_pb2.ChaincodeSpec(type = ccType, - chaincodeID = chaincode_pb2.ChaincodeID(path=path), + 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)) return ccSpec def createPropsalId(): return 'TODO proposal Id' +def createInvokeProposalForBDD(ccSpec, chainID, signersCert, Mspid): + "Returns a deployment proposal of chaincode type" + lc_chaincode_invocation_spec = chaincode_pb2.ChaincodeInvocationSpec(chaincodeSpec = ccSpec) + + # Create + ccHdrExt = chaincode_proposal_pb2.ChaincodeHeaderExtension(chaincodeID=ccSpec.chaincodeID) + + ccProposalPayload = chaincode_proposal_pb2.ChaincodeProposalPayload(Input=lc_chaincode_invocation_spec.SerializeToString()) + + bootstrapHelper = bootstrap_util.BootstrapHelper(chainId=chainID) + + chainHdr = bootstrapHelper.makeChainHeader(type=common_dot_common_pb2.HeaderType.Value("CONFIGURATION_TRANSACTION"), + txID=bootstrap_util.GetUUID(), extension=ccHdrExt.SerializeToString()) + serializedIdentity = identities_pb2.SerializedIdentity(Mspid=Mspid, IdBytes=crypto.dump_certificate(crypto.FILETYPE_PEM, signersCert)) + + + sigHdr = bootstrapHelper.makeSignatureHeader(serializedIdentity.SerializeToString(), bootstrap_util.BootstrapHelper.getNonce()) + + header = common_dot_common_pb2.Header(chainHeader=chainHdr, signatureHeader=sigHdr) + + # make proposal + proposal = fabric_proposal_pb2.Proposal(header=header.SerializeToString(), payload=ccProposalPayload.SerializeToString()) + + return proposal + + +def signProposal(proposal, entity, signersCert): + import hashlib + from ecdsa import util + from ecdsa import VerifyingKey + import binascii + # Sign the proposal + proposalBytes = proposal.SerializeToString() + #print("Proposal Bytes = \n{0}\n\n".format(binascii.hexlify(bytearray(proposalBytes)))) + + # calculate sha2_256 and dump for info only + digest = hashlib.sha256(proposalBytes).digest() + print("Proposal Bytes digest= \n{0}\n\n".format( binascii.hexlify(bytearray(digest)) )) + signature = entity.sign(proposalBytes) + # signature = signingKey.sign(proposalBytes, hashfunc=hashlib.sha256, sigencode=util.sigencode_der) + + #Verify the signature + entity.verifySignature(signature=signature, signersCert=signersCert, data=proposalBytes) + # vk = VerifyingKey.from_der(crypto.dump_publickey(crypto.FILETYPE_ASN1, signersCert.get_pubkey())) + # assert vk.verify(signature, proposalBytes, hashfunc=hashlib.sha256, sigdecode=util.sigdecode_der), "Invalid signature!!" + + print("Proposal Bytes signature= \n{0}\n\n".format(binascii.hexlify(bytearray(signature)))) + print("") + + signedProposal = fabric_proposal_pb2.SignedProposal(proposalBytes=proposalBytes, signature=signature) + return signedProposal + + def createDeploymentProposalForBDD(ccDeploymentSpec): "Returns a deployment proposal of chaincode type" lc_chaincode_spec = chaincode_pb2.ChaincodeSpec(type = chaincode_pb2.ChaincodeSpec.GOLANG, @@ -29,6 +92,6 @@ def getEndorserStubs(context, composeServices): for composeService in composeServices: ipAddress = bdd_test_util.ipFromContainerNamePart(composeService, context.compose_containers) channel = bdd_grpc_util.getGRPCChannel(ipAddress) - newEndorserStub = fabric_next_pb2.beta_create_Endorser_stub(channel) + newEndorserStub = fabric_service_pb2.beta_create_Endorser_stub(channel) stubs.append(newEndorserStub) return stubs diff --git a/bddtests/steps/orderer_util.py b/bddtests/steps/orderer_util.py index 5803373e41a..bbadaf22838 100644 --- a/bddtests/steps/orderer_util.py +++ b/bddtests/steps/orderer_util.py @@ -90,7 +90,7 @@ def readMessages(self, expectedCount): try: for reply in self.replyGenerator: counter += 1 - print("received reply: {0}, counter = {1}".format(reply, counter)) + #print("received reply: {0}, counter = {1}".format(reply, counter)) msgsReceived.append(reply) if counter == int(expectedCount): break @@ -125,7 +125,7 @@ def getBlocks(self): reply = self.readMessage() if reply.HasField("block"): blocks.append(reply.block) - print("received reply: {0}, len(blocks) = {1}".format(reply, len(blocks))) + #print("received reply: {0}, len(blocks) = {1}".format(reply, len(blocks))) else: if reply.status != common_pb2.SUCCESS: print("Got error: {0}".format(reply.status)) diff --git a/core/peer/msp/peermsp_test.go b/core/peer/msp/peermsp_test.go index d681f957fd9..5fc13271ca4 100644 --- a/core/peer/msp/peermsp_test.go +++ b/core/peer/msp/peermsp_test.go @@ -22,10 +22,12 @@ import ( "github.com/hyperledger/fabric/common/util" "github.com/hyperledger/fabric/msp" "github.com/hyperledger/fabric/protos/msp/testutils" + "github.com/hyperledger/fabric/protos/utils" ) func TestLocalMSP(t *testing.T) { - err := LoadLocalMsp("../../../msp/sampleconfig/") + testMSPConfigPath := utils.GetTESTMSPConfigPath() + err := LoadLocalMsp(testMSPConfigPath) if err != nil { t.Fatalf("LoadLocalMsp failed, err %s", err) } @@ -38,7 +40,8 @@ func TestLocalMSP(t *testing.T) { // TODO: as soon as proper per-chain MSP support is developed, this test will no longer be required func TestFakeSetup(t *testing.T) { - err := LoadFakeSetupWithLocalMspAndTestChainMsp("../../../msp/sampleconfig/") + testMSPConfigPath := utils.GetTESTMSPConfigPath() + err := LoadFakeSetupWithLocalMspAndTestChainMsp(testMSPConfigPath) if err != nil { t.Fatalf("LoadLocalMsp failed, err %s", err) } @@ -59,7 +62,8 @@ func TestFakeSetup(t *testing.T) { } func TestGetMSPManagerFromBlock(t *testing.T) { - conf, err := msp.GetLocalMspConfig("../../../msp/sampleconfig/") + testMSPConfigPath := utils.GetTESTMSPConfigPath() + conf, err := msp.GetLocalMspConfig(testMSPConfigPath) if err != nil { t.Fatalf("GetLocalMspConfig failed, err %s", err) } diff --git a/msp/configbuilder.go b/msp/configbuilder.go index 028ef2b2e6c..49b2cd5b828 100644 --- a/msp/configbuilder.go +++ b/msp/configbuilder.go @@ -1,10 +1,11 @@ package msp import ( - "encoding/json" "fmt" "io/ioutil" + "github.com/golang/protobuf/proto" + "encoding/pem" "path/filepath" @@ -104,9 +105,9 @@ func GetLocalMspConfig(dir string) (*msp.MSPConfig, error) { sigid := &msp.SigningIdentityInfo{PublicSigner: signcert[0], PrivateSigner: keyinfo} - fmspconf := msp.FabricMSPConfig{Admins: admincert, RootCerts: cacerts, SigningIdentity: sigid, Name: "DEFAULT"} + fmspconf := &msp.FabricMSPConfig{Admins: admincert, RootCerts: cacerts, SigningIdentity: sigid, Name: "DEFAULT"} - fmpsjs, _ := json.Marshal(fmspconf) + fmpsjs, _ := proto.Marshal(fmspconf) mspconf := &msp.MSPConfig{Config: fmpsjs, Type: int32(FABRIC)} diff --git a/msp/identities.go b/msp/identities.go index cf8ecf31731..ab020eb4617 100644 --- a/msp/identities.go +++ b/msp/identities.go @@ -19,6 +19,7 @@ package msp import ( "crypto/rand" "crypto/x509" + "encoding/hex" "fmt" "encoding/pem" @@ -89,6 +90,10 @@ func (id *identity) Verify(msg []byte, sig []byte) error { } // Verify signature + mspLogger.Debugf("Verify: msg = %s", hex.Dump(msg)) + mspLogger.Debugf("Verify: digest = %s", hex.Dump(digest)) + mspLogger.Debugf("Verify: sig = %s", hex.Dump(sig)) + valid, err := id.msp.bccsp.Verify(id.pk, sig, digest, nil) if err != nil { return fmt.Errorf("Could not determine the validity of the signature, err %s", err) diff --git a/msp/mspimpl.go b/msp/mspimpl.go index 8a2272ad20e..35837ae4493 100644 --- a/msp/mspimpl.go +++ b/msp/mspimpl.go @@ -23,8 +23,6 @@ import ( "encoding/pem" - "encoding/json" - "bytes" "github.com/golang/protobuf/proto" @@ -146,7 +144,7 @@ func (msp *bccspmsp) Setup(conf1 *m.MSPConfig) error { // given that it's an msp of type fabric, extract the MSPConfig instance var conf m.FabricMSPConfig - err := json.Unmarshal(conf1.Config, &conf) + err := proto.Unmarshal(conf1.Config, &conf) if err != nil { return fmt.Errorf("Failed unmarshalling fabric msp config, err %s", err) } diff --git a/peer/core.yaml b/peer/core.yaml index 5d414ab4d1d..d77bf695d64 100644 --- a/peer/core.yaml +++ b/peer/core.yaml @@ -149,7 +149,7 @@ peer: fileSystemPath: /var/hyperledger/production # Path on the file system where peer will find MSP local configurations - mspConfigPath: /var/hyperledger/msp + mspConfigPath: /etc/hyperledger/fabric/msp/sampleconfig # Used with Go profiling tools only in none production environment. In # production, it should be disabled (eg enabled: false) diff --git a/peer/main.go b/peer/main.go index 62a3f973f22..4294fb99664 100644 --- a/peer/main.go +++ b/peer/main.go @@ -101,15 +101,7 @@ func main() { // Init the MSP // TODO: determine the location of this config file - var mspMgrConfigDir string - var alternativeCfgPath = os.Getenv("PEER_CFG_PATH") - if alternativeCfgPath != "" { - mspMgrConfigDir = alternativeCfgPath + "/msp/sampleconfig/" - } else if _, err := os.Stat("./msp/sampleconfig/"); err == nil { - mspMgrConfigDir = "./msp/sampleconfig/" - } else { - mspMgrConfigDir = os.Getenv("GOPATH") + "/src/github.com/hyperledger/fabric/msp/sampleconfig/" - } + var mspMgrConfigDir = viper.GetString("peer.mspConfigPath") err = common.InitCrypto(mspMgrConfigDir) if err != nil { // Handle errors reading the config file diff --git a/protos/msp/testutils/testutils.go b/protos/msp/testutils/testutils.go index 97d7cca9391..392080acb2f 100644 --- a/protos/msp/testutils/testutils.go +++ b/protos/msp/testutils/testutils.go @@ -33,7 +33,7 @@ func GetTestBlockFromMspConfig(conf *msp.MSPConfig) (*common.Block, error) { return nil, fmt.Errorf("proto.Marshal failed for a configuration item payload, err %s", err) } - ci := &common.ConfigurationItem{Key: msputils.MSPKey, Value: confBytes} + ci := &common.ConfigurationItem{Type: common.ConfigurationItem_MSP, Key: msputils.MSPKey, Value: confBytes} ciBytes, err := proto.Marshal(ci) if err != nil { return nil, fmt.Errorf("proto.Marshal failed for a configuration item, err %s", err) diff --git a/protos/msp/utils/utils.go b/protos/msp/utils/utils.go index bf0ce7c7a01..b03f3f311af 100644 --- a/protos/msp/utils/utils.go +++ b/protos/msp/utils/utils.go @@ -66,7 +66,8 @@ func GetMSPManagerConfigFromBlock(b *common.Block) ([]*msp.MSPConfig, error) { return nil, err } - if ci.Key != MSPKey { + if ci.Type != common.ConfigurationItem_MSP { + continue } diff --git a/protos/utils/blockutils.go b/protos/utils/blockutils.go index a178f8dc323..533f55aeec8 100644 --- a/protos/utils/blockutils.go +++ b/protos/utils/blockutils.go @@ -129,11 +129,11 @@ func createSignedConfigItem(chainID string, Signatures: nil} } -// This function is needed to locate the MSP test configuration when running +// GetTESTMSPConfigPath This function is needed to locate the MSP test configuration when running // in CI build env or local with "make unit-test". A better way to manage this // is to define a config path in yaml that may point to test or production // location of the config -func getTESTMSPConfigPath() string { +func GetTESTMSPConfigPath() string { cfgPath := os.Getenv("PEER_CFG_PATH") + "/msp/sampleconfig/" if _, err := ioutil.ReadDir(cfgPath); err != nil { cfgPath = os.Getenv("GOPATH") + "/src/github.com/hyperledger/fabric/msp/sampleconfig/" @@ -143,7 +143,7 @@ func getTESTMSPConfigPath() string { // EncodeMSPUnsigned gets the unsigned configuration item with the default MSP func EncodeMSPUnsigned(chainID string) *cb.ConfigurationItem { - cfgPath := getTESTMSPConfigPath() + cfgPath := GetTESTMSPConfigPath() conf, err := msp.GetLocalMspConfig(cfgPath) if err != nil { panic(fmt.Sprintf("GetLocalMspConfig failed, err %s", err)) @@ -153,12 +153,12 @@ func EncodeMSPUnsigned(chainID string) *cb.ConfigurationItem { return createConfigItem(chainID, mspKey, MarshalOrPanic(conf), - xxxDefaultModificationPolicyID, cb.ConfigurationItem_Orderer) + xxxDefaultModificationPolicyID, cb.ConfigurationItem_MSP) } // EncodeMSP gets the signed configuration item with the default MSP func EncodeMSP(chainID string) *cb.SignedConfigurationItem { - cfgPath := getTESTMSPConfigPath() + cfgPath := GetTESTMSPConfigPath() conf, err := msp.GetLocalMspConfig(cfgPath) if err != nil { panic(fmt.Sprintf("GetLocalMspConfig failed, err %s", err)) @@ -168,7 +168,7 @@ func EncodeMSP(chainID string) *cb.SignedConfigurationItem { return createSignedConfigItem(chainID, mspKey, MarshalOrPanic(conf), - xxxDefaultModificationPolicyID, cb.ConfigurationItem_Orderer) + xxxDefaultModificationPolicyID, cb.ConfigurationItem_MSP) } // EncodeAnchorPeers returns a configuration item with anchor peers