Skip to content

Commit 692effe

Browse files
committed
[FAB-1141] Incorporate latest changes to protos
Regenerated orderer proto files. Removed references to ingress/egress policies. Added default policies for all groups. Now sign all envelopes. Added readers/writers/admins to each group. Now use SerializedIdentity as opposed to cert as PEM for certChain. Added value for BlockDataHashingDataStructure.width for channel configs. Removed peerOrg2 for now. Will add later. Addressed non-deterministic issue with lccc and MSP id sorting for default endorsement policy handling. Change-Id: I60b177ea6cf8464b3d35e85b45ef3f250941acdf Signed-off-by: jeffgarratt <[email protected]>
1 parent 23872a2 commit 692effe

12 files changed

+167
-210
lines changed

bddtests/environment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def after_scenario(context, scenario):
7272

7373
# stop any running peer that could get in the way before starting the tests
7474
def before_all(context):
75-
cli_call(["../build/bin/peer", "node", "stop"], expect_success=False)
75+
pass
7676

7777
# stop any running peer that could get in the way before starting the tests
7878
def after_all(context):

bddtests/features/bootstrap.feature

+18-10
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,36 @@ Feature: Bootstrap
1616
Scenario Outline: Bootstrap a development network with 4 peers (2 orgs) and 1 orderer (1 org), each having a single independent root of trust (No fabric-ca, just openssl)
1717
#creates 1 self-signed key/cert pair per orderer organization
1818
Given the orderer network has organizations:
19-
| Organization |
20-
| ordererOrg0 |
19+
| Organization | Readers | Writers | Admins |
20+
| ordererOrg0 | member | member | admin |
2121

2222
And user requests role of orderer admin by creating a key and csr for orderer and acquires signed certificate from organization:
2323
| User | Orderer | Organization |
2424
| orderer0Signer | orderer0 | ordererOrg0 |
2525

26+
27+
# Rolenames : MspPrincipal.proto
2628
And the peer network has organizations:
27-
| Organization |
28-
| peerOrg0 |
29-
| peerOrg1 |
30-
| peerOrg2 |
29+
| Organization | Readers | Writers | Admins |
30+
| peerOrg0 | member | member | admin |
31+
| peerOrg1 | member | member | admin |
32+
# | peerOrg2 | member | member | admin |
33+
34+
3135

3236
And a ordererBootstrapAdmin is identified and given access to all public certificates and orderer node info
3337

38+
And the ordererBootstrapAdmin creates a cert alias "bootstrapCertAlias" for orderer network bootstrap purposes for organizations
39+
| Organization |
40+
| ordererOrg0 |
41+
3442
And the ordererBootstrapAdmin generates a GUUID to identify the orderer system chain and refer to it by name as "OrdererSystemChainId"
3543

3644
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":
3745
| Organization |
3846
| peerOrg0 |
3947
| peerOrg1 |
40-
| peerOrg2 |
48+
# | peerOrg2 |
4149

4250
And the ordererBoostrapAdmin creates the chain creation policy names "chainCreationPolicyNames" for orderer system chain "OrdererSystemChainId" with policies:
4351
|PolicyName |
@@ -50,7 +58,7 @@ Feature: Bootstrap
5058

5159
# Order info includes orderer admin/orderer information and address (host:port) from previous steps
5260
# Only the peer organizations can vary.
53-
And the ordererBootstrapAdmin creates the genesis block "ordererGenesisBlock" for chain "OrdererSystemChainId" for network config policy "<PolicyType>" and consensus "<ConsensusType>" using chain creators policies:
61+
And the ordererBootstrapAdmin using cert alias "bootstrapCertAlias" creates the genesis block "ordererGenesisBlock" for chain "OrdererSystemChainId" for network config policy "<PolicyType>" and consensus "<ConsensusType>" using chain creators policies:
5462
| ConfigGroup Names |
5563
| chainCreatePolicy1 |
5664
| chainCreationPolicyNames |
@@ -108,14 +116,14 @@ Feature: Bootstrap
108116
| peerOrg0 |
109117
| peerOrg1 |
110118

