Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FABCN-407] Update protos (#154) #157

Merged
merged 1 commit into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions libraries/fabric-shim/protos/common/collection.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ import "common/policies.proto";
// messages; the extra struct is required because repeated oneof is
// forbidden by the protobuf syntax
message CollectionConfigPackage {
option deprecated = true;
repeated CollectionConfig config = 1;
}

// CollectionConfig defines the configuration of a collection object;
// it currently contains a single, static type.
// Dynamic collections are deferred.
message CollectionConfig {
option deprecated = true;
oneof payload {
StaticCollectionConfig static_collection_config = 1;
}
Expand All @@ -33,6 +35,7 @@ message CollectionConfig {
// known at chaincode instantiation time, and that cannot be changed.
// Dynamic collections are deferred.
message StaticCollectionConfig {
option deprecated = true;
// the name of the collection inside the denoted chaincode
string name = 1;
// a reference to a policy residing / managed in the config block
Expand All @@ -59,6 +62,9 @@ message StaticCollectionConfig {
// write the data (if set to false, for example if you want to implement more granular
// access logic in the chaincode)
bool member_only_write = 7;
// a reference to a policy residing / managed in the config block
// to define the endorsement policy for this collection
ApplicationPolicy endorsement_policy= 8;
}


Expand All @@ -67,6 +73,7 @@ message StaticCollectionConfig {
// more general Policy. Instead of containing the actual policy, the
// configuration may in the future contain a string reference to a policy.
message CollectionPolicyConfig {
option deprecated = true;
oneof payload {
// Initially, only a signature policy is supported.
SignaturePolicyEnvelope signature_policy = 1;
Expand All @@ -76,13 +83,3 @@ message CollectionPolicyConfig {
// string reference = 2;
}
}


// CollectionCriteria defines an element of a private data that corresponds
// to a certain transaction and collection
message CollectionCriteria {
string channel = 1;
string tx_id = 2;
string collection = 3;
string namespace = 4;
}
14 changes: 7 additions & 7 deletions libraries/fabric-shim/protos/common/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ enum HeaderType {

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

// LastConfig is the encoded value for the Metadata message which is encoded in the LAST_CONFIGURATION block metadata index
Expand Down
10 changes: 0 additions & 10 deletions libraries/fabric-shim/protos/common/configtx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ message ConfigEnvelope {
// Note that CONFIG_UPDATE has a Payload.Data of a Marshaled ConfigUpdate
}

message ConfigGroupSchema {
map<string, ConfigGroupSchema> groups = 1;
map<string, ConfigValueSchema> values = 2;
map<string, ConfigPolicySchema> policies = 3;
}

message ConfigValueSchema {}

message ConfigPolicySchema {}

// Config represents the config for a particular channel
message Config {
// Prevent removed tag re-use
Expand Down
17 changes: 17 additions & 0 deletions libraries/fabric-shim/protos/common/policies.proto
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,20 @@ message ImplicitMetaPolicy {
string sub_policy = 1;
Rule rule = 2;
}

// ApplicationPolicy captures the diffenrent policy types that
// are set and evaluted at the application level.
message ApplicationPolicy {
option deprecated = true;
oneof Type {
// SignaturePolicy type is used if the policy is specified as
// a combination (using threshold gates) of signatures from MSP
// principals
SignaturePolicyEnvelope signature_policy = 1;

// ChannelConfigPolicyReference is used when the policy is
// specified as a string that references a policy defined in
// the configuration of the channel
string channel_config_policy_reference = 2;
}
}
2 changes: 2 additions & 0 deletions libraries/fabric-shim/protos/discovery/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ message ChaincodeInterest {
message ChaincodeCall {
string name = 1;
repeated string collection_names = 2;
bool no_private_reads = 3; // Indicates we do not need to read from private data
bool no_public_writes = 4; // Indicates we do not need to write to the chaincode namespace
}

// ChaincodeQueryResult contains EndorsementDescriptors for
Expand Down
5 changes: 3 additions & 2 deletions libraries/fabric-shim/protos/gossip/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ option java_package = "org.hyperledger.fabric.protos.gossip";

package gossip;

import "common/collection.proto";
import "peer/collection.proto";

// Gossip
service Gossip {
Expand Down Expand Up @@ -175,6 +175,7 @@ message ConnEstablish {
bytes pki_id = 1;
bytes identity = 2;
bytes tls_cert_hash = 3;
bool probe = 4;
}

// PeerIdentity defines the identity of the peer
Expand Down Expand Up @@ -257,7 +258,7 @@ message PrivatePayload {
string tx_id = 3;
bytes private_rwset = 4;
uint64 private_sim_height = 5;
common.CollectionConfigPackage collection_configs = 6;
protos.CollectionConfigPackage collection_configs = 6;
}

// Membership messages
Expand Down
6 changes: 6 additions & 0 deletions libraries/fabric-shim/protos/peer/chaincode_shim.proto
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,9 @@ message StateMetadataResult {
service ChaincodeSupport {
rpc Register(stream ChaincodeMessage) returns (stream ChaincodeMessage);
}

// Chaincode as a server - peer establishes a connection to the chaincode as a client
// Currently only supports a stream connection.
service Chaincode {
rpc Connect(stream ChaincodeMessage) returns (stream ChaincodeMessage);
}
82 changes: 82 additions & 0 deletions libraries/fabric-shim/protos/peer/collection.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Copyright the Hyperledger Fabric contributors. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

syntax = "proto3";

option go_package = "github.com/hyperledger/fabric-protos-go/peer";
option java_package = "org.hyperledger.fabric.protos.peer";

package protos;

import "common/policies.proto";
import "peer/policy.proto";

// CollectionConfigPackage represents an array of CollectionConfig
// messages; the extra struct is required because repeated oneof is
// forbidden by the protobuf syntax
message CollectionConfigPackage {
repeated CollectionConfig config = 1;
}

// CollectionConfig defines the configuration of a collection object;
// it currently contains a single, static type.
// Dynamic collections are deferred.
message CollectionConfig {
oneof payload {
StaticCollectionConfig static_collection_config = 1;
}
}


// StaticCollectionConfig constitutes the configuration parameters of a
// static collection object. Static collections are collections that are
// known at chaincode instantiation time, and that cannot be changed.
// Dynamic collections are deferred.
message StaticCollectionConfig {
// the name of the collection inside the denoted chaincode
string name = 1;
// a reference to a policy residing / managed in the config block
// to define which orgs have access to this collection’s private data
CollectionPolicyConfig member_orgs_policy = 2;
// The minimum number of peers private data will be sent to upon
// endorsement. The endorsement would fail if dissemination to at least
// this number of peers is not achieved.
int32 required_peer_count = 3;
// The maximum number of peers that private data will be sent to
// upon endorsement. This number has to be bigger than required_peer_count.
int32 maximum_peer_count = 4;
// The number of blocks after which the collection data expires.
// For instance if the value is set to 10, a key last modified by block number 100
// will be purged at block number 111. A zero value is treated same as MaxUint64
uint64 block_to_live = 5;
// The member only read access denotes whether only collection member clients
// can read the private data (if set to true), or even non members can
// read the data (if set to false, for example if you want to implement more granular
// access logic in the chaincode)
bool member_only_read = 6;
// The member only write access denotes whether only collection member clients
// can write the private data (if set to true), or even non members can
// write the data (if set to false, for example if you want to implement more granular
// access logic in the chaincode)
bool member_only_write = 7;
// a reference to a policy residing / managed in the config block
// to define the endorsement policy for this collection
ApplicationPolicy endorsement_policy= 8;
}


// Collection policy configuration. Initially, the configuration can only
// contain a SignaturePolicy. In the future, the SignaturePolicy may be a
// more general Policy. Instead of containing the actual policy, the
// configuration may in the future contain a string reference to a policy.
message CollectionPolicyConfig {
oneof payload {
// Initially, only a signature policy is supported.
common.SignaturePolicyEnvelope signature_policy = 1;
// Later, the SignaturePolicy will be replaced by a Policy.
// Policy policy = 1;
// A reference to a Policy is planned to be added later.
// string reference = 2;
}
}
32 changes: 26 additions & 6 deletions libraries/fabric-shim/protos/peer/lifecycle/lifecycle.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ option go_package = "github.com/hyperledger/fabric-protos-go/peer/lifecycle";

package lifecycle;

import "common/collection.proto";
import "peer/collection.proto";

// InstallChaincodeArgs is the message used as the argument to
// '_lifecycle.InstallChaincode'.
Expand Down Expand Up @@ -97,7 +97,7 @@ message ApproveChaincodeDefinitionForMyOrgArgs {
string endorsement_plugin = 4;
string validation_plugin = 5;
bytes validation_parameter = 6;
common.CollectionConfigPackage collections = 7;
protos.CollectionConfigPackage collections = 7;
bool init_required = 8;
ChaincodeSource source = 9;
}
Expand Down Expand Up @@ -130,7 +130,7 @@ message CommitChaincodeDefinitionArgs {
string endorsement_plugin = 4;
string validation_plugin = 5;
bytes validation_parameter = 6;
common.CollectionConfigPackage collections = 7;
protos.CollectionConfigPackage collections = 7;
bool init_required = 8;
}

Expand All @@ -149,7 +149,7 @@ message CheckCommitReadinessArgs {
string endorsement_plugin = 4;
string validation_plugin = 5;
bytes validation_parameter = 6;
common.CollectionConfigPackage collections = 7;
protos.CollectionConfigPackage collections = 7;
bool init_required = 8;
}

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

// QueryApprovedChaincodeDefinitionArgs is the message used as arguments to
// `_lifecycle.QueryApprovedChaincodeDefinition`.
message QueryApprovedChaincodeDefinitionArgs {
string name = 1;
int64 sequence = 2;
}

// QueryApprovedChaincodeDefinitionResult is the message returned by
// `_lifecycle.QueryApprovedChaincodeDefinition`.
message QueryApprovedChaincodeDefinitionResult {
int64 sequence = 1;
string version = 2;
string endorsement_plugin = 3;
string validation_plugin = 4;
bytes validation_parameter = 5;
protos.CollectionConfigPackage collections = 6;
bool init_required = 7;
ChaincodeSource source = 8;
}

// QueryChaincodeDefinitionArgs is the message used as arguments to
// `_lifecycle.QueryChaincodeDefinition`.
message QueryChaincodeDefinitionArgs {
Expand All @@ -175,7 +195,7 @@ message QueryChaincodeDefinitionResult {
string endorsement_plugin = 3;
string validation_plugin = 4;
bytes validation_parameter = 5;
common.CollectionConfigPackage collections = 6;
protos.CollectionConfigPackage collections = 6;
bool init_required = 7;
map<string,bool> approvals = 8;
}
Expand All @@ -194,7 +214,7 @@ message QueryChaincodeDefinitionsResult {
string endorsement_plugin = 4;
string validation_plugin = 5;
bytes validation_parameter = 6;
common.CollectionConfigPackage collections = 7;
protos.CollectionConfigPackage collections = 7;
bool init_required = 8;
}
repeated ChaincodeDefinition chaincode_definitions = 1;
Expand Down
14 changes: 0 additions & 14 deletions libraries/fabric-shim/protos/peer/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,6 @@ package protos;
import "peer/proposal_response.proto";
import "common/common.proto";

// This message is necessary to facilitate the verification of the signature
// (in the signature field) over the bytes of the transaction (in the
// transactionBytes field).
message SignedTransaction {
// The bytes of the Transaction. NDD
bytes transaction_bytes = 1;

// Signature of the transactionBytes The public key of the signature is in
// the header field of TransactionAction There might be multiple
// TransactionAction, so multiple headers, but there should be same
// transactor identity (cert) in all headers
bytes signature = 2;
}

// ProcessedTransaction wraps an Envelope that includes a transaction along with an indication
// of whether the transaction was validated or invalidated by committing peer.
// The use case is that GetTransactionByID API needs to retrieve the transaction Envelope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ option go_package = "github.com/hyperledger/fabric-protos-go/transientstore";
option java_package = "org.hyperledger.fabric.protos.transientstore";

import "ledger/rwset/rwset.proto";
import "common/collection.proto";
import "peer/collection.proto";

// TxPvtReadWriteSetWithConfigInfo encapsulates the transaction's private
// read-write set and additional information about the configurations such as
// the latest collection config when the transaction is simulated
message TxPvtReadWriteSetWithConfigInfo {
uint64 endorsed_at = 1;
rwset.TxPvtReadWriteSet pvt_rwset = 2;
map<string, common.CollectionConfigPackage> collection_configs = 3;
map<string, protos.CollectionConfigPackage> collection_configs = 3;
}