@@ -20,68 +20,97 @@ limitations under the License.
20
20
syntax = "proto3" ;
21
21
22
22
import "common.proto" ;
23
+ import "policies.proto" ;
23
24
24
25
option go_package = "github.com/hyperledger/fabric/protos/common" ;
25
26
26
27
package common ;
27
28
28
- // ConfigurationEnvelope is designed to contain _all_ configuration for a chain with no dependency
29
+ // ConfigEnvelope is designed to contain _all_ configuration for a chain with no dependency
29
30
// on previous configuration transactions.
30
31
//
31
32
// It is generated with the following scheme:
32
33
// 1. Retrieve the existing configuration
33
- // 2. Note the highest configuration sequence number, store it and increment it by one
34
- // 3. Modify desired ConfigurationItems, setting each LastModified to the stored and incremented sequence number
35
- // a) Note that the ConfigurationItem has a ChainHeader header attached to it, who's type is set to CONFIGURATION_ITEM
36
- // 4. Update SignedConfigurationItem with appropriate signatures over the modified ConfigurationItem
37
- // a) Each signature is of type ConfigurationSignature
38
- // b) The ConfigurationSignature signature is over the concatenation of signatureHeader and the ConfigurationItem bytes (which includes a ChainHeader)
39
- // 5. Submit new Configuration for ordering in Envelope signed by submitter
40
- // a) The Envelope Payload has data set to the marshaled ConfigurationEnvelope
41
- // b) The Envelope Payload has a header of type Header.Type.CONFIGURATION_TRANSACTION
34
+ // 2. Note the config properties (ConfigValue, ConfigPolicy, ConfigGroup) to be modified
35
+ // 3. Add any intermediate ConfigGroups to the ConfigUpdate.read_set (sparsely)
36
+ // 4. Add any additional desired dependencies to ConfigUpdate.read_set (sparsely)
37
+ // 5. Modify the config properties, incrementing each version by 1, set them in the ConfigUpdate.write_set
38
+ // Note: any element not modified but specified should already be in the read_set, so may be specified sparsely
39
+ // 6. Create ConfigUpdate message and marshal it into ConfigUpdateEnvelope.update and encode the required signatures
40
+ // a) Each signature is of type ConfigSignature
41
+ // b) The ConfigSignature signature is over the concatenation of signature_header and the ConfigUpdate bytes (which includes a ChainHeader)
42
+ // 5. Submit new Config for ordering in Envelope signed by submitter
43
+ // a) The Envelope Payload has data set to the marshaled ConfigEnvelope
44
+ // b) The Envelope Payload has a header of type Header.Type.CONFIG_UPDATE
42
45
//
43
46
// The configuration manager will verify:
44
- // 1. All configuration items and the envelope refer to the correct chain
45
- // 2. Some configuration item has been added or modified
46
- // 3. No existing configuration item has been ommitted
47
- // 4. All configuration changes have a LastModification of one more than the last configuration's highest LastModification number
48
- // 5. All configuration changes satisfy the corresponding modification policy
49
- message ConfigurationEnvelope {
50
- repeated SignedConfigurationItem Items = 1 ;
51
-
52
- // XXX This needs to be signed over, purely temporary pending completion of https://jira.hyperledger.org/browse/FAB-1880
53
- ChainHeader header = 2 ;
47
+ // 1. All items in the read_set exist at the read versions
48
+ // 2. All items in the write_set at a different version than, or not in, the read_set have been appropriately signed according to their mod_policy
49
+ // 3. The new configuration satisfies the ConfigSchema
50
+ message ConfigEnvelope {
51
+ Config config = 1 ; // A marshaled Config structure
52
+ ConfigUpdateEnvelope last_update = 2 ; // The most recent ConfigUpdateEnvelope whose diff generated the current config
54
53
}
55
54
56
- // ConfigurationTemplate is used as a serialization format to share configuration templates
57
- // The orderer supplies a configuration template to the user to use when constructing a new
58
- // chain creation transaction, so this is used to facilitate that.
59
- message ConfigurationTemplate {
60
- repeated ConfigurationItem Items = 1 ;
55
+ message ConfigGroupSchema {
56
+ map <string , ConfigGroupSchema > groups = 1 ;
57
+ map <string , ConfigValueSchema > values = 2 ;
58
+ map <string , ConfigPolicySchema > policies = 3 ;
61
59
}
62
60
63
- // This message may change slightly depending on the finalization of signature schemes for transactions
64
- message SignedConfigurationItem {
65
- bytes ConfigurationItem = 1 ;
66
- repeated ConfigurationSignature Signatures = 2 ;
61
+ message ConfigValueSchema {}
62
+
63
+ message ConfigPolicySchema {}
64
+
65
+ // Config represents the config for a particular channel
66
+ message Config {
67
+ ChannelHeader header = 1 ;
68
+ ConfigGroup channel = 2 ;
69
+ }
70
+
71
+ message ConfigUpdateEnvelope {
72
+ bytes config_update = 1 ; // A marshaled ConfigUpdate structure
73
+ repeated ConfigSignature signatures = 2 ; // Signatures over the config_update
74
+ }
75
+
76
+ // ConfigUpdate is used to submit a subset of config and to have the orderer apply to Config
77
+ // it is always submitted inside a ConfigUpdateEnvelope which allows the addition of signatures
78
+ // resulting in a new total configuration. The update is applied as follows:
79
+ // 1. The versions from all of the elements in the read_set is verified against the versions in the existing config.
80
+ // If there is a mismatch in the read versions, then the config update fails and is rejected.
81
+ // 2. Any elements in the write_set with the same version as the read_set are ignored.
82
+ // 3. The corresponding mod_policy for every remaining element in the write_set is collected.
83
+ // 4. Each policy is checked against the signatures from the ConfigUpdateEnvelope, any failing to verify are rejected
84
+ // 5. The write_set is applied to the Config and the ConfigGroupSchema verifies that the updates were legal
85
+ message ConfigUpdate {
86
+ ChannelHeader header = 1 ; // Header scopes the update to a particular Channel
87
+ ConfigGroup read_set = 2 ; // ReadSet explicitly lists the portion of the config which was read, this should be sparse with only Version set
88
+ ConfigGroup write_set = 3 ; // WriteSet lists the portion of the config which was written, this should included updated Versions
89
+ }
90
+
91
+ // ConfigGroup is the hierarchical data structure for holding config
92
+ message ConfigGroup {
93
+ uint64 version = 1 ;
94
+ map <string ,ConfigGroup > groups = 2 ;
95
+ map <string ,ConfigValue > values = 3 ;
96
+ map <string ,ConfigPolicy > policies = 4 ;
97
+ string mod_policy = 5 ;
98
+ }
99
+
100
+ // ConfigValue represents an individual piece of config data
101
+ message ConfigValue {
102
+ uint64 version = 1 ;
103
+ bytes value = 2 ;
104
+ string mod_policy = 3 ;
67
105
}
68
106
69
- message ConfigurationItem {
70
- enum ConfigurationType {
71
- Policy = 0 ; // Implies that the Value is a marshaled Policy message, and may be referred to by Key as a ModificationPolicy
72
- Chain = 1 ; // Marshaled format for this type is yet to be determined
73
- Orderer = 2 ; // Marshaled format for this type is yet to be determined
74
- Peer = 3 ; // Marshaled format for this type is yet to be determined
75
- MSP = 4 ; // Marshaled MSPConfig proto
76
- }
77
- ConfigurationType Type = 1 ; // The type of configuration this is.
78
- uint64 LastModified = 2 ; // The Sequence number in the ConfigurationEnvelope this item was last modified
79
- string ModificationPolicy = 3 ; // What policy to check before allowing modification
80
- string Key = 4 ; // A unique ID, unique scoped by Type, to reference the value by
81
- bytes Value = 5 ; // The byte representation of this configuration, usually a marshaled message
107
+ message ConfigPolicy {
108
+ uint64 version = 1 ;
109
+ Policy policy = 2 ;
110
+ string mod_policy = 3 ;
82
111
}
83
112
84
- message ConfigurationSignature {
85
- bytes signatureHeader = 1 ; // A marshaled SignatureHeader
86
- bytes signature = 2 ; // Signature over the concatenation of configurationItem bytes and signatureHeader bytes
113
+ message ConfigSignature {
114
+ bytes signature_header = 1 ; // A marshaled SignatureHeader
115
+ bytes signature = 2 ; // Signature over the concatenation signatureHeader bytes and config bytes
87
116
}
0 commit comments