111-
And the user "dev0Org0" creates a ConfigUpdate Tx "configUpdateTx1" using signed ConfigUpdateEnvelope "createChannelConfigUpdate1"
119+
And the user "dev0Org0" creates a ConfigUpdate Tx "configUpdateTx1" using cert alias "dev0Org0App1" using signed ConfigUpdateEnvelope "createChannelConfigUpdate1"
112120

113121
And the user "dev0Org0" broadcasts ConfigUpdate Tx "configUpdateTx1" to orderer "orderer0" to create channel "com.acme.blockchain.jdoe.Channel1"
114122

115123
# Sleep as the deliver takes a bit to have the first block ready
116124
And I wait "2" seconds
117125

118-
When user "dev0Org0" connects to deliver function on orderer "orderer0"
126+
When user "dev0Org0" using cert alias "dev0Org0App1" connects to deliver function on orderer "orderer0"
119127
And user "dev0Org0" sends deliver a seek request on orderer "orderer0" with properties:
120128
| ChainId | Start | End |
121129
| com.acme.blockchain.jdoe.Channel1 | 0 | 0 |

bddtests/orderer/ab_pb2_grpc.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
12
import grpc
23
from grpc.framework.common import cardinality
34
from grpc.framework.interfaces.face import utilities as face_utilities
45

56
import common.common_pb2 as common_dot_common__pb2
67
import orderer.ab_pb2 as orderer_dot_ab__pb2
7-
import common.common_pb2 as common_dot_common__pb2
8-
import orderer.ab_pb2 as orderer_dot_ab__pb2
98

109

1110
class AtomicBroadcastStub(object):

bddtests/orderer/configuration_pb2.py

+5-83
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bddtests/orderer/configuration_pb2_grpc.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
12
import grpc
23
from grpc.framework.common import cardinality
34
from grpc.framework.interfaces.face import utilities as face_utilities

bddtests/orderer/kafka_pb2_grpc.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
12
import grpc
23
from grpc.framework.common import cardinality
34
from grpc.framework.interfaces.face import utilities as face_utilities

bddtests/steps/bootstrap_impl.py

+36-31
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,6 @@
2222
import compose
2323
import time
2424

25-
class ChannelCreationInfo:
26-
'Used to store the information needed to construct Config TX for orderer broadcast to create a new channel'
27-
def __init__(self, channelId, channelCreationPolicyName, signedConfigEnvelope):
28-
self.channelId = channelId
29-
self.channelCreationPolicyName = channelCreationPolicyName
30-
self.config_update_envelope = signedConfigEnvelope
31-
32-
def __repr__(self):
33-
return "channelId = {0}\nchannelCreationPolicyName={1}\nconfigUpdateEnvelope={2}\n".format(self.channelId,
34-
self.channelCreationPolicyName,
35-
str(
36-
self.config_update_envelope))
37-
38-
39-
4025
@given(u'the orderer network has organizations')
4126
def step_impl(context):
4227
assert 'table' in context, "Expected table of orderer organizations"
@@ -75,8 +60,9 @@ def step_impl(context):
7560
# Simply create the user
7661
bootstrap_util.getOrdererBootstrapAdmin(context, shouldCreate=True)
7762

