Skip to content

Commit cdecb52

Browse files
author
Jason Yellick
committed
[FAB-2027] Proto style fixes
https://jira.hyperledger.org/browse/FAB-2027 Per https://jira.hyperledger.org/browse/FAB-2026 the proto style in fabric is inconsistent and violates accepted proto style guidelines. This CR makes the non-golang code invasive proto changes to conform with the style guide. In particular, protoc converts lower_underscore_separated to LowerUnderscoreSeparated which means that most of our existing fields can be normalized to the official proto style with no code changes. This does not fix fields which contained upper case abbreviations particularly fields ending in 'ID' like txID which must become tx_id and will be translated to TxId. This does not fix the enum fields which by proto style should be UPPER_CASE as this will also require code changes. Change-Id: Id32d6caba43be9e1c6b1f638be284071bf52f0fd Signed-off-by: Jason Yellick <[email protected]>
1 parent fd536a3 commit cdecb52

27 files changed

+574
-560
lines changed

protos/common/common.pb.go

+66-66
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/common/common.proto

+13-13
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ message Metadata {
6464
}
6565

6666
message MetadataSignature {
67-
bytes signatureHeader = 1; // An encoded SignatureHeader
67+
bytes signature_header = 1; // An encoded SignatureHeader
6868
bytes signature = 2; // The signature over the concatenation of the Metadata value bytes, signatureHeader, and block header
6969
}
7070

7171
message Header {
72-
ChainHeader chainHeader = 1;
73-
SignatureHeader signatureHeader = 2;
72+
ChainHeader chain_header = 1;
73+
SignatureHeader signature_header = 2;
7474
}
7575

7676
// Header is a generic replay prevention and identity message to include in a signed payload
@@ -85,15 +85,15 @@ message ChainHeader {
8585
google.protobuf.Timestamp timestamp = 3;
8686

8787
// Identifier of the chain this message is bound for
88-
string chainID = 4;
88+
string chainID = 4; // XXX change to channel_id
8989

9090
// An unique identifier that is used end-to-end.
9191
// - set by higher layers such as end user or SDK
9292
// - passed to the endorser (which will check for uniqueness)
9393
// - as the header is passed along unchanged, it will be
9494
// be retrieved by the committer (uniqueness check here as well)
9595
// - to be stored in the ledger
96-
string txID = 5;
96+
string txID = 5; // XXX change to tx_id
9797

9898
// The epoch in which this header was generated, where epoch is defined based on block height
9999
// Epoch in which the response has been generated. This field identifies a
@@ -140,24 +140,24 @@ message Envelope {
140140
// in the BlockHeader. This makes it natural and obvious that the Data is included in the hash, but
141141
// the Metadata is not.
142142
message Block {
143-
BlockHeader Header = 1;
144-
BlockData Data = 2;
145-
BlockMetadata Metadata = 3;
143+
BlockHeader header = 1;
144+
BlockData data = 2;
145+
BlockMetadata metadata = 3;
146146
}
147147

148148
// BlockHeader is the element of the block which forms the block chain
149149
// The block header is hashed using the configured chain hashing algorithm
150150
// over the ASN.1 encoding of the BlockHeader
151151
message BlockHeader {
152-
uint64 Number = 1; // The position in the blockchain
153-
bytes PreviousHash = 2; // The hash of the previous block header
154-
bytes DataHash = 3; // The hash of the BlockData, by MerkleTree
152+
uint64 number = 1; // The position in the blockchain
153+
bytes previous_hash = 2; // The hash of the previous block header
154+
bytes data_hash = 3; // The hash of the BlockData, by MerkleTree
155155
}
156156

157157
message BlockData {
158-
repeated bytes Data = 1;
158+
repeated bytes data = 1;
159159
}
160160

161161
message BlockMetadata {
162-
repeated bytes Metadata = 1;
162+
repeated bytes metadata = 1;
163163
}

0 commit comments

Comments
 (0)