Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 24390b4

Browse files
committed
FAB-6117 Update proto. snapshot fix
Orderer wait time overall configurable. Remove dead code CACERTS dir. Change-Id: Ib6b31f6fa4e2280b023e792d0659006eaab48eb5 Signed-off-by: rickr <cr22rc@gmail.com>
1 parent 8ccc1a7 commit 24390b4

File tree

7 files changed

+94
-19
lines changed

7 files changed

+94
-19
lines changed

README.md

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,49 @@ Add below code in your `pom.xml` to download fabric-sdk-java-1.0.1
6565

6666
`*************************************************`
6767

68+
## 1.1.0-SNAPSHOT builds
69+
Work in progress 1.1.0 SNAPSHOT builds can be used by adding the following to your application's
70+
pom.xml
71+
```
72+
<dependencies>
73+
74+
<!-- https://mvnrepository.com/artifact/org.hyperledger.fabric-sdk-java/fabric-sdk-java -->
75+
<dependency>
76+
<groupId>org.hyperledger.fabric-sdk-java</groupId>
77+
<artifactId>fabric-sdk-java</artifactId>
78+
<version>1.1.0-SNAPSHOT</version>
79+
</dependency>
80+
81+
</dependencies>
82+
```
83+
84+
Add to your maven's setting.xml typically in the .m2 directory under your home directory:
85+
```
86+
<profiles>
87+
<profile>
88+
<id>allow-snapshots</id>
89+
<activation>
90+
<activeByDefault>true</activeByDefault>
91+
</activation>
92+
<repositories>
93+
<repository>
94+
<id>snapshots-repo</id>
95+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
96+
<releases>
97+
<enabled>false</enabled>
98+
</releases>
99+
<snapshots>
100+
<enabled>true</enabled>
101+
</snapshots>
102+
</repository>
103+
</repositories>
104+
</profile>
105+
</profiles>
106+
```
107+
108+
109+
110+
68111

69112
## Latest builds of Fabric and Fabric-ca v1.1.0
70113

