Skip to content

Commit

Permalink
feat(satp-hermes): add API1 layer WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(satp-hermes): BLO API specification

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(satp-hermes): add BLO layer

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

fix(satp-hermes): fix status endpoint and spec

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

fix(satp-hermes): fix lint

Signed-off-by: André Augusto <andre.augusto@tecnico.ulisboa.pt>

ci(satp-hermes): rebase and update ci

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(satp-hermes): update BLO specification

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

docs(satp-hermes): migrate BLO open api spec from json to yml

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(satp-hermes): update Go BLO SDK generation

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(satp-hermes): update BLO specification

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(satp-hermes): add health check endpoint to BLO spec

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

fix(satp-hermes): re-add open-api json files

The canonical source for the API definition are the yaml files located at packages/cactus-plugin-satp-hermes/src/main/yml/openapi.yml, due to its better readability compared to json. When yarn codegen is ran within the cactus-plugin-satp-hermes package, the json files are generated from the yaml.

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

 feat(satp-hermes): remove deprecated spec

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): add gateway coordinator WIP

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(bungee): add skeleton for bungee

Signed-off-by: André Augusto <andre.augusto@tecnico.ulisboa.pt>

refactor(plugin-satp-hermes): update messages formats SATP core version 2.0.0 OpenAPI

* created new messages in openAPI definition

feat(bungee): fix bungee dependencies

Signed-off-by: André Augusto <andre.augusto@tecnico.ulisboa.pt>

feat(SATP-Hermes): gateway coordinator

feat(SATP-Hermes): gateway coordinator

feat(SATP-Hermes): gateway coordinator WIP

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

test(SATP-Hermes): enable decorators needed for gateway coordinator checks

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

docs(SATP-Hermes): update package.json

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): remove kotlin sdk, add protobuffer

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): protobuf structure

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): protobuf structure

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): refactor naming

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): protobuf structure improvements

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): update yarn.lock and clean up

Signed-off-by: André Augusto <andre.augusto@tecnico.ulisboa.pt>

refactor(test-tooling): fix types of streams: use NodeJS.ReadableStream

1. The container management library that we use in the test infrastructure
(called dockerode) is expecting streams that are defined in the global
namespace of the `@types/node` library, e.g. the standard library of NodeJS
itself.
2. Previously we were using the "streams" package to provide type information
to the streams that we were passing around to dockerode and it was working
fine, but after some changes that seem unrelated this has broken the
compilation process.
3. The mentioned changes are not yet on the main branch, but we expect
them to be there soon and so this change is laying the groundwork for that
by pre-emptively fixing the broken build's root cause which is that the
test-tooling package does not declare it's typings related dependencies
correctly: It implicitly uses the NodeJS standard library's types but
so far had not declared them on the package level.
4. This change is therefore to rectify the issue of the `@types/node`
dependency missing from the test-tooling package and also the refactoring
of some of the test ledger classes which were relying on the `streams`
builtin package instead of correctly using the NodeJS.ReadableStream global.
5. Earlier the reasoning for this was that we try to avoid pulling in
types from the global scope because we try to avoid any sort of dependency
on the global scope in general. Once we have proof though that this is
causing issues with the build, then we must give up the principle for
practical reasons (and only in the minimum viable scope, e.g. this does
not change the fact that everywhere else in the codebase we should still
do our best to avoid using the global scoped classes, types, functions,
etc..).

Thank you to @AndreAugusto11 and @RafaelAPB for pointing out this issue
through the pull request of his that is currently being worked on at the
time of this writing:
RafaelAPB#72

Related to but does not address #2811

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>

refactor(SATP-Hermes): remove unused packages

* updated openapi version
* updated bungee plugin version to 2.0.0-alpha.2

Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com>

Signed-off-by: André Augusto <andre.augusto@tecnico.ulisboa.pt>
Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>

fix(satp-hermes): re-add open-api json files

The canonical source for the API definition are the yaml files located at packages/cactus-plugin-satp-hermes/src/main/yml/openapi.yml, due to its better readability compared to json. When yarn codegen is ran within the cactus-plugin-satp-hermes package, the json files are generated from the yaml.

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

