Skip to content

Commit

Permalink
Be 862 Fix sync error (#228)
Browse files Browse the repository at this point in the history
* BE-862 Add null validation for sync error

And upgraded fabric version Explorer supports

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

* BE-862 Add test case to validate the fix

Signed-off-by: Atsushi Neki <nekiaiken@gmail.com>
  • Loading branch information
nekia authored Apr 11, 2021
1 parent b28b16e commit 5ce121a
Show file tree
Hide file tree
Showing 11 changed files with 2,145 additions and 1,979 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: Apache-2.0

FROM node:14.16.0-alpine3.13 AS BUILD_IMAGE
FROM node:13-alpine AS BUILD_IMAGE

# default values pf environment variables
# that are used inside container
Expand All @@ -18,10 +18,10 @@ COPY . .

# install required dependencies by NPM packages:
# current dependencies are: python, make, g++
RUN apk add --no-cache --virtual npm-deps python make g++ curl bash && \
python -m ensurepip && \
RUN apk add --no-cache --virtual npm-deps python3 make g++ curl bash && \
python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip install --upgrade pip setuptools && \
pip3 install --upgrade pip setuptools && \
rm -r /root/.cache

# install node-prune (https://github.com/tj/node-prune)
Expand All @@ -43,7 +43,7 @@ RUN rm -rf node_modules/rxjs/_esm5/
RUN rm -rf node_modules/rxjs/_esm2015/
RUN rm -rf node_modules/grpc/deps/grpc/third_party/

FROM node:10.19-alpine3.9
FROM node:13-alpine

# database configuration
ENV DATABASE_HOST 127.0.0.1
Expand Down
4 changes: 2 additions & 2 deletions app/platform/fabric/e2e-test/runTestSuite.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash

ROOTDIR="$(cd "$(dirname "$0")"/../../../.. && pwd)"
FABRIC_V1_VERSION=1.4.9
FABRIC_V1_VERSION=1.4.11
FABRIC_CA_V1_VERSION=1.4.9
FABRIC_V2_VERSION=2.2.1
FABRIC_V2_VERSION=2.3.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.1
dockerTag: 2.3.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.9
fabricVersion: 1.4.11
#! peer database ledger type (couchdb, goleveldb)
dbType: goleveldb
#! This parameter is used to define fabric logging spec in peers
Expand Down
4 changes: 2 additions & 2 deletions app/platform/fabric/sync/SyncService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,9 @@ export class SyncServices {
if (txObj.payload.header.channel_header.typeString === 'CONFIG') {
txid = sha.sha256(txStr);
readSet =
txObj.payload.data.last_update.payload.data.config_update.read_set;
txObj.payload.data.last_update.payload?.data.config_update.read_set;
writeSet =
txObj.payload.data.last_update.payload.data.config_update.write_set;
txObj.payload.data.last_update.payload?.data.config_update.write_set;
}

const read_set = JSON.stringify(readSet, null, 2);
Expand Down
8 changes: 8 additions & 0 deletions app/test/SyncService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,12 @@ describe('processBlockEvent', () => {
);
clock.restore();
});

it("should be done without any errors when config block doesn't have any payload in last updated data", async () => {
const stubClient = setupClient();

stubConfigBlock.data.data[0].payload.data.last_update.payload = null;
await expect(sync.processBlockEvent(stubClient, stubConfigBlock)).to
.eventually.to.be.true;
});
});
4 changes: 2 additions & 2 deletions client/e2e-test/gui-e2e-test-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ TIMEOUT=600
DELAY=10

ROOTDIR="$(cd "$(dirname "$0")"/../.. && pwd)"
FABRIC_V1_VERSION=1.4.9
FABRIC_V1_VERSION=1.4.11
FABRIC_CA_V1_VERSION=1.4.9
FABRIC_V2_VERSION=2.2.1
FABRIC_V2_VERSION=2.3.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.1
dockerTag: 2.3.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.9
fabricVersion: 1.4.11
#! peer database ledger type (couchdb, goleveldb)
dbType: goleveldb
#! This parameter is used to define fabric logging spec in peers
Expand Down
Loading

0 comments on commit 5ce121a

Please sign in to comment.