Skip to content

Commit 0fcb145

Browse files
Jason Yellickkchristidis
Jason Yellick
authored andcommitted
[FAB-2723] (PA) Remove old ChainCreationPolicyName
Before FAB-1302, channel creation was governed by a list of ChainCreationPolicyNames. This mechanism was replaced by the notion of consortiums and a corresponding consortium channel creation policy. This allows channel creation policies to be tied to the consortium, rather than to an arbitrary list and is both simpler, and more expressive. Consequently, the old chain creaiton policy name, and chain creation policy protos are no longer needed. This CR removes them to erase any confusion. This is an ABI break, and will prevent channels created with the older style config to fail to start. Change-Id: I08f82d66a8bf48c2b3301ed8f1394d7e4edb53ad Signed-off-by: Jason Yellick <[email protected]> Signed-off-by: Kostas Christidis <[email protected]>
1 parent 312628c commit 0fcb145

File tree

9 files changed

+32
-148
lines changed

9 files changed

+32
-148
lines changed

common/config/api.go

-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ type Orderer interface {
8686
// BatchTimeout returns the amount of time to wait before creating a batch
8787
BatchTimeout() time.Duration
8888

89-
// ChainCreationPolicyNames returns the policy names which are allowed for chain creation
90-
// This field is only set for the system ordering chain
91-
ChainCreationPolicyNames() []string
92-
9389
// MaxChannelsCount returns the maximum count of channels to allow for an ordering network
9490
MaxChannelsCount() uint64
9591

common/config/orderer.go

+5-16
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ const (
4242
// BatchTimeoutKey is the cb.ConfigItem type key name for the BatchTimeout message
4343
BatchTimeoutKey = "BatchTimeout"
4444

45-
// ChainCreationPolicyNamesKey is the cb.ConfigItem type key name for the ChainCreationPolicyNames message
46-
ChainCreationPolicyNamesKey = "ChainCreationPolicyNames"
47-
4845
// ChannelRestrictions is the key name for the ChannelRestrictions message
4946
ChannelRestrictionsKey = "ChannelRestrictions"
5047

@@ -54,13 +51,11 @@ const (
5451

5552
// OrdererProtos is used as the source of the OrdererConfig
5653
type OrdererProtos struct {
57-
ConsensusType *ab.ConsensusType
58-
BatchSize *ab.BatchSize
59-
BatchTimeout *ab.BatchTimeout
60-
ChainCreationPolicyNames *ab.ChainCreationPolicyNames
61-
KafkaBrokers *ab.KafkaBrokers
62-
CreationPolicy *ab.CreationPolicy
63-
ChannelRestrictions *ab.ChannelRestrictions
54+
ConsensusType *ab.ConsensusType
55+
BatchSize *ab.BatchSize
56+
BatchTimeout *ab.BatchTimeout
57+
KafkaBrokers *ab.KafkaBrokers
58+
ChannelRestrictions *ab.ChannelRestrictions
6459
}
6560

6661
// Config is stores the orderer component configuration
@@ -133,12 +128,6 @@ func (oc *OrdererConfig) BatchTimeout() time.Duration {
133128
return oc.batchTimeout
134129
}
135130

136-
// ChainCreationPolicyNames returns the policy names which are allowed for chain creation
137-
// This field is only set for the system ordering chain
138-
func (oc *OrdererConfig) ChainCreationPolicyNames() []string {
139-
return oc.protos.ChainCreationPolicyNames.Names
140-
}
141-
142131
// KafkaBrokers returns the addresses (IP:port notation) of a set of "bootstrap"
143132
// Kafka brokers, i.e. this is not necessarily the entire set of Kafka brokers
144133
// used for ordering

common/config/orderer_util.go

-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ func TemplateBatchTimeout(batchTimeout string) *cb.ConfigGroup {
4646
return ordererConfigGroup(BatchTimeoutKey, utils.MarshalOrPanic(&ab.BatchTimeout{Timeout: batchTimeout}))
4747
}
4848

49-
// TemplateChainCreationPolicyNames creates a headerless configuraiton item representing the chain creation policy names
50-
func TemplateChainCreationPolicyNames(names []string) *cb.ConfigGroup {
51-
return ordererConfigGroup(ChainCreationPolicyNamesKey, utils.MarshalOrPanic(&ab.ChainCreationPolicyNames{Names: names}))
52-
}
53-
5449
// TemplateChannelRestrictions creates a config group with ChannelRestrictions specified
5550
func TemplateChannelRestrictions(maxChannels uint64) *cb.ConfigGroup {
5651
return ordererConfigGroup(ChannelRestrictionsKey, utils.MarshalOrPanic(&ab.ChannelRestrictions{MaxCount: maxChannels}))

common/configtx/tool/provisional/provisional.go

+4-22
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package provisional
1919
import (
2020
"fmt"
2121

22-
"github.com/hyperledger/fabric/common/cauthdsl"
2322
"github.com/hyperledger/fabric/common/config"
2423
configvaluesmsp "github.com/hyperledger/fabric/common/config/msp"
2524
"github.com/hyperledger/fabric/common/configtx"
@@ -73,22 +72,15 @@ const (
7372
// does not exist.
7473
TestChainID = "testchainid"
7574

76-
// AcceptAllPolicyKey is the key of the AcceptAllPolicy.
77-
AcceptAllPolicyKey = "AcceptAllPolicy"
78-
7975
// BlockValidationPolicyKey TODO
8076
BlockValidationPolicyKey = "BlockValidation"
8177
)
8278

83-
// DefaultChainCreationPolicyNames is the default value of ChainCreatorsKey.
84-
var DefaultChainCreationPolicyNames = []string{AcceptAllPolicyKey}
85-
8679
type bootstrapper struct {
87-
channelGroups []*cb.ConfigGroup
88-
ordererGroups []*cb.ConfigGroup
89-
applicationGroups []*cb.ConfigGroup
90-
ordererSystemChannelGroups []*cb.ConfigGroup
91-
consortiumsGroups []*cb.ConfigGroup
80+
channelGroups []*cb.ConfigGroup
81+
ordererGroups []*cb.ConfigGroup
82+
applicationGroups []*cb.ConfigGroup
83+
consortiumsGroups []*cb.ConfigGroup
9284
}
9385

9486
// New returns a new provisional bootstrap helper.
@@ -104,9 +96,6 @@ func New(conf *genesisconfig.Profile) Generator {
10496
policies.TemplateImplicitMetaAnyPolicy([]string{}, configvaluesmsp.ReadersPolicyKey),
10597
policies.TemplateImplicitMetaAnyPolicy([]string{}, configvaluesmsp.WritersPolicyKey),
10698
policies.TemplateImplicitMetaMajorityPolicy([]string{}, configvaluesmsp.AdminsPolicyKey),
107-
108-
// Temporary AcceptAllPolicy XXX, remove
109-
cauthdsl.TemplatePolicy(AcceptAllPolicyKey, cauthdsl.AcceptAllPolicy),
11099
},
111100
}
112101

@@ -148,11 +137,6 @@ func New(conf *genesisconfig.Profile) Generator {
148137
default:
149138
panic(fmt.Errorf("Wrong consenter type value given: %s", conf.Orderer.OrdererType))
150139
}
151-
152-
bs.ordererSystemChannelGroups = []*cb.ConfigGroup{
153-
// Policies
154-
config.TemplateChainCreationPolicyNames(DefaultChainCreationPolicyNames),
155-
}
156140
}
157141

158142
if conf.Application != nil {
@@ -234,7 +218,6 @@ func (bs *bootstrapper) GenesisBlock() *cb.Block {
234218
configtx.NewModPolicySettingTemplate(
235219
configvaluesmsp.AdminsPolicyKey,
236220
configtx.NewCompositeTemplate(
237-
configtx.NewSimpleTemplate(bs.ordererSystemChannelGroups...),
238221
configtx.NewSimpleTemplate(bs.consortiumsGroups...),
239222
bs.ChannelTemplate(),
240223
),
@@ -253,7 +236,6 @@ func (bs *bootstrapper) GenesisBlockForChannel(channelID string) *cb.Block {
253236
configtx.NewModPolicySettingTemplate(
254237
configvaluesmsp.AdminsPolicyKey,
255238
configtx.NewCompositeTemplate(
256-
configtx.NewSimpleTemplate(bs.ordererSystemChannelGroups...),
257239
configtx.NewSimpleTemplate(bs.consortiumsGroups...),
258240
bs.ChannelTemplate(),
259241
),

common/mocks/configvalues/channel/orderer/sharedconfig.go

-21
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,8 @@ type SharedConfig struct {
2727
BatchSizeVal *ab.BatchSize
2828
// BatchTimeoutVal is returned as the result of BatchTimeout()
2929
BatchTimeoutVal time.Duration
30-
// ChainCreationPolicyNamesVal is returned as the result of ChainCreationPolicyNames()
31-
ChainCreationPolicyNamesVal []string
3230
// KafkaBrokersVal is returned as the result of KafkaBrokers()
3331
KafkaBrokersVal []string
34-
// IngressPolicyNamesVal is returned as the result of IngressPolicyNames()
35-
IngressPolicyNamesVal []string
36-
// EgressPolicyNamesVal is returned as the result of EgressPolicyNames()
37-
EgressPolicyNamesVal []string
3832
// MaxChannelsCountVal is returns as the result of MaxChannelsCount()
3933
MaxChannelsCountVal uint64
4034
}
@@ -54,11 +48,6 @@ func (scm *SharedConfig) BatchTimeout() time.Duration {
5448
return scm.BatchTimeoutVal
5549
}
5650

57-
// ChainCreationPolicyNames returns the ChainCreationPolicyNamesVal
58-
func (scm *SharedConfig) ChainCreationPolicyNames() []string {
59-
return scm.ChainCreationPolicyNamesVal
60-
}
61-
6251
// KafkaBrokers returns the KafkaBrokersVal
6352
func (scm *SharedConfig) KafkaBrokers() []string {
6453
return scm.KafkaBrokersVal
@@ -68,13 +57,3 @@ func (scm *SharedConfig) KafkaBrokers() []string {
6857
func (scm *SharedConfig) MaxChannelsCount() uint64 {
6958
return scm.MaxChannelsCountVal
7059
}
71-
72-
// IngressPolicyNames returns the IngressPolicyNamesVal
73-
func (scm *SharedConfig) IngressPolicyNames() []string {
74-
return scm.IngressPolicyNamesVal
75-
}
76-
77-
// EgressPolicyNames returns the EgressPolicyNamesVal
78-
func (scm *SharedConfig) EgressPolicyNames() []string {
79-
return scm.EgressPolicyNamesVal
80-
}

orderer/multichain/manager.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func NewManagerImpl(ledgerFactory ledger.Factory, consenters map[string]Consente
109109
ledgerResources := ml.newLedgerResources(configTx)
110110
chainID := ledgerResources.ChainID()
111111

112-
if ledgerResources.SharedConfig().ChainCreationPolicyNames() != nil {
112+
if ledgerResources.ConsortiumsConfig() != nil {
113113
if ml.systemChannelID != "" {
114114
logger.Fatalf("There appear to be two system chains %s and %s", ml.systemChannelID, chainID)
115115
}

protos/orderer/ab.pb.go

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

protos/orderer/configuration.pb.go

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

protos/orderer/configuration.proto

-20
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,6 @@ message BatchTimeout {
5050
string timeout = 1;
5151
}
5252

53-
// When submitting a new chain configuration transaction to create a new chain,
54-
// the first configuration item must be of type Orderer with Key CreationPolicy
55-
// and contents of a Marshaled CreationPolicy. The policy should be set to the
56-
// policy which was supplied by the ordering service for the client's chain
57-
// creation. The digest should be the hash of the concatenation of the remaining
58-
// ConfigurationItem bytes. The signatures of the configuration item should
59-
// satisfy the policy for chain creation.
60-
message CreationPolicy {
61-
// The name of the policy which should be used to validate the creation of
62-
// this chain
63-
string policy = 1;
64-
}
65-
66-
// ChainCreationPolicyNames is the set of policies which may be invoked for chain creation
67-
message ChainCreationPolicyNames {
68-
// A list of policies, in evaluation these are 'or'-ed, note this is not a proper policy
69-
// because implementing referential policies in a general way is difficult, and dangerous
70-
repeated string names = 1;
71-
}
72-
7353
// Carries a list of bootstrap brokers, i.e. this is not the exclusive set of
7454
// brokers an ordering service
7555
message KafkaBrokers {

0 commit comments

Comments
 (0)