ci(satp-hermes): re-activate satp-hermes ci

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

fixup: update package json, ci, yarn lock

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): add gateway coordinator WIP

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(bungee): add skeleton for bungee

Signed-off-by: André Augusto <andre.augusto@tecnico.ulisboa.pt>

refactor(plugin-satp-hermes): update messages formats SATP core version 2.0.0 OpenAPI

* created new messages in openAPI definition

feat(bungee): fix bungee dependencies

Signed-off-by: André Augusto <andre.augusto@tecnico.ulisboa.pt>

feat(SATP-Hermes): gateway coordinator

feat(SATP-Hermes): gateway coordinator

feat(SATP-Hermes): gateway coordinator WIP

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

test(SATP-Hermes): enable decorators needed for gateway coordinator checks

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

docs(SATP-Hermes): update package.json

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): remove kotlin sdk, add protobuffer

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): protobuf structure

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): protobuf structure

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

refactor(SATP-Hermes): refactor naming

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): protobuf structure improvements

Signed-off-by: Rafael Belchior <rafael.belchior@tecnico.ulisboa.pt>

feat(SATP-Hermes): update yarn.lock and clean up

Signed-off-by: André Augusto <andre.augusto@tecnico.ulisboa.pt>

refactor(test-tooling): fix types of streams: use NodeJS.ReadableStream

1. The container management library that we use in the test infrastructure
(called dockerode) is expecting streams that are defined in the global
namespace of the `@types/node` library, e.g. the standard library of NodeJS
itself.
2. Previously we were using the "streams" package to provide type information
to the streams that we were passing around to dockerode and it was working
fine, but after some changes that seem unrelated this has broken the
compilation process.
3. The mentioned changes are not yet on the main branch, but we expect
them to be there soon and so this change is laying the groundwork for that
by pre-emptively fixing the broken build's root cause which is that the
test-tooling package does not declare it's typings related dependencies
correctly: It implicitly uses the NodeJS standard library's types but
so far had not declared them on the package level.
4. This change is therefore to rectify the issue of the `@types/node`
dependency missing from the test-tooling package and also the refactoring
of some of the test ledger classes which were relying on the `streams`
builtin package instead of correctly using the NodeJS.ReadableStream global.
5. Earlier the reasoning for this was that we try to avoid pulling in
types from the global scope because we try to avoid any sort of dependency
on the global scope in general. Once we have proof though that this is
causing issues with the build, then we must give up the principle for
practical reasons (and only in the minimum viable scope, e.g. this does
not change the fact that everywhere else in the codebase we should still
do our best to avoid using the global scoped classes, types, functions,
etc..).

Thank you to @AndreAugusto11 and @RafaelAPB for pointing out this issue
through the pull request of his that is currently being worked on at the
time of this writing:
RafaelAPB#72

Related to but does not address #2811

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>

refactor(SATP-Hermes): remove unused packages

* updated openapi version
* updated bungee plugin version to 2.0.0-alpha.2

Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com>

Signed-off-by: André Augusto <andre.augusto@tecnico.ulisboa.pt>
Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
  • Loading branch information
