Skip to content

Commit

Permalink
Merge "[FAB-4157] Remove BCCSP parms from configtx.yaml"
Browse files Browse the repository at this point in the history
  • Loading branch information
christo4ferris authored and Gerrit Code Review committed Jun 4, 2017
2 parents 5e6b08b + a997c30 commit ae71b2f
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 110 deletions.
4 changes: 2 additions & 2 deletions common/config/organization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestOrganization(t *testing.T) {

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

mspConf, err = msp.GetVerifyingMspConfig(mspDir, nil, "")
mspConf, err = msp.GetVerifyingMspConfig(mspDir, "")
oc.(*OrganizationConfig).protos.MSP = mspConf
err = oc.Validate(t, nil)
assert.Error(t, err, "Validate should have returned error for empty MSP ID")
Expand Down
11 changes: 4 additions & 7 deletions common/configtx/tool/localconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (

"path/filepath"

bccsp "github.com/hyperledger/fabric/bccsp/factory"
cf "github.com/hyperledger/fabric/core/config"
)

Expand Down Expand Up @@ -101,11 +100,10 @@ type Application struct {

// Organization encodes the organization-level configuration needed in config transactions.
type Organization struct {
Name string `yaml:"Name"`
ID string `yaml:"ID"`
MSPDir string `yaml:"MSPDir"`
AdminPrincipal string `yaml:"AdminPrincipal"`
BCCSP *bccsp.FactoryOpts `yaml:"BCCSP"`
Name string `yaml:"Name"`
ID string `yaml:"ID"`
MSPDir string `yaml:"MSPDir"`
AdminPrincipal string `yaml:"AdminPrincipal"`

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

func translatePaths(configDir string, org *Organization) {
cf.TranslatePathInPlace(configDir, &org.MSPDir)
cf.TranslatePathInPlace(configDir, &org.BCCSP.SwOpts.FileKeystore.KeyStorePath)
}
6 changes: 3 additions & 3 deletions common/configtx/tool/provisional/provisional.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func New(conf *genesisconfig.Profile) Generator {
}

for _, org := range conf.Orderer.Organizations {
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.BCCSP, org.ID)
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.ID)
if err != nil {
logger.Panicf("1 - Error loading MSP configuration for org %s: %s", org.Name, err)
}
Expand Down Expand Up @@ -154,7 +154,7 @@ func New(conf *genesisconfig.Profile) Generator {
policies.TemplateImplicitMetaMajorityPolicy([]string{config.ApplicationGroupKey}, configvaluesmsp.AdminsPolicyKey),
}
for _, org := range conf.Application.Organizations {
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.BCCSP, org.ID)
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.ID)
if err != nil {
logger.Panicf("2- Error loading MSP configuration for org %s: %s", org.Name, err)
}
Expand Down Expand Up @@ -193,7 +193,7 @@ func New(conf *genesisconfig.Profile) Generator {
bs.consortiumsGroups = append(bs.consortiumsGroups, cg)

for _, org := range consortium.Organizations {
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.BCCSP, org.ID)
mspConfig, err := msp.GetVerifyingMspConfig(org.MSPDir, org.ID)
if err != nil {
logger.Panicf("3 - Error loading MSP configuration for org %s: %s", org.Name, err)
}
Expand Down
2 changes: 1 addition & 1 deletion common/tools/cryptogen/msp/msp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestGenerateVerifyingMSP(t *testing.T) {
"Expected to find file "+file)
}
// finally check to see if we can load this as a verifying MSP config
testMSPConfig, err := fabricmsp.GetVerifyingMspConfig(mspDir, nil, testName)
testMSPConfig, err := fabricmsp.GetVerifyingMspConfig(mspDir, testName)
assert.NoError(t, err, "Error parsing verifying MSP config")
testMSP, err := fabricmsp.NewBccspMsp()
assert.NoError(t, err, "Error creating new BCCSP MSP")
Expand Down
24 changes: 0 additions & 24 deletions examples/cluster/config/configtx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@ Organizations:

AdminPrincipal: Role.ADMIN

# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
# Location of Key Store. If this is unset, a location will
# be chosen using 'MSPDir'/keystore
FileKeyStore:
KeyStore:

- &Org1
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Expand All @@ -80,18 +68,6 @@ Organizations:

AdminPrincipal: Role.ADMIN

# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
# Location of Key Store. If this is unset, a location will
# be chosen using 'MSPDir'/keystore
FileKeyStore:
KeyStore:

AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
Expand Down
36 changes: 0 additions & 36 deletions examples/e2e_cli/configtx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,6 @@ Organizations:
# MSPDir is the filesystem path which contains the MSP configuration
MSPDir: crypto-config/ordererOrganizations/example.com/msp

# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
# Location of Key Store. If this is unset, a location will
# be chosen using 'MSPDir'/keystore
FileKeyStore:
KeyStore:

- &Org1
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Expand All @@ -77,18 +65,6 @@ Organizations:

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

# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
# Location of Key Store. If this is unset, a location will
# be chosen using 'MSPDir'/keystore
FileKeyStore:
KeyStore:

AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
Expand All @@ -106,18 +82,6 @@ Organizations:

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

# BCCSP (Blockchain crypto provider): Select which crypto implementation or
# library to use
BCCSP:
Default: SW
SW:
Hash: SHA2
Security: 256
# Location of Key Store. If this is unset, a location will
# be chosen using 'MSPDir'/keystore
FileKeyStore:
KeyStore:

AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
Expand Down
8 changes: 4 additions & 4 deletions msp/configbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ func GetLocalMspConfig(dir string, bccspConfig *factory.FactoryOpts, ID string)

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

return getMspConfig(dir, bccspConfig, ID, sigid)
return getMspConfig(dir, ID, sigid)
}

