Skip to content

Commit

Permalink
Merge pull request #41 from skalenetwork/ticket-25/rewrite-IMA-agent-…
Browse files Browse the repository at this point in the history
…on-TypeScript
  • Loading branch information
sergiy-skalelabs authored Jan 8, 2024
2 parents 073d04f + 79e645c commit d940bd5
Show file tree
Hide file tree
Showing 60 changed files with 9,205 additions and 7,230 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/comprehensive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ jobs:
run: |
yarn install
- name: INIT - build IMA
working-directory: ${{env.working-directory}}
run: |
yarn rebuild
- name: INIT - initialize comprehensive test tokens
working-directory: ${{env.working-directory}}
run: |
Expand Down Expand Up @@ -276,22 +281,22 @@ jobs:
- name: SELF-TEST A - use IMA to browse S-Chain via node 00-00 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.1:2164 || true
node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.1:2164 || true
- name: SELF-TEST B - use IMA to browse S-Chain via node 00-01 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.2:2264 || true
node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.2:2264 || true
- name: SELF-TEST C - use IMA to browse S-Chain via node 01-00 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.3:2364 || true
node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.3:2364 || true
- name: SELF-TEST D - use IMA to browse S-Chain via node 01-01 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.4:2464 || true
node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.4:2464 || true
- name: INIT - download SGX Wallet
working-directory: ${{env.working-directory}}
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/container-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ jobs:
run: |
yarn install
- name: INIT - build IMA
working-directory: ${{env.working-directory}}
run: |
yarn rebuild
- name: INIT - initialize comprehensive test tokens
working-directory: ${{env.working-directory}}
run: |
Expand Down Expand Up @@ -286,22 +291,22 @@ jobs:
- name: SELF-TEST A - use IMA to browse S-Chain via node 00-00 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.1:2164 || true
node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.1:2164 || true
- name: SELF-TEST B - use IMA to browse S-Chain via node 00-01 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.2:2264 || true
node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.2:2264 || true
- name: SELF-TEST C - use IMA to browse S-Chain via node 01-00 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.3:2364 || true
node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.3:2364 || true
- name: SELF-TEST D - use IMA to browse S-Chain via node 01-01 and test last is alive
working-directory: ${{env.working-directory}}
run: |
node ./src/main.mjs --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.4:2464 || true
node ./src/build/main.js --colors --no-gathered --browse-s-chain --url-s-chain=http://127.0.0.4:2464 || true
- name: INIT - build IMA docker container
working-directory: ${{env.working-directory}}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ jobs:
run: |
yarn install
- name: INIT - build IMA
working-directory: ./src
run: |
yarn rebuild
- name: Compile contracts
working-directory: ./IMA/proxy
run: |
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,7 @@ venv
# network-browser

network-browser/test*.json

src/build
network-browser/build/*
network-browser.js
network-browser.js
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RUN which python3

RUN mkdir /ima
WORKDIR /ima

COPY package.json package.json

COPY runner runner
Expand Down Expand Up @@ -66,5 +67,6 @@ RUN node-gyp --version

WORKDIR /ima
RUN yarn install
RUN yarn rebuild

CMD ["bash", "/ima/runner/run.sh"]
2 changes: 1 addition & 1 deletion IMA
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"license": "AGPL-3.0",
"author": "SKALE Labs and contributors",
"scripts": {
"build": "cd src && yarn build && cd ..",
"rebuild": "cd src && yarn rebuild && cd ..",
"clean-build": "cd src && yarn clean-build && cd ..",
"lint-check": "cd src && yarn lint-check && cd ..",
"lint-nb": "cd network-browser && yarn lint-check && cd ..",
"install-nb": "cd network-browser && bun install && cd ..",
Expand Down
2 changes: 1 addition & 1 deletion runner/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ BASE_OPTIONS="--gas-price-multiplier=$GAS_PRICE_MULTIPLIER \
--no-expose-pwa \
--auto-exit=86400"

IMA_LOOP_CMD="node $DIR/../src/main.mjs --loop $BASE_OPTIONS"
IMA_LOOP_CMD="node $DIR/../src/build/main.js --loop $BASE_OPTIONS"
NETWORK_BROWSER_CMD="node $DIR/../network-browser/build/index.js"

echo "$(date) - Running IMA loop and network-browser"
Expand Down
45 changes: 45 additions & 0 deletions src/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = {
"env": {
browser: false,
es2020: true,
node: true
},
extends: "standard-with-typescript",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
},
"rules": {
"linebreak-style": [ "error", "unix" ],
"eqeqeq": "off",
"comma-dangle": [ "error", "never" ],
"comma-style": [ "error", "last" ],
"space-in-parens": [ "error", "always" ],
"space-before-blocks": [ "error", "always" ],
"array-bracket-spacing": [ "error", "always" ],
"object-curly-spacing": [ "error", "always" ],
"curly": [ "error", "multi-or-nest" ],
"nonblock-statement-body-position": [ "error", "below" ],
"no-cond-assign": [ "error", "always" ],
"max-len": [ "error", { "code": 100, "tabWidth": 4 } ],
"max-lines-per-function": [ "error", { "max": 200, "skipBlankLines": false } ],
"@typescript-eslint/indent": [ "error", 4, { "ignoredNodes": [ "SwitchCase" ] } ],
"@typescript-eslint/quotes": [ "error", "double" ],
"@typescript-eslint/semi": [ "error", "always" ],
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/keyword-spacing": [ "error", {
"overrides": {
"if": { "before": false, "after": false },
"else": { "before": true, "after": true },
"for": { "before": false, "after": false },
"while": { "before": false, "after": false }
}
} ],
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/no-this-alias": "off"
}
};
73 changes: 0 additions & 73 deletions src/.eslintrc.js

This file was deleted.

5 changes: 1 addition & 4 deletions src/about.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ PAYMENT TRANSACTION options:
--gas-price-multiplier-tc ..............Sets Gas Price Multiplier for S<->S Target S-Chain transactions, Default value is 0.0.
--gas-price-multiplier .................Sets Gas Price Multiplier for both Main Net and S-Chain(s).
--gas-multiplier-mn ....................Sets Gas Value Multiplier for Main Net transactions, Default value is 1.25. Specify value 0.0 to disable Gas Price Customization for Main Net.
--gas-multiplier-sc ....................Sets Gas Value Multiplierfor S-Chain transactions, Default value is 1.25.
--gas-multiplier-sc ....................Sets Gas Value Multiplier S-Chain transactions, Default value is 1.25.
--gas-multiplier-tc ....................Sets Gas Value Multiplier for S<->S Target S-Chain transactions, Default value is 1.25.
--gas-multiplier .......................Sets Gas Value Multiplier for both Main Net and S-Chain(s).
REGISTRATION commands:
Expand Down Expand Up @@ -194,9 +194,6 @@ IMA JSON RPC SERVER options:
--no-cross-ima .........................Disable calls to IMA JSON RPC servers to compute BLS signature parts and operation state inside time frames. Use calls to skaled. Default mode.
TEST options:
--browse-s-chain .......................Download own S-Chain's network information.
OPTIMIZATION options:
--enable-multicall .....................Enable optimizations via multi-call. Default mode.
--disable-multicall ....................Disable optimizations via multi-call.
LOGGING options:
--expose ...............................Expose low-level log details after successful operations. By default details exposed only on errors.
--no-expose ............................Expose low-level log details only after errors. Default expose mode.
Expand Down
Loading

0 comments on commit d940bd5

Please sign in to comment.