Skip to content

Commit 2802430

Browse files
author
Jason Yellick
committed
[FAB-6143] Cleanup dead code
Now that almost all references the config templating code is gone, it should be removed entirely from the codebase. This final CR in the channel config generation cleanup series shows a net decrease of over 400 lines, with an even larger shift of lines of code from the orderer/peer production binaries and into the configtxgen binary. Change-Id: I614a10113c0f90b822da5103319a91f2f28b66b5 Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
1 parent 2ef4823 commit 2802430

File tree

18 files changed

+45
-863
lines changed

18 files changed

+45
-863
lines changed

common/channelconfig/application_util.go

Lines changed: 0 additions & 42 deletions
This file was deleted.

common/channelconfig/channel_util.go

Lines changed: 0 additions & 82 deletions
This file was deleted.

common/channelconfig/consortium.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ import (
1212
"github.com/pkg/errors"
1313
)
1414

15+
const (
16+
// ChannelCreationPolicyKey is the key used in the consortium config to denote the policy
17+
// to be used in evaluating whether a channel creation request is authorized
18+
ChannelCreationPolicyKey = "ChannelCreationPolicy"
19+
)
20+
1521
// ConsortiumProtos holds the config protos for the consortium config
1622
type ConsortiumProtos struct {
1723
ChannelCreationPolicy *cb.Policy

common/channelconfig/consortiums_util.go

Lines changed: 0 additions & 34 deletions
This file was deleted.

common/channelconfig/msp_test.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ import (
1010
"testing"
1111

1212
"github.com/hyperledger/fabric/common/capabilities"
13-
"github.com/hyperledger/fabric/common/cauthdsl"
1413
"github.com/hyperledger/fabric/core/config"
1514
"github.com/hyperledger/fabric/msp"
16-
cb "github.com/hyperledger/fabric/protos/common"
1715
mspprotos "github.com/hyperledger/fabric/protos/msp"
18-
"github.com/hyperledger/fabric/protos/utils"
1916
"github.com/stretchr/testify/assert"
2017
)
2118

@@ -58,33 +55,3 @@ func TestMSPConfigFailure(t *testing.T) {
5855
assert.Error(t, err)
5956
})
6057
}
61-
62-
func TestTemplates(t *testing.T) {
63-
mspDir, err := config.GetDevMspDir()
64-
assert.NoError(t, err)
65-
mspConf, err := msp.GetLocalMspConfig(mspDir, nil, "DEFAULT")
66-
assert.NoError(t, err)
67-
68-
expectedMSPValue := &cb.ConfigValue{
69-
Value: utils.MarshalOrPanic(mspConf),
70-
}
71-
configGroup := TemplateGroupMSP([]string{"TestPath"}, mspConf)
72-
testGroup, ok := configGroup.Groups["TestPath"]
73-
assert.Equal(t, true, ok, "Failed to find group key")
74-
assert.Equal(t, expectedMSPValue, testGroup.Values[MSPKey], "MSPKey did not match expected value")
75-
76-
configGroup = TemplateGroupMSPWithAdminRolePrincipal([]string{"TestPath"}, mspConf, false)
77-
expectedPolicyValue := utils.MarshalOrPanic(cauthdsl.SignedByMspMember("DEFAULT"))
78-
actualPolicyValue := configGroup.Groups["TestPath"].Policies[AdminsPolicyKey].Policy.Value
79-
assert.Equal(t, expectedPolicyValue, actualPolicyValue, "Expected SignedByMspMemberPolicy")
80-
81-
mspConf = &mspprotos.MSPConfig{}
82-
assert.Panics(t, func() {
83-
configGroup = TemplateGroupMSPWithAdminRolePrincipal([]string{"TestPath"}, mspConf, false)
84-
}, "Expected panic with bad msp config")
85-
mspConf.Type = int32(10)
86-
assert.Panics(t, func() {
87-
configGroup = TemplateGroupMSPWithAdminRolePrincipal([]string{"TestPath"}, mspConf, false)
88-
}, "Expected panic with bad msp config")
89-
90-
}

common/channelconfig/msp_util.go

Lines changed: 0 additions & 100 deletions
This file was deleted.

common/channelconfig/orderer_util.go

Lines changed: 0 additions & 52 deletions
This file was deleted.

common/channelconfig/organization.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ import (
1616
"github.com/pkg/errors"
1717
)
1818

19+
const (
20+
// MSPKey is the key for the MSP definition in orderer groups
21+
MSPKey = "MSP"
22+
)
23+
1924
// OrganizationProtos are used to deserialize the organization config
2025
type OrganizationProtos struct {
2126
MSP *mspprotos.MSPConfig

0 commit comments

Comments
 (0)