Skip to content

Commit

Permalink
FAB-11411 Fabric protobuf sync
Browse files Browse the repository at this point in the history
Change-Id: Id72293923735f1d536f8858bd2d47fe47f4b1bf2
Signed-off-by: rickr <cr22rc@gmail.com>
  • Loading branch information
cr22rc committed Aug 2, 2018
1 parent 1475a3d commit 61b439e
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 75 deletions.
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
<show>public</show>
<doctitle>Hyperledger Fabric Java SDK</doctitle>
<nohelp>true</nohelp>
<failOnError>true</failOnError>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -623,6 +624,7 @@
<show>public</show>
<doctitle>Hyperledger Fabric Java SDK</doctitle>
<nohelp>true</nohelp>
<failOnError>true</failOnError>
</configuration>
<executions>
<execution>
Expand Down
2 changes: 1 addition & 1 deletion src/main/proto/common/configuration.proto
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ message Capabilities {
// if the need arises in the future. For the time being, a capability being in the
// capabilities map requires that that capability be supported.
message Capability {
}
}
8 changes: 6 additions & 2 deletions src/main/proto/discovery/protocol.proto
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,13 @@ message ConfigResult {
map<string, Endpoints> orderers = 2;
}

// PeerMembershipQuery requests PeerMembershipResult
// PeerMembershipQuery requests PeerMembershipResult.
// The filter field may be optionally populated in order
// for the peer membership to be filtered according to
// chaincodes that are installed on peers and collection
// access control policies.
message PeerMembershipQuery {

ChaincodeInterest filter = 1;
}

