Skip to content

Commit e23910e

Browse files
committed
ci(fabric-connector-weaver): added ci jobs for fabric connector driver
Signed-off-by: Carlos Amaro <[email protected]>
1 parent a154870 commit e23910e

File tree

9 files changed

+1226
-23
lines changed

9 files changed

+1226
-23
lines changed

.cspell.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,18 @@
255255
,"overriden"
256256
,"Certificat"
257257
,"adress"
258+
,"FabricProto"
259+
,"bnum"
260+
,"Requestby"
261+
,"ecies"
262+
,"ECIESKDF"
263+
,"kbuf"
264+
,"sjcl"
265+
,"ECIES"
266+
,"driverdbs"
267+
,"driverdb"
268+
,"fabproto"
269+
,"unsubscription"
258270
],
259271
"dictionaries": [
260272
"typescript,node,npm,go,rust"

.github/workflows/ci_weaver.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
asset-transfer:
2828
with:
2929
run_all: $RUN_ALL
30-
uses: ./.github/workflows/test_weaver-asset-transfer.yaml
30+
uses: ./.github/workflows/test_weaver-asset-transfer.yaml ./.github/workflows/test_weaver-asset-transfer-fabric-connector.yaml
3131
relay:
3232
with:
3333
run_all: $RUN_ALL
@@ -47,7 +47,7 @@ jobs:
4747
data-sharing:
4848
with:
4949
run_all: $RUN_ALL
50-
uses: ./.github/workflows/test_weaver-data-sharing.yaml
50+
uses: ./.github/workflows/test_weaver-data-sharing.yaml ./.github/workflows/test_weaver-data-sharing-fabric-connector.yaml
5151
node-pkgs:
5252
with:
5353
run_all: $RUN_ALL

.github/workflows/test_weaver-asset-transfer-fabric-connector.yaml

Lines changed: 725 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/test_weaver-data-sharing-fabric-connector.yaml

Lines changed: 465 additions & 0 deletions
Large diffs are not rendered by default.

packages/cactus-plugin-ledger-connector-fabric/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"email": "[email protected]",
3535
"url": "https://accenture.com"
3636
},
37-
{
37+
{
3838
"name": "Carlos Amaro",
3939
"email": "[email protected]",
4040
"url": "https://accenture.com"
@@ -73,6 +73,7 @@
7373
"@hyperledger/cactus-common": "2.1.0",
7474
"@hyperledger/cactus-core": "2.1.0",
7575
"@hyperledger/cactus-core-api": "2.1.0",
76+
"@hyperledger/cactus-plugin-keychain-memory": "2.1.0",
7677
"axios": "1.8.4",
7778
"bl": "6.1.0",
7879
"bn.js": "4.12.0",

packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ export class PluginLedgerConnectorFabric
13191319
return transientMap;
13201320
}
13211321

1322-
// Main invoke function wtih logic to handle policy and turn response from chaincode into a view.
1322+
// Main invoke function with logic to handle policy and turn response from chaincode into a view.
13231323
// 1. Prepare credentials/gateway for communicating with fabric network
13241324
// 2. Set the endorser list for the transaction, this enforces that the list provided will endorse the proposed transaction
13251325
// 3. Prepare the view and return.

packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/events.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class Events {
4848
private readonly logger: Logger;
4949
private readonly connector: PluginLedgerConnectorFabric;
5050

51-
private listner: Listener;
51+
private listener: Listener;
5252

5353
private certificate: any;
5454

@@ -59,7 +59,7 @@ export class Events {
5959
};
6060
this.logger = LoggerProvider.getOrCreate(logOptions);
6161
this.connector = options.driver.getConnectorInstance();
62-
this.listner = options.driver.getListenerInstance();
62+
this.listener = options.driver.getListenerInstance();
6363
this.certificate = options.certificate;
6464
}
6565

@@ -98,7 +98,7 @@ export class Events {
9898
// event being subscribed for the first time
9999
// Start an appropriate type of event listener for this event subscription if one is not already active
100100
const [, error] = await handlePromise(
101-
this.listner.registerListenerForEventSubscription(
101+
this.listener.registerListenerForEventSubscription(
102102
call_request.eventMatcher!,
103103
gatewayOptions,
104104
),
@@ -157,7 +157,7 @@ export class Events {
157157
gatewayOptions: GatewayOptions,
158158
) {
159159
const [unregister, err] = await handlePromise(
160-
this.listner.unregisterListenerForEventSubscription(
160+
this.listener.unregisterListenerForEventSubscription(
161161
call_request.eventMatcher!,
162162
gatewayOptions,
163163
),
@@ -198,7 +198,7 @@ export class Events {
198198
const ack_send = create(AckSchema, {
199199
requestId: newRequestId,
200200
// event got unsubscribed
201-
message: `Event ${JSON.stringify(deletedSubscription)} unsubscription is successful!`,
201+
message: `Event ${JSON.stringify(deletedSubscription)} unsubscription was successful!`,
202202
status: Ack_STATUS.OK,
203203
});
204204

packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/fabric-driver-server.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class FabricDriverServer {
9090
private readonly relayEndpoint: string;
9191
private readonly mock: boolean;
9292
private readonly events: Events;
93-
private readonly listner: Listener;
93+
private readonly listener: Listener;
9494

9595
private networkName: string = "network1";
9696
private monitorSyncPeriod: number = 30; // in seconds
@@ -153,7 +153,7 @@ export class FabricDriverServer {
153153
certificate: this.certificate,
154154
});
155155

156-
this.listner = new Listener({
156+
this.listener = new Listener({
157157
logLevel: this.loglevel,
158158
driver: this,
159159
chainCodeId: this.interopChainCode,
@@ -183,7 +183,7 @@ export class FabricDriverServer {
183183
}
184184

185185
public getListenerInstance(): Listener {
186-
return this.listner;
186+
return this.listener;
187187
}
188188

189189
public getEventsInstance(): Events {
@@ -276,14 +276,14 @@ export class FabricDriverServer {
276276
});
277277
return create(AckSchema, {
278278
requestId: newRequestId,
279-
message: "Mock Procesing addEventSubscription",
279+
message: "Mock Processing addEventSubscription",
280280
status: Ack_STATUS.OK,
281281
});
282282
} else {
283283
this.spawnSubscribeEventHelper(request, newRequestId);
284284
const ackResponse = create(AckSchema, {
285285
requestId: newRequestId,
286-
message: "Procesing addEventSubscription",
286+
message: "Processing addEventSubscription",
287287
status: Ack_STATUS.OK,
288288
});
289289
// gRPC response.
@@ -587,7 +587,7 @@ export class FabricDriverServer {
587587
this.logger.info("Starting monitor...");
588588
this.logger.info(`Monitor sync period: ${this.monitorSyncPeriod}`);
589589
while (true) {
590-
await this.listner.monitorBlockForMissedEvents(this.gatewayOptions);
590+
await this.listener.monitorBlockForMissedEvents(this.gatewayOptions);
591591
await delay(this.monitorSyncPeriod * 1000);
592592
}
593593
}
@@ -609,7 +609,7 @@ export class FabricDriverServer {
609609
}
610610

611611
// Register all listeners again
612-
const status = await this.listner.loadEventSubscriptionsFromStorage(
612+
const status = await this.listener.loadEventSubscriptionsFromStorage(
613613
this.gatewayOptions,
614614
);
615615
this.logger.info(`Load Event Subscriptions Status: ${status}`);

packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/weaver/listener.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
} from "./utils";
2727
import { Events } from "./events";
2828
import { FabricDriverServer } from "./fabric-driver-server";
29-
import * as fabproto6 from "fabric-protos";
29+
import * as FabricProto6 from "fabric-protos";
3030
import {
3131
GatewayOptions,
3232
GetBlockResponseDecodedV1,
@@ -232,14 +232,14 @@ export class Listener {
232232
// Parse the block data; typically there is only one element in this array but we will interate over it just to be safe
233233
const blockNum = block.header.number;
234234
const blockData = (
235-
(block as fabproto6.common.Block).data as fabproto6.common.BlockData
235+
(block as FabricProto6.common.Block).data as FabricProto6.common.BlockData
236236
).data;
237237
const blockMetadata = (
238-
(block as fabproto6.common.Block)
239-
.metadata as fabproto6.common.BlockMetadata
238+
(block as FabricProto6.common.Block)
239+
.metadata as FabricProto6.common.BlockMetadata
240240
).metadata;
241241
const txFilterIndex =
242-
fabproto6.common.BlockMetadataIndex.TRANSACTIONS_FILTER;
242+
FabricProto6.common.BlockMetadataIndex.TRANSACTIONS_FILTER;
243243
const txValid = blockMetadata[txFilterIndex];
244244
this.logger.debug(
245245
`Event ${loggerName}: block #${blockNum}, #Transactions: ${blockData.length}`,
@@ -256,7 +256,7 @@ export class Listener {
256256
`Event ${loggerName}: Transaction with TxId: ${tx_id}, index: ${index}`,
257257
);
258258

259-
if (txValid[index] === fabproto6.protos.TxValidationCode.VALID) {
259+
if (txValid[index] === FabricProto6.protos.TxValidationCode.VALID) {
260260
// Iterate through the transaction list
261261
transactions.forEach(async (transaction: any) => {
262262
// Check if block subscription and then call handle block event
@@ -326,7 +326,7 @@ export class Listener {
326326
});
327327
} else {
328328
this.logger.error(
329-
`Event ${loggerName}: Transaction with TxId: ${tx_id} is invalid with code ${txValid[index]}:${fabproto6.protos.TxValidationCode[txValid[index]]}. Discarding.`,
329+
`Event ${loggerName}: Transaction with TxId: ${tx_id} is invalid with code ${txValid[index]}:${FabricProto6.protos.TxValidationCode[txValid[index]]}. Discarding.`,
330330
);
331331
}
332332
});

0 commit comments

Comments
 (0)