Skip to content

Commit a997c30

Browse files
author
Jason Yellick
committed
[FAB-4157] Remove BCCSP parms from configtx.yaml
Because configtxgen only collects crypto material, it does not actually validate it, (ie signing, or checking signatures), the BCCSP information attached to the MSP definitions is unnecessary. Its presence complicates the config file for no gain, and there have been issues reported around failing to set these parms properly. Change-Id: I9728b69a66fbbc21373eba59693481d1e6156615 Signed-off-by: Jason Yellick <[email protected]>
1 parent a959653 commit a997c30

File tree

10 files changed

+15
-110
lines changed

10 files changed

+15
-110
lines changed

common/config/organization_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestOrganization(t *testing.T) {
4343

4444
mspDir, err := fabricconfig.GetDevMspDir()
4545
assert.NoError(t, err, "Error getting MSP dev directory")
46-
mspConf, err := msp.GetVerifyingMspConfig(mspDir, nil, "TestMSP")
46+
mspConf, err := msp.GetVerifyingMspConfig(mspDir, "TestMSP")
4747
assert.NoError(t, err, "Error loading MSP config")
4848
oc.(*OrganizationConfig).protos.MSP = mspConf
4949
mspHandler.BeginConfig(t)
@@ -57,7 +57,7 @@ func TestOrganization(t *testing.T) {
5757
err = oc.Validate(t, nil)
5858
assert.Error(t, err, "Validate should have returned error for attempt to change MSPID")
5959

60-
mspConf, err = msp.GetVerifyingMspConfig(mspDir, nil, "")
60+
mspConf, err = msp.GetVerifyingMspConfig(mspDir, "")
6161
oc.(*OrganizationConfig).protos.MSP = mspConf
6262
err = oc.Validate(t, nil)
6363
assert.Error(t, err, "Validate should have returned error for empty MSP ID")

common/configtx/tool/localconfig/config.go

+4-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030

3131
"path/filepath"
3232

33-
bccsp "github.com/hyperledger/fabric/bccsp/factory"
3433
cf "github.com/hyperledger/fabric/core/config"
3534
)
3635

@@ -101,11 +100,10 @@ type Application struct {
101100

102101
// Organization encodes the organization-level configuration needed in config transactions.
103102
type Organization struct {
104-
Name string `yaml:"Name"`
105-
ID string `yaml:"ID"`
106-
MSPDir string `yaml:"MSPDir"`
107-
AdminPrincipal string `yaml:"AdminPrincipal"`
108-
BCCSP *bccsp.FactoryOpts `yaml:"BCCSP"`
103+
Name string `yaml:"Name"`
104+
ID string `yaml:"ID"`
105+
MSPDir string `yaml:"MSPDir"`
106+
AdminPrincipal string `yaml:"AdminPrincipal"`
109107

110108
// Note: Viper deserialization does not seem to care for
111109
// embedding of types, so we use one organization struct
@@ -267,5 +265,4 @@ func (p *Profile) completeInitialization(configDir string) {
267265

268266
func translatePaths(configDir string, org *Organization) {
269267
cf.TranslatePathInPlace(configDir, &org.MSPDir)
270-
cf.TranslatePathInPlace(configDir, &org.BCCSP.SwOpts.FileKeystore.KeyStorePath)
271268
}

common/configtx/tool/provisional/provisional.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func New(conf *genesisconfig.Profile) Generator {
125125
}
126126

127127
for _, org := range conf.Orderer.Organizations {
128-
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.BCCSP, org.ID)
128+
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.ID)
129129
if err != nil {
130130
logger.Panicf("1 - Error loading MSP configuration for org %s: %s", org.Name, err)
131131
}
@@ -154,7 +154,7 @@ func New(conf *genesisconfig.Profile) Generator {
154154
policies.TemplateImplicitMetaMajorityPolicy([]string{config.ApplicationGroupKey}, configvaluesmsp.AdminsPolicyKey),
155155
}
156156
for _, org := range conf.Application.Organizations {
157-
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.BCCSP, org.ID)
157+
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.ID)
158158
if err != nil {
159159
logger.Panicf("2- Error loading MSP configuration for org %s: %s", org.Name, err)
160160
}
@@ -193,7 +193,7 @@ func New(conf *genesisconfig.Profile) Generator {
193193
bs.consortiumsGroups = append(bs.consortiumsGroups, cg)
194194

195195
for _, org := range consortium.Organizations {
196-
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.BCCSP, org.ID)
196+
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.ID)
197197
if err != nil {
198198
logger.Panicf("3 - Error loading MSP configuration for org %s: %s", org.Name, err)
199199
}

common/tools/cryptogen/msp/msp_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func TestGenerateVerifyingMSP(t *testing.T) {
9999
"Expected to find file "+file)
100100
}
101101
// finally check to see if we can load this as a verifying MSP config
102-
testMSPConfig, err := fabricmsp.GetVerifyingMspConfig(mspDir, nil, testName)
102+
testMSPConfig, err := fabricmsp.GetVerifyingMspConfig(mspDir, testName)
103103
assert.NoError(t, err, "Error parsing verifying MSP config")
104104
testMSP, err := fabricmsp.NewBccspMsp()
105105
assert.NoError(t, err, "Error creating new BCCSP MSP")

examples/cluster/config/configtx.yaml

-24
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,6 @@ Organizations:
5656

5757
AdminPrincipal: Role.ADMIN
5858

59-
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
60-
# library to use
61-
BCCSP:
62-
Default: SW
63-
SW:
64-
Hash: SHA2
65-
Security: 256
66-
# Location of Key Store. If this is unset, a location will
67-
# be chosen using 'MSPDir'/keystore
68-
FileKeyStore:
69-
KeyStore:
70-
7159
- &Org1
7260
# DefaultOrg defines the organization which is used in the sampleconfig
7361
# of the fabric.git development environment
@@ -80,18 +68,6 @@ Organizations:
8068

8169
AdminPrincipal: Role.ADMIN
8270

83-
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
84-
# library to use
85-
BCCSP:
86-
Default: SW
87-
SW:
88-
Hash: SHA2
89-
Security: 256
90-
# Location of Key Store. If this is unset, a location will
91-
# be chosen using 'MSPDir'/keystore
92-
FileKeyStore:
93-
KeyStore:
94-
9571
AnchorPeers:
9672
# AnchorPeers defines the location of peers which can be used
9773
# for cross org gossip communication. Note, this value is only

examples/e2e_cli/configtx.yaml

-36
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,6 @@ Organizations:
5555
# MSPDir is the filesystem path which contains the MSP configuration
5656
MSPDir: crypto-config/ordererOrganizations/example.com/msp
5757

58-
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
59-
# library to use
60-
BCCSP:
61-
Default: SW
62-
SW:
63-
Hash: SHA2
64-
Security: 256
65-
# Location of Key Store. If this is unset, a location will
66-
# be chosen using 'MSPDir'/keystore
67-
FileKeyStore:
68-
KeyStore:
69-
7058
- &Org1
7159
# DefaultOrg defines the organization which is used in the sampleconfig
7260
# of the fabric.git development environment
@@ -77,18 +65,6 @@ Organizations:
7765

7866
MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
7967

80-
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
81-
# library to use
82-
BCCSP:
83-
Default: SW
84-
SW:
85-
Hash: SHA2
86-
Security: 256
87-
# Location of Key Store. If this is unset, a location will
88-
# be chosen using 'MSPDir'/keystore
89-
FileKeyStore:
90-
KeyStore:
91-
9268
AnchorPeers:
9369
# AnchorPeers defines the location of peers which can be used
9470
# for cross org gossip communication. Note, this value is only
@@ -106,18 +82,6 @@ Organizations:
10682

10783
MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
10884

109-
# BCCSP (Blockchain crypto provider): Select which crypto implementation or
110-
# library to use
111-
BCCSP:
112-
Default: SW
113-
SW:
114-
Hash: SHA2
115-
Security: 256
116-
# Location of Key Store. If this is unset, a location will
117-
# be chosen using 'MSPDir'/keystore
118-
FileKeyStore:
119-
KeyStore:
120-
12185
AnchorPeers:
12286
# AnchorPeers defines the location of peers which can be used
12387
# for cross org gossip communication. Note, this value is only

msp/configbuilder.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ func GetLocalMspConfig(dir string, bccspConfig *factory.FactoryOpts, ID string)
151151

152152
sigid := &msp.SigningIdentityInfo{PublicSigner: signcert[0], PrivateSigner: nil}
153153

154-
return getMspConfig(dir, bccspConfig, ID, sigid)
154+
return getMspConfig(dir, ID, sigid)
155155
}
156156

