-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-16473] Copy proto files into source control
This is a temporary fix to get the builds working again. After we're back to a working state, I plan on updating the code to use protobufjs 6, so that we can just pull the latest protos in again. The patch-package hack Gari put into the SDK won't work here, as we'd need to patch the code on the users system. The ideal solution is to move the fabric-protos module out of fabric-sdk-node and integrate it into the new fabric-protos repository, but apparently any additional updates to that CI is blocked for now: "we are not building more into github/azure until after 2.0" I don't really want to add a chaincode -> SDK dependency as that is bound to cause us issues come release time. Signed-off-by: Simon Stone <sstone1@uk.ibm.com> Change-Id: I7c868a9f1e31decb93e5fd89819638b84392b965
- Loading branch information
Simon Stone
committed
Sep 2, 2019
1 parent
ef4c7aa
commit e71eedd
Showing
44 changed files
with
4,096 additions
and
809 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
Copyright IBM Corp. All Rights Reserved. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
syntax = "proto3"; | ||
|
||
import "common/policies.proto"; | ||
|
||
option go_package = "github.com/hyperledger/fabric/protos/common"; | ||
option java_package = "org.hyperledger.fabric.protos.common"; | ||
|
||
package common; | ||
|
||
// 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; | ||
} | ||
|
||
|
||
// 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. | ||
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; | ||
} | ||
} | ||
|
||
|
||
// 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
/* | ||
Copyright IBM Corp. 2016 All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
syntax = "proto3"; | ||
|
||
import "google/protobuf/timestamp.proto"; | ||
|
||
option go_package = "github.com/hyperledger/fabric/protos/common"; | ||
option java_package = "org.hyperledger.fabric.protos.common"; | ||
|
||
package common; | ||
|
||
// These status codes are intended to resemble selected HTTP status codes | ||
enum Status { | ||
UNKNOWN = 0; | ||
SUCCESS = 200; | ||
BAD_REQUEST = 400; | ||
FORBIDDEN = 403; | ||
NOT_FOUND = 404; | ||
REQUEST_ENTITY_TOO_LARGE = 413; | ||
INTERNAL_SERVER_ERROR = 500; | ||
NOT_IMPLEMENTED = 501; | ||
SERVICE_UNAVAILABLE = 503; | ||
} | ||
|
||
enum HeaderType { | ||
// Prevent removed tag re-use | ||
// Uncomment after fabric-baseimage moves to 3.5.1 | ||
// reserved 7; | ||
// reserved "PEER_RESOURCE_UPDATE"; | ||
|
||
MESSAGE = 0; // Used for messages which are signed but opaque | ||
CONFIG = 1; // Used for messages which express the channel config | ||
CONFIG_UPDATE = 2; // Used for transactions which update the channel config | ||
ENDORSER_TRANSACTION = 3; // Used by the SDK to submit endorser based transactions | ||
ORDERER_TRANSACTION = 4; // Used internally by the orderer for management | ||
DELIVER_SEEK_INFO = 5; // Used as the type for Envelope messages submitted to instruct the Deliver API to seek | ||
CHAINCODE_PACKAGE = 6; // Used for packaging chaincode artifacts for install | ||
PEER_ADMIN_OPERATION = 8; // Used for invoking an administrative operation on a peer | ||
TOKEN_TRANSACTION = 9; // Used to denote transactions that invoke token management operations | ||
} | ||
|
||
// 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; /* 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 | ||
message LastConfig { | ||
uint64 index = 1; | ||
} | ||
|
||
// Metadata is a common structure to be used to encode block metadata | ||
message Metadata { | ||
bytes value = 1; | ||
repeated MetadataSignature signatures = 2; | ||
} | ||
|
||
message MetadataSignature { | ||
bytes signature_header = 1; // An encoded SignatureHeader | ||
bytes signature = 2; // The signature over the concatenation of the Metadata value bytes, signatureHeader, and block header | ||
} | ||
|
||
message Header { | ||
bytes channel_header = 1; | ||
bytes signature_header = 2; | ||
} | ||
|
||
// Header is a generic replay prevention and identity message to include in a signed payload | ||
message ChannelHeader { | ||
int32 type = 1; // Header types 0-10000 are reserved and defined by HeaderType | ||
|
||
// Version indicates message protocol version | ||
int32 version = 2; | ||
|
||
// Timestamp is the local time when the message was created | ||
// by the sender | ||
google.protobuf.Timestamp timestamp = 3; | ||
|
||
// Identifier of the channel this message is bound for | ||
string channel_id = 4; | ||
|
||
// An unique identifier that is used end-to-end. | ||
// - set by higher layers such as end user or SDK | ||
// - passed to the endorser (which will check for uniqueness) | ||
// - as the header is passed along unchanged, it will be | ||
// be retrieved by the committer (uniqueness check here as well) | ||
// - to be stored in the ledger | ||
string tx_id = 5; | ||
|
||
// The epoch in which this header was generated, where epoch is defined based on block height | ||
// Epoch in which the response has been generated. This field identifies a | ||
// logical window of time. A proposal response is accepted by a peer only if | ||
// two conditions hold: | ||
// 1. the epoch specified in the message is the current epoch | ||
// 2. this message has been only seen once during this epoch (i.e. it hasn't | ||
// been replayed) | ||
uint64 epoch = 6; | ||
|
||
// Extension that may be attached based on the header type | ||
bytes extension = 7; | ||
|
||
// If mutual TLS is employed, this represents | ||
// the hash of the client's TLS certificate | ||
bytes tls_cert_hash = 8; | ||
} | ||
|
||
message SignatureHeader { | ||
// Creator of the message, a marshaled msp.SerializedIdentity | ||
bytes creator = 1; | ||
|
||
// Arbitrary number that may only be used once. Can be used to detect replay attacks. | ||
bytes nonce = 2; | ||
} | ||
|
||
// Payload is the message contents (and header to allow for signing) | ||
message Payload { | ||
|
||
// Header is included to provide identity and prevent replay | ||
Header header = 1; | ||
|
||
// Data, the encoding of which is defined by the type in the header | ||
bytes data = 2; | ||
} | ||
|
||
// Envelope wraps a Payload with a signature so that the message may be authenticated | ||
message Envelope { | ||
// A marshaled Payload | ||
bytes payload = 1; | ||
|
||
// A signature by the creator specified in the Payload header | ||
bytes signature = 2; | ||
} | ||
|
||
// This is finalized block structure to be shared among the orderer and peer | ||
// Note that the BlockHeader chains to the previous BlockHeader, and the BlockData hash is embedded | ||
// in the BlockHeader. This makes it natural and obvious that the Data is included in the hash, but | ||
// the Metadata is not. | ||
message Block { | ||
BlockHeader header = 1; | ||
BlockData data = 2; | ||
BlockMetadata metadata = 3; | ||
} | ||
|
||
// BlockHeader is the element of the block which forms the block chain | ||
// The block header is hashed using the configured chain hashing algorithm | ||
// over the ASN.1 encoding of the BlockHeader | ||
message BlockHeader { | ||
uint64 number = 1; // The position in the blockchain | ||
bytes previous_hash = 2; // The hash of the previous block header | ||
bytes data_hash = 3; // The hash of the BlockData, by MerkleTree | ||
} | ||
|
||
message BlockData { | ||
repeated bytes data = 1; | ||
} | ||
|
||
message BlockMetadata { | ||
repeated bytes metadata = 1; | ||
} | ||
|
||
// OrdererBlockMetadata defines metadata that is set by the ordering service. | ||
message OrdererBlockMetadata { | ||
LastConfig last_config = 1; | ||
bytes consenter_metadata = 2; | ||
} |
Oops, something went wrong.