-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(copm): add fabric COPM implementation
Primary Change: - add connectRPC cactus plugin for copm primitives Secondary Changes: - add common COPM prototypes - add common weaver protos-js directory to enable building under ci.yaml, which requires all local dependencies to be present at build time - remove incorrect 'main' declaration in protos-js package file - add separate tsconfig file to /weaver/sdks/fabric/interoperation-node-sdk to allow it to be built by ci.yaml - update weaver fabric network makefile 'clean' target to continue if some target files were not generated by the make process Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: Jennifer Bell <jenniferlianne@gmail.com> Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
- Loading branch information
Showing
164 changed files
with
37,569 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ | |
"commenceack", | ||
"configtx", | ||
"connectrpc", | ||
"Copm", | ||
"Corda", | ||
"Cordapp", | ||
"couchdb", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: 'Copm Test' | ||
description: "common setup steps for the weaver network needed to run copm tests" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Use Node.js ${{ env.NODEJS_VERSION }} | ||
uses: actions/setup-node@v4.0.2 | ||
with: | ||
node-version: ${{ env.NODEJS_VERSION }} | ||
- id: yarn-cache | ||
name: Restore Yarn Cache | ||
uses: actions/cache@v4.0.1 | ||
with: | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} | ||
path: ./.yarn/ | ||
restore-keys: | | ||
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }} | ||
- name: Get Latest Relay Dependencies | ||
shell: bash | ||
run: | | ||
make protos-local | ||
cargo update -p nom | ||
cargo update -p lexical-core | ||
working-directory: weaver/core/relay | ||
- name: Use Protoc 3.15 | ||
shell: bash | ||
run: | | ||
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip | ||
unzip protoc-3.15.6-linux-x86_64.zip -d protoc | ||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | ||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.4.0 | ||
# PROTOS | ||
- name: Build local weaver dependencies | ||
run: make setup --trace | ||
shell: bash | ||
working-directory: packages/cacti-plugin-copm-fabric |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
workflow_call: | ||
|
||
env: | ||
NODEJS_VERSION: v18.18.2 | ||
RUN_TRIVY_SCAN: true | ||
RUN_CODE_COVERAGE: true | ||
|
||
jobs: | ||
copm-fabric-fabric-pledge-and-provestate: | ||
continue-on-error: false | ||
env: | ||
CACTI_NPM_PACKAGE_NAME: "@hyperledger-cacti/cacti-plugin-copm-fabric" | ||
HFC_LOGGING: '{"debug":"console","info":"console","warn": "console","error":"console"}' | ||
FULL_BUILD_DISABLED: true | ||
FREE_UP_GITHUB_RUNNER_DISK_SPACE_DISABLED: false | ||
JEST_TEST_PATTERN: packages/cacti-plugin-copm-fabric/src/test/typescript/integration/test-copm-pledge-claim.test.ts packages/cacti-plugin-copm-fabric/src/test/typescript/integration/test-copm-getverifiedview.test.ts | ||
JEST_TEST_RUNNER_DISABLED: false | ||
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/plc-copm-fabric-fabric-pledge | ||
JEST_TEST_CODE_COVERAGE_ENABLED: true | ||
TAPE_TEST_PATTERN: "" | ||
TAPE_TEST_RUNNER_DISABLED: true | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4.1.1 | ||
- uses: ./.github/actions/copm_test/ | ||
- name: Make the fabric network | ||
run: make pledge-network --trace | ||
working-directory: packages/cacti-plugin-copm-fabric | ||
- name: show the running network | ||
run: docker container ls | ||
- run: ./tools/ci.sh | ||
- name: Upload coverage reports as artifacts | ||
if: ${{ env.RUN_CODE_COVERAGE == 'true' }} | ||
uses: actions/upload-artifact@v4.3.3 | ||
with: | ||
name: coverage-reports-copm-fabric | ||
path: ./code-coverage-ts/**/ | ||
|
||
copm-fabric-fabric-lock: | ||
continue-on-error: false | ||
env: | ||
CACTI_NPM_PACKAGE_NAME: "@hyperledger-cacti/cacti-plugin-copm-fabric" | ||
HFC_LOGGING: '{"debug":"console","info":"console","warn": "console","error":"console"}' | ||
FULL_BUILD_DISABLED: true | ||
FREE_UP_GITHUB_RUNNER_DISK_SPACE_DISABLED: false | ||
JEST_TEST_PATTERN: packages/cacti-plugin-copm-fabric/src/test/typescript/integration/test-copm-lock-claim.test.ts | ||
JEST_TEST_RUNNER_DISABLED: false | ||
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/plc-copm-fabric-fabric-lock | ||
JEST_TEST_CODE_COVERAGE_ENABLED: true | ||
TAPE_TEST_PATTERN: "" | ||
TAPE_TEST_RUNNER_DISABLED: true | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4.1.1 | ||
- uses: ./.github/actions/copm_test/ | ||
- name: Make the fabric network | ||
run: make lock-network --trace | ||
working-directory: packages/cacti-plugin-copm-fabric | ||
- name: show the running network | ||
run: docker container ls | ||
- run: ./tools/ci.sh | ||
- name: Upload coverage reports as artifacts | ||
if: ${{ env.RUN_CODE_COVERAGE == 'true' }} | ||
uses: actions/upload-artifact@v4.3.3 | ||
with: | ||
name: coverage-reports-copm-fabric-lock | ||
path: ./code-coverage-ts/**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# @hyperledger-cacti/cacti-copm-core | ||
|
||
This package defines the common types, interfaces, and endpoints for the | ||
COPM module to be used by Digital Ledger-specific implementations. | ||
|
||
These endpoints require specific chaincode and weaver relays to be deployed on the network. | ||
Please see https://hyperledger-cacti.github.io/cacti/weaver/introduction/. | ||
|
||
Endpoint documentation: | ||
https://jenniferlianne.github.io/cacti/references/openapi/cacti-copm-core_openapi/ | ||
|
||
# Usage | ||
|
||
## Installation | ||
|
||
Yarn: | ||
|
||
yarn add --exact @hyperledger-cacti/cacti-copm-core | ||
|
||
|
||
# Development | ||
|
||
When implementing a new distributed ledger, the following interfaces must be implemented: | ||
|
||
- DLTransactionContext: Implements running a transaction on the local network | ||
- DLRemoteTransactionContext: Uses the weaver relays to run a transaction on another network | ||
- DLTransactionContextFactory: Factory to return either local or remote context for the specific DLT. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: v1 | ||
plugins: | ||
# This will invoke protoc-gen-es and write output to src/gen | ||
- plugin: es | ||
out: src/main/typescript/generated | ||
opt: | ||
# Add more plugin options here | ||
- target=ts | ||
# This will invoke protoc-gen-connect-es | ||
- plugin: connect-es | ||
out: src/main/typescript/generated | ||
opt: | ||
# Add more plugin options here | ||
- target=ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", | ||
"spaces": 2, | ||
"generator-cli": { | ||
"version": "6.6.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"name": "@hyperledger-cacti/cacti-copm-core", | ||
"version": "2.0.0", | ||
"description": "Cacti Common Operators", | ||
"homepage": "https://github.com/hyperledger-cacti/cacti#readme", | ||
"bugs": { | ||
"url": "https://github.com/hyperledger-cacti/cacti/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/hyperledger-cacti/cacti.git" | ||
}, | ||
"license": "Apache-2.0", | ||
"author": "Jennifer Bell", | ||
"main": "dist/lib/main/typescript/index.js", | ||
"module": "dist/lib/main/typescript/index.js", | ||
"types": "dist/lib/main/typescript/index.d.ts", | ||
"files": [ | ||
"dist/*" | ||
], | ||
"scripts": { | ||
"bundleopenapi": "yarn run --top-level tools:bundle-open-api-tpl-files", | ||
"codegen": "yarn run --top-level run-s 'codegen:*'", | ||
"codegen:proto": "yarn run proto:openapi; yarn run proto:connectrpc", | ||
"dev:redo": "yarn run bundleopenapi; yarn run codegen:proto", | ||
"proto:connectrpc": "yarn run buf generate --template=./buf.gen.yaml ./src/main/proto/generated/openapi", | ||
"proto:openapi": "yarn run --top-level openapi-generator-cli generate -i ./src/main/json/openapi.json -g protobuf-schema --model-name-suffix=PB --language-specific-primitives=google.protobuf.Any --type-mappings=AnyType=google.protobuf.Any --type-mappings=object=google.protobuf.Any --additional-properties=packageName=org.hyperledger.cacti.plugin.cacti.plugin.copm.core -o ./src/main/proto/generated/openapi/ -t=./src/main/mustache/openapi-generator/templates/protobuf-schema/ --ignore-file-override ../../openapi-generator-ignore" | ||
}, | ||
"dependencies": { | ||
"@bufbuild/buf": "1.30.0", | ||
"@bufbuild/protobuf": "1.10.0", | ||
"@connectrpc/connect": "1.4.0", | ||
"@hyperledger/cacti-weaver-sdk-fabric": "2.0.0", | ||
"@hyperledger/cactus-common": "2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@bufbuild/protoc-gen-es": "1.8.0", | ||
"@connectrpc/connect-node": "1.4.0", | ||
"@connectrpc/protoc-gen-connect-es": "1.4.0", | ||
"@openapitools/openapi-generator-cli": "2.7.0" | ||
} | ||
} |
Oops, something went wrong.