Skip to content

Commit 823aed3

Browse files
author
Srinivasan Muralidharan
committedJan 18, 2017
consolidate protos/peer proto files
https://jira.hyperledger.org/browse/FAB-1716 remove "fabric_" from filnames. consolidate files so we don't have so many. remove unused entries in "fabric.proto". remove message.proto remove properties from core.yaml not in use Change-Id: I0ee8d1bb87bf5cf3ebf9fb8b5e4c7aa30e8c7dcb Signed-off-by: Srinivasan Muralidharan <muralisr@us.ibm.com>
1 parent 6da52bc commit 823aed3

27 files changed

+1071
-1457
lines changed
 

‎core/peer/config.go

+1-7
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,11 @@ func CacheConfiguration() (err error) {
8585
// getPeerEndpoint returns the PeerEndpoint for this Peer instance. Affected by env:peer.addressAutoDetect
8686
getPeerEndpoint := func() (*pb.PeerEndpoint, error) {
8787
var peerAddress string
88-
var peerType pb.PeerEndpoint_Type
8988
peerAddress, err := getLocalAddress()
9089
if err != nil {
9190
return nil, err
9291
}
93-
if viper.GetBool("peer.validator.enabled") {
94-
peerType = pb.PeerEndpoint_VALIDATOR
95-
} else {
96-
peerType = pb.PeerEndpoint_NON_VALIDATOR
97-
}
98-
return &pb.PeerEndpoint{ID: &pb.PeerID{Name: viper.GetString("peer.id")}, Address: peerAddress, Type: peerType}, nil
92+
return &pb.PeerEndpoint{ID: &pb.PeerID{Name: viper.GetString("peer.id")}, Address: peerAddress}, nil
9993
}
10094

10195
localAddress, localAddressError = getLocalAddress()

‎protos/peer/server_admin.pb.go ‎protos/peer/admin.pb.go

+113-48
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

‎protos/peer/chaincode.pb.go

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

‎protos/peer/chaincode_proposal.pb.go

-110
This file was deleted.

‎protos/peer/chaincode_proposal.proto

-137
This file was deleted.

‎protos/peer/chaincode_transaction.pb.go

-95
This file was deleted.

‎protos/peer/chaincode_transaction.proto

-57
This file was deleted.

‎protos/peer/chaincodeevent.pb.go

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

‎protos/peer/configuration.pb.go

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

‎protos/peer/events.pb.go

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

‎protos/peer/events.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ syntax = "proto3";
1818

1919
import "common/common.proto";
2020
import "peer/chaincodeevent.proto";
21-
import "peer/fabric_transaction.proto";
21+
import "peer/transaction.proto";
2222

2323
option go_package = "github.com/hyperledger/fabric/protos/peer";
2424

‎protos/peer/fabric.pb.go

-155
This file was deleted.

‎protos/peer/fabric_message.pb.go

-81
This file was deleted.

‎protos/peer/fabric_message.proto

-48
This file was deleted.

‎protos/peer/fabric_proposal.pb.go

-112
This file was deleted.

‎protos/peer/fabric_service.pb.go

-108
This file was deleted.

‎protos/peer/fabric_service.proto

-28
This file was deleted.

‎protos/peer/fabric_transaction.pb.go

-167
This file was deleted.

‎protos/peer/peer.pb.go

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

‎protos/peer/fabric.proto ‎protos/peer/peer.proto

+8-19
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ option go_package = "github.com/hyperledger/fabric/protos/peer";
1919

2020
package protos;
2121

22-
message PeerAddress {
23-
string host = 1;
24-
int32 port = 2;
25-
}
22+
import "peer/proposal.proto";
23+
import "peer/proposal_response.proto";
2624

2725
message PeerID {
2826
string name = 1;
@@ -31,21 +29,6 @@ message PeerID {
3129
message PeerEndpoint {
3230
PeerID ID = 1;
3331
string address = 2;
34-
enum Type {
35-
UNDEFINED = 0;
36-
VALIDATOR = 1;
37-
NON_VALIDATOR = 2;
38-
}
39-
Type type = 3;
40-
bytes pkiID = 4;
41-
}
42-
43-
message PeersMessage {
44-
repeated PeerEndpoint peers = 1;
45-
}
46-
47-
message PeersAddresses {
48-
repeated string addresses = 1;
4932
}
5033

5134
// Contains information about the blockchain ledger such as height, current
@@ -57,3 +40,9 @@ message BlockchainInfo {
5740
bytes previousBlockHash = 3;
5841

5942
}
43+
44+
//-------- the Endorser service ------------
45+
46+
service Endorser {
47+
rpc ProcessProposal(SignedProposal) returns (ProposalResponse) {}
48+
}

‎protos/peer/proposal.pb.go

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

‎protos/peer/fabric_proposal.proto ‎protos/peer/proposal.proto

+118
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ option go_package = "github.com/hyperledger/fabric/protos/peer";
2020

2121
package protos;
2222

23+
import "peer/chaincode.proto";
24+
2325
/*
2426
The flow to get a generic transaction approved goes as follows:
2527
@@ -140,3 +142,119 @@ message Proposal {
140142
// ChaincodeAction message.
141143
bytes extension = 3;
142144
}
145+
146+
//-------- the Chaincode Proposal -----------
147+
148+
/*
149+
The flow to get a CHAINCODE transaction approved goes as follows:
150+
151+
1. client sends proposal to endorser
152+
====================================
153+
154+
The proposal is basically a request to do something on a chaincode, that will
155+
result on some action - some change in the state of a chaincode and/or some
156+
data to be committed to the ledger; a proposal in general contains a header
157+
(with some metadata describing it, such as the type, the identity of the
158+
invoker, the time, the ID of the chain, a cryptographic nonce..) and a payload
159+
(the chaincode ID, invocation arguments..). Optionally, it may contain actions
160+
that the endorser may be asked to endorse, to emulate a submitting peer. A
161+
chaincode proposal contains the following messages:
162+
163+
SignedProposal
164+
|\_ Signature (signature on the Proposal message by the creator specified in the header)
165+
\_ Proposal
166+
|\_ Header (the header for this proposal)
167+
|\_ ChaincodeProposalPayload (the payload for this proposal)
168+
\_ ChaincodeAction (the actions for this proposal - optional for a proposal)
169+
170+
2. endorser sends proposal response back to client
171+
==================================================
172+
173+
The proposal response contains an endorser's response to a client's proposal. A
174+
proposal response contains a success/error code, a response payload and a
175+
signature (also referred to as endorsement) over the response payload. The
176+
response payload contains a hash of the proposal (to securely link this
177+
response to the corresponding proposal), a description of the action resulting
178+
from the proposal and the endorser's signature over its payload. Formally, a
179+
chaincode proposal response contains the following messages:
180+
181+
ProposalResponse
182+
|\_ Endorsement (the endorser's signature over the whole response payload)
183+
\_ ProposalResponsePayload
184+
\_ ChaincodeAction (the actions for this proposal)
185+
186+
3. client assembles endorsements into a transaction
187+
===================================================
188+
189+
A transaction message assembles one or more proposals and corresponding
190+
responses into a message to be sent to orderers. After ordering, (batches of)
191+
transactions are delivered to committing peers for validation and final
192+
delivery into the ledger. A transaction contains one or more actions. Each of
193+
them contains a header (same as that of the proposal that requested it), a
194+
proposal payload (same as that of the proposal that requested it), a
195+
description of the resulting action and signatures from each of the endorsers
196+
that endorsed the action.
197+
198+
SignedTransaction
199+
|\_ Signature (signature on the Transaction message by the creator specified in the header)
200+
\_ Transaction
201+
\_ TransactionAction (1...n)
202+
|\_ Header (1) (the header of the proposal that requested this action)
203+
\_ ChaincodeActionPayload (1)
204+
|\_ ChaincodeProposalPayload (1) (payload of the proposal that requested this action)
205+
\_ ChaincodeEndorsedAction (1)
206+
|\_ Endorsement (1...n) (endorsers' signatures over the whole response payload)
207+
\_ ProposalResponsePayload
208+
\_ ChaincodeAction (the actions for this proposal)
209+
*/
210+
211+
// ChaincodeHeaderExtension is the Header's extentions message to be used when
212+
// the Header's type is CHAINCODE. This extensions is used to specify which
213+
// chaincode to invoke and what should appear on the ledger.
214+
message ChaincodeHeaderExtension {
215+
216+
// The PayloadVisibility field controls to what extent the Proposal's payload
217+
// (recall that for the type CHAINCODE, it is ChaincodeProposalPayload
218+
// message) field will be visible in the final transaction and in the ledger.
219+
// Ideally, it would be configurable, supporting at least 3 main “visibility
220+
// modes”:
221+
// 1. all bytes of the payload are visible;
222+
// 2. only a hash of the payload is visible;
223+
// 3. nothing is visible.
224+
// Notice that the visibility function may be potentially part of the ESCC.
225+
// In that case it overrides PayloadVisibility field. Finally notice that
226+
// this field impacts the content of ProposalResponsePayload.proposalHash.
227+
bytes payloadVisibility = 1;
228+
229+
// The ID of the chaincode to target.
230+
ChaincodeID chaincodeID = 2;
231+
}
232+
233+
// ChaincodeProposalPayload is the Proposal's payload message to be used when
234+
// the Header's type is CHAINCODE. It contains the arguments for this
235+
// invocation.
236+
message ChaincodeProposalPayload {
237+
238+
// Input contains the arguments for this invocation. If this invocation
239+
// deploys a new chaincode, ESCC/VSCC are part of this field.
240+
bytes Input = 1;
241+
242+
// Transient contains data (e.g. cryptographic material) that might be used
243+
// to implement some form of application-level confidentiality. The contents
244+
// of this field are supposed to always be omitted from the transaction and
245+
// excluded from the ledger.
246+
bytes Transient = 2;
247+
}
248+
249+
// ChaincodeAction contains the actions the events generated by the execution
250+
// of the chaincode.
251+
message ChaincodeAction {
252+
253+
// This field contains the read set and the write set produced by the
254+
// chaincode executing this invocation.
255+
bytes results = 1;
256+
257+
// This field contains the events generated by the chaincode executing this
258+
// invocation.
259+
bytes events = 2;
260+
}

0 commit comments

Comments
 (0)
Please sign in to comment.