Skip to content

Commit

Permalink
fix(weaver-membership-functions): reverted earlier buggy change affec…
Browse files Browse the repository at this point in the history
…ting identity mgmt

Partially reverting changes made in https://github.com/hyperledger/cacti/pull/2901.
These changes made the IIN Agent chaincode operations fail.
Also fixed typos and formatting in the docs.

Signed-off-by: VRamakrishna <[email protected]>
  • Loading branch information
VRamakrishna authored and sandeepnRES committed Dec 21, 2023
1 parent e679801 commit faf90dd
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Prepare `fabric-cli` for configuration suitably as follows.
```bash
./bin/fabric-cli env set-file ./.env
```

| Notes |
|:------|
| If the `CONFIG_PATH` environment variable is omitted from `.env`, then you must also run:<br/>```./bin/fabric-cli config set-file ./config.json``` |
Expand Down Expand Up @@ -166,6 +167,7 @@ Prepare `fabric-cli` for configuration suitably as follows.
```bash
./bin/fabric-cli env set-file ./.env
```

| Notes |
|:------|
| If the `CONFIG_PATH` environment variable is omitted from `.env`, then you must also run:<br/>```./bin/fabric-cli config set-file ./config.json``` |
Expand Down Expand Up @@ -283,6 +285,7 @@ Prepare `fabric-cli` for configuration suitably as follows.
```
./bin/fabric-cli env set-file ./.env
```

| Notes |
|:------|
| If the `CONFIG_PATH` environment variable is omitted from `.env`, then you must also run:<br/>```./bin/fabric-cli config set-file ./config.json``` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Before starting, make sure you have the following software installed on your hos
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
```
| Notes |
|:------|
| The latest version at present is `3.15.6`, but you should check the above link to find the most current version before running the above steps. |
Expand Down Expand Up @@ -273,6 +274,7 @@ make build-image-local
#### Deployment

Use the following steps to run Fabric IIN Agents in Docker containers:

* The `.env.n1.org1` and `.env.n1.org1.tls` files in the `docker-testnet/envs` directory contain environment variables used by the iin-agent of `org1` of `network1` at startup and runtime. Edit either of these files (depending on whether you wish to start the relay with or without TLS) as follows:
- Replace `<PATH-TO-WEAVER>` with the absolute path of the `weaver` folder within your Cacti repository clone.
- Update the following value:
Expand Down Expand Up @@ -439,7 +441,7 @@ Navigate to the `weaver/core/relay` folder. Refer [here](#building-relay-image)
```
* The `.env.corda` and `.env.corda.tls` files in the `docker/testnet-envs` directory contain environment variables used by the `Corda_Network` relay at startup and runtime. Edit either of these files (depending on whether you wish to start the relay with or without TLS), and update the following value:
```
DOCKER_IMAGE_NAME=weaver-relay-server
DOCKER_IMAGE_NAME=cacti-weaver-relay-server
```
* Repeat the above step for `.env.corda2` or `.env.corda2.tls` in `docker/testnet-envs` directory, which contain environment variables for the `Corda_Network2` relay.
* To deploy the relay server for `Corda_Network` without TLS, run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Before starting, make sure you have the following software installed on your hos
go install google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
```
| Notes |
|:------|
| The latest version at present is `3.15.6`, but you should check the above link to find the most current version before running the above steps. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ IIN Agent is a client of a member of a DLT network or security domain with speci
#### Deployment
Use the following steps to run Fabric IIN Agents in Docker containers:
* The `.env.n1.org1` and `.env.n1.org1.tls` files in the `docker-testnet/envs` directory contain environment variables used by the iin-agent of `org1` of `network1` at startup and runtime. Edit either of these files (depending on whether you wish to start the relay with or without TLS) as follows:
- Replace `<PATH-TO-WEAVER>` with the absolute path of the `weaver` folder within your Cacti repository clone.
- If Fabric network was started with 1 org, and IIN Agents are to be started with TLS enabled, update the `DNS_CONFIG_PATH` variable as:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ func (s *SmartContract) CreateLocalMembership(ctx contractapi.TransactionContext
if err != nil {
return fmt.Errorf("Unmarshal error: %s", err)
}
membership.SecurityDomain = membershipLocalSecurityDomain

membershipLocalKey, err := ctx.GetStub().CreateCompositeKey(membershipObjectType, []string{membershipLocalSecurityDomain})
acp, getErr := ctx.GetStub().GetState(membershipLocalKey)
Expand Down Expand Up @@ -221,7 +220,6 @@ func (s *SmartContract) UpdateLocalMembership(ctx contractapi.TransactionContext
if err != nil {
return fmt.Errorf("Unmarshal error: %s", err)
}
membership.SecurityDomain = membershipLocalSecurityDomain

membershipLocalKey, err := ctx.GetStub().CreateCompositeKey(membershipObjectType, []string{membershipLocalSecurityDomain})
_, getErr := s.GetMembershipBySecurityDomain(ctx, membershipLocalSecurityDomain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ const loadLocalHelper = async (
registerUser: false
})
try {
const response = await MembershipManager.createLocalMembership(gateway, members, channelName, contractName)
const response = await MembershipManager.createLocalMembership(gateway, members, networkName, channelName, contractName)
logger.info('CreateLocalMembership Successful.')
} catch (e) {
logger.error(e)
logger.info('CreateLocalMembership attempting Update')
const response = await MembershipManager.updateLocalMembership(gateway, members, channelName, contractName)
const response = await MembershipManager.updateLocalMembership(gateway, members, networkName, channelName, contractName)
logger.info('UpdateLocalMembership response: success: ', response)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ import { handlePromise, promisifyAll } from './helpers'
async function createLocalMembership(
gateway: Gateway,
memberMspIds: Array<string>,
securityDomain: string,
channelName: string,
weaverCCId: string
): Promise<any> {
const network = await gateway.getNetwork(channelName)
const membership = getMSPConfigurations(network, memberMspIds)
membership.setSecuritydomain('')
membership.setSecuritydomain(securityDomain)
const membership64 = Buffer.from(membership.serializeBinary()).toString('base64')
const contract = network.getContract(weaverCCId)
return await contract.submitTransaction("CreateLocalMembership", membership64);
Expand All @@ -36,12 +37,13 @@ async function createLocalMembership(
async function updateLocalMembership(
gateway: Gateway,
memberMspIds: Array<string>,
securityDomain: string,
channelName: string,
weaverCCId: string
): Promise<any> {
const network = await gateway.getNetwork(channelName)
const membership = getMSPConfigurations(network, memberMspIds)
membership.setSecuritydomain('')
membership.setSecuritydomain(securityDomain)
const membership64 = Buffer.from(membership.serializeBinary()).toString('base64')
const contract = network.getContract(weaverCCId)
return await contract.submitTransaction("UpdateLocalMembership", membership64);
Expand Down

0 comments on commit faf90dd

Please sign in to comment.