Skip to content

Commit 5acea60

Browse files
authored
[FABCN-407] Update protos (#154)
To prepare for the implementation of chaincode gRPC server, this patch updates protobuf definitions to the latest ones. Signed-off-by: Taku Shimosawa <taku.shimosawa@hal.hitachi.com>
1 parent 2fcf3eb commit 5acea60

11 files changed

Lines changed: 152 additions & 51 deletions

File tree

libraries/fabric-shim/protos/common/collection.proto

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ import "common/policies.proto";
1515
// messages; the extra struct is required because repeated oneof is
1616
// forbidden by the protobuf syntax
1717
message CollectionConfigPackage {
18+
option deprecated = true;
1819
repeated CollectionConfig config = 1;
1920
}
2021

2122
// CollectionConfig defines the configuration of a collection object;
2223
// it currently contains a single, static type.
2324
// Dynamic collections are deferred.
2425
message CollectionConfig {
26+
option deprecated = true;
2527
oneof payload {
2628
StaticCollectionConfig static_collection_config = 1;
2729
}
@@ -33,6 +35,7 @@ message CollectionConfig {
3335
// known at chaincode instantiation time, and that cannot be changed.
3436
// Dynamic collections are deferred.
3537
message StaticCollectionConfig {
38+
option deprecated = true;
3639
// the name of the collection inside the denoted chaincode
3740
string name = 1;
3841
// a reference to a policy residing / managed in the config block
@@ -59,6 +62,9 @@ message StaticCollectionConfig {
5962
// write the data (if set to false, for example if you want to implement more granular
6063
// access logic in the chaincode)
6164
bool member_only_write = 7;
65+
// a reference to a policy residing / managed in the config block
66+
// to define the endorsement policy for this collection
67+
ApplicationPolicy endorsement_policy= 8;
6268
}
6369

6470

@@ -67,6 +73,7 @@ message StaticCollectionConfig {
6773
// more general Policy. Instead of containing the actual policy, the
6874
// configuration may in the future contain a string reference to a policy.
6975
message CollectionPolicyConfig {
76+
option deprecated = true;
7077
oneof payload {
7178
// Initially, only a signature policy is supported.
7279
SignaturePolicyEnvelope signature_policy = 1;
@@ -76,13 +83,3 @@ message CollectionPolicyConfig {
7683
// string reference = 2;
7784
}
7885
}
79-
80-
81-
// CollectionCriteria defines an element of a private data that corresponds
82-
// to a certain transaction and collection
83-
message CollectionCriteria {
84-
string channel = 1;
85-
string tx_id = 2;
86-
string collection = 3;
87-
string namespace = 4;
88-
}

libraries/fabric-shim/protos/common/common.proto

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ enum HeaderType {
4040

4141
// This enum enlists indexes of the block metadata array
4242
enum BlockMetadataIndex {
43-
SIGNATURES = 0; // Block metadata array position for block signatures
44-
LAST_CONFIG = 1; // Block metadata array position to store last configuration block sequence number
45-
TRANSACTIONS_FILTER = 2; // Block metadata array position to store serialized bit array filter of invalid transactions
46-
ORDERER = 3 [deprecated=true]; /* Block metadata array position to store operational metadata for orderers
47-
e.g. For Kafka, this is where we store the last offset written to the local ledger */
48-
COMMIT_HASH = 4; /* Block metadata array position to store the hash of TRANSACTIONS_FILTER, State Updates,
49-
and the COMMIT_HASH of the previous block */
43+
SIGNATURES = 0; // Block metadata array position for block signatures
44+
LAST_CONFIG = 1 [deprecated=true]; // Block metadata array position to store last configuration block sequence number
45+
TRANSACTIONS_FILTER = 2; // Block metadata array position to store serialized bit array filter of invalid transactions
46+
ORDERER = 3 [deprecated=true]; /* Block metadata array position to store operational metadata for orderers
47+
e.g. For Kafka, this is where we store the last offset written to the local ledger */
48+
COMMIT_HASH = 4; /* Block metadata array position to store the hash of TRANSACTIONS_FILTER, State Updates,
49+
and the COMMIT_HASH of the previous block */
5050
}
5151

5252
// LastConfig is the encoded value for the Metadata message which is encoded in the LAST_CONFIGURATION block metadata index

libraries/fabric-shim/protos/common/configtx.proto

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ message ConfigEnvelope {
3939
// Note that CONFIG_UPDATE has a Payload.Data of a Marshaled ConfigUpdate
4040
}
4141

42-
message ConfigGroupSchema {
43-
map<string, ConfigGroupSchema> groups = 1;
44-
map<string, ConfigValueSchema> values = 2;
45-
map<string, ConfigPolicySchema> policies = 3;
46-
}
47-
48-
message ConfigValueSchema {}
49-
50-
message ConfigPolicySchema {}
51-
5242
// Config represents the config for a particular channel
5343
message Config {
5444
// Prevent removed tag re-use

libraries/fabric-shim/protos/common/policies.proto

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,20 @@ message ImplicitMetaPolicy {
6565
string sub_policy = 1;
6666
Rule rule = 2;
6767
}
68+
69+
// ApplicationPolicy captures the diffenrent policy types that
70+
// are set and evaluted at the application level.
71+
message ApplicationPolicy {
72+
option deprecated = true;
73+
oneof Type {
74+
// SignaturePolicy type is used if the policy is specified as
75+
// a combination (using threshold gates) of signatures from MSP
76+
// principals
77+
SignaturePolicyEnvelope signature_policy = 1;
78+
79+
// ChannelConfigPolicyReference is used when the policy is
80+
// specified as a string that references a policy defined in
81+
// the configuration of the channel
82+
string channel_config_policy_reference = 2;
83+
}
84+
}

libraries/fabric-shim/protos/discovery/protocol.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ message ChaincodeInterest {
156156
message ChaincodeCall {
157157
string name = 1;
158158
repeated string collection_names = 2;
159+
bool no_private_reads = 3; // Indicates we do not need to read from private data
160+
bool no_public_writes = 4; // Indicates we do not need to write to the chaincode namespace
159161
}
160162

161163
// ChaincodeQueryResult contains EndorsementDescriptors for

libraries/fabric-shim/protos/gossip/message.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ option java_package = "org.hyperledger.fabric.protos.gossip";
99

1010
package gossip;
1111

12-
import "common/collection.proto";
12+
import "peer/collection.proto";
1313

1414
// Gossip
1515
service Gossip {
@@ -175,6 +175,7 @@ message ConnEstablish {
175175
bytes pki_id = 1;
176176
bytes identity = 2;
177177
bytes tls_cert_hash = 3;
178+
bool probe = 4;
178179
}
179180

180181
// PeerIdentity defines the identity of the peer
@@ -257,7 +258,7 @@ message PrivatePayload {
257258
string tx_id = 3;
258259
bytes private_rwset = 4;
259260
uint64 private_sim_height = 5;
260-
common.CollectionConfigPackage collection_configs = 6;
261+
protos.CollectionConfigPackage collection_configs = 6;
261262
}
262263

263264
// Membership messages

libraries/fabric-shim/protos/peer/chaincode_shim.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,9 @@ message StateMetadataResult {
177177
service ChaincodeSupport {
178178
rpc Register(stream ChaincodeMessage) returns (stream ChaincodeMessage);
179179
}
180+
181+
// Chaincode as a server - peer establishes a connection to the chaincode as a client
182+
// Currently only supports a stream connection.
183+
service Chaincode {
184+
rpc Connect(stream ChaincodeMessage) returns (stream ChaincodeMessage);
185+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
// Copyright the Hyperledger Fabric contributors. All rights reserved.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
syntax = "proto3";
6+
7+
option go_package = "github.com/hyperledger/fabric-protos-go/peer";
8+
option java_package = "org.hyperledger.fabric.protos.peer";
9+
10+
package protos;
11+
12+
import "common/policies.proto";
13+
import "peer/policy.proto";
14+
15+
// CollectionConfigPackage represents an array of CollectionConfig
16+
// messages; the extra struct is required because repeated oneof is
17+
// forbidden by the protobuf syntax
18+
message CollectionConfigPackage {
19+
repeated CollectionConfig config = 1;
20+
}
21+
22+
// CollectionConfig defines the configuration of a collection object;
23+
// it currently contains a single, static type.
24+
// Dynamic collections are deferred.
25+
message CollectionConfig {
26+
oneof payload {
27+
StaticCollectionConfig static_collection_config = 1;
28+
}
29+
}
30+
31+
32+
// StaticCollectionConfig constitutes the configuration parameters of a
33+
// static collection object. Static collections are collections that are
34+
// known at chaincode instantiation time, and that cannot be changed.
35+
// Dynamic collections are deferred.
36+
message StaticCollectionConfig {
37+
// the name of the collection inside the denoted chaincode
38+
string name = 1;
39+
// a reference to a policy residing / managed in the config block
40+
// to define which orgs have access to this collection’s private data
41+
CollectionPolicyConfig member_orgs_policy = 2;
42+
// The minimum number of peers private data will be sent to upon
43+
// endorsement. The endorsement would fail if dissemination to at least
44+
// this number of peers is not achieved.
45+
int32 required_peer_count = 3;
46+
// The maximum number of peers that private data will be sent to
47+
// upon endorsement. This number has to be bigger than required_peer_count.
48+
int32 maximum_peer_count = 4;
49+
// The number of blocks after which the collection data expires.
50+
// For instance if the value is set to 10, a key last modified by block number 100
51+
// will be purged at block number 111. A zero value is treated same as MaxUint64
52+
uint64 block_to_live = 5;
53+
// The member only read access denotes whether only collection member clients
54+
// can read the private data (if set to true), or even non members can
55+
// read the data (if set to false, for example if you want to implement more granular
56+
// access logic in the chaincode)
57+
bool member_only_read = 6;
58+
// The member only write access denotes whether only collection member clients
59+
// can write the private data (if set to true), or even non members can
60+
// write the data (if set to false, for example if you want to implement more granular
61+
// access logic in the chaincode)
62+
bool member_only_write = 7;
63+
// a reference to a policy residing / managed in the config block
64+
// to define the endorsement policy for this collection
65+
ApplicationPolicy endorsement_policy= 8;
66+
}
67+
68+
69+
// Collection policy configuration. Initially, the configuration can only
70+
// contain a SignaturePolicy. In the future, the SignaturePolicy may be a
71+
// more general Policy. Instead of containing the actual policy, the
72+
// configuration may in the future contain a string reference to a policy.
73+
message CollectionPolicyConfig {
74+
oneof payload {
75+
// Initially, only a signature policy is supported.
76+
common.SignaturePolicyEnvelope signature_policy = 1;
77+
// Later, the SignaturePolicy will be replaced by a Policy.
78+
// Policy policy = 1;
79+
// A reference to a Policy is planned to be added later.
80+
// string reference = 2;
81+
}
82+
}

libraries/fabric-shim/protos/peer/lifecycle/lifecycle.proto

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ option go_package = "github.com/hyperledger/fabric-protos-go/peer/lifecycle";
99

1010
package lifecycle;
1111

12-
import "common/collection.proto";
12+
import "peer/collection.proto";
1313

1414
// InstallChaincodeArgs is the message used as the argument to
1515
// '_lifecycle.InstallChaincode'.
@@ -97,7 +97,7 @@ message ApproveChaincodeDefinitionForMyOrgArgs {
9797
string endorsement_plugin = 4;
9898
string validation_plugin = 5;
9999
bytes validation_parameter = 6;
100-
common.CollectionConfigPackage collections = 7;
100+
protos.CollectionConfigPackage collections = 7;
101101
bool init_required = 8;
102102
ChaincodeSource source = 9;
103103
}
@@ -130,7 +130,7 @@ message CommitChaincodeDefinitionArgs {
130130
string endorsement_plugin = 4;
131131
string validation_plugin = 5;
132132
bytes validation_parameter = 6;
133-
common.CollectionConfigPackage collections = 7;
133+
protos.CollectionConfigPackage collections = 7;
134134
bool init_required = 8;
135135
}
136136

@@ -149,7 +149,7 @@ message CheckCommitReadinessArgs {
149149
string endorsement_plugin = 4;
150150
string validation_plugin = 5;
151151
bytes validation_parameter = 6;
152-
common.CollectionConfigPackage collections = 7;
152+
protos.CollectionConfigPackage collections = 7;
153153
bool init_required = 8;
154154
}
155155

@@ -161,6 +161,26 @@ message CheckCommitReadinessResult{
161161
map<string, bool> approvals = 1;
162162
}
163163

164+
// QueryApprovedChaincodeDefinitionArgs is the message used as arguments to
165+
// `_lifecycle.QueryApprovedChaincodeDefinition`.
166+
message QueryApprovedChaincodeDefinitionArgs {
167+
string name = 1;
168+
int64 sequence = 2;
169+
}
170+
171+
// QueryApprovedChaincodeDefinitionResult is the message returned by
172+
// `_lifecycle.QueryApprovedChaincodeDefinition`.
173+
message QueryApprovedChaincodeDefinitionResult {
174+
int64 sequence = 1;
175+
string version = 2;
176+
string endorsement_plugin = 3;
177+
string validation_plugin = 4;
178+
bytes validation_parameter = 5;
179+
protos.CollectionConfigPackage collections = 6;
180+
bool init_required = 7;
181+
ChaincodeSource source = 8;
182+
}
183+
164184
// QueryChaincodeDefinitionArgs is the message used as arguments to
165185
// `_lifecycle.QueryChaincodeDefinition`.
166186
message QueryChaincodeDefinitionArgs {
@@ -175,7 +195,7 @@ message QueryChaincodeDefinitionResult {
175195
string endorsement_plugin = 3;
176196
string validation_plugin = 4;
177197
bytes validation_parameter = 5;
178-
common.CollectionConfigPackage collections = 6;
198+
protos.CollectionConfigPackage collections = 6;
179199
bool init_required = 7;
180200
map<string,bool> approvals = 8;
181201
}
@@ -194,7 +214,7 @@ message QueryChaincodeDefinitionsResult {
194214
string endorsement_plugin = 4;
195215
string validation_plugin = 5;
196216
bytes validation_parameter = 6;
197-
common.CollectionConfigPackage collections = 7;
217+
protos.CollectionConfigPackage collections = 7;
198218
bool init_required = 8;
199219
}
200220
repeated ChaincodeDefinition chaincode_definitions = 1;

libraries/fabric-shim/protos/peer/transaction.proto

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,6 @@ package protos;
1313
import "peer/proposal_response.proto";
1414
import "common/common.proto";
1515

16-
// This message is necessary to facilitate the verification of the signature
17-
// (in the signature field) over the bytes of the transaction (in the
18-
// transactionBytes field).
19-
message SignedTransaction {
20-
// The bytes of the Transaction. NDD
21-
bytes transaction_bytes = 1;
22-
23-
// Signature of the transactionBytes The public key of the signature is in
24-
// the header field of TransactionAction There might be multiple
25-
// TransactionAction, so multiple headers, but there should be same
26-
// transactor identity (cert) in all headers
27-
bytes signature = 2;
28-
}
29-
3016
// ProcessedTransaction wraps an Envelope that includes a transaction along with an indication
3117
// of whether the transaction was validated or invalidated by committing peer.
3218
// The use case is that GetTransactionByID API needs to retrieve the transaction Envelope

0 commit comments

Comments
 (0)