RafaelAPB authored and rafaelbelchiorbd committed Aug 23, 2024
1 parent e590b03 commit 4342957
Show file tree
Hide file tree
Showing 124 changed files with 30,040 additions and 2,285 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,31 @@ jobs:
with:
name: coverage-reports-36
path: ./code-coverage-ts/**/
cactus-plugin-bungee-hermes:
continue-on-error: false
env:
FULL_BUILD_DISABLED: true
JEST_TEST_RUNNER_DISABLED: false
JEST_TEST_PATTERN: packages/cactus-plugin-bungee-hermes/src/test/typescript/(unit|integration|benchmark)/.*/*.test.ts
TAPE_TEST_RUNNER_DISABLED: true
needs: build-dev
runs-on: ubuntu-22.04
steps:
- name: Use Node.js ${{ env.NODEJS_VERSION }}
uses: actions/setup-node@v3.6.0
with:
node-version: ${{ env.NODEJS_VERSION }}
- uses: actions/checkout@v3.5.2

- id: yarn-cache
name: Restore Yarn Cache
uses: actions/cache@v3.3.1
with:
key: ${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
path: ./.yarn/
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('./yarn.lock') }}
- run: ./tools/ci.sh
ct-api-client:
continue-on-error: false
env:
Expand Down Expand Up @@ -2632,4 +2657,4 @@ name: Cactus_CI
push:
branches:
- main
- dev
- dev
31 changes: 24 additions & 7 deletions packages/cactus-plugin-satp-hermes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
"name": "@hyperledger/cactus-plugin-satp-hermes",
"version": "2.0.0-rc.2",
"description": "SATP-Hermes implementation of SATP.",
"customMetadata": {
"satp-draft-versions": {
"satp-core": "02",
"satp-architecture": "02",
"satp-crash": "02"
}
},
"keywords": [
"Hyperledger",
"Integration",
Expand Down Expand Up @@ -46,16 +53,23 @@
"build": "run-p tsc codegen",
"build-proto": "buf build --path src/main/proto --verbose",
"build:dev:backend:postbuild": "mkdir -p ./dist/lib/knex && cp -r ./src/knex/* ./dist/lib/knex",
"bundle-openapi-yaml": "swagger-cli bundle ./src/main/yml/bol/openapi-blo.yml -o ./src/main/yml/bol/openapi-blo-bundled.yml -r -t yaml",
"bundle-openapi-json": "swagger-cli bundle ./src/main/yml/bol/openapi-blo.yml -o ./src/main/json/openapi-blo-bundled.json -r -t json",
"bundle-openapi-gateway-json": "swagger-cli bundle ./src/main/yml/openapi.yml -o ./src/main/json/openapi-gateway-bundled.json -r -t json",
"codegen": "run-p 'codegen:*'",
"codegen:openapi": "npm run generate-sdk",
"codegen:proto": "npm run generate-proto",
"generate-proto": "cd src/main/proto && buf generate --template buf.gen.yaml --config buf.yaml --verbose",
"generate-sdk": "run-p 'generate-sdk:*'",
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"lint": "npm-run-all 'buf lint' eslint '*/*/src/**/*.{js,ts}' --quiet --fix && cspell \"*/*/src/**/*.{js,ts}\"",
"lint-protobuf": "buf lint --path src/main/proto --verbose",
"generate-sdk:typescript-axios-bol": "yarn bundle-openapi-yaml && yarn bundle-openapi-json && openapi-generator-cli generate -i ./src/main/yml/bol/openapi-blo-bundled.yml -g typescript-axios -o ./src/main/typescript/generated/openapi-blo/typescript-axios/ --reserved-words-mappings protected=protected --enable-post-process-file",
"generate-sdk:typescript-axios-gateway": "yarn bundle-openapi-gateway-json && openapi-generator-cli generate -i ./src/main/json/openapi-gateway-bundled.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/ --reserved-words-mappings protected=protected --ignore-file-override ../../openapi-generator-ignore",
"generate-sdk:go": "openapi-generator-cli generate -i ./src/main/yml/bol/openapi-blo-bundled.yml -g go -o ./src/main/go/generated --additional-properties=packageName=generated,generateInterfaces=true,packageVersion=v0.0.1,moduleName=github.com/hyperledger/cacti/packages/cactus-plugin-satp-hermes/src/main/go/generated --git-user-id hyperledger --git-repo-id cacti/packages/cactus-plugin-satp-hermes/src/main/go/generated",
"lint": "run-p 'lint:*'",
"lint:eslint": "eslint '*/*/src/**/*.{js,ts}' --quiet --fix && cspell \"*/*/src/**/*.{js,ts}\"",
"lint:oapi": "vacuum lint -d -e ./src/main/yml/bol/openapi-blo-bundled.yml",
"lint:protobuf": "buf lint --path src/main/proto --verbose",
"pretsc": "npm run generate-sdk",
"tsc": "tsc --project ./tsconfig.json",
"tsc": "tsc --project ./tsconfig.yml",
"watch": "tsc --build --watch"
},
"jest": {
Expand Down Expand Up @@ -97,9 +111,11 @@
"web3-utils": "1.6.1"
},
"devDependencies": {
"@apidevtools/swagger-cli": "4.0.4",
"@bufbuild/buf": "1.29.0",
"@bufbuild/protobuf": "1.7.2",
"@bufbuild/protoc-gen-es": "1.7.2",
"@quobix/vacuum": "^0.9.10",
"@types/body-parser": "1.19.4",
"@types/crypto-js": "4.0.1",
"@types/express": "4.17.21",
Expand All @@ -112,7 +128,8 @@
"express": "4.19.2",
"fabric-network": "2.2.20",
"kubo-rpc-client": "3.0.1",
"typescript": "5.5.2"
"typescript": "5.5.2",
"swagger-cli": "^4.0.4"
},
"engines": {
"node": ">=18",
Expand All @@ -125,14 +142,14 @@
"tsc": {
"patterns": [
"src/",
"src/*/json/**/openapi*"
"src/*/yml/**/*"
],
"ignore": [
"src/**/generated/*"
],
"extensions": [
"ts",
"json"
"yml"
],
"quiet": true,
"verbose": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from "path";
import { v4 as uuidv4 } from "uuid";

// default configuration for knex
module.exports = {
Expand Down
147 changes: 147 additions & 0 deletions packages/cactus-plugin-satp-hermes/src/main/go/generated/api_chains.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions packages/cactus-plugin-satp-hermes/src/main/go/generated/docs/Chain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Chain

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ChainId** | **string** | A unique identifier for the blockchain network. |
**ChainName** | **string** | The name of the blockchain network. |
**ChainType** | **string** | The type of blockchain network (e.g., &#39;evm&#39;, &#39;fabric&#39;). |
**NetworkName** | **string** | The specific network name within the blockchain (e.g., &#39;mainnet&#39;, &#39;testnet&#39;). |

## Methods

### NewChain

`func NewChain(chainId string, chainName string, chainType string, networkName string, ) *Chain`

NewChain instantiates a new Chain object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed

### NewChainWithDefaults

`func NewChainWithDefaults() *Chain`

NewChainWithDefaults instantiates a new Chain object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set

### GetChainId

`func (o *Chain) GetChainId() string`

GetChainId returns the ChainId field if non-nil, zero value otherwise.

### GetChainIdOk

`func (o *Chain) GetChainIdOk() (*string, bool)`

GetChainIdOk returns a tuple with the ChainId field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetChainId

`func (o *Chain) SetChainId(v string)`

SetChainId sets ChainId field to given value.


### GetChainName

`func (o *Chain) GetChainName() string`

GetChainName returns the ChainName field if non-nil, zero value otherwise.

### GetChainNameOk

`func (o *Chain) GetChainNameOk() (*string, bool)`

GetChainNameOk returns a tuple with the ChainName field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetChainName

`func (o *Chain) SetChainName(v string)`

SetChainName sets ChainName field to given value.


### GetChainType

`func (o *Chain) GetChainType() string`

GetChainType returns the ChainType field if non-nil, zero value otherwise.

### GetChainTypeOk

`func (o *Chain) GetChainTypeOk() (*string, bool)`

GetChainTypeOk returns a tuple with the ChainType field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetChainType

`func (o *Chain) SetChainType(v string)`

SetChainType sets ChainType field to given value.


### GetNetworkName

`func (o *Chain) GetNetworkName() string`

GetNetworkName returns the NetworkName field if non-nil, zero value otherwise.

### GetNetworkNameOk

`func (o *Chain) GetNetworkNameOk() (*string, bool)`

GetNetworkNameOk returns a tuple with the NetworkName field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetNetworkName

`func (o *Chain) SetNetworkName(v string)`

SetNetworkName sets NetworkName field to given value.



[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


Loading

0 comments on commit 4342957

Please sign in to comment.