func GetVerifyingMspConfig(dir string, bccspConfig *factory.FactoryOpts, ID string) (*msp.MSPConfig, error) {
return getMspConfig(dir, bccspConfig, ID, nil)
func GetVerifyingMspConfig(dir string, ID string) (*msp.MSPConfig, error) {
return getMspConfig(dir, ID, nil)
}

func getMspConfig(dir string, bccspConfig *factory.FactoryOpts, ID string, sigid *msp.SigningIdentityInfo) (*msp.MSPConfig, error) {
func getMspConfig(dir string, ID string, sigid *msp.SigningIdentityInfo) (*msp.MSPConfig, error) {
cacertDir := filepath.Join(dir, cacerts)
signcertDir := filepath.Join(dir, signcerts)
admincertDir := filepath.Join(dir, admincerts)
Expand Down
2 changes: 1 addition & 1 deletion msp/msp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestGetSigningIdentityFromVerifyingMSP(t *testing.T) {
os.Exit(-1)
}

conf, err = GetVerifyingMspConfig(mspDir, nil, "DEFAULT")
conf, err = GetVerifyingMspConfig(mspDir, "DEFAULT")
if err != nil {
fmt.Printf("Setup should have succeeded, got err %s instead", err)
os.Exit(-1)
Expand Down
16 changes: 0 additions & 16 deletions sampleconfig/configtx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,6 @@ Organizations:
# ADMIN and role type MEMBER respectively.
AdminPrincipal: Role.ADMIN

# BCCSP: Select which crypto implementation or library to use for the
# blockchain crypto service provider.
BCCSP:
Default: SW
SW:
# TODO: The default Hash and Security level needs refactoring to
# be fully configurable. Changing these defaults requires
# coordination SHA2 is hardcoded in several places, not only
# BCCSP.
Hash: SHA2
Security: 256
# Location of key store. If this is unset, a location will be
# chosen using: 'MSPDir'/keystore
FileKeyStore:
KeyStore:

AnchorPeers:
# AnchorPeers defines the location of peers which can be used for
# cross-org gossip communication. Note, this value is only encoded
Expand Down
16 changes: 0 additions & 16 deletions test/feature/configs/configtx.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,6 @@ Organizations:
# ADMIN and role type MEMBER respectively.
AdminPrincipal: Role.ADMIN

# BCCSP: Select which crypto implementation or library to use for the
# blockchain crypto service provider.
BCCSP:
Default: SW
SW:
# TODO: The default Hash and Security level needs refactoring to
# be fully configurable. Changing these defaults requires
# coordination SHA2 is hardcoded in several places, not only
# BCCSP.
Hash: SHA2
Security: 256
# Location of key store. If this is unset, a location will be
# chosen using: 'MSPDir'/keystore
FileKeyStore:
KeyStore:

AnchorPeers:
# AnchorPeers defines the location of peers which can be used for
# cross-org gossip communication. Note, this value is only encoded
Expand Down

0 comments on commit ae71b2f

Please sign in to comment.