78-
@given(u'the ordererBootstrapAdmin creates the genesis block "{ordererGenesisBlockName}" for chain "{ordererSystemChainIdName}" for network config policy "{networkConfigPolicy}" and consensus "{consensusType}" using chain creators policies')
79-
def step_impl(context, ordererGenesisBlockName, ordererSystemChainIdName, networkConfigPolicy, consensusType):
63+
@given(u'the ordererBootstrapAdmin using cert alias "{certAlias}" creates the genesis block "{ordererGenesisBlockName}" for chain "{ordererSystemChainIdName}" for network config policy "{networkConfigPolicy}" and consensus "{consensusType}" using chain creators policies')
64+
def step_impl(context, certAlias, ordererGenesisBlockName, ordererSystemChainIdName, networkConfigPolicy, consensusType):
65+
directory = bootstrap_util.getDirectory(context=context)
8066
ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
8167
ordererSystemChainIdGUUID = ordererBootstrapAdmin.tags[ordererSystemChainIdName]
8268
# Now collect the named signed config items
@@ -87,7 +73,11 @@ def step_impl(context, ordererGenesisBlockName, ordererSystemChainIdName, networ
8773
# Concatenate signedConfigItems
8874

8975
# Construct block
90-
(genesisBlock,envelope) = bootstrap_util.createGenesisBlock(context, ordererSystemChainIdGUUID, consensusType, signedConfigItems=configGroups)
76+
nodeAdminTuple = ordererBootstrapAdmin.tags[certAlias]
77+
bootstrapCert = directory.findCertForNodeAdminTuple(nodeAdminTuple=nodeAdminTuple)
78+
(genesisBlock, envelope) = bootstrap_util.createGenesisBlock(context, ordererSystemChainIdGUUID, consensusType,
79+
nodeAdminTuple=nodeAdminTuple,
80+
signedConfigItems=configGroups)
9181
ordererBootstrapAdmin.setTagValue(ordererGenesisBlockName, genesisBlock)
9282
bootstrap_util.OrdererGensisBlockCompositionCallback(context, genesisBlock)
9383
bootstrap_util.PeerCompositionCallback(context)
@@ -170,7 +160,7 @@ def step_impl(context, userName, createChannelSignedConfigEnvelope):
170160
#NOTE: Conidered passing signing key for appDeveloper, but decided that the peer org signatures they need to collect subsequently should be proper way
171161
config_update_envelope = bootstrap_util.createConfigUpdateEnvelope(channelConfigGroup=channel_config_groups, chainId=channelID, chainCreationPolicyName=chainCreationPolicyName)
172162

173-
user.setTagValue(createChannelSignedConfigEnvelope, ChannelCreationInfo(channelID, chainCreationPolicyName, config_update_envelope))
163+
user.setTagValue(createChannelSignedConfigEnvelope, config_update_envelope)
174164

175165
# Construct TX Config Envelope, broadcast, expect success, and then connect to deliver to revtrieve block.
176166
# Make sure the blockdata exactly the TxConfigEnvelope I submitted.
@@ -192,23 +182,26 @@ def step_impl(context, userName, createChannelSignedConfigEnvelopeName):
192182
assert 'table' in context, "Expected table of peer organizations"
193183
directory = bootstrap_util.getDirectory(context)
194184
user = directory.getUser(userName=userName)
195-
# Get the ChannelCreationInfo object that holds the signedConfigEnvelope
196-
channelCreationInfo = user.tags[createChannelSignedConfigEnvelopeName]
197-
config_update_envelope = channelCreationInfo.config_update_envelope
185+
config_update_envelope = user.tags[createChannelSignedConfigEnvelopeName]
198186
for row in context.table.rows:
199187
org = directory.getOrganization(row['Organization'])
200188
assert bootstrap_util.Network.Peer in org.networks, "Organization '{0}' not in Peer network".format(org.name)
201189
bootstrap_util.BootstrapHelper.addSignatureToSignedConfigItem(config_update_envelope, (org, org.getSelfSignedCert()))
202190
# print("Signatures for signedConfigEnvelope:\n {0}\n".format(signedConfigEnvelope.Items[0]))
203191

204-
@given(u'the user "{userName}" creates a ConfigUpdate Tx "{configUpdateTxName}" using signed ConfigUpdateEnvelope "{createChannelSignedConfigEnvelopeName}"')
205-
def step_impl(context, userName, configUpdateTxName, createChannelSignedConfigEnvelopeName):
192+
@given(u'the user "{userName}" creates a ConfigUpdate Tx "{configUpdateTxName}" using cert alias "{certAlias}" using signed ConfigUpdateEnvelope "{createChannelSignedConfigEnvelopeName}"')
193+
def step_impl(context, userName, certAlias, configUpdateTxName, createChannelSignedConfigEnvelopeName):
206194
directory = bootstrap_util.getDirectory(context)
207195
user = directory.getUser(userName=userName)
208-
channelCreationInfo = user.tags[createChannelSignedConfigEnvelopeName]
209-
#TODO: this is temporary until partial update is supported. Normally you would just return
210-
# this message and send directly to broadcast.
211-
envelope_for_config_update = bootstrap_util.createConfigUpdateTxEnvelope(channelCreationInfo.channelId, channelCreationInfo.config_update_envelope)
196+
namedAdminTuple = user.tags[certAlias]
197+
cert = directory.findCertForNodeAdminTuple(namedAdminTuple)
198+
config_update_envelope = user.tags[createChannelSignedConfigEnvelopeName]
199+
config_update = bootstrap_util.getChannelIdFromConfigUpdateEnvelope(config_update_envelope)
200+
envelope_for_config_update = bootstrap_util.createEnvelopeForMsg(directory=directory,
201+
nodeAdminTuple=namedAdminTuple,
202+
chainId=config_update.channel_id,
203+
msg=config_update_envelope,
204+
typeAsString="CONFIG_UPDATE")
212205
user.setTagValue(configUpdateTxName, envelope_for_config_update)
213206

214207
@given(u'the user "{userName}" broadcasts ConfigUpdate Tx "{configTxName}" to orderer "{orderer}" to create channel "{channelId}"')
@@ -226,11 +219,13 @@ def step_impl(context, userName, transactionAlias, orderer, channelId):
226219
bootstrap_util.broadcastCreateChannelConfigTx(context=context, composeService=orderer, chainId=channelId, user=user, configTxEnvelope=transaction)
227220

228221

229-
@when(u'user "{userName}" connects to deliver function on orderer "{composeService}"')
230-
def step_impl(context, userName, composeService):
222+
@when(u'user "{userName}" using cert alias "{certAlias}" connects to deliver function on orderer "{composeService}"')
223+
def step_impl(context, userName, certAlias, composeService):
231224
directory = bootstrap_util.getDirectory(context)
232225
user = directory.getUser(userName=userName)
233-
user.connectToDeliverFunction(context, composeService)
226+
nodeAdminTuple = user.tags[certAlias]
227+
cert = directory.findCertForNodeAdminTuple(nodeAdminTuple)
228+
user.connectToDeliverFunction(context, composeService, cert, nodeAdminTuple=nodeAdminTuple)
234229

235230
@when(u'user "{userName}" sends deliver a seek request on orderer "{composeService}" with properties')
236231
def step_impl(context, userName, composeService):
@@ -336,3 +331,13 @@ def step_impl(context, userNameSource, objectAlias, userNameTarget):
336331
userSource = directory.getUser(userName=userNameSource)
337332
userTarget = directory.getUser(userName=userNameTarget)
338333
userTarget.setTagValue(objectAlias, userSource.tags[objectAlias])
334+
335+
@given(u'the ordererBootstrapAdmin creates a cert alias "{certAlias}" for orderer network bootstrap purposes for organizations')
336+
def step_impl(context, certAlias):
337+
assert "table" in context, "Expected table of Organizations"
338+
directory = bootstrap_util.getDirectory(context)
339+
ordererBootstrapAdmin = bootstrap_util.getOrdererBootstrapAdmin(context)
340+
assert len(context.table.rows) == 1, "Only support single orderer orgnaization at moment"
341+
for row in context.table.rows:
342+
nodeAdminNamedTuple = directory.registerOrdererAdminTuple(ordererBootstrapAdmin.name, "ordererBootstrapAdmin", row['Organization'])
343+
ordererBootstrapAdmin.setTagValue(certAlias, nodeAdminNamedTuple)

0 commit comments

Comments
 (0)