Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove channel and chaincode operations from Fabric v1 connector #1411

Merged
merged 1 commit into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ const semver = require('semver');
const { DefaultEventHandlerStrategies, DefaultQueryHandlerStrategies, Gateway } = require('fabric-network');
const { ConnectorBase, CaliperUtils, TxStatus, ConfigUtil } = require('@hyperledger/caliper-core');
const FabricConnectorContext = require('../../FabricConnectorContext');
const FabricChannelOperations = require('./FabricChannelOperations');
const FabricChaincodeOperations = require('./FabricChaincodeOperations');

const logger = CaliperUtils.getLogger('connectors/v1/FabricGateway');

Expand Down Expand Up @@ -133,18 +131,14 @@ class V1FabricGateway extends ConnectorBase {
const tlsInfo = this.connectorConfiguration.isMutualTLS() ? 'mutual'
: ((await this.connectorConfiguration.getConnectionProfileDefinitionForOrganization(defaultOrganization)).isTLSEnabled() ? 'server' : 'none');
logger.info(`Fabric SDK version: ${this.fabricNetworkVersion.toString()}; TLS based on ${defaultOrganization}: ${tlsInfo}`);

const fabricChannelOperations = new FabricChannelOperations(this.connectorConfiguration);
await fabricChannelOperations.createChannelsAndJoinPeers();
}

/**
* Installs and initializes the specified contracts.
* @async
*/
async installSmartContract() {
const fabricChaincodeOperations = new FabricChaincodeOperations(this.connectorConfiguration);
await fabricChaincodeOperations.installAndInstantiateChaincodes();
logger.warn(`Install smart contract not available with Fabric SDK version: ${this.fabricNetworkVersion.toString()}`);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ const FabricConstants = require('fabric-client/lib/Constants');
const {ConnectorBase, CaliperUtils, TxStatus, Version, ConfigUtil} = require('@hyperledger/caliper-core');
const FabricConnectorContext = require('../../FabricConnectorContext');
const ClientCreator = require('./ClientCreator');
const FabricChannelOperations = require('./FabricChannelOperations');
const FabricChaincodeOperations = require('./FabricChaincodeOperations');
const logger = CaliperUtils.getLogger('connectors/v1/FabricNonGateway');

/**
Expand Down Expand Up @@ -129,18 +127,14 @@ class V1Fabric extends ConnectorBase {
const tlsInfo = this.connectorConfiguration.isMutualTLS() ? 'mutual'
: ((await this.connectorConfiguration.getConnectionProfileDefinitionForOrganization(defaultOrganization)).isTLSEnabled() ? 'server' : 'none');
logger.info(`Fabric SDK version: ${this.fabricNetworkVersion.toString()}; TLS based on ${defaultOrganization}: ${tlsInfo}`);

const fabricChannelOperations = new FabricChannelOperations(this.connectorConfiguration);
await fabricChannelOperations.createChannelsAndJoinPeers();
}

/**
* Installs and initializes the specified contracts.
* @async
*/
async installSmartContract() {
const fabricChaincodeOperations = new FabricChaincodeOperations(this.connectorConfiguration);
await fabricChaincodeOperations.installAndInstantiateChaincodes();
logger.warn(`Install smart contract not available with Fabric SDK version: ${this.fabricNetworkVersion.toString()}`);
}

/**
Expand Down
5 changes: 1 addition & 4 deletions packages/caliper-fabric/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"semver": "7.1.1"
},
"devDependencies": {
"fabric-protos": "2.1.0",
"chai": "^3.5.0",
"chai-as-promised": "^7.1.1",
"eslint": "^5.16.0",
Expand Down Expand Up @@ -88,8 +87,6 @@
"lib/identity-management/IWallet*",
"lib/connector-versions/v1/fabric-gateway.js",
"lib/connector-versions/v1/fabric.js",
"lib/connector-versions/v1/FabricChaincodeOperations.js",
"lib/connector-versions/v1/FabricChannelOperations.js",
"lib/connector-versions/v2/fabric-gateway.js",
"lib/connector-versions/v2/registrarHelper.js"
],
Expand All @@ -105,4 +102,4 @@
"lines": 1
},
"license": "Apache-2.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,6 @@ describe('A Node-SDK V1 Fabric Gateway', () => {
mockery.registerMock('fabric-client', Client);
mockery.registerMock('fabric-client/lib/Constants', Constants);
mockery.registerMock('fabric-network/package', {version: '1.4.11'});
mockery.registerMock('./FabricChannelOperations', class {
/** */
async createChannelsAndJoinPeers() {}
});
mockery.registerMock('./FabricChaincodeOperations', class {
/** */
async installAndInstantiateChaincodes() {}
});

FabricGateway = require('../../../lib/connector-versions/v1/FabricGateway');
GenerateWallet = require('../../utils/GenerateWallet');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ describe('A Node-SDK V1 Fabric Non Gateway', () => {
mockery.registerMock('fabric-client', Client);
mockery.registerMock('fabric-client/lib/Constants', Constants);
mockery.registerMock('fabric-client/package', {version: '1.4.11'});
mockery.registerMock('./FabricChannelOperations', class {
/** */
async createChannelsAndJoinPeers() {}
});
mockery.registerMock('./FabricChaincodeOperations', class {
/** */
async installAndInstantiateChaincodes() {}
});

FabricNonGateway = require('../../../lib/connector-versions/v1/FabricNonGateway');
FabricConnectorContext = require('../../../lib/FabricConnectorContext');
Expand Down