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

Copm register assets in chaincode #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"Hursley",
"HyperLedger",
"immalleable",
"imodule",
"ipaddress",
"ipfs",
"IPFSHTTP",
Expand Down
6 changes: 5 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
**/node_modules/**
**/dist/**

**/build/**
docs/*
examples/cactus-example-carbon-accounting-frontend/www/
examples/cactus-example-supply-chain-frontend/www/
weaver/core/identity-management/iin-agent/out/
Expand Down Expand Up @@ -32,6 +33,8 @@ weaver/common/policy-dsl/parser/PolicyParser.js
weaver/common/policy-dsl/test/MyErrorListener.js
weaver/common/policy-dsl/test/MyParseTreeVisitor.js
weaver/common/protos-js/driver/driver_grpc_pb.js
weaver/common/protos-sol/solidity-protos/soltest/test/TestFixture.js
weaver/common/protos-sol/solidity-protos/soltest/migrations/1_deploy_contract.js
weaver/core/drivers/fabric-driver/server/dbConnector.ts
weaver/core/drivers/fabric-driver/server/events.ts
weaver/core/drivers/fabric-driver/server/fabric-code.ts
Expand Down Expand Up @@ -106,3 +109,4 @@ weaver/sdks/fabric/interoperation-node-sdk/src/helpers.ts
weaver/sdks/fabric/interoperation-node-sdk/test/AssetManager.js
weaver/sdks/fabric/interoperation-node-sdk/test/InteroperableHelper.js
weaver/sdks/fabric/interoperation-node-sdk/test/Relay.js
weaver/sdks/fabric/interoperation-node-sdk/protos-js/driver/driver_grpc_pb.js
42 changes: 38 additions & 4 deletions .github/actions/copm_test/action.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
name: 'Copm Test'
description: "common setup steps for the weaver network needed to run copm tests"
inputs:
github-actor:
description: the github actor variable
required: true
github-token:
description: the github secret token variable
required: true
runs:
using: "composite"
steps:
- name: free github runner disk space
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Use Node.js ${{ env.NODEJS_VERSION }}
uses: actions/setup-node@v4.0.2
with:
Expand All @@ -22,15 +36,35 @@ runs:
cargo update -p nom
cargo update -p lexical-core
working-directory: weaver/core/relay
- uses: actions/setup-go@v4
with:
go-version: '1.20.2'
- 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
- name: Set up JDK 17
uses: actions/setup-java@v3.11.0
with:
java-version: '17'
distribution: 'adopt'
- name: Generate github.properties
shell: bash
working-directory: packages/cacti-plugin-copm-fabric
run: |
echo "Using ${{ inputs.github-actor }} user."
{
echo "username=${{ inputs.github-actor }}"
echo "password=${{ inputs.github-token }}"
echo "url=https://maven.pkg.github.com/hyperledger/cacti"
} >> github.properties
{
echo "username=${{ inputs.github-actor }}"
echo "password=${{ inputs.github-token }}"
echo "url=https://maven.pkg.github.com/hyperledger/cacti"
} >> github.main.properties
working-directory: weaver/tests/network-setups/corda


12 changes: 9 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
plugin-htlc-coordinator-besu-changed: ${{ steps.changes.outputs.plugin-htlc-coordinator-besu-changed }}
test-tooling-changed: ${{ steps.changes.outputs.test-tooling-changed }}
ghcr-dev-container-vscode-changed: ${{ steps.changes.outputs.ghcr-dev-container-vscode-changed }}
plugin-copm-fabric-changed: ${{ steps.changes.outputs.plugin-copm-fabric-changed }}
copm-changed: ${{ steps.changes.outputs.copm-changed }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.1.7
Expand Down Expand Up @@ -175,9 +175,15 @@ jobs:
- './packages/cactus-plugin-keychain-memory/**'
# - './.github/workflows/ci.yaml'

plugin-copm-fabric-changed:
copm-changed:
- './packages/cactus-common/**'
- './packages/cactus-core/**'
- './packages/cactus-core-api/**'
- './packages/cacti-copm-common/**'
- './packages/cacti-copm-test/**'
- './packages/cacti-plugin-copm-fabric/**'
- './packages/cacti-plugin-copm-corda/**'
- './weaver/**'

build-dev:
needs: check-ci-skip
Expand Down Expand Up @@ -1471,7 +1477,7 @@ jobs:
needs:
- build-dev
- compute_changed_packages
if: needs.compute_changed_packages.outputs.plugin-copm-fabric-changed == 'true'
if: needs.compute_changed_packages.outputs.copm-changed == 'true'
uses: ./.github/workflows/test_copm.yaml


Expand Down
138 changes: 80 additions & 58 deletions .github/workflows/test_copm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,84 @@ env:
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/**/
matrix-pledge-and-getview:
name: pledge-getview-${{ matrix.net1 }}-${{ matrix.net2 }}
strategy:
fail-fast: false
matrix:
net1: ["fabric", "corda"]
net2: ["fabric", "corda"]
env:
FULL_BUILD_DISABLED: true
FREE_UP_GITHUB_RUNNER_DISK_SPACE_DISABLED: false
JEST_TEST_PATTERN: packages/cacti-copm-test/src/test/typescript/integration/test-copm-getverifiedview.test.ts packages/cacti-copm-test/src/test/typescript/integration/test-copm-pledge-claim.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/copm-pledge-${{ matrix.net1 }}-${{ matrix.net2}}
JEST_TEST_CODE_COVERAGE_ENABLED: true
TAPE_TEST_PATTERN: ''
TAPE_TEST_RUNNER_DISABLED: true
COPM_NET_1: ${{ matrix.net1 }}
COPM_NET_2: ${{ matrix.net2 }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.1.1
- uses: ./.github/actions/copm_test/
with:
github-actor: ${GITHUB_ACTOR}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Make the ${{matrix.net1}} network
run: |
make setup; make pledge-network
working-directory: packages/cacti-plugin-copm-${{ matrix.net1 }}
- name: Make the ${{matrix.net2}} network
run: |
make setup; make pledge-network
working-directory: packages/cacti-plugin-copm-${{ matrix.net2 }}
if: ${{ matrix.net1 != matrix.net2 }}
- 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: copm-pledge-${{ matrix.net1 }}-${{ matrix.net2}}
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/**/
matrix-lock:
name: lock-${{ matrix.net1 }}
strategy:
fail-fast: false
matrix:
net1: ["fabric", "corda"]
env:
FULL_BUILD_DISABLED: true
FREE_UP_GITHUB_RUNNER_DISK_SPACE_DISABLED: false
TAPE_TEST_PATTERN: ''
TAPE_TEST_RUNNER_DISABLED: true
JEST_TEST_PATTERN: packages/cacti-copm-test/src/test/typescript/integration/test-copm-lock-claim.test.ts
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_COVERAGE_PATH: ./code-coverage-ts/copm-lock-${{ matrix.net1 }}
JEST_TEST_CODE_COVERAGE_ENABLED: true
COPM_NET_1: ${{ matrix.net1 }}
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4.1.1
- uses: ./.github/actions/copm_test/
with:
github-actor: ${GITHUB_ACTOR}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Make the ${{matrix.net1}} network
run: |
make setup; make lock-network
working-directory: packages/cacti-plugin-copm-${{ matrix.net1 }}
- 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: copm-lock-${{ matrix.net1 }}
path: ./code-coverage-ts/**/

3 changes: 2 additions & 1 deletion docs/scripts/publish_openapi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import os.path
import re
import subprocess
import json
import shutil
Expand Down Expand Up @@ -65,7 +66,7 @@ def get_openapi_files(root_dir):
for openapi_file in get_openapi_files(package['location']):
if not package_group in apis_by_group:
apis_by_group[package_group] = []
package_basename = package['name'].replace('@hyperledger/','')
package_basename = re.sub(r'@.*\/', '', package['name'])
publish_openapi(package_basename, openapi_file)
print(f"{package_group} : {package_basename}")
apis_by_group[package_group].append(package_basename)
Expand Down
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ module.exports = {
logHeapUsage: true,
testEnvironment: "node",
moduleNameMapper: {
"./build/src/(.*js)": "./dist/lib/$1", // special handling for weaver/sdks/fabric/interoperation-node-sdk
"^(\\.\\.?\\/.+)\\.jsx?$": "$1",
},
modulePathIgnorePatterns: ["./weaver/core/identity-management", "./weaver/core/", ],
maxWorkers: 1,
maxConcurrency: 1,
setupFilesAfterEnv: ["jest-extended/all", "./jest.setup.console.logs.js"],
Expand Down
Loading
Loading