Skip to content

Commit

Permalink
BE-851 Upgrade fabric version supported by Explorer (#208)
Browse files Browse the repository at this point in the history
* BE-851 Upgrade fabric version supporting

Signed-off-by: Atsushi Neki <nekiaiken@gmail.com>

* BE-851 Upgrade supported fabric version

v1.4.9 and v2.2.1
Fixed an issue that multiple discover requests conflict when loading UI.

Signed-off-by: Atsushi Neki <nekiaiken@gmail.com>
  • Loading branch information
nekia authored Dec 28, 2020
1 parent 7f5ab1b commit 3ae0d58
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 89 deletions.
2 changes: 1 addition & 1 deletion app/platform/fabric/FabricClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class FabricClient {
channel_name
);

if ('peers_by_org' in discover_results) {
if (discover_results && 'peers_by_org' in discover_results) {
for (const org in discover_results.peers_by_org) {
logger.info('Discovered', org, discover_results.peers_by_org[org].peers);
}
Expand Down
5 changes: 5 additions & 0 deletions app/platform/fabric/Proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ export class Proxy {
node.ledger_height_unsigned = peer.ledgerHeight.unsigned;
}
}
} else {
// Sometime 'peers_by_org' property is not included in discover result
node.ledger_height_low = '-';
node.ledger_height_high = '-';
node.ledger_height_unsigned = '-';
}
peers.push(node);
} else if (node.peer_type === 'ORDERER') {
Expand Down
8 changes: 4 additions & 4 deletions app/platform/fabric/e2e-test/runTestSuite.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash

ROOTDIR="$(cd "$(dirname "$0")"/../../../.. && pwd)"
FABRIC_V1_VERSION=1.4.8
FABRIC_CA_V1_VERSION=1.4.7
FABRIC_V2_VERSION=2.2.0
FABRIC_CA_V2_VERSION=1.4.7
FABRIC_V1_VERSION=1.4.9
FABRIC_CA_V1_VERSION=1.4.9
FABRIC_V2_VERSION=2.2.1
FABRIC_CA_V2_VERSION=1.4.9

echo "#### Downloaded fabric-test repo"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

---
dockerOrg: hyperledger
dockerTag: 2.2.0
dockerTag: 2.2.1

#! peer database ledger type (couchdb, goleveldb)
dbType: goleveldb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#! Released images are pulled from docker hub hyperledger/, e.g. 1.4.5 or 2.0.0
#! Development stream images are pulled from
#! hyperledger-fabric.jfrog.io/, e.g. 1.4.5-stable or 2.0.0-stable
fabricVersion: 1.4.8
fabricVersion: 1.4.9
#! peer database ledger type (couchdb, goleveldb)
dbType: goleveldb
#! This parameter is used to define fabric logging spec in peers
Expand Down
37 changes: 24 additions & 13 deletions app/platform/fabric/gateway/FabricGateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class FabricGateway {
asLocalhost: boolean;
ds: DiscoveryService;
dsTargets: Discoverer[];
waitingResp: boolean;

/**
* Creates an instance of FabricGateway.
Expand Down Expand Up @@ -427,23 +428,33 @@ export class FabricGateway {
}

async sendDiscoveryRequest() {
let result;
try {
await this.ds.send({
asLocalhost: this.asLocalhost,
requestTimeout: 5000,
refreshAge: 15000,
targets: this.dsTargets
});
logger.info('Succeeded to send discovery request');
if (!this.waitingResp) {
this.waitingResp = true;
await this.ds.send({
asLocalhost: this.asLocalhost,
requestTimeout: 5000,
refreshAge: 15000,
targets: this.dsTargets
});
logger.info('Succeeded to send discovery request');
} else {
logger.info('Have already been sending a request');
}

const result = await this.ds.getDiscoveryResults(true);
return result;
result = await this.ds.getDiscoveryResults(true);
} catch (error) {
logger.error('Failed to send discovery request for channel', error);
this.ds.close();
this.ds = null;
logger.warn('Failed to send discovery request for channel', error);
if (this.ds) {
this.ds.close();
this.ds = null;
}
result = null;
} finally {
this.waitingResp = false;
}
return null;
return result;
}

async getDiscoveryResult(channelName) {
Expand Down
12 changes: 7 additions & 5 deletions app/platform/fabric/sync/SyncService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,13 @@ export class SyncServices {
}

// Insert chaincode
await this.insertNewChannelChaincode(
client,
channel_genesis_hash,
discoveryResults
);
if (discoveryResults) {
await this.insertNewChannelChaincode(
client,
channel_genesis_hash,
discoveryResults
);
}
}

/**
Expand Down
8 changes: 4 additions & 4 deletions client/e2e-test/gui-e2e-test-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ TIMEOUT=600
DELAY=10

ROOTDIR="$(cd "$(dirname "$0")"/../.. && pwd)"
FABRIC_V1_VERSION=1.4.8
FABRIC_CA_V1_VERSION=1.4.7
FABRIC_V2_VERSION=2.2.0
FABRIC_CA_V2_VERSION=1.4.7
FABRIC_V1_VERSION=1.4.9
FABRIC_CA_V1_VERSION=1.4.9
FABRIC_V2_VERSION=2.2.1
FABRIC_CA_V2_VERSION=1.4.9

echo "#### Downloaded fabric-test repo"

Expand Down
2 changes: 1 addition & 1 deletion client/e2e-test/specs/gui-e2e-test-network-spec-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#! Development stream images are pulled from
#! hyperledger-fabric.jfrog.io/, e.g. 1.4.5-stable or 2.0.0-stable
dockerOrg: hyperledger
dockerTag: 2.2.0
dockerTag: 2.2.1

#! peer database ledger type (couchdb, goleveldb)
dbType: goleveldb
Expand Down
2 changes: 1 addition & 1 deletion client/e2e-test/specs/gui-e2e-test-network-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#! Released images are pulled from docker hub hyperledger/, e.g. 1.4.5 or 2.0.0
#! Development stream images are pulled from
#! hyperledger-fabric.jfrog.io/, e.g. 1.4.5-stable or 2.0.0-stable
fabricVersion: 1.4.8
fabricVersion: 1.4.9
#! peer database ledger type (couchdb, goleveldb)
dbType: goleveldb
#! This parameter is used to define fabric logging spec in peers
Expand Down
113 changes: 57 additions & 56 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"enum": "^2.5.0",
"express": "^4.15.3",
"express-rate-limit": "^5.0.0",
"fabric-ca-client": "^2.2.0",
"fabric-network": "^2.2.4-snapshot.11",
"fabric-ca-client": "^2.2.4",
"fabric-network": "^2.2.4",
"fast-stats": "0.0.3",
"fs-extra": "^6.0.1",
"grpc": "^1.20.3",
Expand Down

0 comments on commit 3ae0d58

Please sign in to comment.