Skip to content

Commit

Permalink
Update hfc protos to 2.x version from https://github.com/hyperledger/…
Browse files Browse the repository at this point in the history
…fabric-protos. (#120)

Signed-off-by: Kelvin Moutet <kelvin.moutet@owkin.com>
  • Loading branch information
Kelvin-M committed Oct 27, 2020
1 parent c0f3e4f commit 91e8f7d
Show file tree
Hide file tree
Showing 127 changed files with 8,576 additions and 4,566 deletions.
9 changes: 6 additions & 3 deletions hfc/fabric/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
CC_INVOKE, CC_QUERY, CC_UPGRADE
from hfc.protos.common import common_pb2, configtx_pb2, ledger_pb2
from hfc.protos.peer import query_pb2
from hfc.protos.peer.chaincode_pb2 import ChaincodeData
from hfc.protos.peer.chaincode_pb2 import ChaincodeData, CDSData
from hfc.fabric.block_decoder import BlockDecoder, \
decode_fabric_peers_info, decode_fabric_MSP_config, \
decode_fabric_endpoints, decode_proposal_response_payload, \
Expand Down Expand Up @@ -1376,6 +1376,9 @@ async def chaincode_instantiate(self, requestor, channel_name, peers,
payload = res['extension']['response']['payload']
ccd.ParseFromString(payload)

cdsData = CDSData()
cdsData.ParseFromString(ccd.data)

policy = decode_signature_policy_envelope(
ccd.policy.SerializeToString())
instantiation_policy = decode_signature_policy_envelope(
Expand All @@ -1387,8 +1390,8 @@ async def chaincode_instantiate(self, requestor, channel_name, peers,
'vscc': ccd.vscc,
'policy': policy,
'data': {
'hash': ccd.data.hash,
'metadatahash': ccd.data.metadatahash,
'hash': cdsData.hash,
'metadatahash': cdsData.metadatahash,
},
'id': ccd.id,
'instantiation_policy': instantiation_policy,
Expand Down
36 changes: 18 additions & 18 deletions hfc/protos/common/collection.proto
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// Copyright the Hyperledger Fabric contributors. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0

syntax = "proto3";

import "hfc/protos/common/policies.proto";

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

package common;

import "hfc/protos/common/policies.proto";

// CollectionConfigPackage represents an array of CollectionConfig
// 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 @@ -35,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 @@ -56,6 +57,14 @@ message StaticCollectionConfig {
// 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;
}


Expand All @@ -64,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 @@ -73,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;
}

0 comments on commit 91e8f7d

Please sign in to comment.