diff --git a/orderer/common/bootstrap/static/static.go b/orderer/common/bootstrap/static/static.go index 25f3ca459e3..c251960d128 100644 --- a/orderer/common/bootstrap/static/static.go +++ b/orderer/common/bootstrap/static/static.go @@ -47,6 +47,14 @@ const ( // DefaultConsensusType is the default value of ConsensusTypeKey DefaultConsensusType = "solo" + + // AcceptAllPolicyKey is the key of the AcceptAllPolicy + AcceptAllPolicyKey = "AcceptAllPolicy" +) + +var ( + // DefaultChainCreators is the default value of ChainCreatorsKey + DefaultChainCreators = []string{AcceptAllPolicyKey} ) // New returns a new static bootstrap helper. @@ -78,6 +86,26 @@ func (b *bootstrapper) encodeBatchSize() *cb.SignedConfigurationItem { return &cb.SignedConfigurationItem{ConfigurationItem: utils.MarshalOrPanic(configItem), Signatures: nil} } +func (b *bootstrapper) encodeChainCreators() *cb.SignedConfigurationItem { + configItemKey := sharedconfig.ChainCreatorsKey + configItemValue := utils.MarshalOrPanic(&ab.ChainCreators{Policies: DefaultChainCreators}) + modPolicy := configtx.DefaultModificationPolicyID + + configItemChainHeader := utils.MakeChainHeader(cb.HeaderType_CONFIGURATION_ITEM, msgVersion, b.chainID, b.epoch) + configItem := utils.MakeConfigurationItem(configItemChainHeader, cb.ConfigurationItem_Orderer, b.lastModified, modPolicy, configItemKey, configItemValue) + return &cb.SignedConfigurationItem{ConfigurationItem: utils.MarshalOrPanic(configItem), Signatures: nil} +} + +func (b *bootstrapper) encodeAcceptAllPolicy() *cb.SignedConfigurationItem { + configItemKey := AcceptAllPolicyKey + configItemValue := utils.MarshalOrPanic(utils.MakePolicyOrPanic(cauthdsl.AcceptAllPolicy)) + modPolicy := configtx.DefaultModificationPolicyID + + configItemChainHeader := utils.MakeChainHeader(cb.HeaderType_CONFIGURATION_ITEM, msgVersion, b.chainID, b.epoch) + configItem := utils.MakeConfigurationItem(configItemChainHeader, cb.ConfigurationItem_Policy, b.lastModified, modPolicy, configItemKey, configItemValue) + return &cb.SignedConfigurationItem{ConfigurationItem: utils.MarshalOrPanic(configItem), Signatures: nil} +} + func (b *bootstrapper) lockDefaultModificationPolicy() *cb.SignedConfigurationItem { // Lock down the default modification policy to prevent any further policy modifications configItemKey := configtx.DefaultModificationPolicyID @@ -96,6 +124,8 @@ func (b *bootstrapper) GenesisBlock() (*cb.Block, error) { configEnvelope := utils.MakeConfigurationEnvelope( b.encodeConsensusType(), b.encodeBatchSize(), + b.encodeChainCreators(), + b.encodeAcceptAllPolicy(), b.lockDefaultModificationPolicy(), ) payloadChainHeader := utils.MakeChainHeader(cb.HeaderType_CONFIGURATION_TRANSACTION, configItemChainHeader.Version, b.chainID, b.epoch) diff --git a/orderer/common/bootstrap/static/static_test.go b/orderer/common/bootstrap/static/static_test.go index 4a59954abdc..17acdc7d06b 100644 --- a/orderer/common/bootstrap/static/static_test.go +++ b/orderer/common/bootstrap/static/static_test.go @@ -59,7 +59,7 @@ func TestGenesisBlockData(t *testing.T) { expectedPayloadChainHeaderType := int32(cb.HeaderType_CONFIGURATION_TRANSACTION) expectedChainHeaderVersion := msgVersion expectedChainHeaderEpoch := uint64(0) - expectedConfigEnvelopeItemsLength := 3 + expectedConfigEnvelopeItemsLength := 5 expectedConfigurationItemChainHeaderType := int32(cb.HeaderType_CONFIGURATION_ITEM) expectedConfigurationItemChainHeaderVersion := msgVersion expectedConfigurationItemType := cb.ConfigurationItem_Policy @@ -110,7 +110,7 @@ func TestGenesisBlockData(t *testing.T) { t.Fatalf("Expected configuration envelope to have %d configuration item(s), got %d", expectedConfigEnvelopeItemsLength, len(configurationEnvelope.Items)) } - signedConfigurationItem := configurationEnvelope.Items[2] + signedConfigurationItem := configurationEnvelope.Items[4] marshaledConfigurationItem := signedConfigurationItem.ConfigurationItem configurationItem := &cb.ConfigurationItem{} if err := proto.Unmarshal(marshaledConfigurationItem, configurationItem); err != nil { diff --git a/orderer/common/sharedconfig/sharedconfig.go b/orderer/common/sharedconfig/sharedconfig.go index 6cf9b7ccd18..630f7e642d1 100644 --- a/orderer/common/sharedconfig/sharedconfig.go +++ b/orderer/common/sharedconfig/sharedconfig.go @@ -32,6 +32,9 @@ const ConsensusTypeKey = "ConsensusType" // BatchSizeKey is the cb.ConfigurationItem type key name for the BatchSize message const BatchSizeKey = "BatchSize" +// ChainCreatorsKey is the cb.ConfigurationItem type key name for the ChainCreators message +const ChainCreatorsKey = "ChainCreators" + var logger = logging.MustGetLogger("orderer/common/sharedconfig") func init() { @@ -48,11 +51,16 @@ type Manager interface { // BatchSize returns the maximum number of messages to include in a block BatchSize() int + + // ChainCreators returns the policy names which are allowed for chain creation + // This field is only set for the system ordering chain + ChainCreators() []string } type ordererConfig struct { consensusType string batchSize int + chainCreators []string } // ManagerImpl is an implementation of Manager and configtx.ConfigHandler @@ -79,6 +87,12 @@ func (pm *ManagerImpl) BatchSize() int { return pm.config.batchSize } +// ChainCreators returns the policy names which are allowed for chain creation +// This field is only set for the system ordering chain +func (pm *ManagerImpl) ChainCreators() []string { + return pm.config.chainCreators +} + // BeginConfig is used to start a new configuration proposal func (pm *ManagerImpl) BeginConfig() { if pm.pendingConfig != nil { @@ -135,6 +149,14 @@ func (pm *ManagerImpl) ProposeConfig(configItem *cb.ConfigurationItem) error { } pm.pendingConfig.batchSize = int(batchSize.Messages) + case ChainCreatorsKey: + chainCreators := &ab.ChainCreators{} + err := proto.Unmarshal(configItem.Value, chainCreators) + if err != nil { + return fmt.Errorf("Unmarshaling error for ChainCreator: %s", err) + } + + pm.pendingConfig.chainCreators = chainCreators.Policies } return nil diff --git a/protos/common/common.pb.go b/protos/common/common.pb.go index 72806e613c2..2a4ae29873e 100644 --- a/protos/common/common.pb.go +++ b/protos/common/common.pb.go @@ -92,6 +92,7 @@ const ( HeaderType_CONFIGURATION_TRANSACTION HeaderType = 1 HeaderType_CONFIGURATION_ITEM HeaderType = 2 HeaderType_ENDORSER_TRANSACTION HeaderType = 3 + HeaderType_ORDERER_TRANSACTION HeaderType = 4 ) var HeaderType_name = map[int32]string{ @@ -99,12 +100,14 @@ var HeaderType_name = map[int32]string{ 1: "CONFIGURATION_TRANSACTION", 2: "CONFIGURATION_ITEM", 3: "ENDORSER_TRANSACTION", + 4: "ORDERER_TRANSACTION", } var HeaderType_value = map[string]int32{ "MESSAGE": 0, "CONFIGURATION_TRANSACTION": 1, "CONFIGURATION_ITEM": 2, "ENDORSER_TRANSACTION": 3, + "ORDERER_TRANSACTION": 4, } func (x HeaderType) String() string { @@ -330,53 +333,54 @@ func init() { func init() { proto.RegisterFile("common/common.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 765 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x5c, 0x54, 0xdd, 0x6e, 0xe2, 0x46, - 0x18, 0x8d, 0x63, 0x7e, 0xc2, 0x67, 0x9a, 0xb8, 0x43, 0x7e, 0x5c, 0xd4, 0x28, 0xc8, 0x52, 0x2b, - 0x94, 0xa8, 0xa0, 0xa6, 0xaa, 0xd4, 0x5b, 0x83, 0x07, 0x62, 0x95, 0x8c, 0xd3, 0xb1, 0x9d, 0xaa, - 0xbd, 0xb1, 0x0c, 0x4c, 0x80, 0x5d, 0xb0, 0x91, 0x31, 0x51, 0x72, 0xbb, 0x0f, 0xb0, 0x5a, 0x69, - 0xf7, 0x76, 0x5f, 0x60, 0x9f, 0x64, 0xdf, 0x60, 0x5f, 0x64, 0xa5, 0xbd, 0x5d, 0x79, 0x6c, 0x03, - 0xce, 0x15, 0x73, 0xbe, 0xef, 0xcc, 0x99, 0x73, 0xbe, 0x19, 0x0c, 0xb5, 0x51, 0xb0, 0x58, 0x04, - 0x7e, 0x3b, 0xf9, 0x69, 0x2d, 0xc3, 0x20, 0x0a, 0x50, 0x29, 0x41, 0xf5, 0x8b, 0x49, 0x10, 0x4c, - 0xe6, 0xac, 0xcd, 0xab, 0xc3, 0xf5, 0x43, 0x3b, 0x9a, 0x2d, 0xd8, 0x2a, 0xf2, 0x16, 0xcb, 0x84, - 0xa8, 0xbe, 0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0x31, 0x7b, 0x42, 0x87, 0x00, 0x96, 0xd1, 0x27, 0x9a, 0xed, 0x50, - 0x6c, 0xc9, 0x7b, 0xb1, 0xee, 0x40, 0xb3, 0x6c, 0x37, 0x27, 0x2e, 0x0b, 0xe8, 0x0c, 0x6a, 0x3b, - 0x72, 0x96, 0xdb, 0x33, 0x06, 0x36, 0xa6, 0xf2, 0x7e, 0xe7, 0xb7, 0xff, 0xaf, 0x26, 0xb3, 0x68, - 0xba, 0x1e, 0xc6, 0xaf, 0xa9, 0x3d, 0x7d, 0x5e, 0xb2, 0x70, 0xce, 0xc6, 0x13, 0x16, 0xb6, 0x1f, - 0xbc, 0x61, 0x38, 0x1b, 0x25, 0x1f, 0xc7, 0x55, 0xfa, 0x01, 0x1d, 0x96, 0x38, 0xfc, 0xe3, 0x7b, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x92, 0x53, 0x0b, 0x44, 0x58, 0x05, 0x00, 0x00, + // 771 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x5c, 0x54, 0xcd, 0x6e, 0xf2, 0x46, + 0x14, 0x8d, 0x63, 0x7e, 0xc2, 0x35, 0xcd, 0xe7, 0x0e, 0xdf, 0x97, 0xb8, 0xa8, 0x51, 0x90, 0xa5, + 0x56, 0x28, 0x51, 0x41, 0x4d, 0x55, 0xa9, 0x5b, 0x83, 0x07, 0x62, 0x95, 0x8c, 0xd3, 0xb1, 0x9d, + 0xaa, 0xdd, 0x58, 0x06, 0x26, 0x80, 0x0a, 0x36, 0x32, 0x26, 0x4a, 0xb6, 0xed, 0xbe, 0xaa, 0xd4, + 0x6e, 0xfb, 0x02, 0x7d, 0x92, 0xbe, 0x41, 0x5f, 0xa4, 0x52, 0xb7, 0xd5, 0x8c, 0x6d, 0xc0, 0xac, + 0x98, 0x73, 0xcf, 0xfd, 0x39, 0xe7, 0xce, 0x60, 0x68, 0x4c, 0xa2, 0xd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0x36, 0xf1, + 0x5d, 0x6a, 0x10, 0xc7, 0xe8, 0xf3, 0xb3, 0x2a, 0xa1, 0x0b, 0x40, 0x45, 0xda, 0x72, 0xf1, 0x83, + 0x7a, 0x8a, 0x34, 0x78, 0x8f, 0x89, 0x69, 0x53, 0x07, 0xd3, 0x42, 0x85, 0x8c, 0x2e, 0xa1, 0x61, + 0x53, 0x13, 0xd3, 0x23, 0xa2, 0x74, 0xe3, 0x01, 0x2a, 0xec, 0xd7, 0x0a, 0xa7, 0xec, 0x15, 0x9d, + 0x03, 0x38, 0xd6, 0x90, 0x18, 0xae, 0x47, 0xb1, 0xa3, 0x9e, 0xf0, 0x81, 0x23, 0xc3, 0x71, 0xfd, + 0xc2, 0x54, 0x55, 0xe2, 0x6d, 0x0f, 0xda, 0x39, 0xfe, 0xc0, 0x1a, 0xb9, 0x98, 0xaa, 0xa7, 0xbd, + 0x2f, 0x7e, 0xbc, 0x9d, 0x2d, 0x92, 0xf9, 0x76, 0xcc, 0xdf, 0x59, 0x77, 0xfe, 0xb6, 0x66, 0xf1, + 0x92, 0x4d, 0x67, 0x2c, 0xee, 0x3e, 0x07, 0xe3, 0x78, 0x31, 0x49, 0x3f, 0x9b, 0x9b, 0xec, 0xd3, + 0x3a, 0xae, 0x08, 0xf8, 0xd5, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8a, 0x69, 0x37, 0x92, 0x72, + 0x05, 0x00, 0x00, } diff --git a/protos/common/common.proto b/protos/common/common.proto index 975c9ecd6bb..2e913e3ece4 100644 --- a/protos/common/common.proto +++ b/protos/common/common.proto @@ -39,6 +39,7 @@ enum HeaderType { CONFIGURATION_TRANSACTION = 1; // Used for messages which reconfigure the chain CONFIGURATION_ITEM = 2; // Used inside of the the reconfiguration message for signing over ConfigurationItems ENDORSER_TRANSACTION = 3; // Used by the SDK to submit endorser based transactions + ORDERER_TRANSACTION = 4; // Used internally by the orderer for management } // This enum enlist indexes of the block metadata array diff --git a/protos/orderer/ab.pb.go b/protos/orderer/ab.pb.go index 8c43bb1234a..aa9381a61f4 100644 --- a/protos/orderer/ab.pb.go +++ b/protos/orderer/ab.pb.go @@ -17,6 +17,8 @@ It has these top-level messages: DeliverResponse ConsensusType BatchSize + CreationPolicy + ChainCreators */ package orderer diff --git a/protos/orderer/configuration.pb.go b/protos/orderer/configuration.pb.go index fb96c8d5f40..1fe04e05fa6 100644 --- a/protos/orderer/configuration.pb.go +++ b/protos/orderer/configuration.pb.go @@ -33,25 +33,56 @@ func (m *BatchSize) String() string { return proto.CompactTextString( func (*BatchSize) ProtoMessage() {} func (*BatchSize) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } +// When submitting a new chain configuration transaction to create a new chain, the first configuration item must of of type +// Orderer with Key CreationPolicy and contents of a Marshaled CreationPolicy. The policy should be set to the policy which +// was supplied by the ordering service for the client's chain creation. The digest should be the hash of the concatenation +// of the remaining ConfigurationItem bytes. The signatures of the configuration item should satisfy the policy for chain creation +type CreationPolicy struct { + // The name of the policy which should be used to validate the creation of this chain + Policy string `protobuf:"bytes,1,opt,name=policy" json:"policy,omitempty"` + // The hash of the concatenation of remaining configuration item bytes + Digest []byte `protobuf:"bytes,2,opt,name=digest,proto3" json:"digest,omitempty"` +} + +func (m *CreationPolicy) Reset() { *m = CreationPolicy{} } +func (m *CreationPolicy) String() string { return proto.CompactTextString(m) } +func (*CreationPolicy) ProtoMessage() {} +func (*CreationPolicy) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } + +type ChainCreators struct { + // A list of policies, any of which may be specified as the chain creation policy in a chain creation request + Policies []string `protobuf:"bytes,1,rep,name=policies" json:"policies,omitempty"` +} + +func (m *ChainCreators) Reset() { *m = ChainCreators{} } +func (m *ChainCreators) String() string { return proto.CompactTextString(m) } +func (*ChainCreators) ProtoMessage() {} +func (*ChainCreators) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } + func init() { proto.RegisterType((*ConsensusType)(nil), "orderer.ConsensusType") proto.RegisterType((*BatchSize)(nil), "orderer.BatchSize") + proto.RegisterType((*CreationPolicy)(nil), "orderer.CreationPolicy") + proto.RegisterType((*ChainCreators)(nil), "orderer.ChainCreators") } func init() { proto.RegisterFile("orderer/configuration.proto", fileDescriptor1) } var fileDescriptor1 = []byte{ - // 177 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x3c, 0x8e, 0xb1, 0xca, 0xc2, 0x30, - 0x14, 0x85, 0x29, 0xfc, 0xbf, 0xda, 0x80, 0x4b, 0x5c, 0xa4, 0x2e, 0x52, 0x07, 0x1d, 0xa4, 0x19, - 0x7c, 0x83, 0xfa, 0x06, 0xd5, 0xc9, 0x2d, 0x4d, 0x6f, 0xd3, 0x80, 0xc9, 0x0d, 0x37, 0xe9, 0x50, - 0x9f, 0x5e, 0x48, 0x8b, 0xd3, 0xbd, 0x1f, 0xdf, 0x81, 0x73, 0xd8, 0x01, 0xa9, 0x03, 0x02, 0x12, - 0x0a, 0x5d, 0x6f, 0xf4, 0x48, 0x32, 0x1a, 0x74, 0x95, 0x27, 0x8c, 0xc8, 0xd7, 0x8b, 0x2c, 0x76, - 0x0a, 0xad, 0x45, 0x27, 0xe6, 0x33, 0xdb, 0xf2, 0xc4, 0xb6, 0x77, 0x74, 0x01, 0x5c, 0x18, 0xc3, - 0x73, 0xf2, 0xc0, 0x39, 0xfb, 0x8b, 0x93, 0x87, 0x7d, 0x76, 0xcc, 0x2e, 0x79, 0x93, 0xfe, 0xf2, - 0xcc, 0xf2, 0x5a, 0x46, 0x35, 0x3c, 0xcc, 0x07, 0x78, 0xc1, 0x36, 0x16, 0x42, 0x90, 0x1a, 0x42, - 0x0a, 0xfd, 0x37, 0x3f, 0xae, 0xab, 0xd7, 0x55, 0x9b, 0x38, 0x8c, 0x6d, 0xa5, 0xd0, 0x8a, 0x61, - 0xf2, 0x40, 0x6f, 0xe8, 0x34, 0x90, 0xe8, 0x65, 0x4b, 0x46, 0x89, 0x54, 0x1a, 0xc4, 0x32, 0xa9, - 0x5d, 0x25, 0xbe, 0x7d, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd1, 0x10, 0x57, 0x86, 0xc1, 0x00, 0x00, - 0x00, + // 237 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x3c, 0x90, 0xc1, 0x4e, 0xf3, 0x30, + 0x10, 0x84, 0x95, 0xff, 0x87, 0x42, 0x2c, 0xca, 0xc1, 0x48, 0xa8, 0x2a, 0x97, 0x2a, 0x1c, 0x88, + 0x04, 0x8a, 0x0f, 0xbc, 0x00, 0x6a, 0x5e, 0x00, 0x05, 0x4e, 0xdc, 0x1c, 0x67, 0xeb, 0x58, 0x6a, + 0xbc, 0xd6, 0xda, 0x39, 0x84, 0xa7, 0x47, 0xdd, 0x5a, 0x3d, 0x79, 0x3e, 0x8f, 0x3d, 0xa3, 0x5d, + 0xf1, 0x84, 0x34, 0x00, 0x01, 0x29, 0x83, 0xfe, 0xe0, 0xec, 0x4c, 0x3a, 0x39, 0xf4, 0x4d, 0x20, + 0x4c, 0x28, 0x6f, 0xb2, 0xb9, 0x7d, 0x30, 0x38, 0x4d, 0xe8, 0xd5, 0xf9, 0x38, 0xbb, 0xd5, 0xb3, + 0x58, 0xb7, 0xe8, 0x23, 0xf8, 0x38, 0xc7, 0xef, 0x25, 0x80, 0x94, 0xe2, 0x2a, 0x2d, 0x01, 0x36, + 0xc5, 0xae, 0xa8, 0xcb, 0x8e, 0x75, 0xf5, 0x22, 0xca, 0xbd, 0x4e, 0x66, 0xfc, 0x72, 0xbf, 0x20, + 0xb7, 0xe2, 0x76, 0x82, 0x18, 0xb5, 0x85, 0xc8, 0x8f, 0xae, 0xbb, 0x0b, 0x57, 0x1f, 0xe2, 0xbe, + 0x25, 0xe0, 0xf6, 0x4f, 0x3c, 0x3a, 0xb3, 0xc8, 0x47, 0xb1, 0x0a, 0xac, 0x72, 0x60, 0xa6, 0xd3, + 0xfd, 0xe0, 0x2c, 0xc4, 0xb4, 0xf9, 0xb7, 0x2b, 0xea, 0xbb, 0x2e, 0x53, 0xf5, 0x2a, 0xd6, 0xed, + 0xa8, 0x9d, 0xe7, 0x18, 0xa4, 0x78, 0xaa, 0xe3, 0x2f, 0x8e, 0xeb, 0xfe, 0xd7, 0x65, 0x77, 0xe1, + 0x7d, 0xf3, 0xf3, 0x66, 0x5d, 0x1a, 0xe7, 0xbe, 0x31, 0x38, 0xa9, 0x71, 0x09, 0x40, 0x47, 0x18, + 0x2c, 0x90, 0x3a, 0xe8, 0x9e, 0x9c, 0x51, 0x3c, 0x63, 0x54, 0x79, 0x03, 0xfd, 0x8a, 0xf9, 0xfd, + 0x2f, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x3d, 0xf4, 0x97, 0x30, 0x01, 0x00, 0x00, } diff --git a/protos/orderer/configuration.proto b/protos/orderer/configuration.proto index 015c7366cd0..1ade0e39e6f 100644 --- a/protos/orderer/configuration.proto +++ b/protos/orderer/configuration.proto @@ -37,3 +37,21 @@ message BatchSize { // Simply specified as messages for now, in the future we may want to allow this to be specified by size in bytes int32 messages = 1; } + +// When submitting a new chain configuration transaction to create a new chain, the first configuration +// item must be of type Orderer with Key CreationPolicy and contents of a Marshaled CreationPolicy. The +// policy should be set to the policy which was supplied by the ordering service for the client's chain +// creation. The digest should be the hash of the concatenation of the remaining ConfigurationItem bytes. +// The signatures of the configuration item should satisfy the policy for chain creation. +message CreationPolicy { + // The name of the policy which should be used to validate the creation of this chain + string policy = 1; + + // The hash of the concatenation of remaining configuration item bytes + bytes digest = 2; +} + +message ChainCreators { + // A list of policies, any of which may be specified as the chain creation policy in a chain creation request + repeated string policies = 1; +}