@@ -74,7 +117,7 @@ You can clone these projects by going to the [Hyperledger repository](https://ge
74117

75118
## Working with the Fabric Vagrant environment
76119
Vagrant is NOT required if your OS has Docker support and all the requirements needed to build directly in your
77-
environment. For non Vagrant envrionment, the steps would be the same as below minus those parts involving Vagrant.
120+
environment. For non Vagrant environment, the steps would be the same as below minus those parts involving Vagrant.
78121
Do the following if you want to run the Fabric components ( peer, orderer, fabric-ca ) in Vagrant:
79122

80123
```
@@ -157,6 +200,10 @@ or
157200
To run the unit tests, please use <code>mvn test</code> or <code>mvn install</code> which will run the unit tests and build the jar file.
158201
You must be running a local peer and orderer to be able to run the unit tests.
159202

203+
**Many unit tests will test failure condition's resulting in exceptions and stack traces being displayed. This is not an indication of failure!**
204+
205+
**[INFO] BUILD SUCCESS** **_At the end is usually a very reliable indication that all tests have passed successfully!_**
206+
160207
### Running the integration tests
161208
You must be running local instances of Fabric-ca, Fabric peers, and Fabric orderers to be able to run the integration tests. See above for running these services in Vagrant.
162209
Use this `maven` command to run the integration tests:
@@ -261,10 +308,19 @@ your server(s) hostname(s) and port(s).
261308

262309
### GO Lang chaincode
263310
Go lang chaincode dependencies must be contained in vendor folder.
264-
For an explanation of this see [Vender folder explanation](https://blog.gopheracademy.com/advent-2015/vendor-folder/)
311+
For an explanation of this see [Vendor folder explanation](https://blog.gopheracademy.com/advent-2015/vendor-folder/)
265312

266313

267314
## Basic Troubleshooting
315+
316+
**Firewalls, load balancers, network proxies**
317+
318+
These can sometimes silently kill a network connections and prevent them from auto reconnecting. To fix this look at
319+
adding to Peers, EventHub's and Orderer's connection properties:
320+
`grpc.NettyChannelBuilderOption.keepAliveTime`, `grpc.NettyChannelBuilderOption.keepAliveTimeout`,
321+
`grpc.NettyChannelBuilderOption.keepAliveWithoutCalls`. Examples of this are in End2endIT.java
322+
323+
268324
**identity or token do not match**
269325

270326
Keep in mind that you can perform the enrollment process with the membership services server only once, as the enrollmentSecret is a one-time-use password. If you have performed a FSUser registration/enrollment with the membership services and subsequently deleted the crypto tokens stored on the client side, the next time you try to enroll, errors similar to the ones below will be seen.

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>org.hyperledger.fabric-sdk-java</groupId>
55
<artifactId>fabric-sdk-java</artifactId>
66
<packaging>jar</packaging>
7-
<version>${fabric.sdk.java.version}-SNAPSHOT</version>
7+
<version>1.1.0-SNAPSHOT</version>
88
<name>fabric-java-sdk</name>
99
<description>Java SDK for Hyperledger fabric project</description>
1010
<url>https://www.hyperledger.org/community/projects</url>
@@ -28,7 +28,6 @@
2828
<tag>fabric-sdk-java-1.0</tag>
2929
</scm>
3030
<properties>
31-
<fabric.sdk.java.version>1.1.0</fabric.sdk.java.version>
3231
<grpc.version>1.5.0</grpc.version><!-- CURRENT_GRPC_VERSION -->
3332
<bouncycastle.version>1.57</bouncycastle.version>
3433
<httpclient.version>4.5.3</httpclient.version>
@@ -37,6 +36,7 @@
3736
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3837
<jacoco.version>0.7.9</jacoco.version>
3938
<org.hyperledger.fabric.sdktest.ITSuite>IntegrationSuite.java</org.hyperledger.fabric.sdktest.ITSuite>
39+
<gpg.executable>gpg2</gpg.executable>
4040
</properties>
4141

4242
<reporting>
@@ -495,7 +495,7 @@
495495
<git-commit-id>${git.commit.id}</git-commit-id>
496496
<git-branch>${git.branch}</git-branch>
497497
<git-commit-time>${git.commit.time}</git-commit-time>
498-
<fabric-sdk-java-version>${fabric.sdk.java.version}</fabric-sdk-java-version>
498+
<fabric-sdk-java-version>${project.version}</fabric-sdk-java-version>
499499
</manifestEntries>
500500
</archive>
501501
</configuration>

src/main/java/org/hyperledger/fabric/sdk/OrdererClient.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.hyperledger.fabric.protos.orderer.Ab.DeliverResponse;
3131
import org.hyperledger.fabric.protos.orderer.AtomicBroadcastGrpc;
3232
import org.hyperledger.fabric.sdk.exception.TransactionException;
33+
import org.hyperledger.fabric.sdk.helper.Config;
3334

3435
import static java.lang.String.format;
3536
import static org.hyperledger.fabric.protos.orderer.Ab.DeliverResponse.TypeCase.STATUS;
@@ -38,7 +39,8 @@
3839
* Sample client code that makes gRPC calls to the server.
3940
*/
4041
class OrdererClient {
41-
private static final long ORDERER_WAIT_TIME = 3000L;
42+
private static final Config config = Config.getConfig();
43+
private static final long ORDERER_WAIT_TIME = config.getOrdererWaitTime();
4244
private final String channelName;
4345
private final ManagedChannelBuilder channelBuilder;
4446
private boolean shutdown = false;
@@ -280,7 +282,7 @@ public void onCompleted() {
280282
try {
281283
if (!finishLatch.await(ordererWaitTimeMilliSecs, TimeUnit.MILLISECONDS)) {
282284
TransactionException ex = new TransactionException(format(
283-
"Channel %s sendDeliver time exceeded for orderer %s, timed out at %d", channelName, name, ordererWaitTimeMilliSecs));
285+
"Channel %s sendDeliver time exceeded for orderer %s, timed out at %d ms.", channelName, name, ordererWaitTimeMilliSecs));
284286
logger.error(ex.getMessage(), ex);
285287
throw ex;
286288
}

src/main/java/org/hyperledger/fabric/sdk/helper/Config.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ public class Config {
3939
public static final String ORG_HYPERLEDGER_FABRIC_SDK_CONFIGURATION = "org.hyperledger.fabric.sdk.configuration";
4040
public static final String SECURITY_LEVEL = "org.hyperledger.fabric.sdk.security_level";
4141
public static final String HASH_ALGORITHM = "org.hyperledger.fabric.sdk.hash_algorithm";
42-
public static final String CACERTS = "org.hyperledger.fabric.sdk.cacerts";
4342
public static final String PROPOSAL_WAIT_TIME = "org.hyperledger.fabric.sdk.proposal.wait.time";
4443
public static final String CHANNEL_CONFIG_WAIT_TIME = "org.hyperledger.fabric.sdk.channelconfig.wait_time";
4544
public static final String ORDERER_RETRY_WAIT_TIME = "org.hyperledger.fabric.sdk.orderer_retry.wait_time";
45+
public static final String ORDERER_WAIT_TIME = "org.hyperledger.fabric.sdk.orderer.ordererWaitTimeMilliSecs";
4646
public static final String EVENTHUB_CONNECTION_WAIT_TIME = "org.hyperledger.fabric.sdk.eventhub_connection.wait_time";
4747
public static final String PROPOSAL_CONSISTENCY_VALIDATION = "org.hyperledger.fabric.sdk.proposal.consistency_validation";
4848
public static final String GENESISBLOCK_WAIT_TIME = "org.hyperledger.fabric.sdk.channel.genesisblock_wait_time";
@@ -91,8 +91,6 @@ private Config() {
9191
defaultProperty(SECURITY_LEVEL, "256");
9292
defaultProperty(HASH_ALGORITHM, "SHA2");
9393
defaultProperty(PROPOSAL_CONSISTENCY_VALIDATION, "true");
94-
// TODO remove this once we have implemented MSP and get the peer certs from the channel
95-
defaultProperty(CACERTS, "/genesisblock/peercacert.pem");
9694

9795
defaultProperty(PROPOSAL_WAIT_TIME, "20000");
9896
defaultProperty(GENESISBLOCK_WAIT_TIME, "5000");
@@ -102,6 +100,7 @@ private Config() {
102100
defaultProperty(DIAGNOTISTIC_FILE_DIRECTORY, null);
103101
defaultProperty(CHANNEL_CONFIG_WAIT_TIME, "15000");
104102
defaultProperty(ORDERER_RETRY_WAIT_TIME, "200");
103+
defaultProperty(ORDERER_WAIT_TIME, "3000");
105104
defaultProperty(EVENTHUB_CONNECTION_WAIT_TIME, "1000");
106105

107106
final String inLogLevel = sdkProperties.getProperty(LOGGERLEVEL);
@@ -218,10 +217,6 @@ public String getHashAlgorithm() {
218217

219218
}
220219

221-
public String[] getPeerCACerts() {
222-
return getProperty(CACERTS).split("'");
223-
}
224-
225220
/**
226221
* Get the timeout for a single proposal request to endorser.
227222
*
@@ -258,6 +253,10 @@ public long getOrdererRetryWaitTime() {
258253
return Long.parseLong(getProperty(ORDERER_RETRY_WAIT_TIME));
259254
}
260255

256+
public long getOrdererWaitTime() {
257+
return Long.parseLong(getProperty(ORDERER_WAIT_TIME));
258+
}
259+
261260
public long getEventHubConnectionWaitTime() {
262261
return Long.parseLong(getProperty(EVENTHUB_CONNECTION_WAIT_TIME));
263262
}

src/main/proto/common/configuration.proto

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,24 @@ message OrdererAddresses {
4646
message Consortium {
4747
string name = 1;
4848
}
49+
50+
// Capabilities message contains all the capabilities that a channel requires
51+
// participant entities to comply with. The entity should drop off the channel
52+
// if it can't fulfill any of the required capabilities.
53+
// Capabilities is encoded into the configuaration as Values of each type
54+
// Orderer, Channel, or Application.
55+
// The key string should represent the capability name, and it must be unique
56+
// within each type. For readability, it may be advisable to prefix the key with
57+
// its type (eg app-acl)
58+
message Capabilities {
59+
map<string, Capability> capabilities = 1;
60+
}
61+
62+
// Capability holds a set of options. We can add more as needed in the
63+
// future. For now, whether it is required or not. If a configured capability
64+
// is not required, it must be completely compatible with previous releases.
65+
// Compatible features are not required to be encoded as capabilities; they
66+
// only provide flexibility for the admins to control the features.
67+
message Capability {
68+
bool required = 1;
69+
}

src/test/java/org/hyperledger/fabric/sdk/helper/ConfigTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package org.hyperledger.fabric.sdk.helper;
1616

1717
import org.apache.log4j.Level;
18-
1918
import org.hyperledger.fabric.sdk.TestConfigHelper;
2019
import org.junit.After;
2120
import org.junit.Assert;
@@ -24,7 +23,7 @@
2423

2524
public class ConfigTest {
2625

27-
private TestConfigHelper configHelper = new TestConfigHelper();
26+
private final TestConfigHelper configHelper = new TestConfigHelper();
2827
// private String originalHashAlgorithm;
2928

3029
@Before
@@ -94,9 +93,6 @@ public void testGetters() {
9493
Assert.assertNotNull(config.getSymmetricAlgorithm());
9594
Assert.assertNotNull(config.getSignatureAlgorithm());
9695
Assert.assertNotNull(config.getCertificateFormat());
97-
98-
// Arrays
99-
Assert.assertNotNull(config.getPeerCACerts());
10096
}
10197

10298
@Test

src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ private Channel constructChannel(String name, HFClient client, SampleOrg sampleO
655655
// Under 5 minutes would require changes to server side to accept faster ping rates.
656656
ordererProperties.put("grpc.NettyChannelBuilderOption.keepAliveTime", new Object[] {5L, TimeUnit.MINUTES});
657657
ordererProperties.put("grpc.NettyChannelBuilderOption.keepAliveTimeout", new Object[] {8L, TimeUnit.SECONDS});
658+
ordererProperties.put("grpc.NettyChannelBuilderOption.keepAliveWithoutCalls", new Object[] {true});
658659

659660
orderers.add(client.newOrderer(orderName, sampleOrg.getOrdererLocation(orderName),
660661
ordererProperties));

0 commit comments

Comments
 (0)