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 <[email protected]>

feat(satp-hermes): BLO API specification

Signed-off-by: Rafael Belchior <[email protected]>

feat(satp-hermes): add BLO layer

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: Rafael Belchior <[email protected]>

fix(satp-hermes): fix lint

Signed-off-by: André Augusto <[email protected]>

ci(satp-hermes): rebase and update ci

Signed-off-by: Rafael Belchior <[email protected]>

feat(satp-hermes): update BLO specification

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: Rafael Belchior <[email protected]>

feat(satp-hermes): update BLO specification

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: Rafael Belchior <[email protected]>

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 <[email protected]>

 feat(satp-hermes): remove deprecated spec

Signed-off-by: Rafael Belchior <[email protected]>

feat(SATP-Hermes): add gateway coordinator WIP

Signed-off-by: Rafael Belchior <[email protected]>

feat(bungee): add skeleton for bungee

Signed-off-by: André Augusto <[email protected]>

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 <[email protected]>

feat(SATP-Hermes): gateway coordinator

feat(SATP-Hermes): gateway coordinator

feat(SATP-Hermes): gateway coordinator WIP

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: Rafael Belchior <[email protected]>

docs(SATP-Hermes): update package.json

Signed-off-by: Rafael Belchior <[email protected]>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <[email protected]>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <[email protected]>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: Rafael Belchior <[email protected]>

feat(SATP-Hermes): protobuf structure

Signed-off-by: Rafael Belchior <[email protected]>

feat(SATP-Hermes): protobuf structure

Signed-off-by: Rafael Belchior <[email protected]>

refactor(SATP-Hermes): refactor naming

Signed-off-by: Rafael Belchior <[email protected]>

feat(SATP-Hermes): protobuf structure improvements

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: André Augusto <[email protected]>

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 <[email protected]>

refactor(SATP-Hermes): remove unused packages

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

Co-authored-by: Peter Somogyvari <[email protected]>

Signed-off-by: André Augusto <[email protected]>
Signed-off-by: Peter Somogyvari <[email protected]>

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 <[email protected]>

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

Signed-off-by: Rafael Belchior <[email protected]>

fixup: update package json, ci, yarn lock

Signed-off-by: Rafael Belchior <[email protected]>

feat(SATP-Hermes): add gateway coordinator WIP

Signed-off-by: Rafael Belchior <[email protected]>

feat(bungee): add skeleton for bungee

Signed-off-by: André Augusto <[email protected]>

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 <[email protected]>

feat(SATP-Hermes): gateway coordinator

feat(SATP-Hermes): gateway coordinator

feat(SATP-Hermes): gateway coordinator WIP

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: Rafael Belchior <[email protected]>

docs(SATP-Hermes): update package.json

Signed-off-by: Rafael Belchior <[email protected]>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <[email protected]>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <[email protected]>

refactor(SATP-Hermes): re-estructure project

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: Rafael Belchior <[email protected]>

feat(SATP-Hermes): protobuf structure

Signed-off-by: Rafael Belchior <[email protected]>

feat(SATP-Hermes): protobuf structure

Signed-off-by: Rafael Belchior <[email protected]>

refactor(SATP-Hermes): refactor naming

Signed-off-by: Rafael Belchior <[email protected]>

feat(SATP-Hermes): protobuf structure improvements

Signed-off-by: Rafael Belchior <[email protected]>

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

Signed-off-by: André Augusto <[email protected]>

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 <[email protected]>

refactor(SATP-Hermes): remove unused packages

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

Co-authored-by: Peter Somogyvari <[email protected]>

Signed-off-by: André Augusto <[email protected]>
Signed-off-by: Peter Somogyvari <[email protected]>
  • Loading branch information
RafaelAPB authored and rafaelbelchiorbd committed Nov 8, 2024
1 parent 1169120 commit 4c8907f
Show file tree
Hide file tree
Showing 124 changed files with 30,141 additions and 855 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,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/[email protected]
with:
node-version: ${{ env.NODEJS_VERSION }}
- uses: actions/[email protected]

- id: yarn-cache
name: Restore Yarn Cache
uses: actions/[email protected]
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 @@ -2300,4 +2325,4 @@ name: Cactus_CI
push:
branches:
- main
- dev
- dev
33 changes: 25 additions & 8 deletions packages/cactus-plugin-satp-hermes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,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-gateway-json": "swagger-cli bundle ./src/main/yml/openapi.yml -o ./src/main/json/openapi-gateway-bundled.json -r -t json",
"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-yaml": "swagger-cli bundle ./src/main/yml/bol/openapi-blo.yml -o ./src/main/yml/bol/openapi-blo-bundled.yml -r -t yaml",
"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: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",
"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",
"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 All @@ -74,6 +81,7 @@
"@connectrpc/connect-express": "1.3.0",
"@connectrpc/connect-node": "1.3.0",
"@connectrpc/protoc-gen-connect-es": "1.3.0",
"@bufbuild/protobuf": "1.10.0",
"axios": "1.7.7",
"body-parser": "1.20.2",
"class-transformer": "0.5.1",
Expand All @@ -94,9 +102,10 @@
"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",
"@bufbuild/protoc-gen-es": "1.8.0",
"@quobix/vacuum": "^0.9.10",
"@types/body-parser": "1.19.4",
"@types/crypto-js": "4.0.1",
"@types/express": "5.0.0",
Expand All @@ -109,6 +118,7 @@
"express": "4.21.0",
"fabric-network": "2.2.20",
"kubo-rpc-client": "3.0.1",
"swagger-cli": "^4.0.4",
"typescript": "5.5.2"
},
"engines": {
Expand All @@ -118,18 +128,25 @@
"publishConfig": {
"access": "public"
},
"customMetadata": {
"satp-draft-versions": {
"satp-core": "02",
"satp-architecture": "02",
"satp-crash": "02"
}
},
"watch": {
"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 4c8907f

Please sign in to comment.