// PeerMembershipResult contains peers mapped by their organizations (MSP_ID)
Expand Down
4 changes: 2 additions & 2 deletions src/main/proto/gossip/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ enum PullMsgType {
// certain data blocks from a remote peer
message DataRequest {
uint64 nonce = 1;
repeated string digests = 2;
repeated bytes digests = 2;
PullMsgType msg_type = 3;
}

Expand All @@ -223,7 +223,7 @@ message DataUpdate {
// to the initator peer and contains the data items it has
message DataDigest {
uint64 nonce = 1;
repeated string digests = 2; // Maybe change this to bitmap later on
repeated bytes digests = 2; // Maybe change this to bitmap later on
PullMsgType msg_type = 3;
}

Expand Down
1 change: 1 addition & 0 deletions src/main/proto/msp/identities.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/


syntax = "proto3";

option go_package = "github.com/hyperledger/fabric/protos/msp";
Expand Down
2 changes: 1 addition & 1 deletion src/main/proto/msp/msp_principal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message MSPPrincipal {
// groupping of entities, per MSP affiliation
// E.g., this can well be represented by an MSP's
// Organization unit
IDENTITY = 2; // Denotes a principal that consists of a single
IDENTITY = 2; // Denotes a principal that consists of a single
// identity
ANONYMITY = 3; // Denotes a principal that can be used to enforce
// an identity to be anonymous or nominal.
Expand Down
7 changes: 7 additions & 0 deletions src/main/proto/peer/chaincode.proto
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,10 @@ message ChaincodeInvocationSpec {
message LifecycleEvent {
string chaincode_name = 1;
}

// ChaincodeInstallPackage stores the necessary information about a chaincode.
message ChaincodeInstallPackage {
string type = 1;
string path = 2;
bytes code_package = 3;
}
8 changes: 4 additions & 4 deletions src/main/proto/peer/chaincode_event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ option go_package = "github.com/hyperledger/fabric/protos/peer";
//ChaincodeEvent is used for events and registrations that are specific to chaincode
//string type - "chaincode"
message ChaincodeEvent {
string chaincode_id = 1;
string tx_id = 2;
string event_name = 3;
bytes payload = 4;
string chaincode_id = 1;
string tx_id = 2;
string event_name = 3;
bytes payload = 4;
}
119 changes: 56 additions & 63 deletions src/main/proto/peer/events.proto
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
/*
Copyright IBM Corp. 2016 All Rights Reserved.
Copyright IBM Corp. 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.
SPDX-License-Identifier: Apache-2.0
*/

syntax = "proto3";
Expand All @@ -27,6 +17,60 @@ option go_package = "github.com/hyperledger/fabric/protos/peer";

package protos;

// FilteredBlock is a minimal set of information about a block
message FilteredBlock {
string channel_id = 1;
uint64 number = 2; // The position in the blockchain
repeated FilteredTransaction filtered_transactions = 4;
}

// FilteredTransaction is a minimal set of information about a transaction
// within a block
message FilteredTransaction {
string txid = 1;
common.HeaderType type = 2;
TxValidationCode tx_validation_code = 3;
oneof Data {
FilteredTransactionActions transaction_actions = 4;
}
}

// FilteredTransactionActions is a wrapper for array of TransactionAction
// message from regular block
message FilteredTransactionActions {
repeated FilteredChaincodeAction chaincode_actions = 1;
}

// FilteredChaincodeAction is a minimal set of information about an action
// within a transaction
message FilteredChaincodeAction {
ChaincodeEvent chaincode_event = 1;
}

// DeliverResponse
message DeliverResponse {
oneof Type {
common.Status status = 1;
common.Block block = 2;
FilteredBlock filtered_block = 3;
}
}

service Deliver {
// deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with
// Payload data as a marshaled orderer.SeekInfo message,
// then a stream of block replies is received
rpc Deliver (stream common.Envelope) returns (stream DeliverResponse) {
}
// deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with
// Payload data as a marshaled orderer.SeekInfo message,
// then a stream of **filtered** block replies is received
rpc DeliverFiltered (stream common.Envelope) returns (stream DeliverResponse) {
}
}

//---------- producer events ---------

//----Event objects----

enum EventType {
Expand Down Expand Up @@ -75,37 +119,6 @@ message Unregister {
repeated Interest events = 1;
}

//FilteredBlock is sent by producers and contains minimal information
//about the block.
message FilteredBlock {
string channel_id = 1;
uint64 number = 2; // The position in the blockchain
repeated FilteredTransaction filtered_transactions = 4;
}

//FilteredTransaction is a minimal set of information about a transaction
//within a block.
message FilteredTransaction {
string txid = 1;
common.HeaderType type = 2;
TxValidationCode tx_validation_code = 3;
oneof Data {
FilteredTransactionActions transaction_actions = 4;
}
}

// FilteredTransactionActions is a wrapper for array of TransactionAction
// message from regular block
message FilteredTransactionActions {
repeated FilteredChaincodeAction chaincode_actions = 1;
}

//FilteredChaincodeAction is a minimal set of information about an action within a
//transaction.
message FilteredChaincodeAction {
ChaincodeEvent chaincode_event = 1;
}

// SignedEvent is used for any communication between consumer and producer
message SignedEvent {
// Signature over the event bytes
Expand Down Expand Up @@ -147,24 +160,4 @@ service Events {
// event chatting using Event
rpc Chat (stream SignedEvent) returns (stream Event) {
}
}

// DeliverResponse
message DeliverResponse {
oneof Type {
common.Status status = 1;
common.Block block = 2;
FilteredBlock filtered_block = 3;
}
}

service Deliver {
// deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled orderer.SeekInfo message,
// then a stream of block replies is received.
rpc Deliver (stream common.Envelope) returns (stream DeliverResponse) {
}
// deliver first requires an Envelope of type ab.DELIVER_SEEK_INFO with Payload data as a marshaled orderer.SeekInfo message,
// then a stream of **filtered** block replies is received.
rpc DeliverFiltered (stream common.Envelope) returns (stream DeliverResponse) {
}
}
1 change: 1 addition & 0 deletions src/main/proto/peer/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ enum TxValidationCode {
BAD_RESPONSE_PAYLOAD = 21;
BAD_RWSET = 22;
ILLEGAL_WRITESET = 23;
INVALID_WRITESET = 24;
NOT_VALIDATED = 254;
INVALID_OTHER_REASON = 255;
}
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ public void testUpdate1() throws Exception {
channel.shutdown(true); // Force channel to shutdown clean up resources.

out("testUpdate1 - done");
out("That's all folks!");
}

private static void queryChaincodeForExpectedValue(HFClient client, Channel channel, final String expect, ChaincodeID chaincodeID) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public void setup() throws Exception {

assertEquals(expectedTransactionId, evenTransactionId.toString());

out("That's all folks!");
}

static void out(String format, Object... args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ public void setup() {
//Ok now do actual channel update.
fooChannel.updateChannelConfiguration(updateChannelConfiguration, client.getUpdateChannelConfigurationSignature(updateChannelConfiguration, ordererAdmin));

Thread.sleep(3000); // give time for events to happen

//Let's add some additional verification...

client.setUserContext(sampleOrg.getPeerAdmin());
Expand Down Expand Up @@ -220,8 +222,6 @@ public void setup() {

out("\n");

Thread.sleep(3000); // give time for events to happen

assertTrue(eventCountFilteredBlock > 0); // make sure we got blockevent that were tested.
assertTrue(eventCountBlock > 0); // make sure we got blockevent that were tested.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,7 @@ public void testMockReenrollNoResult() throws Exception {

mockClient.setHttpPostResponse("{\"success\":true}");
mockClient.reenroll(user);
out("That's all folks!");
}

@Ignore
Expand Down

0 comments on commit 61b439e

Please sign in to comment.