github.com/darrenli6/fabric-sdk-example@v0.0.0-20220109053535-94b13b56df8c/protos/common/configtx.proto (about)

     1  /*
     2  Copyright IBM Corp. 2017 All Rights Reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8                   http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  syntax = "proto3";
    18  
    19  import "common/common.proto";
    20  import "common/policies.proto";
    21  
    22  option go_package = "github.com/hyperledger/fabric/protos/common";
    23  option java_package = "org.hyperledger.fabric.protos.common";
    24  
    25  package common;
    26  
    27  // ConfigEnvelope is designed to contain _all_ configuration for a chain with no dependency
    28  // on previous configuration transactions.
    29  //
    30  // It is generated with the following scheme:
    31  //   1. Retrieve the existing configuration
    32  //   2. Note the config properties (ConfigValue, ConfigPolicy, ConfigGroup) to be modified
    33  //   3. Add any intermediate ConfigGroups to the ConfigUpdate.read_set (sparsely)
    34  //   4. Add any additional desired dependencies to ConfigUpdate.read_set (sparsely)
    35  //   5. Modify the config properties, incrementing each version by 1, set them in the ConfigUpdate.write_set
    36  //      Note: any element not modified but specified should already be in the read_set, so may be specified sparsely
    37  //   6. Create ConfigUpdate message and marshal it into ConfigUpdateEnvelope.update and encode the required signatures
    38  //     a) Each signature is of type ConfigSignature
    39  //     b) The ConfigSignature signature is over the concatenation of signature_header and the ConfigUpdate bytes (which includes a ChainHeader)
    40  //   5. Submit new Config for ordering in Envelope signed by submitter
    41  //     a) The Envelope Payload has data set to the marshaled ConfigEnvelope
    42  //     b) The Envelope Payload has a header of type Header.Type.CONFIG_UPDATE
    43  //
    44  // The configuration manager will verify:
    45  //   1. All items in the read_set exist at the read versions
    46  //   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
    47  //   3. The new configuration satisfies the ConfigSchema
    48  message ConfigEnvelope {
    49      Config config = 1;        // A marshaled Config structure
    50      Envelope last_update = 2; // The last CONFIG_UPDATE message which generated this current configuration
    51                                // Note that CONFIG_UPDATE has a Payload.Data of a Marshaled ConfigUpdate
    52  }
    53  
    54  message ConfigGroupSchema {
    55      map<string, ConfigGroupSchema> groups = 1;
    56      map<string, ConfigValueSchema> values = 2;
    57      map<string, ConfigPolicySchema> policies = 3;
    58  }
    59  
    60  message ConfigValueSchema {}
    61  
    62  message ConfigPolicySchema {}
    63  
    64  // Config represents the config for a particular channel
    65  message Config {
    66      uint64 sequence = 1;
    67      ConfigGroup channel_group = 2;
    68  }
    69  
    70  message ConfigUpdateEnvelope {
    71      bytes config_update = 1;                 // A marshaled ConfigUpdate structure
    72      repeated ConfigSignature signatures = 2; // Signatures over the config_update
    73  }
    74  
    75  // ConfigUpdate is used to submit a subset of config and to have the orderer apply to Config
    76  // it is always submitted inside a ConfigUpdateEnvelope which allows the addition of signatures
    77  // resulting in a new total configuration.  The update is applied as follows:
    78  // 1. The versions from all of the elements in the read_set is verified against the versions in the existing config.
    79  //    If there is a mismatch in the read versions, then the config update fails and is rejected.
    80  // 2. Any elements in the write_set with the same version as the read_set are ignored.
    81  // 3. The corresponding mod_policy for every remaining element in the write_set is collected.
    82  // 4. Each policy is checked against the signatures from the ConfigUpdateEnvelope, any failing to verify are rejected
    83  // 5. The write_set is applied to the Config and the ConfigGroupSchema verifies that the updates were legal
    84  message ConfigUpdate {
    85      string channel_id = 1;     // Which channel this config update is for
    86      ConfigGroup read_set = 2;  // ReadSet explicitly lists the portion of the config which was read, this should be sparse with only Version set
    87      ConfigGroup write_set = 3; // WriteSet lists the portion of the config which was written, this should included updated Versions
    88  }
    89  
    90  // ConfigGroup is the hierarchical data structure for holding config
    91  message ConfigGroup {
    92      uint64 version = 1;
    93      map<string,ConfigGroup> groups = 2;
    94      map<string,ConfigValue> values = 3;
    95      map<string,ConfigPolicy> policies = 4;
    96      string mod_policy = 5;
    97  }
    98  
    99  // ConfigValue represents an individual piece of config data
   100  message ConfigValue {
   101      uint64 version = 1;
   102      bytes value = 2;
   103      string mod_policy = 3;
   104  }
   105  
   106  message ConfigPolicy {
   107      uint64 version = 1;
   108      Policy policy = 2;
   109      string mod_policy = 3;
   110  }
   111  
   112  message ConfigSignature {
   113      bytes signature_header = 1; // A marshaled SignatureHeader
   114      bytes signature = 2;        // Signature over the concatenation signatureHeader bytes and config bytes
   115  }