157-
func GetVerifyingMspConfig(dir string, bccspConfig *factory.FactoryOpts, ID string) (*msp.MSPConfig, error) {
158-
return getMspConfig(dir, bccspConfig, ID, nil)
157+
func GetVerifyingMspConfig(dir string, ID string) (*msp.MSPConfig, error) {
158+
return getMspConfig(dir, ID, nil)
159159
}
160160

161-
func getMspConfig(dir string, bccspConfig *factory.FactoryOpts, ID string, sigid *msp.SigningIdentityInfo) (*msp.MSPConfig, error) {
161+
func getMspConfig(dir string, ID string, sigid *msp.SigningIdentityInfo) (*msp.MSPConfig, error) {
162162
cacertDir := filepath.Join(dir, cacerts)
163163
signcertDir := filepath.Join(dir, signcerts)
164164
admincertDir := filepath.Join(dir, admincerts)

msp/msp_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func TestGetSigningIdentityFromVerifyingMSP(t *testing.T) {
206206
os.Exit(-1)
207207
}
208208

209-
conf, err = GetVerifyingMspConfig(mspDir, nil, "DEFAULT")
209+
conf, err = GetVerifyingMspConfig(mspDir, "DEFAULT")
210210
if err != nil {
211211
fmt.Printf("Setup should have succeeded, got err %s instead", err)
212212
os.Exit(-1)

sampleconfig/configtx.yaml

-16
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,6 @@ Organizations:
9595
# ADMIN and role type MEMBER respectively.
9696
AdminPrincipal: Role.ADMIN
9797

98-
# BCCSP: Select which crypto implementation or library to use for the
99-
# blockchain crypto service provider.
100-
BCCSP:
101-
Default: SW
102-
SW:
103-
# TODO: The default Hash and Security level needs refactoring to
104-
# be fully configurable. Changing these defaults requires
105-
# coordination SHA2 is hardcoded in several places, not only
106-
# BCCSP.
107-
Hash: SHA2
108-
Security: 256
109-
# Location of key store. If this is unset, a location will be
110-
# chosen using: 'MSPDir'/keystore
111-
FileKeyStore:
112-
KeyStore:
113-
11498
AnchorPeers:
11599
# AnchorPeers defines the location of peers which can be used for
116100
# cross-org gossip communication. Note, this value is only encoded

test/feature/configs/configtx.yaml

-16
Original file line numberDiff line numberDiff line change
@@ -95,22 +95,6 @@ Organizations:
9595
# ADMIN and role type MEMBER respectively.
9696
AdminPrincipal: Role.ADMIN
9797

98-
# BCCSP: Select which crypto implementation or library to use for the
99-
# blockchain crypto service provider.
100-
BCCSP:
101-
Default: SW
102-
SW:
103-
# TODO: The default Hash and Security level needs refactoring to
104-
# be fully configurable. Changing these defaults requires
105-
# coordination SHA2 is hardcoded in several places, not only
106-
# BCCSP.
107-
Hash: SHA2
108-
Security: 256
109-
# Location of key store. If this is unset, a location will be
110-
# chosen using: 'MSPDir'/keystore
111-
FileKeyStore:
112-
KeyStore:
113-
11498
AnchorPeers:
11599
# AnchorPeers defines the location of peers which can be used for
116100
# cross-org gossip communication. Note, this value is only encoded

0 commit comments

Comments
 (0)