From 91f47743102b7ebd5c2af4122fe593ed70597ba2 Mon Sep 17 00:00:00 2001 From: Dmitryii Osipov Date: Fri, 17 Jan 2025 17:25:27 +0700 Subject: [PATCH] chore: clean-up repo (#1715) --- .dockerignore | 5 + .github/workflows/e2e-tests.yaml | 343 - idea/api-gateway/.env.example | 3 - idea/api-gateway/.eslintrc.js | 37 - idea/api-gateway/.gitignore | 37 - idea/api-gateway/.prettierrc | 10 - idea/api-gateway/Dockerfile | 15 - idea/api-gateway/README.md | 723 --- idea/api-gateway/package.json | 48 - idea/api-gateway/src/config.ts | 30 - idea/api-gateway/src/main.ts | 17 - .../middleware/check-genesis.middleware.ts | 33 - idea/api-gateway/src/middleware/index.ts | 3 - .../src/middleware/test-balance.middleware.ts | 37 - .../validate-json-rpc-request.middleware.ts | 39 - idea/api-gateway/src/rmq.ts | 210 - idea/api-gateway/src/server.ts | 222 - idea/api-gateway/src/utils/get-response.ts | 19 - idea/api-gateway/src/utils/index.ts | 1 - idea/api-gateway/tsconfig.json | 10 - idea/indexer/.env.example | 12 - idea/indexer/.gitignore | 3 - idea/indexer/Dockerfile | 16 - idea/indexer/README.md | 22 - idea/indexer/package.json | 53 - idea/indexer/src/common/constants.ts | 1 - .../src/common/enums/code-status.enum.ts | 5 - idea/indexer/src/common/enums/index.ts | 7 - .../common/enums/message-entry-poing.enum.ts | 5 - .../common/enums/message-read-reason.enum.ts | 5 - .../src/common/enums/message-status.enum.ts | 4 - .../src/common/enums/message-type.enum.ts | 4 - .../src/common/enums/program-status.enum.ts | 8 - .../src/common/helpers/generate-uuid.ts | 3 - .../src/common/helpers/get-extrinsics.ts | 57 - .../src/common/helpers/get-msg-entry.ts | 5 - .../helpers/get-payload-by-gear-event.ts | 94 - .../common/helpers/get-update-message-data.ts | 10 - idea/indexer/src/common/helpers/index.ts | 6 - idea/indexer/src/common/helpers/metahash.ts | 16 - idea/indexer/src/common/index.ts | 4 - idea/indexer/src/common/types/code.ts | 10 - idea/indexer/src/common/types/gear.ts | 24 - idea/indexer/src/common/types/index.ts | 5 - idea/indexer/src/common/types/indexer.ts | 17 - idea/indexer/src/common/types/message.ts | 26 - idea/indexer/src/common/types/program.ts | 10 - idea/indexer/src/config.ts | 36 - idea/indexer/src/database/data-source.ts | 18 - .../src/database/entities/base.entity.ts | 15 - .../src/database/entities/block.entity.ts | 24 - .../src/database/entities/code.entity.ts | 39 - idea/indexer/src/database/entities/index.ts | 6 - .../src/database/entities/message.entity.ts | 53 - .../src/database/entities/program.entity.ts | 42 - .../src/database/entities/state.entity.ts | 28 - .../src/database/entities/status.entity.ts | 18 - idea/indexer/src/database/index.ts | 2 - .../database/migrations/1666974357483-init.ts | 212 - ...63-update_meta_code_and_add_state_table.ts | 101 - .../1674754846501-update_meta_table_colums.ts | 35 - .../1675420216422-update_program_status.ts | 84 - .../1676455747413-update_message_table.ts | 72 - ...069754299-delete_unique_hash_meta_table.ts | 19 - ...2-update_relation_between_code_and_meta.ts | 33 - .../1678708517193-code-status-unknown.ts | 40 - .../1678717516065-unique-meta-hash.ts | 19 - .../migrations/1680591096475-status.ts | 35 - .../1681206929961-program-expiration.ts | 26 - .../1681220971037-remove-generated-pk.ts | 72 - .../1685519228764-nullable-owner.ts | 80 - .../1689589565828-remove-meta-entity.ts | 82 - .../1690793654952-add-has-state-field.ts | 26 - .../migrations/1694089926155-add-indexes.ts | 42 - .../migrations/1701091693635-add-indexes.ts | 48 - .../1707831399009-drop-relations.ts | 235 - idea/indexer/src/gear/connect.ts | 72 - idea/indexer/src/gear/handlers/batch.ts | 167 - idea/indexer/src/gear/handlers/code.ts | 57 - idea/indexer/src/gear/handlers/events.ts | 176 - idea/indexer/src/gear/handlers/index.ts | 6 - idea/indexer/src/gear/handlers/msg.ts | 59 - idea/indexer/src/gear/handlers/program.ts | 53 - idea/indexer/src/gear/handlers/voucher.ts | 110 - idea/indexer/src/gear/index.ts | 2 - idea/indexer/src/gear/indexer.ts | 292 - idea/indexer/src/gear/temp-state.ts | 212 - idea/indexer/src/healthcheck.server.ts | 49 - idea/indexer/src/main.ts | 48 - idea/indexer/src/rmq.ts | 231 - idea/indexer/src/services/block.service.ts | 69 - idea/indexer/src/services/code.service.ts | 162 - idea/indexer/src/services/index.ts | 6 - idea/indexer/src/services/message.service.ts | 145 - idea/indexer/src/services/program.service.ts | 186 - idea/indexer/src/services/state.service.ts | 87 - idea/indexer/src/services/status.service.ts | 28 - idea/indexer/tsconfig.json | 10 - idea/meta-storage/.env.example | 7 - idea/meta-storage/.gitignore | 1 - idea/meta-storage/Dockerfile | 18 - idea/meta-storage/README.md | 1 - idea/meta-storage/package.json | 28 - idea/meta-storage/src/config.ts | 26 - idea/meta-storage/src/database/data-source.ts | 16 - .../src/database/entities/code.entity.ts | 15 - .../src/database/entities/index.ts | 3 - .../src/database/entities/meta.entity.ts | 17 - .../src/database/entities/sails.entity.ts | 18 - idea/meta-storage/src/database/index.ts | 2 - idea/meta-storage/src/main.ts | 22 - idea/meta-storage/src/rmq.ts | 120 - idea/meta-storage/src/service.ts | 138 - idea/meta-storage/src/util/validate.ts | 9 - idea/meta-storage/tsconfig.json | 10 - idea/test-balance/.env.example | 10 - idea/test-balance/.eslintrc.js | 21 - idea/test-balance/.gitignore | 4 - idea/test-balance/Dockerfile | 14 - idea/test-balance/README.md | 1 - idea/test-balance/package.json | 46 - idea/test-balance/src/config.ts | 30 - .../src/database/app-data-source.ts | 20 - idea/test-balance/src/database/index.ts | 2 - .../src/database/transfer.entity.ts | 14 - idea/test-balance/src/healthcheck.router.ts | 29 - idea/test-balance/src/main.ts | 34 - idea/test-balance/src/services/gear.ts | 170 - idea/test-balance/src/services/index.ts | 3 - idea/test-balance/src/services/rmq.ts | 121 - idea/test-balance/src/services/transfer.ts | 77 - idea/test-balance/src/utils/create-account.ts | 13 - idea/test-balance/src/utils/index.ts | 2 - .../src/utils/validate-address.ts | 14 - idea/test-balance/tsconfig.json | 10 - idea/tests/.gitignore | 9 - idea/tests/Makefile | 23 - idea/tests/README.md | 18 - idea/tests/babel.config.json | 14 - idea/tests/e2e/config.ts | 18 - idea/tests/e2e/indexer.test.ts | 847 --- idea/tests/e2e/jsonrpc-errors.test.ts | 81 - idea/tests/e2e/meta-storage.test.ts | 49 - idea/tests/e2e/request.ts | 29 - idea/tests/e2e/test-balance.test.ts | 48 - idea/tests/e2e/utils.ts | 15 - idea/tests/jest.config.js | 14 - idea/tests/package.json | 31 - idea/tests/programs/Cargo.lock | 5726 ----------------- idea/tests/programs/Cargo.toml | 18 - idea/tests/programs/ping-sails/README.md | 3 - idea/tests/programs/ping-sails/app/Cargo.toml | 7 - idea/tests/programs/ping-sails/app/src/lib.rs | 20 - .../programs/ping-sails/app/src/service.rs | 19 - idea/tests/programs/ping-sails/wasm/.binpath | 1 - .../tests/programs/ping-sails/wasm/Cargo.toml | 13 - idea/tests/programs/ping-sails/wasm/build.rs | 15 - idea/tests/programs/ping-sails/wasm/ping.idl | 8 - .../tests/programs/ping-sails/wasm/src/lib.rs | 4 - idea/tests/tsconfig.json | 17 - idea/tests/wasm-test/app.opt.wasm | Bin 14312 -> 0 bytes idea/voucher-indexer/.gitignore | 10 - idea/voucher-indexer/Dockerfile | 20 - idea/voucher-indexer/README.md | 84 - idea/voucher-indexer/package.json | 36 - idea/voucher-indexer/src/common/enum.ts | 7 - idea/voucher-indexer/src/common/index.ts | 1 - idea/voucher-indexer/src/config.ts | 27 - idea/voucher-indexer/src/main.ts | 19 - idea/voucher-indexer/src/model/index.ts | 1 - .../src/model/voucher.model.ts | 50 - idea/voucher-indexer/src/processor.ts | 86 - idea/voucher-indexer/src/server.ts | 39 - idea/voucher-indexer/src/service.ts | 111 - idea/voucher-indexer/src/state.ts | 179 - idea/voucher-indexer/src/types/call.ts | 17 - idea/voucher-indexer/src/types/event.ts | 17 - idea/voucher-indexer/src/types/index.ts | 2 - idea/voucher-indexer/tsconfig.json | 19 - k8s/gear-node/Dockerfile | 11 - k8s/staging-env/api-gateway/api-gateway.yaml | 56 - .../data-storage/data-storage-testnet.yaml | 58 - .../data-storage-workshop-node.yaml | 58 - .../frontend-nginx-template.yaml | 79 - .../frontend-nginx/frontend-nginx.yaml | 61 - k8s/staging-env/kafka/kafka-template.yaml | 96 - k8s/staging-env/kafka/kafka-ui.yaml | 44 - k8s/staging-env/kafka/kafka.yaml | 70 - k8s/staging-env/kafka/zookeeper.yaml | 50 - .../kubernetes-dashboard.yaml | 282 - .../kubernetes-dashboard/metrics.yaml | 186 - .../postgres/postgres-template.yaml | 77 - .../postgres/postgres-testbalance.yaml | 63 - k8s/staging-env/postgres/postgres.yaml | 65 - .../test-balance-workshop-node.yaml | 65 - k8s/test-env/api-gateway/api-gateway.yaml | 61 - k8s/test-env/data-storage/data-storage.yaml | 64 - .../frontend-nginx/frontend-nginx.yaml | 70 - k8s/test-env/gear-node/gear-node.yaml | 39 - k8s/test-env/kafka/kafka.yaml | 70 - k8s/test-env/kafka/zookeeper.yaml | 37 - .../postgres/postgres-testbalance.yaml | 53 - k8s/test-env/postgres/postgres.yaml | 55 - k8s/test-env/test-balance/test-balance.yaml | 65 - k8s/vara-node/Dockerfile | 11 - 205 files changed, 5 insertions(+), 16742 deletions(-) create mode 100644 .dockerignore delete mode 100644 .github/workflows/e2e-tests.yaml delete mode 100644 idea/api-gateway/.env.example delete mode 100644 idea/api-gateway/.eslintrc.js delete mode 100644 idea/api-gateway/.gitignore delete mode 100644 idea/api-gateway/.prettierrc delete mode 100644 idea/api-gateway/Dockerfile delete mode 100644 idea/api-gateway/README.md delete mode 100644 idea/api-gateway/package.json delete mode 100644 idea/api-gateway/src/config.ts delete mode 100644 idea/api-gateway/src/main.ts delete mode 100644 idea/api-gateway/src/middleware/check-genesis.middleware.ts delete mode 100644 idea/api-gateway/src/middleware/index.ts delete mode 100644 idea/api-gateway/src/middleware/test-balance.middleware.ts delete mode 100644 idea/api-gateway/src/middleware/validate-json-rpc-request.middleware.ts delete mode 100644 idea/api-gateway/src/rmq.ts delete mode 100644 idea/api-gateway/src/server.ts delete mode 100644 idea/api-gateway/src/utils/get-response.ts delete mode 100644 idea/api-gateway/src/utils/index.ts delete mode 100644 idea/api-gateway/tsconfig.json delete mode 100644 idea/indexer/.env.example delete mode 100644 idea/indexer/.gitignore delete mode 100644 idea/indexer/Dockerfile delete mode 100644 idea/indexer/README.md delete mode 100644 idea/indexer/package.json delete mode 100644 idea/indexer/src/common/constants.ts delete mode 100644 idea/indexer/src/common/enums/code-status.enum.ts delete mode 100644 idea/indexer/src/common/enums/index.ts delete mode 100644 idea/indexer/src/common/enums/message-entry-poing.enum.ts delete mode 100644 idea/indexer/src/common/enums/message-read-reason.enum.ts delete mode 100644 idea/indexer/src/common/enums/message-status.enum.ts delete mode 100644 idea/indexer/src/common/enums/message-type.enum.ts delete mode 100644 idea/indexer/src/common/enums/program-status.enum.ts delete mode 100644 idea/indexer/src/common/helpers/generate-uuid.ts delete mode 100644 idea/indexer/src/common/helpers/get-extrinsics.ts delete mode 100644 idea/indexer/src/common/helpers/get-msg-entry.ts delete mode 100644 idea/indexer/src/common/helpers/get-payload-by-gear-event.ts delete mode 100644 idea/indexer/src/common/helpers/get-update-message-data.ts delete mode 100644 idea/indexer/src/common/helpers/index.ts delete mode 100644 idea/indexer/src/common/helpers/metahash.ts delete mode 100644 idea/indexer/src/common/index.ts delete mode 100644 idea/indexer/src/common/types/code.ts delete mode 100644 idea/indexer/src/common/types/gear.ts delete mode 100644 idea/indexer/src/common/types/index.ts delete mode 100644 idea/indexer/src/common/types/indexer.ts delete mode 100644 idea/indexer/src/common/types/message.ts delete mode 100644 idea/indexer/src/common/types/program.ts delete mode 100644 idea/indexer/src/config.ts delete mode 100644 idea/indexer/src/database/data-source.ts delete mode 100644 idea/indexer/src/database/entities/base.entity.ts delete mode 100644 idea/indexer/src/database/entities/block.entity.ts delete mode 100644 idea/indexer/src/database/entities/code.entity.ts delete mode 100644 idea/indexer/src/database/entities/index.ts delete mode 100644 idea/indexer/src/database/entities/message.entity.ts delete mode 100644 idea/indexer/src/database/entities/program.entity.ts delete mode 100644 idea/indexer/src/database/entities/state.entity.ts delete mode 100644 idea/indexer/src/database/entities/status.entity.ts delete mode 100644 idea/indexer/src/database/index.ts delete mode 100644 idea/indexer/src/database/migrations/1666974357483-init.ts delete mode 100644 idea/indexer/src/database/migrations/1673872715863-update_meta_code_and_add_state_table.ts delete mode 100644 idea/indexer/src/database/migrations/1674754846501-update_meta_table_colums.ts delete mode 100644 idea/indexer/src/database/migrations/1675420216422-update_program_status.ts delete mode 100644 idea/indexer/src/database/migrations/1676455747413-update_message_table.ts delete mode 100644 idea/indexer/src/database/migrations/1677069754299-delete_unique_hash_meta_table.ts delete mode 100644 idea/indexer/src/database/migrations/1677072331302-update_relation_between_code_and_meta.ts delete mode 100644 idea/indexer/src/database/migrations/1678708517193-code-status-unknown.ts delete mode 100644 idea/indexer/src/database/migrations/1678717516065-unique-meta-hash.ts delete mode 100644 idea/indexer/src/database/migrations/1680591096475-status.ts delete mode 100644 idea/indexer/src/database/migrations/1681206929961-program-expiration.ts delete mode 100644 idea/indexer/src/database/migrations/1681220971037-remove-generated-pk.ts delete mode 100644 idea/indexer/src/database/migrations/1685519228764-nullable-owner.ts delete mode 100644 idea/indexer/src/database/migrations/1689589565828-remove-meta-entity.ts delete mode 100644 idea/indexer/src/database/migrations/1690793654952-add-has-state-field.ts delete mode 100644 idea/indexer/src/database/migrations/1694089926155-add-indexes.ts delete mode 100644 idea/indexer/src/database/migrations/1701091693635-add-indexes.ts delete mode 100644 idea/indexer/src/database/migrations/1707831399009-drop-relations.ts delete mode 100644 idea/indexer/src/gear/connect.ts delete mode 100644 idea/indexer/src/gear/handlers/batch.ts delete mode 100644 idea/indexer/src/gear/handlers/code.ts delete mode 100644 idea/indexer/src/gear/handlers/events.ts delete mode 100644 idea/indexer/src/gear/handlers/index.ts delete mode 100644 idea/indexer/src/gear/handlers/msg.ts delete mode 100644 idea/indexer/src/gear/handlers/program.ts delete mode 100644 idea/indexer/src/gear/handlers/voucher.ts delete mode 100644 idea/indexer/src/gear/index.ts delete mode 100644 idea/indexer/src/gear/indexer.ts delete mode 100644 idea/indexer/src/gear/temp-state.ts delete mode 100644 idea/indexer/src/healthcheck.server.ts delete mode 100644 idea/indexer/src/main.ts delete mode 100644 idea/indexer/src/rmq.ts delete mode 100644 idea/indexer/src/services/block.service.ts delete mode 100644 idea/indexer/src/services/code.service.ts delete mode 100644 idea/indexer/src/services/index.ts delete mode 100644 idea/indexer/src/services/message.service.ts delete mode 100644 idea/indexer/src/services/program.service.ts delete mode 100644 idea/indexer/src/services/state.service.ts delete mode 100644 idea/indexer/src/services/status.service.ts delete mode 100644 idea/indexer/tsconfig.json delete mode 100644 idea/meta-storage/.env.example delete mode 100644 idea/meta-storage/.gitignore delete mode 100644 idea/meta-storage/Dockerfile delete mode 100644 idea/meta-storage/README.md delete mode 100644 idea/meta-storage/package.json delete mode 100644 idea/meta-storage/src/config.ts delete mode 100644 idea/meta-storage/src/database/data-source.ts delete mode 100644 idea/meta-storage/src/database/entities/code.entity.ts delete mode 100644 idea/meta-storage/src/database/entities/index.ts delete mode 100644 idea/meta-storage/src/database/entities/meta.entity.ts delete mode 100644 idea/meta-storage/src/database/entities/sails.entity.ts delete mode 100644 idea/meta-storage/src/database/index.ts delete mode 100644 idea/meta-storage/src/main.ts delete mode 100644 idea/meta-storage/src/rmq.ts delete mode 100644 idea/meta-storage/src/service.ts delete mode 100644 idea/meta-storage/src/util/validate.ts delete mode 100644 idea/meta-storage/tsconfig.json delete mode 100644 idea/test-balance/.env.example delete mode 100644 idea/test-balance/.eslintrc.js delete mode 100644 idea/test-balance/.gitignore delete mode 100644 idea/test-balance/Dockerfile delete mode 100644 idea/test-balance/README.md delete mode 100644 idea/test-balance/package.json delete mode 100644 idea/test-balance/src/config.ts delete mode 100644 idea/test-balance/src/database/app-data-source.ts delete mode 100644 idea/test-balance/src/database/index.ts delete mode 100644 idea/test-balance/src/database/transfer.entity.ts delete mode 100644 idea/test-balance/src/healthcheck.router.ts delete mode 100644 idea/test-balance/src/main.ts delete mode 100644 idea/test-balance/src/services/gear.ts delete mode 100644 idea/test-balance/src/services/index.ts delete mode 100644 idea/test-balance/src/services/rmq.ts delete mode 100644 idea/test-balance/src/services/transfer.ts delete mode 100644 idea/test-balance/src/utils/create-account.ts delete mode 100644 idea/test-balance/src/utils/index.ts delete mode 100644 idea/test-balance/src/utils/validate-address.ts delete mode 100644 idea/test-balance/tsconfig.json delete mode 100644 idea/tests/.gitignore delete mode 100644 idea/tests/Makefile delete mode 100644 idea/tests/README.md delete mode 100644 idea/tests/babel.config.json delete mode 100644 idea/tests/e2e/config.ts delete mode 100644 idea/tests/e2e/indexer.test.ts delete mode 100644 idea/tests/e2e/jsonrpc-errors.test.ts delete mode 100644 idea/tests/e2e/meta-storage.test.ts delete mode 100644 idea/tests/e2e/request.ts delete mode 100644 idea/tests/e2e/test-balance.test.ts delete mode 100644 idea/tests/e2e/utils.ts delete mode 100644 idea/tests/jest.config.js delete mode 100644 idea/tests/package.json delete mode 100644 idea/tests/programs/Cargo.lock delete mode 100644 idea/tests/programs/Cargo.toml delete mode 100644 idea/tests/programs/ping-sails/README.md delete mode 100644 idea/tests/programs/ping-sails/app/Cargo.toml delete mode 100644 idea/tests/programs/ping-sails/app/src/lib.rs delete mode 100644 idea/tests/programs/ping-sails/app/src/service.rs delete mode 100644 idea/tests/programs/ping-sails/wasm/.binpath delete mode 100644 idea/tests/programs/ping-sails/wasm/Cargo.toml delete mode 100644 idea/tests/programs/ping-sails/wasm/build.rs delete mode 100644 idea/tests/programs/ping-sails/wasm/ping.idl delete mode 100644 idea/tests/programs/ping-sails/wasm/src/lib.rs delete mode 100644 idea/tests/tsconfig.json delete mode 100644 idea/tests/wasm-test/app.opt.wasm delete mode 100644 idea/voucher-indexer/.gitignore delete mode 100644 idea/voucher-indexer/Dockerfile delete mode 100644 idea/voucher-indexer/README.md delete mode 100644 idea/voucher-indexer/package.json delete mode 100644 idea/voucher-indexer/src/common/enum.ts delete mode 100644 idea/voucher-indexer/src/common/index.ts delete mode 100644 idea/voucher-indexer/src/config.ts delete mode 100644 idea/voucher-indexer/src/main.ts delete mode 100644 idea/voucher-indexer/src/model/index.ts delete mode 100644 idea/voucher-indexer/src/model/voucher.model.ts delete mode 100644 idea/voucher-indexer/src/processor.ts delete mode 100644 idea/voucher-indexer/src/server.ts delete mode 100644 idea/voucher-indexer/src/service.ts delete mode 100644 idea/voucher-indexer/src/state.ts delete mode 100644 idea/voucher-indexer/src/types/call.ts delete mode 100644 idea/voucher-indexer/src/types/event.ts delete mode 100644 idea/voucher-indexer/src/types/index.ts delete mode 100644 idea/voucher-indexer/tsconfig.json delete mode 100644 k8s/gear-node/Dockerfile delete mode 100644 k8s/staging-env/api-gateway/api-gateway.yaml delete mode 100644 k8s/staging-env/data-storage/data-storage-testnet.yaml delete mode 100644 k8s/staging-env/data-storage/data-storage-workshop-node.yaml delete mode 100644 k8s/staging-env/frontend-nginx/frontend-nginx-template.yaml delete mode 100644 k8s/staging-env/frontend-nginx/frontend-nginx.yaml delete mode 100644 k8s/staging-env/kafka/kafka-template.yaml delete mode 100644 k8s/staging-env/kafka/kafka-ui.yaml delete mode 100644 k8s/staging-env/kafka/kafka.yaml delete mode 100644 k8s/staging-env/kafka/zookeeper.yaml delete mode 100644 k8s/staging-env/kubernetes-dashboard/kubernetes-dashboard.yaml delete mode 100644 k8s/staging-env/kubernetes-dashboard/metrics.yaml delete mode 100644 k8s/staging-env/postgres/postgres-template.yaml delete mode 100644 k8s/staging-env/postgres/postgres-testbalance.yaml delete mode 100644 k8s/staging-env/postgres/postgres.yaml delete mode 100644 k8s/staging-env/test-balance/test-balance-workshop-node.yaml delete mode 100644 k8s/test-env/api-gateway/api-gateway.yaml delete mode 100644 k8s/test-env/data-storage/data-storage.yaml delete mode 100644 k8s/test-env/frontend-nginx/frontend-nginx.yaml delete mode 100644 k8s/test-env/gear-node/gear-node.yaml delete mode 100644 k8s/test-env/kafka/kafka.yaml delete mode 100644 k8s/test-env/kafka/zookeeper.yaml delete mode 100644 k8s/test-env/postgres/postgres-testbalance.yaml delete mode 100644 k8s/test-env/postgres/postgres.yaml delete mode 100644 k8s/test-env/test-balance/test-balance.yaml delete mode 100644 k8s/vara-node/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..18a0630dc9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +.env +dist + +.gitignore diff --git a/.github/workflows/e2e-tests.yaml b/.github/workflows/e2e-tests.yaml deleted file mode 100644 index 0e642a22ae..0000000000 --- a/.github/workflows/e2e-tests.yaml +++ /dev/null @@ -1,343 +0,0 @@ -name: 'Gear Idea: e2e test' - -on: - pull_request: - types: [synchronize, labeled, opened, reopened, ready_for_review] - branches: [main] - paths: - - idea/api-gateway/** - - idea/common/** - - idea/indexer/** - - idea/frontend/** - - idea/test-balance/** - - idea/tests/** - - idea/meta-storage/** - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.AWS_REGION }} - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - KUBE_NAMESPACE: test-env - DOCKER_BUILDKIT: 1 - REACT_APP_NODE_ADDRESS: ${{ secrets.REACT_APP_NODE_ADDRESS }} - REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL }} - REACT_APP_WASM_COMPILER_URL: ${{ secrets.REACT_APP_WASM_COMPILER_URL }} - REACT_APP_DEFAULT_NODES_URL: ${{ secrets.REACT_APP_DEFAULT_NODES_URL }} - REACT_APP_RRT: '' - REACT_APP_HCAPTCHA_SITE_KEY: ${{ secrets.REACT_APP_HCAPTCHA_SITE_KEY }} - BINARYEN_VERSION: version_111 - -jobs: - check-labels: - if: contains(github.event.pull_request.labels.*.name, 'A2-mergeoncegreen') - runs-on: ubuntu-latest - steps: - - run: echo "Condition passed" - - - build-frontend-pkg: - runs-on: ubuntu-latest - needs: [check-labels] - environment: staging - # Declare outputs for next steps - outputs: - frontend_changed: ${{ steps.check_file_changed.outputs.frontend_changed }} - - steps: - - uses: actions/checkout@v2 - with: - # Checkout as many commits as needed for the diff - fetch-depth: 2 - - - shell: pwsh - id: check_file_changed - run: | - # Diff HEAD with the previous commit - $diff = git diff --name-only HEAD^ HEAD - # Check if a file under frontend/ has changed (added, modified, deleted) - $SourceDiffFrontend = $diff | Where-Object { $_ -match '^idea/frontend/' } - $HasDiffFrontend = $SourceDiffFrontend.Length -gt 0 - # Set the output - Write-Host "::set-output name=frontend_changed::$HasDiffFrontend" - - - name: Cancel previous workflow runs - if: steps.check_file_changed.outputs.frontend_changed == 'True' - uses: styfle/cancel-workflow-action@0.4.0 - with: - access_token: ${{ github.token }} - - - if: steps.check_file_changed.outputs.frontend_changed == 'True' - uses: c-hive/gha-yarn-cache@v2.1.0 - - - name: Setup NodeJS - if: steps.check_file_changed.outputs.frontend_changed == 'True' - uses: actions/setup-node@v2 - with: - node-version: 18 - cache: yarn - - - name: Install dependencies - if: steps.check_file_changed.outputs.frontend_changed == 'True' - uses: borales/actions-yarn@v3.0.0 - with: - cmd: install - - - name: Install additional dependencies rollup-linux-x64-gnu - if: steps.check_file_changed.outputs.frontend_changed == 'True' - run : sudo yarn add @rollup/rollup-linux-x64-gnu - - - name: Build frontend pkg - if: steps.check_file_changed.outputs.frontend_changed == 'True' - run: sudo yarn build:frontend - - build-and-push-gear-node-image: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - needs: [check-labels] - environment: dev - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Log in to the github container registry - uses: docker/login-action@master - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Gear node Docker image - uses: docker/build-push-action@master - with: - file: k8s/gear-node/Dockerfile - push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-node:dev - - build-and-push-indexer-image: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - needs: [check-labels] - environment: dev - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Log in to the github container registry - uses: docker/login-action@master - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Indexer Docker image - uses: docker/build-push-action@master - with: - file: idea/indexer/Dockerfile - push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-indexer:dev - - build-and-push-api-gateway-image: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - needs: [check-labels] - environment: dev - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Log in to the github container registry - uses: docker/login-action@master - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Api Gateway Docker image - uses: docker/build-push-action@master - with: - file: idea/api-gateway/Dockerfile - push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-api-gateway:dev - - build-and-push-meta-storage-image: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - needs: [check-labels] - environment: dev - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Log in to the github container registry - uses: docker/login-action@master - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Meta Storage Docker image - uses: docker/build-push-action@master - with: - file: idea/meta-storage/Dockerfile - push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-meta-storage:dev - - build-and-push-test-balance-image: - if: github.event.pull_request.draft == false - runs-on: ubuntu-latest - needs: [check-labels] - environment: dev - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Log in to the github container registry - uses: docker/login-action@master - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Test Balance Docker image - uses: docker/build-push-action@master - with: - file: idea/test-balance/Dockerfile - push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-test-balance:dev - - purge-k8s-test-env: - if: github.event.pull_request.draft == false - needs: - [ - build-and-push-indexer-image, - build-and-push-api-gateway-image, - build-and-push-meta-storage-image, - build-and-push-test-balance-image, - build-and-push-gear-node-image - ] - runs-on: ubuntu-latest - - steps: - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - - - name: Restart RabbitMQ - uses: sergeyfilyanin/kubectl-aws-eks@master - with: - args: rollout restart deployment rabbitmq -n $KUBE_NAMESPACE - - - name: Check RabbitMQ - uses: sergeyfilyanin/kubectl-aws-eks@master - with: - args: rollout status deployment rabbitmq -n $KUBE_NAMESPACE --timeout=120s - - - name: Deploy to k8s - uses: sergeyfilyanin/kubectl-aws-eks@master - with: - args: rollout restart deployment gear-node api-gateway-testenv frontend-nginx-testenv postgres-testenv postgres-testbalance-testenv postgres-meta-testenv -n $KUBE_NAMESPACE - - - name: Check k8s deployments - uses: sergeyfilyanin/kubectl-aws-eks@master - with: - args: get deployment -o name -n $KUBE_NAMESPACE | xargs -n1 -t kubectl rollout status -n $KUBE_NAMESPACE --timeout=120s - - - name: Deploy to k8s indexer - uses: sergeyfilyanin/kubectl-aws-eks@master - with: - args: rollout restart deployment test-balance-testenv indexer-testenv meta-storage -n $KUBE_NAMESPACE - - - name: Check k8s deployment test-balance-testenv - uses: sergeyfilyanin/kubectl-aws-eks@master - with: - args: rollout status deployment test-balance-testenv -n $KUBE_NAMESPACE --timeout=120s - - - name: Check k8s deployment indexer - uses: sergeyfilyanin/kubectl-aws-eks@master - with: - args: rollout status deployment indexer-testenv -n $KUBE_NAMESPACE --timeout=120s - - - name: Check k8s deployment meta-storage - uses: sergeyfilyanin/kubectl-aws-eks@master - with: - args: rollout status deployment meta-storage -n $KUBE_NAMESPACE --timeout=120s - - run-e2e-tests: - if: github.event.pull_request.draft == false - needs: [purge-k8s-test-env] - runs-on: ubuntu-latest - environment: dev - env: - RUSTUP_HOME: /tmp/rustup_home - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install NodeJS 20.x - uses: actions/setup-node@v2.1.5 - with: - node-version: 20.x - - - name: Set up Rust - uses: dtolnay/rust-toolchain@stable - with: - targets: wasm32-unknown-unknown - - - name: "Prepare: Build test programs" - working-directory: api/programs - run: cargo build --release - - - name: "Prepare: Copy built programs" - run: cp api/programs/target/wasm32-unknown-unknown/release/* idea/tests/wasm-test - - - name: "Prepare: Build test programs" - working-directory: idea/tests/programs - run: cargo build --release - - - name: "Install dependencies" - run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install - - - name: "Build: @gear-js/common" - run: yarn build:common - - - name: "Run tests" - timeout-minutes: 7 - working-directory: idea/tests - env: - API_ENDPOINT: ${{ secrets.API_ADDRESS_URL_TEST }} - WS_PROVIDER: ${{ secrets.WS_PROVIDER_URL_TEST }} - WS_PROVIDER_VARA: ${{ secrets.WS_PROVIDER_VARA_URL_TEST }} - TEST_ENV: ${{ secrets.TEST_ENV }} - run: yarn test diff --git a/idea/api-gateway/.env.example b/idea/api-gateway/.env.example deleted file mode 100644 index fdca7e61fa..0000000000 --- a/idea/api-gateway/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -RABBIT_MQ_URL=amqp://127.0.0.1 -CAPTCH_SECRET=0x234567898765432 -PORT=3000 diff --git a/idea/api-gateway/.eslintrc.js b/idea/api-gateway/.eslintrc.js deleted file mode 100644 index 58f69ab170..0000000000 --- a/idea/api-gateway/.eslintrc.js +++ /dev/null @@ -1,37 +0,0 @@ -module.exports = { - 'root': true, - 'env': { - 'browser': true, - 'es2021': true, - 'node': true - }, - 'extends': ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], - 'parser': '@typescript-eslint/parser', - 'parserOptions': { - 'ecmaVersion': 'latest', - 'sourceType': 'module' - }, - 'plugins': ['@typescript-eslint'], - 'rules': { - 'indent': [ - 'warn', - 2, - { - 'SwitchCase': 1, - 'flatTernaryExpressions': false - } - ], - 'object-curly-spacing': ['error', 'always'], - 'max-len': ['error', { 'code': 120, 'tabWidth': 2 }], - 'linebreak-style': ['error', 'unix'], - 'quotes': ['warn', 'single', { 'avoidEscape': true }], - 'semi': ['error', 'always'], - 'eol-last': 'error', - '@typescript-eslint/no-empty-function': 0, - 'no-case-declarations': 0, - '@typescript-eslint/interface-name-prefix': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-explicit-any': 'off' - } -}; diff --git a/idea/api-gateway/.gitignore b/idea/api-gateway/.gitignore deleted file mode 100644 index ea48d652e5..0000000000 --- a/idea/api-gateway/.gitignore +++ /dev/null @@ -1,37 +0,0 @@ -# compiled output -/dist -/node_modules - -# Logs -logs -*.log -npm-debug.log* -pnpm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# OS -.DS_Store - -# Tests -/coverage -/.nyc_output - -# IDEs and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace - -# IDE - VSCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -.env \ No newline at end of file diff --git a/idea/api-gateway/.prettierrc b/idea/api-gateway/.prettierrc deleted file mode 100644 index 756227b5ad..0000000000 --- a/idea/api-gateway/.prettierrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "singleQuote": true, - "trailingComma": "all", - "endOfLine": "lf", - "printWidth": 120, - "bracketSpacing": true, - "bracketSameLine": true, - "arrowParens": "always", - "tabWidth": 2 -} diff --git a/idea/api-gateway/Dockerfile b/idea/api-gateway/Dockerfile deleted file mode 100644 index 6b9e03533d..0000000000 --- a/idea/api-gateway/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM node:18-alpine - -WORKDIR /src -COPY package.json . -COPY yarn.lock . -COPY tsconfig.json . -COPY .yarn .yarn -COPY .yarnrc.yml . -COPY ./idea/common idea/common -COPY ./idea/api-gateway idea/api-gateway -RUN yarn install -RUN yarn build:common -RUN yarn build:api-gateway - -CMD ["node", "idea/api-gateway/dist/main"] diff --git a/idea/api-gateway/README.md b/idea/api-gateway/README.md deleted file mode 100644 index 925f7d89a9..0000000000 --- a/idea/api-gateway/README.md +++ /dev/null @@ -1,723 +0,0 @@ -# @gear-js/api-gateway - - -# JSON-RPC API Documentation - -This document describes the JSON-RPC API for our service. - -## Overview - -Our service uses JSON-RPC 2.0 for communication. All requests should be POST requests with a JSON body. - -## Methods - -### `networkData.available` - -Checks if the network data is indexed - -
-Details - -#### Parameters - -- `genesis` (string): The genesis of the network. - -#### Response - -- `result` (boolean): Returns `true` if the network is indexed, `false` otherwise. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "networkData.available", - "params": { - "genesis": "0x..." - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": true, - "id": 1 -} -``` - -
- -### `testBalance.available` - -Checks if there is a service allowing to get test balance on the network - -
-Click to expand! - -#### Parameters - -- `genesis` (string): The network genesis - -#### Response - -- `result` (boolean): Returns `true` if a service allowing to get test balance on the network is available, `false` otherwise. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "testBalance.available", - "params": { - "genesis": "0x..." - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": true, - "id": 1 -} -``` - -
- -### `code.all` - -Get list of codes. - -
-Click to expand! - -#### Parameters - -- `genesis` (string): The network genesis -- `limit` (number, default - 20): The maximum number of items to return. -- `offset` (number, default - 0): The number of items to skip before starting to return items. -- `query` (string, optional): A query string to search by part of the id or part of the name. -- `name` (string, optional): The name of the code. -- `fromDate` (string, optional): The start date for the range within which to search for codes. The date should be in ISO 8601 format (YYYY-MM-DD) -- `toDate` (string, optional): The end date for the range within which to search for codes. The date should be in ISO 8601 format (YYYY-MM-DD). -- `uploadedBy` (string, optional): The public key of the user who uploaded the code. Use this to filter codes by uploader. - -#### Response - -- `result` (array): An array of code objects. Each object contains details about a code, such as its id, name, upload date, and uploader. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "code.all", - "params": { - "genesis": "0x...", - "query": "ab123c", - "fromDate": "2022-01-01", - "toDate": "2022-12-31", - "uploadedBy": "0x...", - "limit": 10, - "offset": 0 - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "count": 2, - "listCode": [ - { - "id": "0x570d184cb5ff2b845b63ce7f94c2a191b658bb6e42eab94627397f969e9be6e8", - "uploadedBy": "0xd6ba31b063bb5772340340a01d07da39718c848efcfb86d051d49c8fec030cba", - "name": "0x570d184cb5ff2b845b63ce7f94c2a191b658bb6e42eab94627397f969e9be6e8", - "status": "Active", - "expiration": null, - "metahash": "0xdedd8663580779a9c869640c044c960bfa6750daf64c74bd3fff762d2697b32d", - "hasState": true, - }, - { - "id": "0xc9998ec8b51bccc4e3077099649c99beebc0d609f21d1d565d7de92b82a1973b", - "uploadedBy": "0xd6ba31b063bb5772340340a01d07da39718c848efcfb86d051d49c8fec030cba", - "name": "my_code", - "status": "Inactive", - "expiration": null, - "metahash": "0x97ac512079f4877503d16ede380b23ceefb2cc340cd9313c911a3110336f8c76", - "hasState": false, - }, - ] - }, - "id": 1 -} -``` - -
- - -### `code.data` - -Retrieves detailed information about a specific code. - -
-Click to expand! - -#### Parameters - -- `genesis` (string): The network genesis -- `id` (string): The id of the code for which to retrieve details. - -#### Response - -- `result` (object): An object containing detailed information about the code. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "code.all", - "params": { - "genesis": "0x...", - "id": "0x570d184cb5ff2b845b63ce7f94c2a191b658bb6e42eab94627397f969e9be6e8", - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "id": "0x570d184cb5ff2b845b63ce7f94c2a191b658bb6e42eab94627397f969e9be6e8", - "uploadedBy": "0xd6ba31b063bb5772340340a01d07da39718c848efcfb86d051d49c8fec030cba", - "name": "0x570d184cb5ff2b845b63ce7f94c2a191b658bb6e42eab94627397f969e9be6e8", - "status": "Active", - "expiration": null, - "metahash": "0xdedd8663580779a9c869640c044c960bfa6750daf64c74bd3fff762d2697b32d", - "hasState": true - }, - "id": 1 -} -``` - -
- - -### `code.name.add` - -Assigns a name to a code. - -
-Click to expand! - -#### Parameters - -- `genesis` (string): The network genesis. -- `id` (string): The id of the code to which to assign a name. -- `name` (string): The name to assign to the code. - -#### Response - -- `result` (object): An object containing detailed information about the code. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "code.name.add", - "params": { - "genesis": "0x...", - "id": "0x570d184cb5ff2b845b63ce7f94c2a191b658bb6e42eab94627397f969e9be6e8", - "name": "my_code" - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "id": "0x570d184cb5ff2b845b63ce7f94c2a191b658bb6e42eab94627397f969e9be6e8", - "uploadedBy": "0xd6ba31b063bb5772340340a01d07da39718c848efcfb86d051d49c8fec030cba", - "name": "my_code", - "status": "Active", - "expiration": null, - "metahash": "0xdedd8663580779a9c869640c044c960bfa6750daf64c74bd3fff762d2697b32d", - "hasState": true - }, - "id": 1 -} -``` - -
- -### `program.all` - -Get list of programs. - -
-Click to expand! - -#### Parameters - -- `genesis` (string): The network genesis -- `limit` (number, default - 20): The maximum number of items to return. -- `offset` (number, default - 0): The number of items to skip before starting to return items. -- `query` (string, optional): A query string to search by part of the id or part of the name. -- `fromDate` (string, optional): The start date for the range within which to search for programs. The date should be in ISO 8601 format (YYYY-MM-DD) -- `toDate` (string, optional): The end date for the range within which to search for programs. The date should be in ISO 8601 format (YYYY-MM-DD). -- `owner` (string, optional): The public key of the user who created the program. Use this to filter programs by uploader. -- `codeId` (string, optional): The id of the code that the program uses. -- `status` (string | string[], optional): The status of the program. Use this to filter programs by status. Possible values are `active`, `inactive`, `programSet`, `exited`, `paused`. - -#### Response - -- `result` (array): An array of program objects. Each object contains details about a program, such as its id, name, upload date, and uploader. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "program.all", - "params": { - "genesis": "0x...", - "query": "ab123c", - "fromDate": "2022-01-01", - "toDate": "2022-12-31", - "limit": 10, - "offset": 0 - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "count": 2, - "programs": [ - { - "id": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "owner": "0xd6ba31b063bb5772340340a01d07da39718c848efcfb86d051d49c8fec030cba", - "name": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "status": "active", - "codeId":"0xc9998ec8b51bccc4e3077099649c99beebc0d609f21d1d565d7de92b82a1973b", - "metahash": "0xdedd8663580779a9c869640c044c960bfa6750daf64c74bd3fff762d2697b32d", - "hasState": true, - }, - { - "id": "0x3f7f4e6365438d5f9f029aab677609901fc94718629a84a845634fafb7679f03", - "owner": "0xd6ba31b063bb5772340340a01d07da39718c848efcfb86d051d49c8fec030cba", - "name": "my_program", - "status": "inactive", - "codeId": "0x570d184cb5ff2b845b63ce7f94c2a191b658bb6e42eab94627397f969e9be6e8", - "metahash": "0x97ac512079f4877503d16ede380b23ceefb2cc340cd9313c911a3110336f8c76", - "hasState": false, - }, - ] - }, - "id": 1 -} -``` - -
- - -### `program.data` - -Retrieves detailed information about a specific program. - -
-Click to expand! - -#### Parameters - -- `genesis` (string): The network genesis -- `id` (string): The id of the program for which to retrieve details. - -#### Response - -- `result` (object): An object containing detailed information about the program. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "program.data", - "params": { - "genesis": "0x...", - "id": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "id": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "owner": "0xd6ba31b063bb5772340340a01d07da39718c848efcfb86d051d49c8fec030cba", - "name": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "status": "active", - "codeId":"0xc9998ec8b51bccc4e3077099649c99beebc0d609f21d1d565d7de92b82a1973b", - "metahash": "0xdedd8663580779a9c869640c044c960bfa6750daf64c74bd3fff762d2697b32d", - "hasState": true, - }, - "id": 1 -} -``` - -
- - - -### `program.name.add` - -Assigns a name to a program. - -
-Click to expand! - -#### Parameters - -- `genesis` (string): The network genesis. -- `id` (string): The id of the program to which to assign a name. -- `name` (string): The name to assign to the program. - -#### Response - -- `result` (object): An object containing detailed information about the program. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "program.name.add", - "params": { - "genesis": "0x...", - "id": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "name": "my_program" - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "id": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "owner": "0xd6ba31b063bb5772340340a01d07da39718c848efcfb86d051d49c8fec030cba", - "name": "my_program", - "status": "active", - "codeId":"0xc9998ec8b51bccc4e3077099649c99beebc0d609f21d1d565d7de92b82a1973b", - "metahash": "0xdedd8663580779a9c869640c044c960bfa6750daf64c74bd3fff762d2697b32d", - "hasState": true, - }, - "id": 1 -} -``` - -
- - -### `message.all` - -Get list of messages. - -
-Click to expand! - -#### Parameters - -- `genesis` (string): The network genesis -- `limit` (number, default - 20): The maximum number of items to return. -- `offset` (number, default - 0): The number of items to skip before starting to return items. -- `fromDate` (string, optional): The start date for the range within which to search for programs. The date should be in ISO 8601 format (YYYY-MM-DD) -- `toDate` (string, optional): The end date for the range within which to search for programs. The date should be in ISO 8601 format (YYYY-MM-DD). -- `destination` (string, optional): The public key of the recipient of the message. -- `source` (string, optional): The public key of the sender of the message. -- `mailbox` (boolean, optional): If true, returns only messages that are in the mailbox of the recipient. -- `type` (string, optional): The type of the message. Possible values are `UserMessageSent`, `MessageQueued` -- `withPrograms` (boolean, optional): If true, returns messages and list of program names. - -#### Response - -- `result` (array): An array of message objects. Each object contains details about a message, such as its id, source, destination, etc. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "message.all", - "params": { - "genesis": "0x...", - "fromDate": "2022-01-01", - "toDate": "2022-12-31", - "source": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "destination": "0xb77bc0d1303cb352169fc44abb980e1fb84cf771618b9b939a9652b3d2744282", - "limit": 10, - "offset": 0, - "withPrograms": true - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "count": 2, - "messages": [ - { - "id": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "blockHash": "0xcd768540b85127b3605907f11c94bf850076639afafe2771014fb2e63ff13f3d", - "genesis": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "timestamp": "1698746421000", - "destination":"0xc9998ec8b51bccc4e3077099649c99beebc0d609f21d1d565d7de92b82a1973b", - "source": "0xdedd8663580779a9c869640c044c960bfa6750daf64c74bd3fff762d2697b32d", - "payload": "0x", - "entry": "handle", - "expiration": null, - "replyToMessageId": null, - "exitCode": null, - "processedWithPanic": false, - "value": "0", - "type": "MessageQueued", - "readReason": null, - }, - { - "id": "0xdc0329e1723e75bdc7984d2c608241390851d3212d6163109c20f80ebe18ecdc", - "blockHash": "0xcd768540b85127b3605907f11c94bf850076639afafe2771014fb2e63ff13f3d", - "genesis": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "timestamp": "1698746421000", - "destination":"0xdedd8663580779a9c869640c044c960bfa6750daf64c74bd3fff762d2697b32d", - "source": "0xc9998ec8b51bccc4e3077099649c99beebc0d609f21d1d565d7de92b82a1973b", - "payload": "0x", - "entry": null, - "expiration": null, - "replyToMessageId": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "exitCode": null, - "processedWithPanic": false, - "value": "0", - "type": "UserMessageSent", - "readReason": null, - }, - ], - "programNames": { - "0xc9998ec8b51bccc4e3077099649c99beebc0d609f21d1d565d7de92b82a1973b": "my_program" - } - }, - "id": 1 -} -``` - -
- - -### `message.data` - -Retrieves detailed information about a specific message. - -
-Click to expand! - -#### Parameters - -- `genesis` (string): The network genesis -- `id` (string): The id of the program for which to retrieve details., -- `withMetahash` (boolean, optional): If true, returns the metahash that can be used to get metadata to decode the payload of the message. - -#### Response - -- `result` (object): An object containing detailed information about the message. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "message.data", - "params": { - "genesis": "0x...", - "id": "0xdc0329e1723e75bdc7984d2c608241390851d3212d6163109c20f80ebe18ecdc", - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "id": "0xdc0329e1723e75bdc7984d2c608241390851d3212d6163109c20f80ebe18ecdc", - "blockHash": "0xcd768540b85127b3605907f11c94bf850076639afafe2771014fb2e63ff13f3d", - "genesis": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "timestamp": "1698746421000", - "destination":"0xdedd8663580779a9c869640c044c960bfa6750daf64c74bd3fff762d2697b32d", - "source": "0xc9998ec8b51bccc4e3077099649c99beebc0d609f21d1d565d7de92b82a1973b", - "payload": "0x", - "entry": null, - "expiration": null, - "replyToMessageId": "0x5835bda08cc9757ea6011ae5bc3f4d8c0357581bb07c3ff195cdac08bbe1deb5", - "exitCode": null, - "processedWithPanic": false, - "value": "0", - "type": "UserMessageSent", - "readReason": null, - }, - "id": 1 -} -``` - -
- -### `meta.get` - -Retrieves metadata for a specific metahash. - -
-Click to expand! - -#### Parameters - -- `hash` (string): The metahash for which to retrieve metadata. - -#### Response - -- `result` (object): An object containing metadata for the metahash. - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "meta.get", - "params": { - "hash": "0xdc0329e1723e75bdc7984d2c608241390851d3212d6163109c20f80ebe18ecdc", - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "hash": "0xdc0329e1723e75bdc7984d2c608241390851d3212d6163109c20f80ebe18ecdc", - "hex": "0x", - }, - "id": 1 -} -``` - -
- -### `meta.add` - -Adds metadata for a specific metahash. - -
-Click to expand! - -#### Parameters - -- `hash` (string): The metahash for which to retrieve metadata. -- `hex` (string): The metadata in hex format. - -#### Response - -- `result` (object): An object containing metadata and metahash - -#### Example - -Request: - -```json -{ - "jsonrpc": "2.0", - "method": "meta.add", - "params": { - "hash": "0xdc0329e1723e75bdc7984d2c608241390851d3212d6163109c20f80ebe18ecdc", - "hex": "0x" - }, - "id": 1 -} -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "hash": "0xdc0329e1723e75bdc7984d2c608241390851d3212d6163109c20f80ebe18ecdc", - "hex": "0x", - }, - "id": 1 -} -``` - -
- - diff --git a/idea/api-gateway/package.json b/idea/api-gateway/package.json deleted file mode 100644 index 5ad452d522..0000000000 --- a/idea/api-gateway/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@gear-js/api-gateway", - "version": "1.0.0", - "description": "", - "author": "", - "private": true, - "license": "GPL-3.0", - "main": "main.js", - "scripts": { - "build": "tsc -p tsconfig.json", - "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", - "start": "node dist/main.js", - "dev": "clear && nodemon src/main.ts" - }, - "dependencies": { - "@gear-js/common": "workspace:^", - "@types/amqplib": "^0.8.2", - "@types/cron": "2.0.0", - "amqplib": "^0.10.3", - "cron": "2.1.0", - "dotenv": "16.0.1", - "express": "4.18.1", - "hcaptcha": "0.1.1", - "nanoid": "3.3.4", - "redis": "^4.6.8", - "rimraf": "3.0.2" - }, - "devDependencies": { - "@types/express": "4.17.13", - "@types/jest": "26.0.24", - "@types/node": "14.18.24", - "@types/nodemon": "1.19.2", - "@typescript-eslint/eslint-plugin": "4.33.0", - "@typescript-eslint/parser": "4.33.0", - "eslint": "7.32.0", - "eslint-config-prettier": "8.5.0", - "eslint-plugin-prettier": "3.4.1", - "nodemon": "2.0.19", - "prettier": "2.7.1", - "supertest": "6.2.4", - "ts-jest": "26.5.6", - "ts-loader": "8.4.0", - "ts-node": "10.9.1", - "ts-node-dev": "2.0.0", - "tsconfig-paths": "3.14.1", - "typescript": "4.7.4" - } -} diff --git a/idea/api-gateway/src/config.ts b/idea/api-gateway/src/config.ts deleted file mode 100644 index 6e9205d529..0000000000 --- a/idea/api-gateway/src/config.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { strict as assert } from 'assert'; -import { config } from 'dotenv'; -config(); - -const checkEnv = (envName: string, default_?: string) => { - const env = process.env[envName] || default_; - assert.notStrictEqual(env, undefined, `${envName} is not specified`); - return env; -}; - -export default { - server: { - port: parseInt('PORT', 10) || 3000, - captchaSecret: checkEnv('CAPTCH_SECRET'), - }, - rabbitmq: { - url: checkEnv('RABBIT_MQ_URL'), - }, - // every 1 hour "0 * * * *" - // every 10 second "*/10 * * * * *" - scheduler: { - genesisHashesTime: process.env.CRON_TIME_GENESIS_HASHES || '0 * * * *', - }, - redis: { - host: checkEnv('REDIS_HOST', '127.0.0.1'), - port: Number(checkEnv('REDIS_PORT', '6379')), - user: checkEnv('REDIS_USER', ''), - password: checkEnv('REDIS_PASSWORD', ''), - }, -}; diff --git a/idea/api-gateway/src/main.ts b/idea/api-gateway/src/main.ts deleted file mode 100644 index a003fcd560..0000000000 --- a/idea/api-gateway/src/main.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { RMQService } from './rmq'; -import { Server, changeStatus } from './server'; - -const bootstrap = async () => { - const rmq = new RMQService(); - await rmq.init(); - - changeStatus(); - - const server = new Server(rmq); - - await rmq.runScheduler(); - - server.run(); -}; - -bootstrap(); diff --git a/idea/api-gateway/src/middleware/check-genesis.middleware.ts b/idea/api-gateway/src/middleware/check-genesis.middleware.ts deleted file mode 100644 index 41b1b82828..0000000000 --- a/idea/api-gateway/src/middleware/check-genesis.middleware.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { Response, Request, NextFunction } from 'express'; -import { IRpcRequest, JSONRPC_ERRORS, META_STORAGE_METHODS } from '@gear-js/common'; - -import { getResponse } from '../utils'; - -const metaStorageMethods: string[] = Object.values(META_STORAGE_METHODS); - -export async function checkGenesisMiddleware( - { body }: Request, - res: Response, - next: NextFunction, -) { - if (Array.isArray(body)) { - for (let i = 0; i < body.length; i++) { - if (metaStorageMethods.includes(body[i].method) || body[i]?.__error) { - continue; - } - - if (!body[i]?.params?.genesis) { - body[i] = { __error: getResponse(body[i], JSONRPC_ERRORS.NoGenesisFound.name) }; - } - } - } else { - if (metaStorageMethods.includes(body.method)) { - return next(); - } - if (!body.params.genesis) { - return res.send(getResponse(body, JSONRPC_ERRORS.NoGenesisFound.name)); - } - } - - next(); -} diff --git a/idea/api-gateway/src/middleware/index.ts b/idea/api-gateway/src/middleware/index.ts deleted file mode 100644 index 31d69a26fe..0000000000 --- a/idea/api-gateway/src/middleware/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './test-balance.middleware'; -export * from './check-genesis.middleware'; -export * from './validate-json-rpc-request.middleware'; diff --git a/idea/api-gateway/src/middleware/test-balance.middleware.ts b/idea/api-gateway/src/middleware/test-balance.middleware.ts deleted file mode 100644 index 04c65c219a..0000000000 --- a/idea/api-gateway/src/middleware/test-balance.middleware.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Response, Request, NextFunction } from 'express'; -import { TEST_BALANCE_METHODS, IRpcRequest, JSONRPC_ERRORS } from '@gear-js/common'; -import { verify } from 'hcaptcha'; - -import config from '../config'; -import { getResponse } from '../utils'; - -const SECRET = config.server.captchaSecret; - -async function verifyCaptcha(token: string): Promise { - if (!token) { - return false; - } - if (process.env.TEST_ENV) { - return true; - } - const verfied = await verify(SECRET, token); - return verfied.success; -} - -export async function captchaMiddleware({ body }: Request, res: Response, next: NextFunction) { - if (Array.isArray(body)) { - for (const request of body) { - if (body.method === TEST_BALANCE_METHODS.TEST_BALANCE_GET && !(await verifyCaptcha(request.params['token']))) { - return res.send(getResponse(body, JSONRPC_ERRORS.Forbidden.name)); - } - } - } else { - if (body.method === TEST_BALANCE_METHODS.TEST_BALANCE_GET) { - if (!(await verifyCaptcha(body.params['token']))) { - return res.send(getResponse(body, JSONRPC_ERRORS.Forbidden.name)); - } - } - } - - return next(); -} diff --git a/idea/api-gateway/src/middleware/validate-json-rpc-request.middleware.ts b/idea/api-gateway/src/middleware/validate-json-rpc-request.middleware.ts deleted file mode 100644 index b750961f8d..0000000000 --- a/idea/api-gateway/src/middleware/validate-json-rpc-request.middleware.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { NextFunction, Request, Response } from 'express'; -import { IRpcRequest, JSONRPC_ERRORS, logger } from '@gear-js/common'; - -export async function validateJsonRpcRequestMiddleware({ body }: Request, res: Response, next: NextFunction) { - if (Array.isArray(body)) { - if (body.length === 0) { - return res.send(getInvalidRequestResponse(null)); - } - for (let i = 0; i < body.length; i++) { - if (!isValidRequestParams(body[i])) { - body[i] = { __error: getInvalidRequestResponse(body[i]) }; - } - } - } else { - if (!isValidRequestParams(body)) { - return res.send(getInvalidRequestResponse(body)); - } - } - - next(); -} - -const isValidRequestParams = ({ id, method, jsonrpc, params }: IRpcRequest): boolean => - !!id && !!method && !!jsonrpc && !!params; - -function getInvalidRequestResponse(req: IRpcRequest) { - logger.info('Invalid request error', { req }); - - const error = JSONRPC_ERRORS.InvalidRequest; - - return { - jsonrpc: '2.0', - id: req?.id || null, - error: { - message: error.message, - code: error.code, - }, - }; -} diff --git a/idea/api-gateway/src/rmq.ts b/idea/api-gateway/src/rmq.ts deleted file mode 100644 index db6ea00eed..0000000000 --- a/idea/api-gateway/src/rmq.ts +++ /dev/null @@ -1,210 +0,0 @@ -import { CronJob } from 'cron'; -import { connect, Connection, Channel } from 'amqplib'; -import { logger, RMQExchange, RMQMessage, RMQQueue, RMQReply, RMQServiceAction, RMQServices } from '@gear-js/common'; - -import config from './config'; - -export class RMQService { - private indexerChannels: Map; - private tbChannels: Map; - public replies: Map RMQReply>; - private connection: Connection; - private metaChannel: Channel; - private mainChannel: Channel; - - constructor() { - this.indexerChannels = new Map(); - this.tbChannels = new Map(); - this.replies = new Map RMQReply>(); - } - - public async init(): Promise { - try { - this.connection = await connect(config.rabbitmq.url); - - logger.info('RabbitMQ connection established sucessfuly', { url: config.rabbitmq.url }); - } catch (error) { - logger.error('Failed to connect to to RabbitMQ', { error }); - process.exit(1); - } - - this.mainChannel = await this.connection.createChannel(); - await this.mainChannel.assertExchange(RMQExchange.GENESISES, 'fanout', { durable: true }); - await this.mainChannel.assertExchange(RMQExchange.DIRECT_EX, 'direct', { durable: true }); - await this.mainChannel.assertQueue(RMQQueue.REPLIES, { - durable: true, - exclusive: false, - autoDelete: false, - messageTtl: 30_000, - }); - - await this.mainChannel.bindQueue(RMQQueue.REPLIES, RMQExchange.DIRECT_EX, RMQQueue.REPLIES); - - await this.mainChannel.assertQueue(RMQQueue.GENESIS, { - durable: true, - exclusive: false, - autoDelete: false, - messageTtl: 30_000, - }); - - await this.mainChannel.bindQueue(RMQQueue.GENESIS, RMQExchange.DIRECT_EX, RMQQueue.GENESIS); - - this.metaChannel = await this.connection.createChannel(); - this.metaChannel.assertExchange(RMQExchange.DIRECT_EX, 'direct', { durable: true }); - - await this.subscribeToGenesises(); - await this.subscribeToReplies(); - } - - private async subscribeToReplies(): Promise { - await this.mainChannel.consume( - RMQQueue.REPLIES, - (message) => { - if (!message) { - return; - } - - const messageContent = JSON.parse(message.content.toString()); - const correlationId = message.properties.correlationId; - const resultFromService = this.replies.get(correlationId); - - if (resultFromService) resultFromService(messageContent); - - this.replies.delete(correlationId); - }, - { noAck: true }, - ); - } - - private async subscribeToGenesises() { - await this.mainChannel.consume( - RMQQueue.GENESIS, - async (message) => { - if (!message) { - return; - } - - const { genesis, service, action } = JSON.parse(message.content.toString()); - logger.info(RMQQueue.GENESIS, { genesis, service, action }); - - switch (service) { - case RMQServices.INDEXER: { - if (action === RMQServiceAction.ADD) { - if (this.indexerChannels.has(genesis)) return; - - const channel = await this.createChannel(); - this.indexerChannels.set(genesis, channel); - await channel.assertQueue(`${RMQServices.INDEXER}.${genesis}`, { - durable: false, - exclusive: false, - autoDelete: true, - }); - } else if (action === RMQServiceAction.DELETE) { - const channel = this.indexerChannels.get(genesis); - if (channel) { - await channel.close(); - this.indexerChannels.delete(genesis); - } - } - break; - } - case RMQServices.TEST_BALANCE: { - if (action === RMQServiceAction.ADD) { - if (this.tbChannels.has(genesis)) return; - - const channel = await this.createChannel(); - this.tbChannels.set(genesis, channel); - await channel.assertQueue(`${RMQServices.TEST_BALANCE}.${genesis}`, { durable: false, exclusive: false }); - } else if (action === RMQServiceAction.DELETE) { - const channel = this.tbChannels.get(genesis); - if (channel) { - await channel.close(); - this.tbChannels.delete(genesis); - } - } - break; - } - default: { - logger.error('Unknown service', { service, genesis, action }); - } - } - - logger.info( - 'Genesises updated', - service === RMQServices.INDEXER - ? { indexer: Array.from(this.indexerChannels.keys()) } - : { tb: Array.from(this.tbChannels.keys()) }, - ); - }, - { noAck: true }, - ); - } - - private async createChannel() { - const channel = await this.connection.createChannel(); - channel.assertExchange(RMQExchange.DIRECT_EX, 'direct', { durable: true }); - return channel; - } - - public sendMsgToIndexer({ genesis, params, correlationId, method }: RMQMessage) { - const channel = this.indexerChannels.get(genesis); - - channel.publish(RMQExchange.DIRECT_EX, `${RMQServices.INDEXER}.${genesis}`, Buffer.from(JSON.stringify(params)), { - correlationId, - headers: { method }, - }); - } - - public sendMsgToMetaStorage({ params, correlationId, method }: RMQMessage) { - this.metaChannel.publish(RMQExchange.DIRECT_EX, RMQServices.META_STORAGE, Buffer.from(JSON.stringify(params)), { - correlationId, - headers: { method }, - }); - } - - public sendMsgToTestBalance({ genesis, params, correlationId, method }: RMQMessage) { - const channel = this.tbChannels.get(genesis); - - channel.publish( - RMQExchange.DIRECT_EX, - `${RMQServices.TEST_BALANCE}.${genesis}`, - Buffer.from(JSON.stringify(params)), - { - correlationId, - headers: { method }, - }, - ); - } - - public requestActiveGenesises() { - this.mainChannel.publish(RMQExchange.GENESISES, '', Buffer.from('')); - logger.info(`Genesises request sent`); - } - - public isExistTBChannel(genesis: string) { - return this.tbChannels.has(genesis); - } - - public isExistIndexerChannel(genesis: string) { - return this.indexerChannels.has(genesis); - } - - public async runScheduler() { - const cronTime = config.scheduler.genesisHashesTime; - - new CronJob( - cronTime, - async () => { - this.tbChannels.clear(); - this.indexerChannels.clear(); - - this.requestActiveGenesises(); - }, - null, - true, - null, - null, - true, - ); - } -} diff --git a/idea/api-gateway/src/server.ts b/idea/api-gateway/src/server.ts deleted file mode 100644 index b067f9e701..0000000000 --- a/idea/api-gateway/src/server.ts +++ /dev/null @@ -1,222 +0,0 @@ -import { - INDEXER_METHODS, - META_STORAGE_METHODS, - RMQMessage, - RMQReply, - TEST_BALANCE_METHODS, - IRpcRequest, - IRpcResponse, - JSONRPC_ERRORS, - API_GATEWAY_METHODS, - logger, - IRpcRequestAfterMiddleware, -} from '@gear-js/common'; -import { nanoid } from 'nanoid'; -import express, { Express, Request, Response } from 'express'; -import { createClient } from 'redis'; - -import { getResponse } from './utils'; -import { checkGenesisMiddleware, captchaMiddleware, validateJsonRpcRequestMiddleware } from './middleware'; -import config from './config'; -import { RMQService } from './rmq'; - -const status = { - rmq: false, -}; - -export function changeStatus() { - status.rmq = !status.rmq; -} - -const AVAILABLE_METHODS: string[] = [ - ...Object.values(INDEXER_METHODS), - ...Object.values(TEST_BALANCE_METHODS), - ...Object.values(META_STORAGE_METHODS), - ...Object.values(API_GATEWAY_METHODS), -]; - -const METHODS_FOR_CACHE_WITH_EXPIRATIONS: Record = { - [INDEXER_METHODS.CODE_DATA]: 300, - [INDEXER_METHODS.PROGRAM_DATA]: 300, - [INDEXER_METHODS.MESSAGE_DATA]: 300, - [INDEXER_METHODS.PROGRAM_ALL]: 10, - [INDEXER_METHODS.MESSAGE_ALL]: 20, - [INDEXER_METHODS.CODE_ALL]: 20, - [INDEXER_METHODS.STATE_GET]: 60, - [INDEXER_METHODS.PROGRAM_STATE_ALL]: 60, - [META_STORAGE_METHODS.META_GET]: 60, -}; - -const METHODS_FOR_CACHE: string[] = Object.keys(METHODS_FOR_CACHE_WITH_EXPIRATIONS); - -function isExistJsonRpcMethod(method: string): boolean { - return AVAILABLE_METHODS.includes(method); -} - -const indexerMethods: string[] = Object.values(INDEXER_METHODS); -const metaStorageMethods: string[] = Object.values(META_STORAGE_METHODS); - -export class Server { - private app: Express; - private redisClient: ReturnType; - private isRedisConnected = false; - private isLoggedRedisError = false; - - constructor(private rmq: RMQService) { - this.app = express(); - this.app.use(express.json({ limit: '5mb' })); - this.app.use(express.urlencoded({ extended: true, limit: '5mb' })); - this.setupRoutes(); - this.redisClient = createClient({ - url: `redis://${config.redis.user}:${config.redis.password}@${config.redis.host}:${config.redis.port}`, - }); - } - - private setupRoutes() { - this.app.post( - '/api', - validateJsonRpcRequestMiddleware, - checkGenesisMiddleware, - captchaMiddleware, - async (req: Request, res: Response) => { - try { - logger.debug('Request', { method: req.body.method, params: req.body.params }); - const result = await this.handleRequest(req.body); - logger.debug('Response', { result }); - res.json(result); - } catch (error) { - logger.error('Handle request error', { error, request: req.body }); - } - }, - ); - - this.app - .get('/health', async (_, res: Response) => { - res.status(status.rmq ? 200 : 500).json({ connected: status }); - }) - .get('/rmq', async (_, res: Response) => { - res.status(status.rmq ? 200 : 500).json({ connected: status.rmq }); - }); - } - - public async run() { - this.redisClient.on('error', (err) => { - if (!this.isLoggedRedisError) { - logger.error('Redis Client Error', { error: err.message }); - this.isLoggedRedisError = true; - } - this.isRedisConnected = false; - }); - this.redisClient.on('disconnected', (err) => { - logger.warn('Redis disconnected', { error: err.message }); - this.isRedisConnected = false; - }); - this.redisClient.connect().then(() => { - this.isRedisConnected = true; - this.isLoggedRedisError = false; - logger.info('Redis connected'); - }); - return this.app.listen(config.server.port, () => logger.info(`App successfully run on the ${config.server.port}`)); - } - - private async handleRequest( - rpcBodyRequest: IRpcRequest | IRpcRequestAfterMiddleware[], - ): Promise { - if (Array.isArray(rpcBodyRequest)) { - const promises = rpcBodyRequest.map(async (rpcBody) => { - if ('__error' in rpcBody) { - return rpcBody.__error; - } else { - try { - return await this.executeProcedure(rpcBody); - } catch (error) { - return getResponse(rpcBody, error.name in JSONRPC_ERRORS ? error.name : JSONRPC_ERRORS.InternalError.name); - } - } - }); - return Promise.all(promises); - } else { - try { - return this.executeProcedure(rpcBodyRequest); - } catch (error) { - return getResponse( - rpcBodyRequest, - error.name in JSONRPC_ERRORS ? error.name : JSONRPC_ERRORS.InternalError.name, - ); - } - } - } - - private async executeProcedure(procedure: IRpcRequest): Promise { - const { method, params } = procedure; - - if (this.isRedisConnected && METHODS_FOR_CACHE.includes(method)) { - const data = await this.redisClient.get(JSON.stringify({ method, params })); - if (data) { - const result = JSON.parse(data); - return getResponse(procedure, null, result); - } - } - - if (!isExistJsonRpcMethod(method)) { - return getResponse(procedure, JSONRPC_ERRORS.MethodNotFound.name); - } - - if (method === API_GATEWAY_METHODS.TEST_BALANCE_AVAILABLE) { - return getResponse(procedure, null, this.rmq.isExistTBChannel(params.genesis)); - } - - if (method === API_GATEWAY_METHODS.NETWORK_DATA_AVAILABLE) { - return getResponse(procedure, null, this.rmq.isExistIndexerChannel(params.genesis)); - } - - if (!metaStorageMethods.includes(method) && !this.isValidGenesis(params.genesis, method)) { - return getResponse(procedure, JSONRPC_ERRORS.UnknownNetwork.name); - } - - const { error, result } = await this.jsonRpcHandler(method, params); - - if (this.isRedisConnected && result && METHODS_FOR_CACHE.includes(method)) { - this.redisClient - .set(JSON.stringify({ method, params }), JSON.stringify(result), { - EX: METHODS_FOR_CACHE_WITH_EXPIRATIONS[method], - }) - .catch((err) => { - logger.error('Failed to set value', { service: 'redis', msg: err.message, stack: err.stack }); - }); - } - - return getResponse(procedure, error, result); - } - - private async jsonRpcHandler( - method: INDEXER_METHODS | META_STORAGE_METHODS | TEST_BALANCE_METHODS, - params: unknown, - ): Promise { - const correlationId: string = nanoid(12); - const genesis = params['genesis']; - let replyResolve; - const replyPromise: Promise = new Promise((resolve) => (replyResolve = resolve)); - - const msg: RMQMessage = { correlationId, params, genesis, method }; - - if (method === TEST_BALANCE_METHODS.TEST_BALANCE_GET) { - this.rmq.sendMsgToTestBalance(msg); - } else if (indexerMethods.includes(method as INDEXER_METHODS)) { - this.rmq.sendMsgToIndexer(msg); - } else if (metaStorageMethods.includes(method as META_STORAGE_METHODS)) { - this.rmq.sendMsgToMetaStorage(msg); - } - - this.rmq.replies.set(correlationId, replyResolve); - - return replyPromise; - } - - private isValidGenesis(genesis: string, method: string): boolean { - if (method === TEST_BALANCE_METHODS.TEST_BALANCE_GET) { - return this.rmq.isExistTBChannel(genesis); - } - return this.rmq.isExistIndexerChannel(genesis); - } -} diff --git a/idea/api-gateway/src/utils/get-response.ts b/idea/api-gateway/src/utils/get-response.ts deleted file mode 100644 index 3be6a10dcd..0000000000 --- a/idea/api-gateway/src/utils/get-response.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { IRpcRequest, IRpcResponse, JSONRPC_ERRORS, logger } from '@gear-js/common'; - -export function getResponse(procedure: IRpcRequest, error?: any, result?: any): IRpcResponse { - const response: IRpcResponse = { - jsonrpc: '2.0', - id: procedure.id, - }; - - if (error || result === undefined) { - if (!JSONRPC_ERRORS[error]) { - error = 'InternalError'; - logger.warn('Internal error on request', procedure); - } - response['error'] = { message: JSONRPC_ERRORS[error].message, code: JSONRPC_ERRORS[error].code }; - } else { - response['result'] = result; - } - return response; -} diff --git a/idea/api-gateway/src/utils/index.ts b/idea/api-gateway/src/utils/index.ts deleted file mode 100644 index 1506380acc..0000000000 --- a/idea/api-gateway/src/utils/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { getResponse } from './get-response'; diff --git a/idea/api-gateway/tsconfig.json b/idea/api-gateway/tsconfig.json deleted file mode 100644 index 7e058e86f3..0000000000 --- a/idea/api-gateway/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./dist", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "allowSyntheticDefaultImports": true, - "strict": false - } -} \ No newline at end of file diff --git a/idea/indexer/.env.example b/idea/indexer/.env.example deleted file mode 100644 index 1784156c3a..0000000000 --- a/idea/indexer/.env.example +++ /dev/null @@ -1,12 +0,0 @@ -# database -DB_NAME=name -DB_USER=user -DB_PASSWORD=pwd -DB_PORT=5432 -DB_HOST=localhost - -# rabbitmq -RABBIT_MQ_URL=amqp://127.0.0.1 - -# gear network -GEAR_WS_PROVIDER=ws://127.0.0.1:9944 \ No newline at end of file diff --git a/idea/indexer/.gitignore b/idea/indexer/.gitignore deleted file mode 100644 index cfbfa63b4c..0000000000 --- a/idea/indexer/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.env -node_modules/ -dist/ \ No newline at end of file diff --git a/idea/indexer/Dockerfile b/idea/indexer/Dockerfile deleted file mode 100644 index 6eb9a07460..0000000000 --- a/idea/indexer/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM node:20-alpine - -WORKDIR /src -COPY package.json . -COPY yarn.lock . -COPY tsconfig.json . -COPY .yarn .yarn -COPY .yarnrc.yml . -COPY ./idea/common idea/common -COPY ./idea/indexer idea/indexer -RUN yarn install -RUN yarn build:common -RUN yarn build:indexer -WORKDIR /src/idea/indexer - -CMD ["node", "dist/main"] diff --git a/idea/indexer/README.md b/idea/indexer/README.md deleted file mode 100644 index bd7fc2e66b..0000000000 --- a/idea/indexer/README.md +++ /dev/null @@ -1,22 +0,0 @@ -

- - GEAR - -

-

- -

-
- -## Description -This microservice is part of the Gear Idea portal, which is responsible for indexing the Gear network and storing program and message data, as well as storing program metadata. - -## Prerequisites -1. Install and run [RabbitMQ server](https://www.rabbitmq.com/#getstarted) -2. Install [PostgreSQL](https://www.postgresql.org/docs/15/tutorial-install.html) and create a database - -## Usage -1. Specify environment variables in `.env` file. Check an example in the `.env.example` file -2. Run `yarn install` to install dependencies -3. Build the package using `yarn build` command -4. Run using `yarn start` command diff --git a/idea/indexer/package.json b/idea/indexer/package.json deleted file mode 100644 index a928cd6791..0000000000 --- a/idea/indexer/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "@gear-js/indexer", - "version": "1.0.0", - "description": "Microservice for indexing Gear network", - "author": "Gear Technologies", - "private": true, - "bugs": { - "url": "https://github.com/gear-tech/gear-js/issues" - }, - "homepage": "https://github.com/gear-tech/gear-js/tree/master/idea/indexer#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/gear-tech/gear-js.git" - }, - "license": "GPL-3.0", - "dependencies": { - "@gear-js/api": "^0.38.1", - "@gear-js/common": "workspace:^", - "@polkadot/api": "14.3.1", - "amqplib": "0.10.3", - "class-transformer": "0.5.1", - "cron": "^3.1.6", - "pg": "8.10.0", - "rxjs": "7.8.0", - "typeorm": "0.3.17", - "winston": "3.8.2" - }, - "devDependencies": { - "@polkadot/api": "14.3.1", - "@types/amqplib": "0.10.1", - "@types/node": "18.15.11", - "jest": "29.5.0", - "prettier": "2.8.7", - "ts-jest": "29.0.5", - "ts-node-dev": "2.0.0", - "typescript": "5.0.2" - }, - "scripts": { - "dev": "clear && ts-node-dev src/main.ts", - "build": "rm -rf dist && tsc", - "start": "node dist/main.js", - "dev:once": "ts-node-dev src/one-time-sync.ts", - "migration:generate": "yarn typeorm migration:generate -p -d dist/database/data-source.js", - "migration:apply": "yarn typeorm migration:run -d dist/database/data-source.js", - "migration:revert": "yarn typeorm migration:revert -d dist/database/data-source.js" - }, - "lint-staged": { - "*.ts": [ - "eslint --fix", - "git add" - ] - } -} diff --git a/idea/indexer/src/common/constants.ts b/idea/indexer/src/common/constants.ts deleted file mode 100644 index a7659dcbbd..0000000000 --- a/idea/indexer/src/common/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export const PAGINATION_LIMIT = 20; diff --git a/idea/indexer/src/common/enums/code-status.enum.ts b/idea/indexer/src/common/enums/code-status.enum.ts deleted file mode 100644 index 62de07a285..0000000000 --- a/idea/indexer/src/common/enums/code-status.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum CodeStatus { - ACTIVE = 'Active', - INACTIVE = 'Inactive', - UNKNOWN = 'Unknown', -} diff --git a/idea/indexer/src/common/enums/index.ts b/idea/indexer/src/common/enums/index.ts deleted file mode 100644 index 414b0c65fb..0000000000 --- a/idea/indexer/src/common/enums/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './message-entry-poing.enum'; -export * from './message-type.enum'; -export * from './program-status.enum'; -export * from './message-read-reason.enum'; -export * from './code-status.enum'; -export * from './message-status.enum'; - diff --git a/idea/indexer/src/common/enums/message-entry-poing.enum.ts b/idea/indexer/src/common/enums/message-entry-poing.enum.ts deleted file mode 100644 index 4114be6a10..0000000000 --- a/idea/indexer/src/common/enums/message-entry-poing.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum MessageEntryPoint { - INIT = 'init', - HANDLE = 'handle', - REPLY = 'reply' -} diff --git a/idea/indexer/src/common/enums/message-read-reason.enum.ts b/idea/indexer/src/common/enums/message-read-reason.enum.ts deleted file mode 100644 index b4ace70405..0000000000 --- a/idea/indexer/src/common/enums/message-read-reason.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum MessageReadReason { - OUT_OF_RENT = 'OutOfRent', - CLAIMED = 'Claimed', - REPLIED = 'Replied', -} diff --git a/idea/indexer/src/common/enums/message-status.enum.ts b/idea/indexer/src/common/enums/message-status.enum.ts deleted file mode 100644 index 3cd7752260..0000000000 --- a/idea/indexer/src/common/enums/message-status.enum.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum MessageStatus { - SUCCESS = 'Success', - FAILED = 'Failed' -} diff --git a/idea/indexer/src/common/enums/message-type.enum.ts b/idea/indexer/src/common/enums/message-type.enum.ts deleted file mode 100644 index adba6a9da9..0000000000 --- a/idea/indexer/src/common/enums/message-type.enum.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum MessageType { - MSG_SENT = 'UserMessageSent', - QUEUED = 'MessageQueued', -} diff --git a/idea/indexer/src/common/enums/program-status.enum.ts b/idea/indexer/src/common/enums/program-status.enum.ts deleted file mode 100644 index 104296c6f2..0000000000 --- a/idea/indexer/src/common/enums/program-status.enum.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum ProgramStatus { - UNKNOWN = 'unknown', - PROGRAM_SET = 'programSet', - ACTIVE = 'active', - TERMINATED = 'terminated', - EXITED = 'exited', - PAUSED = 'paused', -} diff --git a/idea/indexer/src/common/helpers/generate-uuid.ts b/idea/indexer/src/common/helpers/generate-uuid.ts deleted file mode 100644 index eb483258d4..0000000000 --- a/idea/indexer/src/common/helpers/generate-uuid.ts +++ /dev/null @@ -1,3 +0,0 @@ -import crypto from 'node:crypto'; - -export const generateUUID = () => crypto.randomUUID(); diff --git a/idea/indexer/src/common/helpers/get-extrinsics.ts b/idea/indexer/src/common/helpers/get-extrinsics.ts deleted file mode 100644 index eb6e795abf..0000000000 --- a/idea/indexer/src/common/helpers/get-extrinsics.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { GearCoreIdsMessageId, GearCoreIdsProgramId } from '@gear-js/api'; -import { Bytes, Enum, GenericCall, GenericExtrinsic, Struct, Tuple, Vec, bool, u128, u64 } from '@polkadot/types'; -import { Hash } from '@polkadot/types/interfaces'; -import { AnyTuple, ITuple } from '@polkadot/types/types'; - -export const getExtrinsics = (extrinsics: Vec>, methods: string[]) => - extrinsics.filter(({ method: { method } }) => methods.includes(method)); - -const BATCH_CALL_METHODS = ['sendMessage', 'sendReply', 'uploadProgram', 'createProgram', 'uploadCode']; - -export const getBatchExtrinsics = (extrinsics: Vec>>>) => - extrinsics.filter(({ method: { method }, args }) => { - if (!method.toLowerCase().startsWith('batch') && method.toLowerCase() !== 'forcebatch') { - return false; - } - - const calls = args.filter((arg: Vec) => { - return arg.filter((call) => BATCH_CALL_METHODS.includes(call.method)).length > 0; - }); - - if (calls.length === 0) { - return false; - } - - return true; - }); - -interface VoucherCall extends Enum { - isSendMessage: boolean; - asSendMessage: { - destination: GearCoreIdsProgramId; - payload: Bytes; - gasLimit: u64; - value: u128; - keepAlive: bool; - }; - isSendReply: boolean; - asSendReply: { - replyToId: GearCoreIdsMessageId; - payload: Bytes; - gasLimit: u64; - value: u128; - keepAlive: bool; - }; - isUploadCode: boolean; - asUploadCode: { - code: Bytes; - }; -} - -export const getVoucherExtrinsics = (extrinsics: Vec>) => - extrinsics.filter( - ({ method: { method, section } }) => section === 'gearVoucher' && method === 'call', - ) as GenericExtrinsic>[]; - -export const getGearRunExtrinsic = (extrinsics: Vec>) => - extrinsics.find(({ method: { section, method } }) => section === 'gear' && method === 'run'); diff --git a/idea/indexer/src/common/helpers/get-msg-entry.ts b/idea/indexer/src/common/helpers/get-msg-entry.ts deleted file mode 100644 index c38a46315b..0000000000 --- a/idea/indexer/src/common/helpers/get-msg-entry.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { GearCommonEventMessageEntry } from '@gear-js/api'; -import { MessageEntryPoint } from '../enums'; - -export const getMsgEntry = (entry: GearCommonEventMessageEntry) => - entry.isInit ? MessageEntryPoint.INIT : entry.isHandle ? MessageEntryPoint.HANDLE : MessageEntryPoint.REPLY; diff --git a/idea/indexer/src/common/helpers/get-payload-by-gear-event.ts b/idea/indexer/src/common/helpers/get-payload-by-gear-event.ts deleted file mode 100644 index 4d5ea6163f..0000000000 --- a/idea/indexer/src/common/helpers/get-payload-by-gear-event.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { EventNames, ProgramStatus, MessageReadReason } from '@gear-js/common'; -import { - CodeChangedData, - MessagesDispatchedData, - ProgramChangedData, - UserMessageReadData, - UserMessageSentData, -} from '@gear-js/api'; -import { GenericEventData } from '@polkadot/types'; - -import { CodeStatus, MessageStatus } from '../enums'; -import { - GearEventPayload, - ProgramChangedInput, - UserMessageReadInput, - MessagesDispatchedDataInput, - UserMessageSentInput, -} from '../types'; -import { CodeChangedInput } from '../types'; - -function userMessageSentPayload({ message, expiration }: UserMessageSentData): UserMessageSentInput { - const { id, source, destination, payload, value, details } = message; - - return { - id: id.toHex(), - destination: destination.toHex(), - source: source.toHex(), - payload: payload.toHex(), - value: value.toString(), - replyToMessageId: details.isSome ? details.unwrap().to.toHex() : null, - //TODO: better explanation of status codes - exitCode: details.isSome ? (details.unwrap().code.isSuccess ? 0 : 1) : null, - expiration: expiration.isSome ? expiration.unwrap().toNumber() : null, - }; -} - -function userMessageReadPayload({ id, reason }: UserMessageReadData): UserMessageReadInput { - const res = { id: id.toHex(), reason: null }; - - if (reason.isSystem && reason.asSystem.isOutOfRent) { - res.reason = MessageReadReason.OUT_OF_RENT; - } - if (reason.isRuntime && reason.asRuntime.isMessageClaimed) { - res.reason = MessageReadReason.CLAIMED; - } - if (reason.isRuntime && reason.asRuntime.isMessageReplied) { - res.reason = MessageReadReason.REPLIED; - } - return res; -} - -function programChangedPayload({ id, change }: ProgramChangedData): ProgramChangedInput { - let status: ProgramStatus; - let expiration: string; - - if (change.isActive) status = ProgramStatus.ACTIVE; - else if (change.isInactive) status = ProgramStatus.EXITED; - else if (change.isTerminated) status = ProgramStatus.TERMINATED; - else if (change.isPaused) status = ProgramStatus.PAUSED; - else if (change.isProgramSet) status = ProgramStatus.PROGRAM_SET; - else status = ProgramStatus.UNKNOWN; - - if (change.isActive) expiration = change.asActive.expiration.toString(); - else if (change.isExpirationChanged) expiration = change.asExpirationChanged.expiration.toString(); - - return { id: id.toHex(), status, expiration }; -} - -function codeChangedPayload({ id, change }: CodeChangedData): CodeChangedInput { - const status = change.isActive ? CodeStatus.ACTIVE : change.isInactive ? CodeStatus.INACTIVE : CodeStatus.UNKNOWN; - const expiration = change.isActive - ? change.asActive.expiration.isSome - ? change.asActive.expiration.unwrap().toString() - : null - : null; - - return { id: id.toHex(), status, expiration }; -} - -function messagesDispatchedPayload({ statuses }: MessagesDispatchedData): MessagesDispatchedDataInput | null { - if (statuses.size > 0) { - return { statuses: statuses.toHuman() as { [key: string]: MessageStatus } }; - } - return null; -} - -export const eventDataHandlers: Record GearEventPayload> = { - [EventNames.UserMessageSent]: (data: UserMessageSentData): UserMessageSentInput => userMessageSentPayload(data), - [EventNames.UserMessageRead]: (data: UserMessageReadData): UserMessageReadInput => userMessageReadPayload(data), - [EventNames.ProgramChanged]: (data: ProgramChangedData): ProgramChangedInput => programChangedPayload(data), - [EventNames.MessagesDispatched]: (data: MessagesDispatchedData): MessagesDispatchedDataInput | null => - messagesDispatchedPayload(data), - [EventNames.CodeChanged]: (data: CodeChangedData): CodeChangedInput => codeChangedPayload(data), -}; diff --git a/idea/indexer/src/common/helpers/get-update-message-data.ts b/idea/indexer/src/common/helpers/get-update-message-data.ts deleted file mode 100644 index d3ee19214f..0000000000 --- a/idea/indexer/src/common/helpers/get-update-message-data.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function getPayloadAndValueAndReplyToId(args: any, method: string): [string, string, string | null] { - const [payloadIndex, valueIndex] = ['sendMessage', 'sendReply'].includes(method) ? [1, 3] : [2, 4]; - - const payload = args[payloadIndex].toHex() as string; - const value = args[valueIndex].toString() as string; - - const replyToId = method === 'sendReply' ? args[0].toHex() : null; - - return [payload, value, replyToId]; -} diff --git a/idea/indexer/src/common/helpers/index.ts b/idea/indexer/src/common/helpers/index.ts deleted file mode 100644 index 1be480f902..0000000000 --- a/idea/indexer/src/common/helpers/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './metahash'; -export * from './generate-uuid'; -export * from './get-payload-by-gear-event'; -export * from './get-update-message-data'; -export * from './get-extrinsics'; -export * from './get-msg-entry'; diff --git a/idea/indexer/src/common/helpers/metahash.ts b/idea/indexer/src/common/helpers/metahash.ts deleted file mode 100644 index de17fcee3c..0000000000 --- a/idea/indexer/src/common/helpers/metahash.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { GearProgram } from '@gear-js/api'; -import { GearCode } from '@gear-js/api/Code'; -import { HexString } from '@polkadot/util/types'; -import { generateCodeHash } from '@gear-js/api'; - -export async function getMetahash(entity: GearProgram | GearCode, id: HexString): Promise { - try { - return await entity.metaHash(id); - } catch (error) { - return null; - } -} - -export function generateMetahash(hex: HexString): HexString { - return generateCodeHash(hex); -} diff --git a/idea/indexer/src/common/index.ts b/idea/indexer/src/common/index.ts deleted file mode 100644 index a5ce457a01..0000000000 --- a/idea/indexer/src/common/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './constants'; -export * from './enums'; -export * from './types'; -export * from './helpers'; diff --git a/idea/indexer/src/common/types/code.ts b/idea/indexer/src/common/types/code.ts deleted file mode 100644 index e8a62bb723..0000000000 --- a/idea/indexer/src/common/types/code.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { HexString } from '@polkadot/util/types'; - -import { CodeStatus } from '../enums'; -import { BaseDataInput } from './gear'; - -export interface CodeChangedInput extends BaseDataInput { - id: HexString; - status: CodeStatus; - expiration: string; -} diff --git a/idea/indexer/src/common/types/gear.ts b/idea/indexer/src/common/types/gear.ts deleted file mode 100644 index 0cfee8f73b..0000000000 --- a/idea/indexer/src/common/types/gear.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { HexString } from '@polkadot/util/types'; - -import { CodeChangedInput } from './code'; -import { MessagesDispatchedDataInput, UserMessageReadInput, UserMessageSentInput } from './message'; -import { ProgramChangedInput } from './program'; - -export interface BaseDataInput { - genesis?: string; - timestamp?: number; - blockHash?: any; -} - -export type GearEventPayload = - | UserMessageSentInput - | UserMessageReadInput - | ProgramChangedInput - | MessagesDispatchedDataInput - | CodeChangedInput - | null; - -export interface BlockParams { - blockNumber: number; - hash: HexString; -} diff --git a/idea/indexer/src/common/types/index.ts b/idea/indexer/src/common/types/index.ts deleted file mode 100644 index 279b347f37..0000000000 --- a/idea/indexer/src/common/types/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './gear'; -export * from './message'; -export * from './program'; -export * from './code'; -export * from './indexer'; diff --git a/idea/indexer/src/common/types/indexer.ts b/idea/indexer/src/common/types/indexer.ts deleted file mode 100644 index ccad2e57e0..0000000000 --- a/idea/indexer/src/common/types/indexer.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { GearApi } from '@gear-js/api'; -import { FrameSystemEventRecord } from '@polkadot/types/lookup'; -import { Vec } from '@polkadot/types'; - -import { TempState } from '../../gear/temp-state'; -import { ExtrinsicStatus, SignedBlock } from '@polkadot/types/interfaces'; - -export interface HandlerParams { - api: GearApi; - block: SignedBlock; - events: Vec; - tempState: TempState; - timestamp: Date; - status: ExtrinsicStatus; - blockHash: string; - genesis: string; -} diff --git a/idea/indexer/src/common/types/message.ts b/idea/indexer/src/common/types/message.ts deleted file mode 100644 index b043c7d72d..0000000000 --- a/idea/indexer/src/common/types/message.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { HexString } from '@polkadot/util/types'; -import { MessageReadReason } from '@gear-js/common'; - -import { MessageEntryPoint, MessageStatus } from '../enums'; -import { BaseDataInput } from './gear'; - -export interface UserMessageReadInput extends BaseDataInput { - id: string; - reason: MessageReadReason | null; -} - -export interface UserMessageSentInput extends BaseDataInput { - id: HexString; - destination: HexString; - source: HexString; - payload?: HexString; - value?: string; - entry?: MessageEntryPoint; - replyToMessageId?: string | null; - exitCode?: number | null; - expiration?: number | null; -} - -export interface MessagesDispatchedDataInput extends BaseDataInput { - statuses: { [key: string]: MessageStatus }; -} diff --git a/idea/indexer/src/common/types/program.ts b/idea/indexer/src/common/types/program.ts deleted file mode 100644 index 86d66c0890..0000000000 --- a/idea/indexer/src/common/types/program.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { HexString } from '@polkadot/util/types'; -import { ProgramStatus } from '@gear-js/common'; - -import { BaseDataInput } from './gear'; - -export interface ProgramChangedInput extends BaseDataInput { - id: HexString; - status: ProgramStatus; - expiration?: string; -} diff --git a/idea/indexer/src/config.ts b/idea/indexer/src/config.ts deleted file mode 100644 index 2c45489572..0000000000 --- a/idea/indexer/src/config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { config } from 'dotenv'; -import { strict as assert } from 'assert'; - -config(); - -export const getEnv = (envName: string, defaultValue?: string) => { - const env = process.env[envName]; - if (!env && defaultValue) { - return defaultValue; - } - assert.notStrictEqual(env, undefined, `${envName} is not specified`); - return env as string; -}; - -export default { - database: { - host: getEnv('DB_HOST', '127.0.0.1'), - port: Number(getEnv('DB_PORT', '5432')), - user: getEnv('DB_USER'), - password: getEnv('DB_PASSWORD'), - name: getEnv('DB_NAME'), - }, - rabbitmq: { - url: getEnv('RABBIT_MQ_URL'), - }, - healthcheck: { - port: Number(getEnv('HEALTHCHECK_PORT', '3001')), - }, - gear: { - providerAddresses: getEnv('GEAR_WS_PROVIDER').split(','), - }, - indexer: { - fromBlock: Number(getEnv('FROM_BLOCK', '0')), - batchSize: Number(getEnv('BATCH_SIZE', '5')), - }, -}; diff --git a/idea/indexer/src/database/data-source.ts b/idea/indexer/src/database/data-source.ts deleted file mode 100644 index e9ab61332f..0000000000 --- a/idea/indexer/src/database/data-source.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { DataSource } from 'typeorm'; - -import { Block, Code, Message, Program, State, Status } from './entities'; -import config from '../config'; - -export const AppDataSource = new DataSource({ - type: 'postgres', - host: config.database.host, - port: config.database.port, - username: config.database.user, - password: config.database.password, - database: config.database.name, - entities: [Message, Program, Code, Block, State, Status], - migrations: ['./dist/database/migrations/*.js'], - synchronize: false, - migrationsRun: true, - logging: ['error', 'schema', 'migration'], -}); diff --git a/idea/indexer/src/database/entities/base.entity.ts b/idea/indexer/src/database/entities/base.entity.ts deleted file mode 100644 index 53474c1dd7..0000000000 --- a/idea/indexer/src/database/entities/base.entity.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Column, Index } from 'typeorm'; -import { IBaseDBRecord } from '@gear-js/common'; - -export abstract class BaseEntity implements IBaseDBRecord { - @Index() - @Column() - public genesis: string; - - @Column({ nullable: true }) - public blockHash: string; - - @Index() - @Column({ type: 'timestamp' }) - public timestamp: Date; -} diff --git a/idea/indexer/src/database/entities/block.entity.ts b/idea/indexer/src/database/entities/block.entity.ts deleted file mode 100644 index aade34b965..0000000000 --- a/idea/indexer/src/database/entities/block.entity.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm'; - -@Entity() -export class Block { - constructor(props: Partial) { - Object.assign(this, props); - } - - @PrimaryGeneratedColumn('uuid') - public _id: string; - - @Index() - @Column() - public number: string; - - @Column({ nullable: true }) - public hash: string; - - @Column({ nullable: true, type: 'timestamp' }) - public timestamp: Date; - - @Column() - public genesis: string; -} diff --git a/idea/indexer/src/database/entities/code.entity.ts b/idea/indexer/src/database/entities/code.entity.ts deleted file mode 100644 index ee9ff11fa1..0000000000 --- a/idea/indexer/src/database/entities/code.entity.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Column, Entity, Index, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from 'typeorm'; -import { ICode } from '@gear-js/common'; - -import { BaseEntity } from './base.entity'; -import { CodeStatus } from '../../common/enums'; - -@Entity() -export class Code extends BaseEntity implements ICode { - constructor(props: Code) { - super(); - Object.assign(this, props); - } - - @PrimaryGeneratedColumn('uuid') - public _id?: string; - - @Index() - @Column() - public id: string; - - @Column() - public uploadedBy: string; - - @Index() - @Column() - public name: string; - - @Column({ type: 'enum', enum: CodeStatus }) - public status: CodeStatus; - - @Column({ nullable: true }) - public expiration?: string; - - @Column({ nullable: true }) - public metahash?: string; - - @Column({ default: false }) - public hasState?: boolean; -} diff --git a/idea/indexer/src/database/entities/index.ts b/idea/indexer/src/database/entities/index.ts deleted file mode 100644 index 422f76fc8a..0000000000 --- a/idea/indexer/src/database/entities/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './message.entity'; -export * from './program.entity'; -export * from './code.entity'; -export * from './block.entity'; -export * from './state.entity'; -export * from './status.entity'; diff --git a/idea/indexer/src/database/entities/message.entity.ts b/idea/indexer/src/database/entities/message.entity.ts deleted file mode 100644 index 56212c6569..0000000000 --- a/idea/indexer/src/database/entities/message.entity.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Column, Entity, Index, PrimaryColumn } from 'typeorm'; -import { IMessage } from '@gear-js/common'; - -import { BaseEntity } from './base.entity'; -import { MessageEntryPoint, MessageType, MessageReadReason } from '../../common/enums'; - -@Entity() -export class Message extends BaseEntity implements IMessage { - constructor(props: Partial) { - super(); - Object.assign(this, props); - } - - @Index() - @PrimaryColumn() - public id: string; - - @Index() - @Column() - public destination: string; - - @Index() - @Column() - public source: string; - - @Column({ nullable: true }) - public payload: string; - - @Column({ default: '0' }) - public value: string; - - @Column({ nullable: true }) - public exitCode?: number; - - @Column({ nullable: true }) - public replyToMessageId?: string; - - @Column({ nullable: true }) - public processedWithPanic?: boolean; - - @Column({ type: 'text', nullable: true, default: null }) - public entry: MessageEntryPoint; - - @Column({ nullable: true }) - public expiration?: number; - - @Index() - @Column({ type: 'text', nullable: true, default: null }) - public type: MessageType; - - @Column({ type: 'text', nullable: true, default: null }) - public readReason?: MessageReadReason; -} diff --git a/idea/indexer/src/database/entities/program.entity.ts b/idea/indexer/src/database/entities/program.entity.ts deleted file mode 100644 index 0913b26909..0000000000 --- a/idea/indexer/src/database/entities/program.entity.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Column, Entity, Index, PrimaryColumn, PrimaryGeneratedColumn } from 'typeorm'; -import { IProgram } from '@gear-js/common'; - -import { BaseEntity } from './base.entity'; -import { ProgramStatus } from '../../common/enums'; - -@Entity() -export class Program extends BaseEntity implements IProgram { - constructor(props: Partial) { - super(); - Object.assign(this, props); - } - - @PrimaryGeneratedColumn('uuid') - public _id: string; - - @Column() - @Index() - public id: string; - - @Column({ nullable: true }) - public owner: string; - - @Column() - @Index() - public name: string; - - @Column({ nullable: true }) - public expiration: string; - - @Column({ name: 'type', type: 'enum', enum: ProgramStatus, default: ProgramStatus.UNKNOWN }) - public status: ProgramStatus; - - @Column({ name: 'code_id' }) - public codeId: string; - - @Column({ nullable: true }) - public metahash: string; - - @Column({ default: false }) - public hasState: boolean; -} diff --git a/idea/indexer/src/database/entities/state.entity.ts b/idea/indexer/src/database/entities/state.entity.ts deleted file mode 100644 index 5852d13b9b..0000000000 --- a/idea/indexer/src/database/entities/state.entity.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Column, Entity, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from 'typeorm'; -import { IState } from '@gear-js/common'; -import { StateFunctions } from '@gear-js/api'; - -@Entity() -export class State implements IState { - constructor(props: Partial) { - Object.assign(this, props); - } - - @PrimaryColumn() - public id: string; - - @Column() - public name: string; - - @Column() - public wasmBuffBase64: string; - - @Column({ type: 'json' }) - public funcNames: string[]; - - @Column({ type: 'json' }) - public functions: StateFunctions; - - @Column({ name: 'code_id' }) - public codeId: string; -} diff --git a/idea/indexer/src/database/entities/status.entity.ts b/idea/indexer/src/database/entities/status.entity.ts deleted file mode 100644 index 988495f826..0000000000 --- a/idea/indexer/src/database/entities/status.entity.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Column, Entity, Index, PrimaryColumn } from 'typeorm'; - -@Entity() -export class Status { - constructor(props: Partial) { - Object.assign(this, props); - } - - @PrimaryColumn() - public height: string; - - @Column({ nullable: true }) - public hash?: string; - - @Index() - @Column() - public genesis: string; -} diff --git a/idea/indexer/src/database/index.ts b/idea/indexer/src/database/index.ts deleted file mode 100644 index 3900ae964b..0000000000 --- a/idea/indexer/src/database/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './entities'; -export * from './data-source'; diff --git a/idea/indexer/src/database/migrations/1666974357483-init.ts b/idea/indexer/src/database/migrations/1666974357483-init.ts deleted file mode 100644 index acf4ea1162..0000000000 --- a/idea/indexer/src/database/migrations/1666974357483-init.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class init1666974357483 implements MigrationInterface { - name = 'init1666974357483'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - CREATE TYPE "public"."code_status_enum" AS ENUM('Active', 'Inactive') - `); - await queryRunner.query(` - CREATE TABLE "code" ( - "genesis" character varying NOT NULL, - "blockHash" character varying, - "timestamp" TIMESTAMP NOT NULL, - "_id" uuid NOT NULL DEFAULT uuid_generate_v4(), - "id" character varying NOT NULL, - "uploadedBy" character varying NOT NULL, - "name" character varying NOT NULL, - "status" "public"."code_status_enum" NOT NULL, - "expiration" character varying, - "meta_id" integer, - CONSTRAINT "REL_8aa019d7912f73ed38fc813815" UNIQUE ("meta_id"), - CONSTRAINT "PK_3faae0c7f4cfa80186e791ce7f1" PRIMARY KEY ("_id") - ) - `); - await queryRunner.query(` - CREATE INDEX "IDX_0d3d98dbcf0d87b240911ce6e3" ON "code" ("genesis") - `); - await queryRunner.query(` - CREATE INDEX "IDX_a2d0e671c0f3215950d128fea2" ON "code" ("uploadedBy") - `); - await queryRunner.query(` - CREATE TABLE "meta" ( - "id" SERIAL NOT NULL, - "program" character varying NOT NULL, - "owner" character varying NOT NULL, - "meta" character varying, - "metaWasm" character varying, - CONSTRAINT "PK_c4c17a6c2bd7651338b60fc590b" PRIMARY KEY ("id") - ) - `); - await queryRunner.query(` - CREATE TYPE "public"."program_type_enum" AS ENUM( - 'unknown', - 'active', - 'terminated', - 'inactive', - 'paused' - ) - `); - await queryRunner.query(` - CREATE TABLE "program" ( - "genesis" character varying NOT NULL, - "blockHash" character varying, - "timestamp" TIMESTAMP NOT NULL, - "_id" uuid NOT NULL DEFAULT uuid_generate_v4(), - "id" character varying NOT NULL, - "owner" character varying NOT NULL, - "name" character varying NOT NULL, - "title" character varying, - "expiration" integer, - "type" "public"."program_type_enum" NOT NULL DEFAULT 'unknown', - "code_id" uuid, - "meta_id" integer, - CONSTRAINT "PK_0927f29c435c391dcb574ccfb7a" PRIMARY KEY ("_id") - ) - `); - await queryRunner.query(` - CREATE INDEX "IDX_634f57814226ec9e93ea5e5da9" ON "program" ("genesis") - `); - await queryRunner.query(` - CREATE INDEX "IDX_a8dbdd1e11aad73e620bcefbb9" ON "program" ("owner") - `); - await queryRunner.query(` - CREATE TYPE "public"."message_entry_enum" AS ENUM('init', 'handle', 'reply') - `); - await queryRunner.query(` - CREATE TYPE "public"."message_type_enum" AS ENUM('UserMessageSent', 'MessageEnqueued') - `); - await queryRunner.query(` - CREATE TYPE "public"."message_readreason_enum" AS ENUM('OutOfRent', 'Claimed', 'Replied') - `); - await queryRunner.query(` - CREATE TABLE "message" ( - "genesis" character varying NOT NULL, - "blockHash" character varying, - "timestamp" TIMESTAMP NOT NULL, - "id" character varying NOT NULL, - "destination" character varying NOT NULL, - "source" character varying NOT NULL, - "payload" character varying, - "value" character varying NOT NULL DEFAULT '0', - "exitCode" integer, - "replyToMessageId" character varying, - "processedWithPanic" boolean, - "entry" "public"."message_entry_enum", - "expiration" integer, - "type" "public"."message_type_enum", - "readReason" "public"."message_readreason_enum", - "program_id" uuid, - CONSTRAINT "PK_ba01f0a3e0123651915008bc578" PRIMARY KEY ("id") - ) - `); - await queryRunner.query(` - CREATE INDEX "IDX_415b62539db7e5df16641549ba" ON "message" ("genesis") - `); - await queryRunner.query(` - CREATE INDEX "IDX_2b0c43ce7cf7b69fcce6dc3450" ON "message" ("destination") - `); - await queryRunner.query(` - CREATE INDEX "IDX_1cad381e4d31baf6327cab90f1" ON "message" ("source") - `); - await queryRunner.query(` - CREATE TABLE "block" ( - "_id" uuid NOT NULL DEFAULT uuid_generate_v4(), - "number" character varying NOT NULL, - "hash" character varying, - "timestamp" TIMESTAMP, - "genesis" character varying NOT NULL, - CONSTRAINT "PK_51cafb3a347f80b2e155f1185a9" PRIMARY KEY ("_id") - ) - `); - await queryRunner.query(` - CREATE INDEX "IDX_a08fe3dc85de760c624254da6a" ON "block" ("genesis") - `); - await queryRunner.query(` - ALTER TABLE "code" - ADD CONSTRAINT "FK_8aa019d7912f73ed38fc8138152" FOREIGN KEY ("meta_id") REFERENCES "meta"("id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD CONSTRAINT "FK_0a5783ec166b1a3d42ba1143f99" FOREIGN KEY ("code_id") REFERENCES "code"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD CONSTRAINT "FK_9dbbd996a3b171485b1b810eb20" FOREIGN KEY ("meta_id") REFERENCES "meta"("id") ON DELETE CASCADE ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE "message" - ADD CONSTRAINT "FK_b8e38090b7fc53bdce979813f76" FOREIGN KEY ("program_id") REFERENCES "program"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "message" DROP CONSTRAINT "FK_b8e38090b7fc53bdce979813f76" - `); - await queryRunner.query(` - ALTER TABLE "program" DROP CONSTRAINT "FK_9dbbd996a3b171485b1b810eb20" - `); - await queryRunner.query(` - ALTER TABLE "program" DROP CONSTRAINT "FK_0a5783ec166b1a3d42ba1143f99" - `); - await queryRunner.query(` - ALTER TABLE "code" DROP CONSTRAINT "FK_8aa019d7912f73ed38fc8138152" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_a08fe3dc85de760c624254da6a" - `); - await queryRunner.query(` - DROP TABLE "block" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_1cad381e4d31baf6327cab90f1" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_2b0c43ce7cf7b69fcce6dc3450" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_415b62539db7e5df16641549ba" - `); - await queryRunner.query(` - DROP TABLE "message" - `); - await queryRunner.query(` - DROP TYPE "public"."message_readreason_enum" - `); - await queryRunner.query(` - DROP TYPE "public"."message_type_enum" - `); - await queryRunner.query(` - DROP TYPE "public"."message_entry_enum" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_a8dbdd1e11aad73e620bcefbb9" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_634f57814226ec9e93ea5e5da9" - `); - await queryRunner.query(` - DROP TABLE "program" - `); - await queryRunner.query(` - DROP TYPE "public"."program_type_enum" - `); - await queryRunner.query(` - DROP TABLE "meta" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_a2d0e671c0f3215950d128fea2" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_0d3d98dbcf0d87b240911ce6e3" - `); - await queryRunner.query(` - DROP TABLE "code" - `); - await queryRunner.query(` - DROP TYPE "public"."code_status_enum" - `); - } -} diff --git a/idea/indexer/src/database/migrations/1673872715863-update_meta_code_and_add_state_table.ts b/idea/indexer/src/database/migrations/1673872715863-update_meta_code_and_add_state_table.ts deleted file mode 100644 index fb058a810d..0000000000 --- a/idea/indexer/src/database/migrations/1673872715863-update_meta_code_and_add_state_table.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class updateMetaCodeAndAddStateTable1673872715863 implements MigrationInterface { - name = 'updateMetaCodeAndAddStateTable1673872715863' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - CREATE TABLE "state" ( - "id" uuid NOT NULL DEFAULT uuid_generate_v4(), - "name" character varying NOT NULL, - "wasmBuffBase64" character varying NOT NULL, - "funcNames" json NOT NULL, - "functions" json NOT NULL, - CONSTRAINT "PK_549ffd046ebab1336c3a8030a12" PRIMARY KEY ("id") - ) - `); - await queryRunner.query(` - CREATE TABLE "state_to_code" ( - "id" uuid NOT NULL DEFAULT uuid_generate_v4(), - "codeId" character varying NOT NULL, - "stateId" uuid NOT NULL, - "stateHex" character varying NOT NULL, - "code_id" uuid, - CONSTRAINT "PK_f4189c7208d247ff74101eba8e4" PRIMARY KEY ("id") - ) - `); - await queryRunner.query(` - ALTER TABLE "meta" DROP COLUMN "program" - `); - await queryRunner.query(` - ALTER TABLE "meta" DROP COLUMN "owner" - `); - await queryRunner.query(` - ALTER TABLE "meta" DROP COLUMN "metaWasm" - `); - await queryRunner.query(` - ALTER TABLE "meta" DROP COLUMN "meta" - `); - await queryRunner.query(` - ALTER TABLE "program" DROP COLUMN "title" - `); - await queryRunner.query(` - ALTER TABLE "meta" - ADD "hash" character varying - `); - await queryRunner.query(` - ALTER TABLE "meta" - ADD "types" json - `); - await queryRunner.query(` - ALTER TABLE "state_to_code" - ADD CONSTRAINT "FK_9fa5d2837b9b9275af7c3e4785d" FOREIGN KEY ("code_id") REFERENCES "code"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE "state_to_code" - ADD CONSTRAINT "FK_fa9cf57f13ab8aa9fa41d96e64f" FOREIGN KEY ("stateId") REFERENCES "state"("id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "state_to_code" DROP CONSTRAINT "FK_fa9cf57f13ab8aa9fa41d96e64f" - `); - await queryRunner.query(` - ALTER TABLE "state_to_code" DROP CONSTRAINT "FK_9fa5d2837b9b9275af7c3e4785d" - `); - await queryRunner.query(` - ALTER TABLE "meta" DROP COLUMN "types" - `); - await queryRunner.query(` - ALTER TABLE "meta" DROP COLUMN "hash" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD "title" character varying - `); - await queryRunner.query(` - ALTER TABLE "meta" - ADD "meta" character varying - `); - await queryRunner.query(` - ALTER TABLE "meta" - ADD "metaWasm" character varying - `); - await queryRunner.query(` - ALTER TABLE "meta" - ADD "owner" character varying NOT NULL - `); - await queryRunner.query(` - ALTER TABLE "meta" - ADD "program" character varying NOT NULL - `); - await queryRunner.query(` - DROP TABLE "state_to_code" - `); - await queryRunner.query(` - DROP TABLE "state" - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1674754846501-update_meta_table_colums.ts b/idea/indexer/src/database/migrations/1674754846501-update_meta_table_colums.ts deleted file mode 100644 index ba35167d15..0000000000 --- a/idea/indexer/src/database/migrations/1674754846501-update_meta_table_colums.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class updateMetaTableColums1674754846501 implements MigrationInterface { - name = 'updateMetaTableColums1674754846501' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "meta" - ADD "hex" character varying - `); - await queryRunner.query(` - ALTER TABLE "meta" - ALTER COLUMN "hash" - SET NOT NULL - `); - await queryRunner.query(` - ALTER TABLE "meta" - ADD CONSTRAINT "UQ_38be34309a8eee85ebfd8f4bc00" UNIQUE ("hash") - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "meta" DROP CONSTRAINT "UQ_38be34309a8eee85ebfd8f4bc00" - `); - await queryRunner.query(` - ALTER TABLE "meta" - ALTER COLUMN "hash" DROP NOT NULL - `); - await queryRunner.query(` - ALTER TABLE "meta" DROP COLUMN "hex" - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1675420216422-update_program_status.ts b/idea/indexer/src/database/migrations/1675420216422-update_program_status.ts deleted file mode 100644 index 1082836a36..0000000000 --- a/idea/indexer/src/database/migrations/1675420216422-update_program_status.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class updateProgramStatus1675420216422 implements MigrationInterface { - name = 'updateProgramStatus1675420216422' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "program" DROP CONSTRAINT "FK_9dbbd996a3b171485b1b810eb20" - `); - await queryRunner.query(` - ALTER TYPE "public"."program_type_enum" - RENAME TO "program_type_enum_old" - `); - await queryRunner.query(` - CREATE TYPE "public"."program_type_enum" AS ENUM( - 'unknown', - 'active', - 'terminated', - 'exited', - 'paused' - ) - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" DROP DEFAULT - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" TYPE "public"."program_type_enum" USING "type"::"text"::"public"."program_type_enum" - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" - SET DEFAULT 'unknown' - `); - await queryRunner.query(` - DROP TYPE "public"."program_type_enum_old" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD CONSTRAINT "FK_9dbbd996a3b171485b1b810eb20" FOREIGN KEY ("meta_id") REFERENCES "meta"("id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "program" DROP CONSTRAINT "FK_9dbbd996a3b171485b1b810eb20" - `); - await queryRunner.query(` - CREATE TYPE "public"."program_type_enum_old" AS ENUM( - 'unknown', - 'active', - 'terminated', - 'inactive', - 'paused' - ) - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" DROP DEFAULT - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" TYPE "public"."program_type_enum_old" USING "type"::"text"::"public"."program_type_enum_old" - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" - SET DEFAULT 'unknown' - `); - await queryRunner.query(` - DROP TYPE "public"."program_type_enum" - `); - await queryRunner.query(` - ALTER TYPE "public"."program_type_enum_old" - RENAME TO "program_type_enum" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD CONSTRAINT "FK_9dbbd996a3b171485b1b810eb20" FOREIGN KEY ("meta_id") REFERENCES "meta"("id") ON DELETE CASCADE ON UPDATE NO ACTION - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1676455747413-update_message_table.ts b/idea/indexer/src/database/migrations/1676455747413-update_message_table.ts deleted file mode 100644 index 03e669d409..0000000000 --- a/idea/indexer/src/database/migrations/1676455747413-update_message_table.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class updateMessageTable1676455747413 implements MigrationInterface { - name = 'updateMessageTable1676455747413' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "message" DROP COLUMN "entry" - `); - await queryRunner.query(` - DROP TYPE "public"."message_entry_enum" - `); - await queryRunner.query(` - ALTER TABLE "message" - ADD "entry" text - `); - await queryRunner.query(` - ALTER TABLE "message" DROP COLUMN "type" - `); - await queryRunner.query(` - DROP TYPE "public"."message_type_enum" - `); - await queryRunner.query(` - ALTER TABLE "message" - ADD "type" text - `); - await queryRunner.query(` - ALTER TABLE "message" DROP COLUMN "readReason" - `); - await queryRunner.query(` - DROP TYPE "public"."message_readreason_enum" - `); - await queryRunner.query(` - ALTER TABLE "message" - ADD "readReason" text - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "message" DROP COLUMN "readReason" - `); - await queryRunner.query(` - CREATE TYPE "public"."message_readreason_enum" AS ENUM('OutOfRent', 'Claimed', 'Replied') - `); - await queryRunner.query(` - ALTER TABLE "message" - ADD "readReason" "public"."message_readreason_enum" - `); - await queryRunner.query(` - ALTER TABLE "message" DROP COLUMN "type" - `); - await queryRunner.query(` - CREATE TYPE "public"."message_type_enum" AS ENUM('UserMessageSent', 'MessageEnqueued') - `); - await queryRunner.query(` - ALTER TABLE "message" - ADD "type" "public"."message_type_enum" - `); - await queryRunner.query(` - ALTER TABLE "message" DROP COLUMN "entry" - `); - await queryRunner.query(` - CREATE TYPE "public"."message_entry_enum" AS ENUM('init', 'handle', 'reply') - `); - await queryRunner.query(` - ALTER TABLE "message" - ADD "entry" "public"."message_entry_enum" - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1677069754299-delete_unique_hash_meta_table.ts b/idea/indexer/src/database/migrations/1677069754299-delete_unique_hash_meta_table.ts deleted file mode 100644 index c2b9795b1e..0000000000 --- a/idea/indexer/src/database/migrations/1677069754299-delete_unique_hash_meta_table.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class deleteUniqueHashMetaTable1677069754299 implements MigrationInterface { - name = 'deleteUniqueHashMetaTable1677069754299' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "meta" DROP CONSTRAINT "UQ_38be34309a8eee85ebfd8f4bc00" - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "meta" - ADD CONSTRAINT "UQ_38be34309a8eee85ebfd8f4bc00" UNIQUE ("hash") - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1677072331302-update_relation_between_code_and_meta.ts b/idea/indexer/src/database/migrations/1677072331302-update_relation_between_code_and_meta.ts deleted file mode 100644 index aa0e90879f..0000000000 --- a/idea/indexer/src/database/migrations/1677072331302-update_relation_between_code_and_meta.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class updateRelationBetweenCodeAndMeta1677072331302 implements MigrationInterface { - name = 'updateRelationBetweenCodeAndMeta1677072331302' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "code" DROP CONSTRAINT "FK_8aa019d7912f73ed38fc8138152" - `); - await queryRunner.query(` - ALTER TABLE "code" DROP CONSTRAINT "REL_8aa019d7912f73ed38fc813815" - `); - await queryRunner.query(` - ALTER TABLE "code" - ADD CONSTRAINT "FK_8aa019d7912f73ed38fc8138152" FOREIGN KEY ("meta_id") REFERENCES "meta"("id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "code" DROP CONSTRAINT "FK_8aa019d7912f73ed38fc8138152" - `); - await queryRunner.query(` - ALTER TABLE "code" - ADD CONSTRAINT "REL_8aa019d7912f73ed38fc813815" UNIQUE ("meta_id") - `); - await queryRunner.query(` - ALTER TABLE "code" - ADD CONSTRAINT "FK_8aa019d7912f73ed38fc8138152" FOREIGN KEY ("meta_id") REFERENCES "meta"("id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1678708517193-code-status-unknown.ts b/idea/indexer/src/database/migrations/1678708517193-code-status-unknown.ts deleted file mode 100644 index ac348b30d3..0000000000 --- a/idea/indexer/src/database/migrations/1678708517193-code-status-unknown.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class codeStatusUnknown1678708517193 implements MigrationInterface { - name = 'codeStatusUnknown1678708517193' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TYPE "public"."code_status_enum" - RENAME TO "code_status_enum_old" - `); - await queryRunner.query(` - CREATE TYPE "public"."code_status_enum" AS ENUM('Active', 'Inactive', 'Unknown') - `); - await queryRunner.query(` - ALTER TABLE "code" - ALTER COLUMN "status" TYPE "public"."code_status_enum" USING "status"::"text"::"public"."code_status_enum" - `); - await queryRunner.query(` - DROP TYPE "public"."code_status_enum_old" - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - CREATE TYPE "public"."code_status_enum_old" AS ENUM('Active', 'Inactive') - `); - await queryRunner.query(` - ALTER TABLE "code" - ALTER COLUMN "status" TYPE "public"."code_status_enum_old" USING "status"::"text"::"public"."code_status_enum_old" - `); - await queryRunner.query(` - DROP TYPE "public"."code_status_enum" - `); - await queryRunner.query(` - ALTER TYPE "public"."code_status_enum_old" - RENAME TO "code_status_enum" - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1678717516065-unique-meta-hash.ts b/idea/indexer/src/database/migrations/1678717516065-unique-meta-hash.ts deleted file mode 100644 index 6f099a3b56..0000000000 --- a/idea/indexer/src/database/migrations/1678717516065-unique-meta-hash.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class uniqueMetaHash1678717516065 implements MigrationInterface { - name = 'uniqueMetaHash1678717516065' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "meta" - ADD CONSTRAINT "UQ_38be34309a8eee85ebfd8f4bc00" UNIQUE ("hash") - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "meta" DROP CONSTRAINT "UQ_38be34309a8eee85ebfd8f4bc00" - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1680591096475-status.ts b/idea/indexer/src/database/migrations/1680591096475-status.ts deleted file mode 100644 index 890904f143..0000000000 --- a/idea/indexer/src/database/migrations/1680591096475-status.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class status1680591096475 implements MigrationInterface { - name = 'status1680591096475' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - CREATE TABLE "status" ( - "height" character varying NOT NULL, - "hash" character varying, - "genesis" character varying NOT NULL, - CONSTRAINT "PK_d903646eb40a38db9c04c2f9d78" PRIMARY KEY ("height") - ) - `); - await queryRunner.query(` - CREATE INDEX "IDX_e0e87ec226dd4b147ba783fd2d" ON "status" ("genesis") - `); - await queryRunner.query(` - CREATE INDEX "IDX_38414873c187a3e0c7943bc4c7" ON "block" ("number") - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - DROP INDEX "public"."IDX_38414873c187a3e0c7943bc4c7" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_e0e87ec226dd4b147ba783fd2d" - `); - await queryRunner.query(` - DROP TABLE "status" - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1681206929961-program-expiration.ts b/idea/indexer/src/database/migrations/1681206929961-program-expiration.ts deleted file mode 100644 index 47e64d3f59..0000000000 --- a/idea/indexer/src/database/migrations/1681206929961-program-expiration.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class programExpiration1681206929961 implements MigrationInterface { - name = 'programExpiration1681206929961' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "program" DROP COLUMN "expiration" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD "expiration" character varying - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "program" DROP COLUMN "expiration" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD "expiration" integer - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1681220971037-remove-generated-pk.ts b/idea/indexer/src/database/migrations/1681220971037-remove-generated-pk.ts deleted file mode 100644 index cebbc20655..0000000000 --- a/idea/indexer/src/database/migrations/1681220971037-remove-generated-pk.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class removeGeneratedPk1681220971037 implements MigrationInterface { - name = 'removeGeneratedPk1681220971037' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "state_to_code" DROP CONSTRAINT "FK_9fa5d2837b9b9275af7c3e4785d" - `); - await queryRunner.query(` - ALTER TABLE "program" DROP CONSTRAINT "FK_0a5783ec166b1a3d42ba1143f99" - `); - await queryRunner.query(` - ALTER TABLE "code" - ALTER COLUMN "_id" DROP DEFAULT - `); - await queryRunner.query(` - ALTER TABLE "message" DROP CONSTRAINT "FK_b8e38090b7fc53bdce979813f76" - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "_id" DROP DEFAULT - `); - await queryRunner.query(` - ALTER TABLE "state_to_code" - ADD CONSTRAINT "FK_9fa5d2837b9b9275af7c3e4785d" FOREIGN KEY ("code_id") REFERENCES "code"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD CONSTRAINT "FK_0a5783ec166b1a3d42ba1143f99" FOREIGN KEY ("code_id") REFERENCES "code"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE "message" - ADD CONSTRAINT "FK_b8e38090b7fc53bdce979813f76" FOREIGN KEY ("program_id") REFERENCES "program"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "message" DROP CONSTRAINT "FK_b8e38090b7fc53bdce979813f76" - `); - await queryRunner.query(` - ALTER TABLE "program" DROP CONSTRAINT "FK_0a5783ec166b1a3d42ba1143f99" - `); - await queryRunner.query(` - ALTER TABLE "state_to_code" DROP CONSTRAINT "FK_9fa5d2837b9b9275af7c3e4785d" - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "_id" - SET DEFAULT uuid_generate_v4() - `); - await queryRunner.query(` - ALTER TABLE "message" - ADD CONSTRAINT "FK_b8e38090b7fc53bdce979813f76" FOREIGN KEY ("program_id") REFERENCES "program"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE "code" - ALTER COLUMN "_id" - SET DEFAULT uuid_generate_v4() - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD CONSTRAINT "FK_0a5783ec166b1a3d42ba1143f99" FOREIGN KEY ("code_id") REFERENCES "code"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE "state_to_code" - ADD CONSTRAINT "FK_9fa5d2837b9b9275af7c3e4785d" FOREIGN KEY ("code_id") REFERENCES "code"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1685519228764-nullable-owner.ts b/idea/indexer/src/database/migrations/1685519228764-nullable-owner.ts deleted file mode 100644 index 18d4454f77..0000000000 --- a/idea/indexer/src/database/migrations/1685519228764-nullable-owner.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class nullableOwner1685519228764 implements MigrationInterface { - name = 'nullableOwner1685519228764' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "owner" DROP NOT NULL - `); - await queryRunner.query(` - ALTER TYPE "public"."program_type_enum" - RENAME TO "program_type_enum_old" - `); - await queryRunner.query(` - CREATE TYPE "public"."program_type_enum" AS ENUM( - 'unknown', - 'programSet', - 'active', - 'terminated', - 'exited', - 'paused' - ) - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" DROP DEFAULT - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" TYPE "public"."program_type_enum" USING "type"::"text"::"public"."program_type_enum" - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" - SET DEFAULT 'unknown' - `); - await queryRunner.query(` - DROP TYPE "public"."program_type_enum_old" - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - CREATE TYPE "public"."program_type_enum_old" AS ENUM( - 'unknown', - 'active', - 'terminated', - 'exited', - 'paused' - ) - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" DROP DEFAULT - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" TYPE "public"."program_type_enum_old" USING "type"::"text"::"public"."program_type_enum_old" - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "type" - SET DEFAULT 'unknown' - `); - await queryRunner.query(` - DROP TYPE "public"."program_type_enum" - `); - await queryRunner.query(` - ALTER TYPE "public"."program_type_enum_old" - RENAME TO "program_type_enum" - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "owner" - SET NOT NULL - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1689589565828-remove-meta-entity.ts b/idea/indexer/src/database/migrations/1689589565828-remove-meta-entity.ts deleted file mode 100644 index b4e0ded343..0000000000 --- a/idea/indexer/src/database/migrations/1689589565828-remove-meta-entity.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; - -export class removeMetaEntity1689589565828 implements MigrationInterface { - name = 'removeMetaEntity1689589565828'; - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "code" DROP CONSTRAINT "FK_8aa019d7912f73ed38fc8138152" - `); - await queryRunner.query(` - ALTER TABLE "program" DROP CONSTRAINT "FK_9dbbd996a3b171485b1b810eb20" - `); - await queryRunner.query(` - ALTER TABLE "code" - RENAME COLUMN "meta_id" TO "metahash" - `); - await queryRunner.query(` - ALTER TABLE "program" - RENAME COLUMN "meta_id" TO "metahash" - `); - await queryRunner.query(` - ALTER TABLE "code" DROP COLUMN "metahash" - `); - await queryRunner.query(` - ALTER TABLE "code" - ADD "metahash" character varying - `); - await queryRunner.query(` - ALTER TABLE "program" DROP COLUMN "metahash" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD "metahash" character varying - `); - await queryRunner.query(` - DROP TABLE "meta" - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - CREATE TABLE "meta" ( - "id" SERIAL NOT NULL, - "program" character varying NOT NULL, - "owner" character varying NOT NULL, - "meta" character varying, - "metaWasm" character varying, - CONSTRAINT "PK_c4c17a6c2bd7651338b60fc590b" PRIMARY KEY ("id") - ) - `); - await queryRunner.query(` - ALTER TABLE "program" DROP COLUMN "metahash" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD "metahash" integer - `); - await queryRunner.query(` - ALTER TABLE "code" DROP COLUMN "metahash" - `); - await queryRunner.query(` - ALTER TABLE "code" - ADD "metahash" integer - `); - await queryRunner.query(` - ALTER TABLE "program" - RENAME COLUMN "metahash" TO "meta_id" - `); - await queryRunner.query(` - ALTER TABLE "code" - RENAME COLUMN "metahash" TO "meta_id" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD CONSTRAINT "FK_9dbbd996a3b171485b1b810eb20" FOREIGN KEY ("meta_id") REFERENCES "meta"("id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - await queryRunner.query(` - ALTER TABLE "code" - ADD CONSTRAINT "FK_8aa019d7912f73ed38fc8138152" FOREIGN KEY ("meta_id") REFERENCES "meta"("id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - } -} diff --git a/idea/indexer/src/database/migrations/1690793654952-add-has-state-field.ts b/idea/indexer/src/database/migrations/1690793654952-add-has-state-field.ts deleted file mode 100644 index 7ef5629884..0000000000 --- a/idea/indexer/src/database/migrations/1690793654952-add-has-state-field.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class addHasStateField1690793654952 implements MigrationInterface { - name = 'addHasStateField1690793654952' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "code" - ADD "hasState" boolean NOT NULL DEFAULT false - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD "hasState" boolean NOT NULL DEFAULT false - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - ALTER TABLE "program" DROP COLUMN "hasState" - `); - await queryRunner.query(` - ALTER TABLE "code" DROP COLUMN "hasState" - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1694089926155-add-indexes.ts b/idea/indexer/src/database/migrations/1694089926155-add-indexes.ts deleted file mode 100644 index 6e995c41fd..0000000000 --- a/idea/indexer/src/database/migrations/1694089926155-add-indexes.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class addIndexes1694089926155 implements MigrationInterface { - name = 'addIndexes1694089926155' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - CREATE INDEX "IDX_e7a6a0dd0160df08d1386778c6" ON "code" ("timestamp") - `); - await queryRunner.query(` - CREATE INDEX "IDX_6169ccad61c4600bab206d1225" ON "program" ("timestamp") - `); - await queryRunner.query(` - CREATE INDEX "IDX_0a97a10e53ad4e12bda1e6b28b" ON "message" ("timestamp") - `); - await queryRunner.query(` - CREATE INDEX "IDX_ba01f0a3e0123651915008bc57" ON "message" ("id") - `); - await queryRunner.query(` - CREATE INDEX "IDX_b477a789fc61e5fc5221c88970" ON "message" ("type") - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - DROP INDEX "public"."IDX_b477a789fc61e5fc5221c88970" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_ba01f0a3e0123651915008bc57" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_0a97a10e53ad4e12bda1e6b28b" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_6169ccad61c4600bab206d1225" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_e7a6a0dd0160df08d1386778c6" - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1701091693635-add-indexes.ts b/idea/indexer/src/database/migrations/1701091693635-add-indexes.ts deleted file mode 100644 index 966922de02..0000000000 --- a/idea/indexer/src/database/migrations/1701091693635-add-indexes.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class AddIndexes1701091693635 implements MigrationInterface { - name = 'AddIndexes1701091693635' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - DROP INDEX "public"."IDX_a2d0e671c0f3215950d128fea2" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_a8dbdd1e11aad73e620bcefbb9" - `); - await queryRunner.query(` - CREATE INDEX "IDX_367e70f79a9106b8e802e1a982" ON "code" ("id") - `); - await queryRunner.query(` - CREATE INDEX "IDX_b5c04a17f83b4eb709102d0768" ON "code" ("name") - `); - await queryRunner.query(` - CREATE INDEX "IDX_3bade5945afbafefdd26a3a29f" ON "program" ("id") - `); - await queryRunner.query(` - CREATE INDEX "IDX_2156fc4598c9a1b865d85b5f1e" ON "program" ("name") - `); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(` - DROP INDEX "public"."IDX_2156fc4598c9a1b865d85b5f1e" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_3bade5945afbafefdd26a3a29f" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_b5c04a17f83b4eb709102d0768" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_367e70f79a9106b8e802e1a982" - `); - await queryRunner.query(` - CREATE INDEX "IDX_a8dbdd1e11aad73e620bcefbb9" ON "program" ("owner") - `); - await queryRunner.query(` - CREATE INDEX "IDX_a2d0e671c0f3215950d128fea2" ON "code" ("uploadedBy") - `); - } - -} diff --git a/idea/indexer/src/database/migrations/1707831399009-drop-relations.ts b/idea/indexer/src/database/migrations/1707831399009-drop-relations.ts deleted file mode 100644 index b5b723a46d..0000000000 --- a/idea/indexer/src/database/migrations/1707831399009-drop-relations.ts +++ /dev/null @@ -1,235 +0,0 @@ -import { MigrationInterface, QueryRunner } from 'typeorm'; -import { UUID, randomUUID } from 'crypto'; - -const updateProgramsQuery = (queryRunner: QueryRunner, programCodeMap: Map) => { - const updateQueries = Array.from(programCodeMap.entries()).map(([programId, codeId]) => { - return queryRunner.query(`UPDATE program SET code_id = '${codeId}' WHERE id = '${programId}';`); - }); - - return Promise.all(updateQueries); -}; - -const preparePrograms = async (queryRunner: QueryRunner, down = false) => { - const codeIdsMap = new Map(); - const programCodeMap = new Map(); - - const codes = (await queryRunner.query(`SELECT _id, id FROM code`)) as any[]; - - codes.forEach(({ _id, id }) => { - down ? codeIdsMap.set(id, _id) : codeIdsMap.set(_id, id); - }); - - const programs = (await queryRunner.query(`SELECT id, code_id FROM program`)) as any[]; - - programs.forEach(({ id, code_id }) => { - if (!codeIdsMap.has(code_id)) { - throw new Error('Code not found'); - } - programCodeMap.set(id, codeIdsMap.get(code_id)); - }); - - return [codeIdsMap, programCodeMap]; -}; - -const prepareStatesUp = async (queryRunner: QueryRunner, codeIdsMap: Map) => { - const stateCodeMap = new Map(); - - const stateCodes = (await queryRunner.query(`SELECT "codeId", "stateId", "stateHex" FROM state_to_code`)) as any[]; - - stateCodes.forEach(({ codeId, stateId, stateHex }) => { - stateCodeMap.set(stateId, { codeId: codeIdsMap.get(codeId), stateHex }); - }); - - return stateCodeMap; -}; - -const updateStates = async (queryRunner: QueryRunner, stateCodeMap: Map) => { - const updateQueries = Array.from(stateCodeMap.entries()).map(([stateId, { codeId, stateHex }]) => { - return queryRunner.query(`UPDATE state SET code_id = '${codeId}', id = '${stateHex}' WHERE id = '${stateId}';`); - }); - - return Promise.all(updateQueries); -}; - -const updateMessages = async (queryRunner: QueryRunner) => { - const programs = await queryRunner.query(`SELECT id, _id FROM program`); - - for (let i = 0; i < programs.length; i++) { - await queryRunner.query(` - UPDATE message SET program_id = '${programs[i]._id}' WHERE destination = '${programs[i].id}'; - `); - await queryRunner.query(` - UPDATE message SET program_id = '${programs[i]._id}' WHERE source = '${programs[i].id}'; - `); - - console.log(`Updated messages of ${i} programs`); - } -}; - -const updateStatesDown = async (queryRunner: QueryRunner, codesMap: Map) => { - const states = await queryRunner.query(`SELECT id, code_id FROM state`); - const statesMap = new Map(); - - states.forEach(({ id, code_id }) => { - statesMap.set(id, { stateId: randomUUID(), codeId: code_id }); - }); - - for (const [id, { stateId, codeId }] of statesMap) { - await queryRunner.query(`UPDATE state SET id = '${stateId}' WHERE id = '${id}'`); - await queryRunner.query(` - INSERT INTO state_to_code ("codeId", "stateId", "stateHex", "code_id") - VALUES ('${codeId}', '${stateId}', '${id}', '${codesMap.get(codeId)}') - `); - } -}; - -export class DropRelations1707831399009 implements MigrationInterface { - transaction?: boolean; - name = 'DropRelations1707831399009'; - - public async up(queryRunner: QueryRunner): Promise { - const [codesMap, programsMap] = await preparePrograms(queryRunner); - - await queryRunner.query(` - ALTER TABLE "message" DROP CONSTRAINT "FK_b8e38090b7fc53bdce979813f76" - `); - await queryRunner.query(` - ALTER TABLE "message" DROP COLUMN "program_id" - `); - - await queryRunner.query(` - ALTER TABLE "program" DROP CONSTRAINT "FK_0a5783ec166b1a3d42ba1143f99" - `); - await queryRunner.query(` - DROP INDEX "public"."IDX_a08fe3dc85de760c624254da6a" - `); - await queryRunner.query(` - ALTER TABLE "program" DROP COLUMN "code_id" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD "code_id" character varying - `); - await updateProgramsQuery(queryRunner, programsMap); - - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "code_id" SET NOT NULL - `); - await queryRunner.query(` - ALTER TABLE "code" - ALTER COLUMN "_id" SET DEFAULT uuid_generate_v4(); - `); - await queryRunner.query(` - ALTER TABLE "program" - ALTER COLUMN "_id" SET DEFAULT uuid_generate_v4(); - `); - - const statesMap = await prepareStatesUp(queryRunner, codesMap); - - await queryRunner.query(`DROP TABLE state_to_code;`); - - await queryRunner.query(` - ALTER TABLE "state" - ADD "code_id" character varying - `); - - await queryRunner.query(` - ALTER TABLE "state" - ALTER COLUMN "id" DROP DEFAULT - `); - - await queryRunner.query(` - ALTER TABLE "state" - ALTER COLUMN "id" TYPE character varying - `); - - await updateStates(queryRunner, statesMap); - - await queryRunner.query(` - ALTER TABLE "state" - ALTER COLUMN "id" SET NOT NULL - `); - - await queryRunner.query(` - ALTER TABLE "state" - ALTER COLUMN "code_id" SET NOT NULL - `); - } - - public async down(queryRunner: QueryRunner): Promise { - const [codesMap, programMap] = await preparePrograms(queryRunner, true); - - await queryRunner.query(` - ALTER TABLE "program" DROP COLUMN "code_id" - `); - await queryRunner.query(` - ALTER TABLE "program" - ADD "code_id" uuid - `); - await updateProgramsQuery(queryRunner, programMap); - - await queryRunner.query(` - ALTER TABLE "program" - ADD CONSTRAINT "FK_0a5783ec166b1a3d42ba1143f99" FOREIGN KEY ("code_id") REFERENCES "code"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - - await queryRunner.query(` - ALTER TABLE "message" - ADD "program_id" uuid - `); - - await updateMessages(queryRunner); - - await queryRunner.query(` - ALTER TABLE "message" - ADD CONSTRAINT "FK_b8e38090b7fc53bdce979813f76" FOREIGN KEY ("program_id") REFERENCES "program"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - - await queryRunner.query(` - CREATE TABLE "state_to_code" ( - "id" uuid NOT NULL DEFAULT uuid_generate_v4(), - "codeId" character varying NOT NULL, - "stateId" uuid NOT NULL, - "stateHex" character varying NOT NULL, - "code_id" uuid, - CONSTRAINT "PK_f4189c7208d247ff74101eba8e4" PRIMARY KEY ("id") - ) - `); - - await updateStatesDown(queryRunner, codesMap); - - await queryRunner.query(` - ALTER TABLE "state" - ALTER COLUMN "id" SET DEFAULT uuid_generate_v4() - `); - - await queryRunner.query(` - ALTER TABLE "state" - ALTER COLUMN "id" SET NOT NULL - `); - - await queryRunner.query(` - ALTER TABLE "state" - ALTER COLUMN "id" TYPE uuid USING id::uuid - `); - - await queryRunner.query(` - ALTER TABLE "state" DROP COLUMN "code_id" - `); - - await queryRunner.query(` - ALTER TABLE "state_to_code" - ADD CONSTRAINT "FK_9fa5d2837b9b9275af7c3e4785d" FOREIGN KEY ("code_id") REFERENCES "code"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - - await queryRunner.query(` - ALTER TABLE "state_to_code" - ADD CONSTRAINT "FK_fa9cf57f13ab8aa9fa41d96e64f" FOREIGN KEY ("stateId") REFERENCES "state"("id") ON DELETE NO ACTION ON UPDATE NO ACTION - `); - - await queryRunner.query(` - CREATE INDEX "IDX_a08fe3dc85de760c624254da6a" ON "block" ("genesis") - `); - } -} diff --git a/idea/indexer/src/gear/connect.ts b/idea/indexer/src/gear/connect.ts deleted file mode 100644 index 254ee54c64..0000000000 --- a/idea/indexer/src/gear/connect.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { GearApi } from '@gear-js/api'; -import { RMQServiceAction, logger } from '@gear-js/common'; - -import config from '../config'; -import { changeStatus } from '../healthcheck.server'; -import { GearIndexer } from './indexer'; - -const addresses = config.gear.providerAddresses; - -// max number of reconnections for each node address -const MAX_RECONNECTIONS = 10; -let reconnectionsCounter = 0; - -type GenesisCb = (action: RMQServiceAction, genesis: string) => void; -let providerAddress = addresses[0]; - -export async function connectToNode(indexer: GearIndexer, cb: GenesisCb) { - if (!providerAddress) { - throw new Error('There are no node addresses to connect to'); - } - - const api = new GearApi({ providerAddress }); - - try { - await api.isReadyOrError; - } catch (error) { - logger.error(`Failed to connect to ${providerAddress}`); - indexer.stop(); - await reconnect(api, indexer, cb); - } - - const genesis = api.genesisHash.toHex(); - - logger.info(`Connected to ${api.runtimeChain} with genesis ${genesis}`); - - cb(RMQServiceAction.ADD, genesis); - - api.on('disconnected', () => { - logger.warn('Disconnected from the node.'); - indexer.stop(); - genesis && cb(RMQServiceAction.DELETE, genesis); - reconnect(api, indexer, cb); - }); - - reconnectionsCounter = 0; - await indexer.run(api); - changeStatus('gear'); -} - -async function reconnect(api: GearApi, indexer: GearIndexer, cb: GenesisCb) { - changeStatus('gear', false); - - await new Promise((resolve) => { - setTimeout(resolve, 2000); - }); - - try { - await api.disconnect(); - } catch (error) { - logger.error('Disconnected from the node1', { error }); - } - reconnectionsCounter++; - - if (reconnectionsCounter === MAX_RECONNECTIONS) { - providerAddress = addresses.filter((address) => address !== providerAddress)[0]; - reconnectionsCounter = 0; - } - - logger.info('Attempting to reconnect'); - - return connectToNode(indexer, cb); -} diff --git a/idea/indexer/src/gear/handlers/batch.ts b/idea/indexer/src/gear/handlers/batch.ts deleted file mode 100644 index 57f650d55a..0000000000 --- a/idea/indexer/src/gear/handlers/batch.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { CodeChanged, MessageQueued, generateCodeHash } from '@gear-js/api'; -import { filterEvents } from '@polkadot/api/util'; -import { GenericCall, GenericExtrinsic, Vec } from '@polkadot/types'; - -import { - CodeStatus, - HandlerParams, - MessageEntryPoint, - MessageType, - ProgramStatus, - getBatchExtrinsics, - getMetahash, - getPayloadAndValueAndReplyToId, -} from '../../common'; -import { TempState } from '../temp-state'; -import { Code, Program } from '../../database'; - -enum BatchCallMethods { - SEND_MESSAGE = 'sendMessage', - SEND_REPLY = 'sendReply', - UPLOAD_PROGRAM = 'uploadProgram', - CREATE_PROGRAM = 'createProgram', - UPLOAD_CODE = 'uploadCode', -} - -enum BatchEventMethods { - MESSAGE_QUEUED = 'MessageQueued', - CODE_CHANGED = 'CodeChanged', - ITEM_COMPLETED = 'ItemCompleted', - ITEM_FAILED = 'ItemFailed', -} - -export const handleBatchTxs = async ({ - api, - block, - events, - status, - timestamp, - blockHash, - genesis, - tempState, -}: HandlerParams) => { - const extrinsics = getBatchExtrinsics(block.block.extrinsics as any); - - if (extrinsics.length === 0) { - return; - } - - for (const tx of extrinsics) { - const txEvents = filterEvents(tx.hash, block, events, status).events; - - const itemCompletedIndexes = []; - - txEvents.forEach(({ event: { method } }, index) => { - if (method === BatchEventMethods.ITEM_COMPLETED || method === BatchEventMethods.ITEM_FAILED) { - itemCompletedIndexes.push(index); - } - }); - - for (let i = 0; i < tx.args[0].length; i++) { - const { method, args } = tx.args[0][i]; - if (!Object.values(BatchCallMethods).includes(method as BatchCallMethods)) { - continue; - } - - const events = txEvents.slice(itemCompletedIndexes[i - 1] || 0, itemCompletedIndexes[i] + 1); - - if (events.at(-1).event.method === BatchEventMethods.ITEM_FAILED) { - continue; - } - - if ([BatchCallMethods.UPLOAD_CODE, BatchCallMethods.UPLOAD_PROGRAM].includes(method as BatchCallMethods)) { - const ccEvent = events.find(({ event: { method } }) => method === 'CodeChanged')?.event as CodeChanged; - - if (!ccEvent) { - continue; - } - - const { - data: { id, change }, - } = ccEvent; - - const codeId = id.toHex(); - const metahash = await getMetahash(api.code, codeId); - - const codeStatus = change.isActive ? CodeStatus.ACTIVE : change.isInactive ? CodeStatus.INACTIVE : null; - - tempState.addCode( - new Code({ - id: codeId, - name: codeId, - genesis, - status: codeStatus, - timestamp: new Date(timestamp), - blockHash: block.block.header.hash.toHex(), - expiration: change.isActive ? change.asActive.expiration.toString() : null, - uploadedBy: tx.signer.inner.toHex(), - metahash, - }), - ); - } - - const mqEvent = events.find(({ event }) => event.method === BatchEventMethods.MESSAGE_QUEUED) - ?.event as MessageQueued; - - if (!mqEvent) { - continue; - } - - const { - data: { id, destination, source, entry }, - } = mqEvent; - - const programId = destination.toHex(); - - if ([BatchCallMethods.CREATE_PROGRAM, BatchCallMethods.UPLOAD_PROGRAM].includes(method as BatchCallMethods)) { - const codeId = method === 'uploadProgram' ? generateCodeHash(args[0].toHex()) : args[0].toHex(); - - const program = new Program({ - id: programId, - name: programId, - owner: source.toHex(), - blockHash, - timestamp, - codeId, - genesis, - status: ProgramStatus.PROGRAM_SET, - }); - - tempState.addProgram(program); - } - - if ( - [ - BatchCallMethods.CREATE_PROGRAM, - BatchCallMethods.SEND_MESSAGE, - BatchCallMethods.SEND_REPLY, - BatchCallMethods.UPLOAD_PROGRAM, - ].includes(method as BatchCallMethods) - ) { - const [payload, value, replyToId] = getPayloadAndValueAndReplyToId(args, method); - - const messageEntry = entry.isInit - ? MessageEntryPoint.INIT - : entry.isHandle - ? MessageEntryPoint.HANDLE - : MessageEntryPoint.REPLY; - - const msgId = id.toHex(); - - tempState.addMsg({ - id: msgId, - blockHash, - genesis, - timestamp, - destination: destination.toHex(), - source: source.toHex(), - payload, - value, - type: MessageType.QUEUED, - entry: messageEntry, - replyToMessageId: replyToId, - }); - } - } - } -}; diff --git a/idea/indexer/src/gear/handlers/code.ts b/idea/indexer/src/gear/handlers/code.ts deleted file mode 100644 index e7e80362e4..0000000000 --- a/idea/indexer/src/gear/handlers/code.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { CodeChanged } from '@gear-js/api'; -import { filterEvents } from '@polkadot/api/util'; -import { CodeStatus } from '@gear-js/common'; - -import { HandlerParams, getExtrinsics, getMetahash } from '../../common'; -import { Code } from '../../database'; - -export const handleCodeTxs = async ({ - api, - block, - blockHash, - events, - status, - timestamp, - genesis, - tempState, -}: HandlerParams) => { - const extrinsics = getExtrinsics(block.block.extrinsics, ['uploadProgram', 'uploadCode']); - - if (extrinsics.length === 0) { - return; - } - - await Promise.all( - extrinsics.map(async (tx) => { - const event = filterEvents(tx.hash, block, events, status).events.find( - ({ event: { method } }) => method === 'CodeChanged', - ); - - if (!event) { - return; - } - - const { - data: { id, change }, - } = event.event as CodeChanged; - const codeId = id.toHex(); - const metahash = await getMetahash(api.code, codeId); - - const codeStatus = change.isActive ? CodeStatus.ACTIVE : change.isInactive ? CodeStatus.INACTIVE : null; - - return tempState.addCode( - new Code({ - id: codeId, - name: codeId, - genesis, - status: codeStatus, - timestamp, - blockHash, - expiration: change.isActive ? change.asActive.expiration.toString() : null, - uploadedBy: tx.signer.inner.toHex(), - metahash, - }), - ); - }), - ); -}; diff --git a/idea/indexer/src/gear/handlers/events.ts b/idea/indexer/src/gear/handlers/events.ts deleted file mode 100644 index 3aceee8f23..0000000000 --- a/idea/indexer/src/gear/handlers/events.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { filterEvents } from '@polkadot/api/util'; -import { Option } from '@polkadot/types'; - -import { HandlerParams, MessageStatus, MessageType, getGearRunExtrinsic } from '../../common'; -import { CodeStatus, EventNames, MessageReadReason, ProgramStatus } from '@gear-js/common'; -import { TempState } from '../temp-state'; -import { - CodeChangedData, - GearApi, - GearCommonProgram, - MessagesDispatchedData, - ProgramChangedData, - UserMessageReadData, - UserMessageSentData, -} from '@gear-js/api'; -import { Message, Program } from '../../database'; - -const programChanged = async ( - { id, change }: ProgramChangedData, - blockHash: string, - timestamp: Date, - genesis: string, - api: GearApi, - tempState: TempState, -) => { - let status: ProgramStatus; - - if (change.isActive) status = ProgramStatus.ACTIVE; - else if (change.isInactive) status = ProgramStatus.EXITED; - else if (change.isTerminated) status = ProgramStatus.TERMINATED; - else if (change.isPaused) status = ProgramStatus.PAUSED; - else if (change.isProgramSet) status = ProgramStatus.PROGRAM_SET; - else status = ProgramStatus.UNKNOWN; - - let expiration: string; - if (change.isActive) expiration = change.asActive.expiration.toString(); - else if (change.isExpirationChanged) change.asExpirationChanged.expiration.toString(); - - if (change.isProgramSet) { - const progStorage = (await api.query.gearProgram.programStorage(id)) as Option; - if (progStorage.isSome) { - if (progStorage.unwrap().isActive) { - const { codeHash } = progStorage.unwrap().asActive; - const programId = id.toHex(); - tempState.addProgram( - new Program({ - id: programId, - name: programId, - blockHash, - timestamp, - genesis, - codeId: codeHash.toHex(), - status: ProgramStatus.PROGRAM_SET, - }), - ); - } - } - } - - return tempState.setProgramStatus(id.toHex(), status, expiration); -}; - -const codeChanged = ({ id, change }: CodeChangedData, tempState: TempState) => { - const status = change.isActive ? CodeStatus.ACTIVE : change.isInactive ? CodeStatus.INACTIVE : CodeStatus.UNKNOWN; - - const expiration = change.isActive - ? change.asActive.expiration.isSome - ? change.asActive.expiration.unwrap().toString() - : null - : null; - - return tempState.setCodeStatus(id.toHex(), status, expiration); -}; - -const messagesDispatched = async ({ statuses }: MessagesDispatchedData, tempState: TempState) => { - return tempState.setDispatchedStatus(statuses.toJSON() as { [key: string]: MessageStatus }); -}; - -const userMessageSent = ( - { message: { id, destination, source, payload, value, details }, expiration }: UserMessageSentData, - blockHash: string, - genesis: string, - timestamp: Date, - tempState: TempState, -) => { - const unwrappedDetails = details.isSome ? details.unwrap() : null; - - return tempState.addMsg( - new Message({ - id: id.toHex(), - blockHash, - genesis, - timestamp, - destination: destination.toHex(), - source: source.toHex(), - payload: payload.toHex(), - value: value.toString(), - type: MessageType.MSG_SENT, - exitCode: unwrappedDetails ? (unwrappedDetails.code.isSuccess ? 0 : 1) : null, - expiration: expiration.isSome ? expiration.unwrap().toNumber() : null, - replyToMessageId: unwrappedDetails ? unwrappedDetails.to.toHex() : null, - }), - ); -}; - -const userMessageRead = ({ id, reason }: UserMessageReadData, tempState: TempState) => { - let readReason: MessageReadReason; - - if (reason.isSystem && reason.asSystem.isOutOfRent) { - readReason = MessageReadReason.OUT_OF_RENT; - } - if (reason.isRuntime && reason.asRuntime.isMessageClaimed) { - readReason = MessageReadReason.CLAIMED; - } - if (reason.isRuntime && reason.asRuntime.isMessageReplied) { - readReason = MessageReadReason.REPLIED; - } - return tempState.setReadStatus(id.toHex(), readReason); -}; - -export async function handleEvents({ - api, - block, - events, - status, - timestamp, - genesis, - blockHash, - tempState, -}: HandlerParams) { - const tx = getGearRunExtrinsic(block.block.extrinsics); - - if (!tx) { - return; - } - - const txEvents = filterEvents(tx.hash, block, events, status).events; - const necessaryEvents = txEvents.filter(({ event: { method } }) => - Object.values(EventNames).includes(method as EventNames), - ); - - if (necessaryEvents.length === 0) { - return; - } - - const promises = []; - - for (const { - event: { data, method }, - } of necessaryEvents) { - switch (method) { - case EventNames.ProgramChanged: { - await programChanged(data as ProgramChangedData, blockHash, timestamp, genesis, api, tempState); - continue; - } - case EventNames.CodeChanged: { - promises.push(codeChanged(data as CodeChangedData, tempState)); - continue; - } - case EventNames.MessagesDispatched: { - promises.push(messagesDispatched(data as MessagesDispatchedData, tempState)); - continue; - } - case EventNames.UserMessageSent: { - userMessageSent(data as UserMessageSentData, blockHash, genesis, timestamp, tempState); - continue; - } - case EventNames.UserMessageRead: { - promises.push(userMessageRead(data as UserMessageReadData, tempState)); - continue; - } - } - } - - await Promise.all(promises); -} diff --git a/idea/indexer/src/gear/handlers/index.ts b/idea/indexer/src/gear/handlers/index.ts deleted file mode 100644 index aff7a1b9fb..0000000000 --- a/idea/indexer/src/gear/handlers/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './batch'; -export * from './code'; -export * from './msg'; -export * from './program'; -export * from './voucher'; -export * from './events'; diff --git a/idea/indexer/src/gear/handlers/msg.ts b/idea/indexer/src/gear/handlers/msg.ts deleted file mode 100644 index 343d8e5bef..0000000000 --- a/idea/indexer/src/gear/handlers/msg.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { filterEvents } from '@polkadot/api/util'; -import { MessageQueued } from '@gear-js/api'; - -import { HandlerParams, MessageType, getExtrinsics, getMsgEntry, getPayloadAndValueAndReplyToId } from '../../common'; - -export const handleMsgTxs = async ({ - block, - events, - status, - timestamp, - blockHash, - genesis, - tempState, -}: HandlerParams) => { - const extrinsics = getExtrinsics(block.block.extrinsics, [ - 'sendMessage', - 'sendReply', - 'uploadProgram', - 'createProgram', - ]); - if (extrinsics.length === 0) { - return; - } - - extrinsics.forEach((tx) => { - const foundEvent = filterEvents(tx.hash, block, events, status).events.find( - ({ event }) => event.method === 'MessageQueued', - ); - - if (!foundEvent) { - return; - } - - const { - data: { id, source, destination, entry }, - } = foundEvent.event as MessageQueued; - - const [payload, value] = getPayloadAndValueAndReplyToId(tx.args, tx.method.method); - - const messageEntry = getMsgEntry(entry); - - const msgId = id.toHex(); - const programId = destination.toHex(); - - tempState.addMsg({ - id: msgId, - blockHash, - genesis, - timestamp, - destination: programId, - source: source.toHex(), - payload, - value, - type: MessageType.QUEUED, - entry: messageEntry, - replyToMessageId: tx.method.method === 'sendReply' ? tx.args[0].toHex() : null, - }); - }); -}; diff --git a/idea/indexer/src/gear/handlers/program.ts b/idea/indexer/src/gear/handlers/program.ts deleted file mode 100644 index ecfef3012a..0000000000 --- a/idea/indexer/src/gear/handlers/program.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { MessageQueued, generateCodeHash } from '@gear-js/api'; -import { filterEvents } from '@polkadot/api/util'; - -import { HandlerParams, ProgramStatus, getExtrinsics } from '../../common'; -import { Program } from '../../database'; - -export const handleProgramTxs = ({ - block, - events, - status, - timestamp, - blockHash, - genesis, - tempState, -}: HandlerParams) => { - const extrinsics = getExtrinsics(block.block.extrinsics, ['uploadProgram', 'createProgram']); - - if (extrinsics.length === 0) { - return; - } - - extrinsics.map((tx) => { - const mqEvent = filterEvents(tx.hash, block, events, status).events.find( - ({ event }) => event.method === 'MessageQueued', - ); - - if (!mqEvent) { - return null; - } - - const { - data: { source, destination }, - } = mqEvent.event as MessageQueued; - - const programId = destination.toHex(); - const owner = source.toHex(); - - const codeId = tx.method.method === 'uploadProgram' ? generateCodeHash(tx.args[0].toHex()) : tx.args[0].toHex(); - - return tempState.addProgram( - new Program({ - id: programId, - name: programId, - owner, - blockHash, - timestamp, - codeId, - genesis, - status: ProgramStatus.PROGRAM_SET, - }), - ); - }); -}; diff --git a/idea/indexer/src/gear/handlers/voucher.ts b/idea/indexer/src/gear/handlers/voucher.ts deleted file mode 100644 index e240d4ad35..0000000000 --- a/idea/indexer/src/gear/handlers/voucher.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { CodeChanged, MessageQueued } from '@gear-js/api'; -import { filterEvents } from '@polkadot/api/util'; - -import { CodeStatus, HandlerParams, MessageType, getMetahash, getMsgEntry, getVoucherExtrinsics } from '../../common'; -import { Code } from '../../database'; - -export const handleVoucherTxs = async ({ - api, - block, - events, - status, - timestamp, - blockHash, - genesis, - tempState, -}: HandlerParams) => { - const extrinsics = getVoucherExtrinsics(block.block.extrinsics); - - if (extrinsics.length === 0) { - return; - } - - const promises = []; - - for (const tx of extrinsics) { - const txEvents = filterEvents(tx.hash, block, events, status).events; - - const call = tx.args[1]; - - if (call.isSendMessage) { - const mqEvent = txEvents.find(({ event }) => event.method === 'MessageQueued'); - if (!mqEvent) { - continue; - } - const { - data: { id, source, destination, entry }, - } = mqEvent.event as MessageQueued; - - tempState.addMsg({ - id: id.toHex(), - source: source.toHex(), - blockHash, - destination: destination.toHex(), - entry: getMsgEntry(entry), - type: MessageType.QUEUED, - payload: call.asSendMessage.payload.toHex(), - value: call.asSendMessage.value.toString(), - timestamp, - genesis, - }); - } - - if (call.isSendReply) { - const mqEvent = txEvents.find(({ event }) => event.method === 'MessageQueued'); - if (!mqEvent) { - continue; - } - const { - data: { id, source, destination, entry }, - } = mqEvent.event as MessageQueued; - - const programId = destination.toHex(); - - tempState.addMsg({ - id: id.toHex(), - source: source.toHex(), - blockHash, - destination: programId, - entry: getMsgEntry(entry), - type: MessageType.QUEUED, - payload: call.asSendReply.payload.toHex(), - value: call.asSendReply.value.toString(), - timestamp, - genesis, - replyToMessageId: call.asSendReply.replyToId.toHex(), - }); - } - - if (call.isUploadCode) { - const ccEvent = txEvents.find(({ event }) => event.method === 'CodeChanged'); - if (!ccEvent) { - continue; - } - - const { - data: { id, change }, - } = ccEvent.event as CodeChanged; - const codeId = id.toHex(); - const metahash = await getMetahash(api.code, codeId); - - const codeStatus = change.isActive ? CodeStatus.ACTIVE : change.isInactive ? CodeStatus.INACTIVE : null; - - tempState.addCode( - new Code({ - id: codeId, - name: codeId, - genesis, - status: codeStatus, - timestamp, - blockHash, - expiration: change.isActive ? change.asActive.expiration.toString() : null, - uploadedBy: tx.signer.inner.toHex(), - metahash, - }), - ); - } - } - - await Promise.all(promises); -}; diff --git a/idea/indexer/src/gear/index.ts b/idea/indexer/src/gear/index.ts deleted file mode 100644 index 0aad46c866..0000000000 --- a/idea/indexer/src/gear/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './indexer'; -export * from './connect'; diff --git a/idea/indexer/src/gear/indexer.ts b/idea/indexer/src/gear/indexer.ts deleted file mode 100644 index cb60594f4d..0000000000 --- a/idea/indexer/src/gear/indexer.ts +++ /dev/null @@ -1,292 +0,0 @@ -import { GearApi } from '@gear-js/api'; -import { HexString } from '@polkadot/util/types'; -import { SignedBlock } from '@polkadot/types/interfaces'; -import { logger } from '@gear-js/common'; -import { ApiDecoration, VoidFn } from '@polkadot/api/types'; - -import { Block } from '../database/entities'; -import { BlockService, CodeService, MessageService, ProgramService, StatusService } from '../services'; -import { TempState } from './temp-state'; -import { RMQService } from '../rmq'; -import { - handleBatchTxs, - handleCodeTxs, - handleEvents, - handleMsgTxs, - handleProgramTxs, - handleVoucherTxs, -} from './handlers'; -import { HandlerParams } from '../common/types/indexer'; -import config from '../config'; -import { CronJob } from 'cron'; - -const getMem = () => { - const mem = process.memoryUsage(); - for (const key in mem) { - mem[key] = (mem[key] / 1024 / 1024).toFixed(2) + ' MB'; - } - return mem; -}; - -export class GearIndexer { - public api: GearApi; - private genesis: HexString; - private unsub: VoidFn; - private newBlocks: Array; - private generatorLoop: boolean; - private tempState: TempState; - private isCheckingNotSynced: boolean; - private _lastProcessedBlock: number; - - constructor( - private programService: ProgramService, - private messageService: MessageService, - private codeService: CodeService, - private blockService: BlockService, - private rmq: RMQService, - private statusService: StatusService, - ) {} - - public async run(api: GearApi) { - this.api = api; - - this.tempState = new TempState( - this.programService, - this.messageService, - this.codeService, - this.blockService, - this.rmq, - this.api, - ); - - this.genesis = this.api.genesisHash.toHex(); - - await Promise.all([ - this.programService.removeDuplicates(this.genesis), - this.codeService.removeDuplicates(this.genesis), - ]); - - await this.statusService.init(this.genesis); - - this._lastProcessedBlock = +(await this.blockService.getLastBlock({ genesis: this.genesis }))?.number || 0; - - this.newBlocks = []; - this.generatorLoop = true; - - // this.indexNotSyncedBlocks().then(() => { - // logger.info('Not synced blocks have been indexed'); - // }); - - this.unsub = await this.api.derive.chain.subscribeNewHeads(({ number }) => { - this.newBlocks.push(number.toNumber()); - }); - this.indexBlocks(); - - this._checkBlockProcessing(); - } - - public stop() { - this.generatorLoop = false; - if (this.unsub) { - this.unsub(); - } - this.api = null; - this.newBlocks = []; - } - - private async *blocksGenerator() { - while (this.generatorLoop) { - if (this.newBlocks.length === 0) { - await new Promise((resolve) => { - setTimeout(resolve, 3000); - }); - continue; - } - yield this.newBlocks.splice(0, 5); - } - } - - private *rangeGenerator(from: number, to: number) { - const batchSize = config.indexer.batchSize; - for (let i = from; i < to; i += batchSize) { - yield [...Array(batchSize).keys()].map((v) => v + i); - } - } - - private async indexNotSyncedBlocks() { - if (this.isCheckingNotSynced) { - return; - } - - this.isCheckingNotSynced = true; - - const status = await this.statusService.getStatus(this.genesis); - - const lastBlockNumber = status ? Number(status.height) : config.indexer.fromBlock; - - const currentBn = await this.api.rpc.chain.getHeader(); - - let tempState = new TempState( - this.programService, - this.messageService, - this.codeService, - this.blockService, - this.rmq, - this.api, - ); - - for (const blockNumbers of this.rangeGenerator(lastBlockNumber, currentBn.number.toNumber())) { - const notSynced = await this.blockService.getNotSynced(blockNumbers); - - if (notSynced.length === 0) { - await this.statusService.update(this.genesis, Math.max(...blockNumbers).toString()); - continue; - } - - const start = Date.now(); - - tempState.newState(this.genesis); - - try { - await Promise.all(notSynced.map((blockNumber) => this.indexBlock(blockNumber, tempState))); - } catch (error) { - logger.error('Error during indexing the data of the blocks', { - blocks: notSynced, - error: error.message, - stack: error.stack, - }); - continue; - } - - try { - const result = await tempState.save(); - - const [min, max] = [Math.min(...notSynced) + '', Math.max(...notSynced) + '']; - - await this.statusService.update(this.genesis, max); - - logger.info(`${min}-${max} not synced`, { - time: (Date.now() - start) / 1000 + 'sec', - mem: getMem(), - result: result, - }); - } catch (error) { - logger.error('Error during saving the data of the blocks', { - blocks: notSynced, - error: error.message, - stack: error.stack, - }); - } - } - - tempState = null; - await this.statusService.update(this.genesis, currentBn.number.toString()); - - this.isCheckingNotSynced = false; - } - - private async indexBlocks() { - for await (const blockNumbers of this.blocksGenerator()) { - if (this.api === null) { - logger.warn('api null'); - this.newBlocks.push(...blockNumbers); - continue; - } - - const start = Date.now(); - - this.tempState.newState(this.genesis); - - try { - await Promise.all(blockNumbers.map((blockNumber) => this.indexBlock(blockNumber, this.tempState))); - } catch (error) { - logger.error('Error during indexing the data of the blocks', { - blocks: blockNumbers, - error: error.message, - stack: error.stack, - }); - continue; - } - - try { - const result = await this.tempState.save(); - - if (result.c > 0 || result.p > 0 || result.m > 0) { - logger.info(`${blockNumbers[0]}-${blockNumbers.at(-1)}`, { - time: (Date.now() - start) / 1000 + 'sec', - mem: getMem(), - result: result, - }); - } - } catch (error) { - logger.error('Error during saving the data of the blocks', { - blocks: blockNumbers, - error: error.message, - stack: error.stack, - }); - } - } - } - - private async indexBlock(blockNumber: number, tempState: TempState): Promise { - if (blockNumber === 0) return; - - let block: SignedBlock; - let apiAt: ApiDecoration<'promise'>; - let hash: string; - - try { - hash = (await this.api.rpc.chain.getBlockHash(blockNumber)).toHex(); - [block, apiAt] = await Promise.all([this.api.rpc.chain.getBlock(hash), this.api.at(hash)]); - } catch (error) { - logger.error('Unable to get block', { number: blockNumber, hash, error: error.message }); - return; - } - - const [events, tsU64] = await Promise.all([apiAt.query.system.events(), apiAt.query.timestamp.now()]); - - const params: HandlerParams = { - api: this.api, - block, - events, - tempState, - timestamp: new Date(tsU64.toNumber()), - status: this.api.createType('ExtrinsicStatus', { finalized: block.block.header.hash.toHex() }), - blockHash: hash, - genesis: this.genesis, - }; - - await Promise.all([ - handleCodeTxs(params), - handleBatchTxs(params), - handleProgramTxs(params), - handleMsgTxs(params), - handleVoucherTxs(params), - ]); - - await handleEvents(params); - - tempState.addBlock( - new Block({ - hash, - number: blockNumber.toString(), - timestamp: params.timestamp, - genesis: this.genesis, - }), - ); - } - - private _checkBlockProcessing() { - const job = new CronJob('*/1 * * * *', async () => { - const lastBlock = await this.blockService.getLastBlock({ genesis: this.genesis }); - - if (+lastBlock?.number <= this._lastProcessedBlock) { - logger.error('Block processing is stuck', { lastBlock: this._lastProcessedBlock }); - } else { - this._lastProcessedBlock = +lastBlock.number; - } - }); - - job.start(); - } -} diff --git a/idea/indexer/src/gear/temp-state.ts b/idea/indexer/src/gear/temp-state.ts deleted file mode 100644 index 09a365bb62..0000000000 --- a/idea/indexer/src/gear/temp-state.ts +++ /dev/null @@ -1,212 +0,0 @@ -import { CodeStatus, MessageReadReason } from '@gear-js/common'; - -import { MessageEntryPoint, MessageStatus, MessageType, ProgramStatus, getMetahash } from '../common'; -import { Block, Code, Message, Program } from '../database'; -import { BlockService, CodeService, MessageService, ProgramService } from '../services'; -import { RMQService } from '../rmq'; -import { GearApi, HexString } from '@gear-js/api'; - -export class TempState { - private programs: Map; - private codes: Map; - private messages: Map; - private blocks: Map; - private genesis: string; - private metahashes: Map; - - constructor( - private programService: ProgramService, - private messageService: MessageService, - private codeService: CodeService, - private blockService: BlockService, - private rmq: RMQService, - private api: GearApi, - ) { - this.programs = new Map(); - this.codes = new Map(); - this.messages = new Map(); - this.blocks = new Map(); - this.metahashes = new Map(); - } - - newState(genesis: string) { - this.genesis = genesis; - this.programs.clear(); - this.codes.clear(); - this.messages.clear(); - this.blocks.clear(); - this.metahashes.clear(); - } - - addProgram(program: Program) { - this.programs.set(program.id, program); - } - - addCode(code: Code) { - this.codes.set(code.id, code); - if (code.metahash) { - this.metahashes.set(code.id, code.metahash); - this.rmq.sendMetahashToMetaStorage(code.metahash); - } - } - - addMsg(msg: Message) { - if (!this.messages.has(msg.id)) { - this.messages.set(msg.id, msg); - } - } - - addBlock(block: Block) { - this.blocks.set(block.hash, block); - } - - async getProgram(id: string): Promise { - if (this.programs.has(id)) { - return this.programs.get(id); - } - try { - const program = await this.programService.get({ id, genesis: this.genesis }); - this.programs.set(program.id, program); - return program; - } catch (err) { - return null; - } - } - - async getCode(id: string): Promise { - if (this.codes.has(id)) { - return this.codes.get(id); - } - try { - const code = await this.codeService.get({ id, genesis: this.genesis }); - this.codes.set(code.id, code); - return code; - } catch (err) { - return null; - } - } - - async getMsg(id: string): Promise { - if (this.messages.has(id)) { - return this.messages.get(id); - } - try { - const msg = await this.messageService.get({ id, genesis: this.genesis }); - this.messages.set(msg.id, msg); - return msg; - } catch (err) { - return null; - } - } - - async getMsgEntry(id: string): Promise { - if (this.messages.has(id)) { - return this.messages.get(id).entry; - } - - try { - const msg = await this.messageService.get({ id, genesis: this.genesis }); - return msg.entry; - } catch (err) { - return null; - } - } - - async setProgramStatus(id: string, status: ProgramStatus, expiration?: string) { - const program = await this.getProgram(id); - if (program) { - program.status = status; - if (expiration) { - program.expiration = expiration; - } - } - } - - async setCodeStatus(id: string, status: CodeStatus, expiration: string) { - const code = await this.getCode(id); - if (code) { - code.status = status; - code.expiration = expiration; - } - } - - async setDispatchedStatus(statuses: { [key: string]: MessageStatus }) { - for (const [id, status] of Object.entries(statuses)) { - const msg = await this.getMsg(id); - if (msg) { - msg.processedWithPanic = status !== 'Success'; - } - } - } - - async setReadStatus(id: string, reason: MessageReadReason) { - const msg = await this.getMsg(id); - if (msg) { - msg.readReason = reason; - } - } - - async getMetahashByCodeId(codeId: string) { - if (this.metahashes.has(codeId)) { - return this.metahashes.get(codeId); - } else { - const metahash = await this.codeService.getMetahash(codeId); - if (metahash) { - this.metahashes.set(codeId, metahash); - } - return metahash; - } - } - - async getMetahashByProgramId(programId: HexString) { - return getMetahash(this.api.program, programId); - } - - async save() { - await Promise.all([ - (async () => { - const codeIds = Array.from(this.codes.keys()); - const existingCodes = await this.codeService.getManyIds(codeIds, this.genesis); - - for (const { _id, id } of existingCodes) { - this.codes.get(id)._id = _id; - } - - await this.codeService.save(Array.from(this.codes.values())); - })(), - (async () => { - for (const m of this.messages.values()) { - if (m.type === MessageType.MSG_SENT) { - if (m.replyToMessageId) { - m.entry = await this.getMsgEntry(m.replyToMessageId); - } - } - } - })(), - this.messageService.save(Array.from(this.messages.values())), - (async () => { - const programIds = Array.from(this.programs.keys()); - const existingPrograms = await this.programService.getManyIds(programIds, this.genesis); - - for (const { _id, id } of existingPrograms) { - this.programs.get(id)._id = _id; - } - - for (const program of this.programs.values()) { - program.metahash = - (await this.getMetahashByCodeId(program.codeId)) || - (await this.getMetahashByProgramId(program.id as HexString)); - } - await this.programService.save(Array.from(this.programs.values())); - })(), - ]); - - await this.blockService.save(Array.from(this.blocks.values())); - - return { - c: this.codes.size, - p: this.programs.size, - m: this.messages.size, - }; - } -} diff --git a/idea/indexer/src/healthcheck.server.ts b/idea/indexer/src/healthcheck.server.ts deleted file mode 100644 index 2b94027c47..0000000000 --- a/idea/indexer/src/healthcheck.server.ts +++ /dev/null @@ -1,49 +0,0 @@ -import http from 'http'; -import { logger } from '@gear-js/common'; - -import config from './config'; - -export const statuses = { - rmq: false, - database: false, - gear: false, -}; - -export const changeStatus = (service: 'rmq' | 'database' | 'gear', status?: boolean) => { - statuses[service] = status === undefined ? !statuses[service] : status; -}; - -const getStatus = (service: 'rmq' | 'database' | 'gear' | 'all') => { - if (service === 'all') { - const connected = Object.values(statuses).reduce((prev, cur) => prev && cur); - return { code: connected ? 200 : 500, connected }; - } - return { code: statuses[service] ? 200 : 500, connected: statuses[service] }; -}; - -const reqListener = function (req: http.IncomingMessage, res: http.ServerResponse) { - let status = getStatus('all'); - - switch (req.url) { - case '/rmq': - status = getStatus('rmq'); - break; - case '/database': - status = getStatus('database'); - break; - case '/gear': - status = getStatus('gear'); - break; - } - res.setHeader('Content-Type', 'application/json'); - res.writeHead(status.code); - res.end(JSON.stringify({ connected: status.connected })); -}; - -const server = http.createServer(reqListener); - -export function runHealthcheckServer() { - server.listen(config.healthcheck.port, () => { - logger.info(`Healthcheck app is running on ${config.healthcheck.port} port`); - }); -} diff --git a/idea/indexer/src/main.ts b/idea/indexer/src/main.ts deleted file mode 100644 index 27ac478c9f..0000000000 --- a/idea/indexer/src/main.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { waitReady } from '@polkadot/wasm-crypto'; -import { RMQServiceAction, logger } from '@gear-js/common'; - -import { changeStatus, runHealthcheckServer } from './healthcheck.server'; -import { AppDataSource } from './database'; -import { RMQService } from './rmq'; -import { BlockService, StatusService } from './services'; -import { CodeService } from './services'; -import { MessageService } from './services'; -import { ProgramService } from './services'; -import { StateService } from './services'; -import { GearIndexer, connectToNode } from './gear'; - -async function bootstrap() { - runHealthcheckServer(); - - const dataSource = await AppDataSource.initialize(); - - logger.info('DB connection established'); - - changeStatus('database'); - - await waitReady(); - - const blockService = new BlockService(dataSource); - const codeService = new CodeService(dataSource); - const programService = new ProgramService(dataSource); - const stateService = new StateService(dataSource, programService); - const messageService = new MessageService(dataSource, programService); - const statusService = new StatusService(dataSource); - - const rmq = new RMQService(blockService, codeService, messageService, programService, stateService); - - await rmq.init(); - changeStatus('rmq'); - - const indexer = new GearIndexer(programService, messageService, codeService, blockService, rmq, statusService); - - await connectToNode(indexer, async (action, genesis) => { - if (action === RMQServiceAction.ADD) { - await rmq.addGenesisQ(genesis); - } else { - await rmq.removeGenesisQ(); - } - }); -} - -bootstrap(); diff --git a/idea/indexer/src/rmq.ts b/idea/indexer/src/rmq.ts deleted file mode 100644 index fe176a26f5..0000000000 --- a/idea/indexer/src/rmq.ts +++ /dev/null @@ -1,231 +0,0 @@ -import { Channel, connect, Connection } from 'amqplib'; -import { - INDEXER_METHODS, - RMQServiceAction, - RMQServices, - FormResponse, - META_STORAGE_INTERNAL_METHODS, - RMQExchange, - RMQQueue, - INDEXER_INTERNAL_METHODS, - logger, -} from '@gear-js/common'; - -import { BlockService, CodeService, MessageService, ProgramService, StateService } from './services'; -import config from './config'; -import { randomUUID } from 'node:crypto'; - -export class RMQService { - private mainChannel: Channel; - private connection: Connection; - private methods: Record void>; - private genesis: string; - - constructor( - private blockService?: BlockService, - private codeService?: CodeService, - private messageService?: MessageService, - private programService?: ProgramService, - private stateService?: StateService, - private oneTimeSync = false, - ) { - if (this.oneTimeSync) return; - this.methods = { - [INDEXER_METHODS.BLOCKS_STATUS]: this.blockService.getLastBlock.bind(this.blockService), - [INDEXER_METHODS.CODE_ALL]: this.codeService.getMany.bind(this.codeService), - [INDEXER_METHODS.CODE_DATA]: this.codeService.get.bind(this.codeService), - [INDEXER_METHODS.CODE_NAME_ADD]: this.codeService.setName.bind(this.codeService), - [INDEXER_METHODS.MESSAGE_ALL]: this.messageService.getMany.bind(this.messageService), - [INDEXER_METHODS.MESSAGE_DATA]: this.messageService.get.bind(this.messageService), - [INDEXER_METHODS.PROGRAM_ALL]: this.programService.getAllPrograms.bind(this.programService), - [INDEXER_METHODS.PROGRAM_DATA]: this.programService.get.bind(this.programService), - [INDEXER_METHODS.PROGRAM_NAME_ADD]: this.programService.setName.bind(this.programService), - [INDEXER_METHODS.PROGRAM_STATE_ALL]: this.stateService.listByProgramId.bind(this.stateService), - [INDEXER_METHODS.PROGRAM_STATE_ADD]: this.stateService.create.bind(this.stateService), - [INDEXER_METHODS.STATE_GET]: this.stateService.get.bind(this.stateService), - [INDEXER_INTERNAL_METHODS.META_HAS_STATE]: async (hashes: string[]) => - Promise.all([this.programService.hasState(hashes), this.codeService.hasState(hashes)]), - }; - } - - public async init(): Promise { - this.connection = await connect(config.rabbitmq.url); - - logger.info('RabbitMQ connection established', { url: config.rabbitmq.url }); - - this.connection.on('close', (error) => { - logger.error('RabbitMQ connection lost', { error }); - process.exit(1); - }); - - try { - this.mainChannel = await this.connection.createChannel(); - - await this.mainChannel.assertExchange(RMQExchange.DIRECT_EX, 'direct'); - await this.mainChannel.assertExchange(RMQExchange.GENESISES, 'fanout', { durable: true }); - await this.mainChannel.assertExchange(RMQExchange.INDXR_META, 'fanout', { autoDelete: true }); - - await this.mainChannel.assertQueue('', { - durable: true, - exclusive: false, - autoDelete: false, - }); - await this.mainChannel.bindQueue('', RMQExchange.INDXR_META, ''); - - await this.metaMsgConsumer(); - await this.genesisesQSetup(); - } catch (error) { - logger.error('Failed to setup rabbitmq exchanges', { error }); - throw error; - } - } - - public async removeGenesisQ() { - const genesis = this.genesis; - this.sendDeleteGenesis(); - const qName = `${RMQServices.INDEXER}.${genesis}`; - this.genesis = null; - await this.mainChannel.unbindQueue(qName, RMQExchange.DIRECT_EX, qName); - } - - public async addGenesisQ(genesis: string) { - const qName = `${RMQServices.INDEXER}.${genesis}`; - this.genesis = genesis; - - logger.info('Adding new queue', { qName }); - - await this.mainChannel.assertQueue(qName, { - durable: false, - exclusive: false, - autoDelete: true, - }); - await this.mainChannel.bindQueue(qName, RMQExchange.DIRECT_EX, qName); - - await this.directMsgConsumer(qName); - - this.sendGenesis(); - logger.info('Queue added', { qName }); - } - - private sendMsg(exchange: string, queue: string, params: any, correlationId?: string, method?: string): void { - const messageBuff = JSON.stringify(params); - this.mainChannel.publish(exchange, queue, Buffer.from(messageBuff), { correlationId, headers: { method } }); - } - - private async metaMsgConsumer(): Promise { - const exchange = 'indxr_meta'; - const channel = await this.connection.createChannel(); - await channel.assertExchange(exchange, 'fanout', { autoDelete: true }); - const q = await channel.assertQueue('', { exclusive: false }); - await channel.bindQueue(q.queue, exchange, ''); - - try { - await channel.consume( - q.queue, - async (msg) => { - if (!msg) { - return; - } - - const { method } = msg.properties.headers; - const params = JSON.parse(msg.content.toString()); - await this.handleIncomingMsg(method, params); - }, - { noAck: true }, - ); - } catch (error) { - logger.error('Meta message consumer error', { error }); - } - } - - private async directMsgConsumer(queue: string): Promise { - try { - await this.mainChannel.consume( - queue, - async (message) => { - if (!message) { - return; - } - const method = message.properties.headers.method; - const params = JSON.parse(message.content.toString()); - const correlationId = message.properties.correlationId; - - const result = await this.handleIncomingMsg(method, params); - - this.sendMsg(RMQExchange.DIRECT_EX, RMQQueue.REPLIES, result, correlationId); - }, - { noAck: true }, - ); - } catch (error) { - logger.error('Direct exchange consumer error.', { error }); - } - } - - private async genesisesQSetup(): Promise { - const qName = RMQQueue.GENESISES_REQUEST; - - await this.mainChannel.assertQueue('', { - exclusive: true, - autoDelete: true, - }); - - await this.mainChannel.bindQueue('', RMQExchange.GENESISES, ''); - - try { - await this.mainChannel.consume( - '', - async (message) => { - if (!message) { - return; - } - - logger.info('Genesis request'); - if (this.genesis) { - this.sendGenesis(); - } - }, - { noAck: true }, - ); - } catch (error) { - logger.error('Topic exchange consumer error.', { error }); - } - } - - private sendGenesis() { - const correlationId = randomUUID(); - const messageBuff = JSON.stringify({ - service: RMQServices.INDEXER, - action: RMQServiceAction.ADD, - genesis: this.genesis, - }); - logger.info('Send genesis', { genesis: this.genesis, correlationId }); - this.mainChannel.publish(RMQExchange.DIRECT_EX, RMQQueue.GENESIS, Buffer.from(messageBuff), { - headers: { correlationId }, - }); - } - - private sendDeleteGenesis() { - logger.info('Send delete genesis', { genesis: this.genesis }); - const messageBuff = JSON.stringify({ - service: RMQServices.INDEXER, - action: RMQServiceAction.DELETE, - genesis: this.genesis, - }); - this.mainChannel.publish(RMQExchange.DIRECT_EX, RMQQueue.GENESIS, Buffer.from(messageBuff)); - } - - @FormResponse - private async handleIncomingMsg(method: INDEXER_METHODS, params: any): Promise { - return this.methods[method](params); - } - - public sendMetahashToMetaStorage(metahash: string) { - this.sendMsg( - RMQExchange.DIRECT_EX, - RMQServices.META_STORAGE, - { metahash }, - null, - META_STORAGE_INTERNAL_METHODS.META_HASH_ADD, - ); - } -} diff --git a/idea/indexer/src/services/block.service.ts b/idea/indexer/src/services/block.service.ts deleted file mode 100644 index 47fd72d48d..0000000000 --- a/idea/indexer/src/services/block.service.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { And, DataSource, In, LessThanOrEqual, MoreThanOrEqual, Repository } from 'typeorm'; - -import { Block } from '../database'; - -export class BlockService { - private repo: Repository; - - constructor(dataSource: DataSource) { - this.repo = dataSource.getRepository(Block); - } - - public async getLastBlock({ genesis }: { genesis: string }): Promise { - const [block] = await this.repo.find({ - where: { - genesis, - }, - order: { - timestamp: 'DESC', - }, - take: 1, - }); - - return block; - } - - public async save(blocks: Block[]): Promise { - return this.repo.save(blocks); - } - - public async getSyncedBlockNumbers(from: number, to: number, genesis: string) { - let startBlock = await this.repo.findOneBy({ genesis, number: from.toString() }); - if (!startBlock) { - startBlock = await this.repo.findOne({ where: { genesis }, order: { timestamp: 'ASC' } }); - } - - let endBlock = await this.repo.findOneBy({ genesis, number: to.toString() }); - if (!endBlock) { - endBlock = await this.repo.findOne({ where: { genesis }, order: { timestamp: 'DESC' } }); - } - - if (!startBlock || !endBlock) { - return []; - } - - const syncedBlocks = await this.repo.find({ - where: { - timestamp: And(MoreThanOrEqual(startBlock.timestamp), LessThanOrEqual(endBlock.timestamp)), - genesis, - }, - select: ['number'], - order: { - timestamp: 'ASC', - }, - }); - - return syncedBlocks.map(({ number }) => Number(number)); - } - - async getNotSynced(numbers: number[]) { - const blocks = await this.repo.find({ - where: { number: In(numbers.map(String)) }, - select: { number: true }, - }); - - const syncedNumbers = blocks.map((block) => Number(block.number)); - - return numbers.filter((number) => !syncedNumbers.includes(number)).sort((a, b) => a - b); - } -} diff --git a/idea/indexer/src/services/code.service.ts b/idea/indexer/src/services/code.service.ts deleted file mode 100644 index 0a3fee0789..0000000000 --- a/idea/indexer/src/services/code.service.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { - AddCodeNameParams, - CodeStatus, - GetAllCodeParams, - GetAllCodeResult, - GetCodeParams, - logger, - CodeNotFound, -} from '@gear-js/common'; -import { Between, DataSource, FindOptionsWhere, ILike, In, Not, Repository } from 'typeorm'; - -import { Code } from '../database/entities'; -import { PAGINATION_LIMIT } from '../common'; - -export class CodeService { - private repo: Repository; - - constructor(dataSource: DataSource) { - this.repo = dataSource.getRepository(Code); - } - - public async save(codes: Code[]) { - if (codes.length === 0) return; - - await this.repo.save(codes); - } - - public async getMany({ - genesis, - query, - limit, - offset, - name, - toDate, - fromDate, - uploadedBy, - }: GetAllCodeParams): Promise { - const commonOptions: FindOptionsWhere = { genesis }; - let options: FindOptionsWhere[] | FindOptionsWhere; - - if (fromDate || toDate) { - commonOptions.timestamp = Between(new Date(fromDate), new Date(toDate)); - } - - if (uploadedBy) { - commonOptions.uploadedBy = uploadedBy; - } - - if (name) { - commonOptions.name = name; - } - - if (query) { - options = [ - { id: ILike(`%${query}%`), ...commonOptions }, - { name: ILike(`%${query}%`), ...commonOptions }, - ]; - } else { - options = commonOptions; - } - - const [listCode, count] = await Promise.all([ - this.repo.find({ - where: options, - take: limit || PAGINATION_LIMIT, - skip: offset || 0, - order: { timestamp: 'DESC' }, - }), - this.repo.count({ where: options }), - ]); - - return { - listCode, - count, - }; - } - - public async get({ id, genesis }: GetCodeParams): Promise { - const code = await this.repo.findOne({ - where: { - id, - genesis, - }, - }); - - if (!code) { - throw new CodeNotFound(); - } - return code; - } - - public async setStatus(id: string, genesis: string, status: CodeStatus, expiration: string): Promise { - const code = await this.get({ id, genesis }); - code.status = status; - code.expiration = expiration; - - return this.repo.save(code); - } - - public async deleteRecords(genesis: string): Promise { - await this.repo.delete({ genesis }); - } - - public async setName({ id, genesis, name }: AddCodeNameParams): Promise { - const code = await this.repo.findOneBy({ id, genesis }); - - if (!code) throw new CodeNotFound(); - - if (code.name === code.id) { - code.name = name; - return this.repo.save(code); - } - - return code; - } - - public async getMetahash(codeId: string): Promise { - const code = await this.repo.findOne({ select: { metahash: true }, where: { id: codeId } }); - if (!code) { - return null; - } - - return code.metahash; - } - - public async hasState(hashes: Array) { - await this.repo.update({ metahash: In(hashes) }, { hasState: true }); - } - - public getManyIds(ids: string[], genesis: string): Promise { - return this.repo.find({ where: { id: In(ids), genesis }, select: { id: true, _id: true } }); - } - - public async removeDuplicates(genesis: string) { - const codes = await this.repo.find({ where: { genesis }, select: { id: true, _id: true } }); - - const ids: [string, string][] = codes.map((c) => [c.id, c._id]); - - const map = new Map(ids); - - if (ids.length === map.size) { - logger.info('No duplicates found', { genesis }); - return; - } - - const primaryKeysToKeep = new Set(map.values()); - - const toRemove = codes.filter((c) => !primaryKeysToKeep.has(c._id)); - - logger.info('Removing duplicate programs', { genesis, size: toRemove.length }); - - await this.repo.remove(toRemove, { chunk: 5_000 }); - } - - public async getAllNotInList(ids: string[], genesis: string): Promise { - const codes = await this.repo.find({ where: { id: In(ids), genesis }, select: { id: true } }); - - const syncedIds = codes.map((c) => c.id); - - return ids.filter((id) => !syncedIds.includes(id)); - } -} diff --git a/idea/indexer/src/services/index.ts b/idea/indexer/src/services/index.ts deleted file mode 100644 index 7c765082f7..0000000000 --- a/idea/indexer/src/services/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './block.service'; -export * from './code.service'; -export * from './message.service'; -export * from './program.service'; -export * from './state.service'; -export * from './status.service'; diff --git a/idea/indexer/src/services/message.service.ts b/idea/indexer/src/services/message.service.ts deleted file mode 100644 index d79b8c79c2..0000000000 --- a/idea/indexer/src/services/message.service.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { Between, DataSource, FindOptionsWhere, IsNull, MoreThan, Repository } from 'typeorm'; -import { - AllMessagesResult, - FindMessageParams, - GetMessagesParams, - MessageReadReason, - logger, - ProgramStatus, - MessageType, - MessageNotFound, -} from '@gear-js/common'; - -import { Message } from '../database'; -import { ProgramService } from './program.service'; -import { MessagesDispatchedDataInput, MessageEntryPoint, PAGINATION_LIMIT } from '../common'; - -export class MessageService { - private repo: Repository; - - constructor(dataSource: DataSource, private programService: ProgramService) { - this.repo = dataSource.getRepository(Message); - } - - public async get({ id, genesis, withMetahash }: FindMessageParams): Promise { - const message = await this.repo.findOne({ where: { id, genesis } }); - - if (!message) { - throw new MessageNotFound(); - } - - if (withMetahash) { - const metahash = await this.programService.getMetahash( - message.type === MessageType.MSG_SENT ? message.source : message.destination, - message.genesis, - ); - - Object.assign(message, { metahash }); - } - - return message; - } - - public async getMany({ - genesis, - source, - destination, - limit, - offset, - toDate, - fromDate, - mailbox, - type, - withPrograms, - }: GetMessagesParams): Promise { - const commonOptions: FindOptionsWhere = { genesis }; - let options: FindOptionsWhere[] | FindOptionsWhere; - - if (type) { - commonOptions.type = type; - } - - if (mailbox) { - commonOptions.readReason = IsNull(); - commonOptions.expiration = MoreThan(0); - commonOptions.type = MessageType.MSG_SENT; - } - - if (fromDate || toDate) { - commonOptions.timestamp = Between(new Date(fromDate), new Date(toDate)); - } - - if (destination && source) { - options = [ - { source, ...commonOptions }, - { destination, ...commonOptions }, - ]; - } else { - if (destination) { - commonOptions.destination = destination; - } else if (source) { - commonOptions.source = source; - } - options = commonOptions; - } - - const [messages, count] = await Promise.all([ - this.repo.find({ - where: options, - take: Math.min(limit || PAGINATION_LIMIT, 100), - skip: offset || 0, - order: { timestamp: 'DESC', type: 'DESC' }, - }), - this.repo.count({ where: options }), - ]); - - const result: AllMessagesResult = { messages, count }; - - if (withPrograms) { - const programIds = new Set(); - - messages.forEach(({ type, source, destination }) => - programIds.add(type === MessageType.MSG_SENT ? source : destination), - ); - - result.programNames = await this.programService.getNames(Array.from(programIds.values()), genesis); - } - - return result; - } - - public async save(messages: Message[]) { - if (messages.length === 0) return; - - await this.repo.save(messages); - } - - public async setDispatchedStatus({ statuses, genesis }: MessagesDispatchedDataInput): Promise { - for (const id of Object.keys(statuses)) { - try { - await this.repo.update({ id, genesis }, { processedWithPanic: statuses[id] === 'Success' ? false : true }); - } catch (error) { - logger.error(error.message, { error }); - } - - if (statuses[id] === 'Failed') { - const message = await this.get({ id, genesis }); - if (message.entry === MessageEntryPoint.INIT) { - await this.programService.setStatus(message.destination, genesis, ProgramStatus.TERMINATED); - } - } - } - } - - public async updateReadStatus(id: string, readReason: MessageReadReason): Promise { - try { - await this.repo.update({ id }, { readReason }); - } catch (error) { - logger.error(error.message, { error }); - } - } - - public async deleteRecords(genesis: string): Promise { - await this.repo.delete({ genesis }); - } -} diff --git a/idea/indexer/src/services/program.service.ts b/idea/indexer/src/services/program.service.ts deleted file mode 100644 index 4ae10a6481..0000000000 --- a/idea/indexer/src/services/program.service.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { Between, DataSource, FindOptionsWhere, ILike, In, Repository } from 'typeorm'; -import { decodeAddress } from '@gear-js/api'; -import { - AddProgramNameParams, - FindProgramParams, - GetAllProgramsParams, - GetAllProgramsResult, - IProgram, - InvalidParamsError, - ProgramNotFound, - ProgramStatus, - logger, -} from '@gear-js/common'; - -import { Program } from '../database/entities'; -import { PAGINATION_LIMIT } from '../common'; - -export class ProgramService { - private repo: Repository; - - constructor(dataSource: DataSource) { - this.repo = dataSource.getRepository(Program); - } - - public async get({ id, genesis }: FindProgramParams): Promise { - if (!id) { - throw new InvalidParamsError('Program ID is required'); - } - - const program = await this.repo.findOne({ - where: { id, genesis }, - }); - - if (!program) { - throw new ProgramNotFound(); - } - return program; - } - - public async getAllPrograms({ - genesis, - query, - limit, - offset, - owner, - toDate, - fromDate, - status, - codeId, - }: GetAllProgramsParams): Promise { - const commonOptions: FindOptionsWhere = { genesis }; - let options: FindOptionsWhere[] | FindOptionsWhere; - - if (owner) { - commonOptions.owner = decodeAddress(owner); - } - - if (status) { - if (Array.isArray(status)) { - commonOptions.status = In(status); - } else { - commonOptions.status = status; - } - } - - if (fromDate || toDate) { - commonOptions.timestamp = Between(new Date(fromDate), new Date(toDate)); - } - - if (codeId) { - commonOptions.codeId = codeId; - } - - if (query) { - options = [ - { id: ILike(`%${query}%`), ...commonOptions }, - { name: ILike(`%${query}%`), ...commonOptions }, - ]; - } else { - options = commonOptions; - } - - const [programs, count] = await Promise.all([ - this.repo.find({ - where: options, - take: limit || PAGINATION_LIMIT, - skip: offset || 0, - order: { timestamp: 'DESC' }, - }), - this.repo.count({ where: options }), - ]); - - return { - programs, - count, - }; - } - - public async save(programs: Program[]) { - if (programs.length === 0) return; - - return this.repo.save(programs); - } - - async setStatus(id: string, genesis: string, status: ProgramStatus): Promise { - const program = await this.get({ id, genesis }); - - if (!program) { - throw new ProgramNotFound(); - } - - program.status = status; - - try { - const programs = await this.repo.save(program); - return programs[0]; - } catch (error) { - logger.error('Unable to set program status', { error }); - } - } - - public async setName({ id, genesis, name }: AddProgramNameParams): Promise { - const program = await this.repo.findOneBy({ id, genesis }); - - if (!program) throw new ProgramNotFound(); - - if (program.name === program.id) { - program.name = name; - return this.repo.save(program); - } - return program; - } - - public async hasState(hashes: Array) { - await this.repo.update({ metahash: In(hashes) }, { hasState: true }); - } - - public async getMetahash(id: string, genesis: string): Promise { - const program = await this.repo.findOne({ where: { id, genesis }, select: { metahash: true } }); - - if (!program) { - return null; - } - - return program.metahash; - } - - public async getNames(ids: string[], genesis: string): Promise> { - const programs = await this.repo.find({ where: { id: In(ids), genesis }, select: { name: true, id: true } }); - - const result = {}; - - programs.forEach((program) => { - result[program.id] = program.name; - }); - - return result; - } - - public getManyIds(ids: string[], genesis: string) { - return this.repo.find({ where: { id: In(ids), genesis }, select: { id: true, _id: true } }); - } - - public async removeDuplicates(genesis: string) { - const programs = await this.repo.find({ where: { genesis }, select: { id: true, _id: true } }); - - const ids: [string, string][] = programs.map((program) => [program.id, program._id]); - - const map = new Map(ids); - - if (ids.length === map.size) { - logger.info('No duplicates found', { genesis }); - return; - } - - const primaryKeysToKeep = new Set(map.values()); - - const toRemove = programs.filter((program) => !primaryKeysToKeep.has(program._id)).map(({ _id }) => _id); - - logger.info('Removing duplicate programs', { genesis, size: toRemove.length }); - - for (let i = 0; i < toRemove.length; i += 5_000) { - await this.repo.delete({ _id: In(toRemove.slice(i, i + 5_000)), genesis }); - } - } -} diff --git a/idea/indexer/src/services/state.service.ts b/idea/indexer/src/services/state.service.ts deleted file mode 100644 index 297a872a53..0000000000 --- a/idea/indexer/src/services/state.service.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { - AddStateParams, - AddStateResult, - GetAllStateParams, - GetStateParams, - GetStatesResult, - ProgramNotFound, - StateAlreadyExists, - StateNotFound, -} from '@gear-js/common'; -import { DataSource, Repository } from 'typeorm'; -import { generateCodeHash, getStateMetadata } from '@gear-js/api'; - -import { State } from '../database'; -import { ProgramService } from './program.service'; - -export class StateService { - private repo: Repository; - - constructor(dataSource: DataSource, private programService: ProgramService) { - this.repo = dataSource.getRepository(State); - } - - public async get({ id }: GetStateParams): Promise { - const state = await this.repo.findOneBy({ id }); - - if (!state) { - throw new StateNotFound(); - } - - return state; - } - - public async listByProgramId({ programId, genesis }: GetAllStateParams): Promise { - const program = await this.programService.get({ id: programId, genesis }); - - if (!program) { - throw new ProgramNotFound(); - } - - const codeId = program.codeId; - - const options = { where: { codeId } }; - - const [states, count] = await Promise.all([this.repo.find(options), this.repo.count(options)]); - - return { - states, - count, - }; - } - - public async create({ genesis, programId, wasmBuffBase64, name }: AddStateParams): Promise { - const program = await this.programService.get({ id: programId, genesis }); - - const metaStateBuff = Buffer.from(wasmBuffBase64, 'base64'); - const stateId = generateCodeHash(metaStateBuff); - - if (await this.repo.findOneBy({ id: stateId })) { - throw new StateAlreadyExists(); - } - - const { functions } = await getStateMetadata(metaStateBuff); - const funcNames = Object.keys(functions); - - const state = await this.repo.save( - new State({ - id: stateId, - name, - wasmBuffBase64, - funcNames, - functions, - codeId: program.codeId, - }), - ); - - return { - status: 'State added', - state: { - id: state.id, - name: state.name, - wasmBuffBase64: state.wasmBuffBase64, - functions: state.functions, - }, - }; - } -} diff --git a/idea/indexer/src/services/status.service.ts b/idea/indexer/src/services/status.service.ts deleted file mode 100644 index dc8e4545c0..0000000000 --- a/idea/indexer/src/services/status.service.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { DataSource, Repository } from 'typeorm'; - -import { Status } from '../database'; -import config from '../config'; - -export class StatusService { - private repo: Repository; - - constructor(dataSource: DataSource) { - this.repo = dataSource.getRepository(Status); - } - - async init(genesis: string) { - if (!(await this.repo.findOneBy({ genesis }))) { - await this.repo.save(new Status({ genesis, height: config.indexer.fromBlock.toString() })); - } - } - - public getStatus(genesis: string): Promise { - return this.repo.findOneBy({ - genesis, - }); - } - - public async update(genesis: string, height: string) { - return this.repo.update({ genesis }, { height }); - } -} diff --git a/idea/indexer/tsconfig.json b/idea/indexer/tsconfig.json deleted file mode 100644 index 759fb69bef..0000000000 --- a/idea/indexer/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./dist", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "allowSyntheticDefaultImports": true, - "strict": false - } -} diff --git a/idea/meta-storage/.env.example b/idea/meta-storage/.env.example deleted file mode 100644 index 1c4ce5962a..0000000000 --- a/idea/meta-storage/.env.example +++ /dev/null @@ -1,7 +0,0 @@ -DB_NAME=meta -DB_USER=postgres -DB_PASSWORD=postgres -DB_PORT=5432 -DB_HOST=mithriy.com - -RMQ_URL=amqp://127.0.0.1 diff --git a/idea/meta-storage/.gitignore b/idea/meta-storage/.gitignore deleted file mode 100644 index 4c49bd78f1..0000000000 --- a/idea/meta-storage/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.env diff --git a/idea/meta-storage/Dockerfile b/idea/meta-storage/Dockerfile deleted file mode 100644 index 856d0b40d9..0000000000 --- a/idea/meta-storage/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM node:18-alpine - -WORKDIR /src -COPY package.json . -COPY yarn.lock . -COPY tsconfig.json . -COPY .yarn .yarn -COPY .yarnrc.yml . -COPY ./idea/common idea/common -COPY ./idea/meta-storage idea/meta-storage -RUN npm cache clean --force -RUN yarn cache clean -RUN yarn install -RUN yarn build:common -RUN yarn build:meta-storage -WORKDIR /src/idea/meta-storage - -CMD ["node", "dist/main"] diff --git a/idea/meta-storage/README.md b/idea/meta-storage/README.md deleted file mode 100644 index ad60dadbd5..0000000000 --- a/idea/meta-storage/README.md +++ /dev/null @@ -1 +0,0 @@ -# meta-storage diff --git a/idea/meta-storage/package.json b/idea/meta-storage/package.json deleted file mode 100644 index 01c9422c61..0000000000 --- a/idea/meta-storage/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "@gear-js/meta-storage", - "packageManager": "yarn@3.3.0", - "devDependencies": { - "ts-node-dev": "^2.0.0", - "typescript": "5.5.3" - }, - "dependencies": { - "@gear-js/api": "0.39.0", - "@gear-js/common": "workspace:^", - "@polkadot/api": "14.3.1", - "amqplib": "0.10.3", - "dotenv": "^16.3.1", - "pg": "8.10.0", - "typeorm": "^0.3.17" - }, - "scripts": { - "build": "rm -rf dist && tsc", - "start": "node dist/main.js", - "watch": "clear && ts-node-dev src/main.ts" - }, - "lint-staged": { - "*.ts": [ - "eslint --fix", - "git add" - ] - } -} diff --git a/idea/meta-storage/src/config.ts b/idea/meta-storage/src/config.ts deleted file mode 100644 index aabf8eb4ce..0000000000 --- a/idea/meta-storage/src/config.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { config } from 'dotenv'; -import { strict as assert } from 'assert'; - -config(); - -export const getEnv = (envName: string, defaultValue?: string) => { - const env = process.env[envName]; - if (!env && defaultValue) { - return defaultValue; - } - assert.notStrictEqual(env, undefined, `${envName} is not specified`); - return env as string; -}; - -export default { - rmq: { - url: getEnv('RMQ_URL'), - }, - db: { - host: getEnv('DB_HOST', 'localhost'), - port: parseInt(getEnv('DB_PORT', '5432'), 10), - user: getEnv('DB_USER'), - password: getEnv('DB_PASSWORD'), - name: getEnv('DB_NAME'), - }, -}; diff --git a/idea/meta-storage/src/database/data-source.ts b/idea/meta-storage/src/database/data-source.ts deleted file mode 100644 index f7b0f74299..0000000000 --- a/idea/meta-storage/src/database/data-source.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { DataSource } from 'typeorm'; - -import { Code, Meta, SailsIdl } from './entities'; -import config from '../config'; - -export const AppDataSource = new DataSource({ - type: 'postgres', - host: config.db.host, - port: config.db.port, - username: config.db.user, - password: config.db.password, - database: config.db.name, - entities: [Meta, SailsIdl, Code], - synchronize: true, - logging: ['error', 'schema'], -}); diff --git a/idea/meta-storage/src/database/entities/code.entity.ts b/idea/meta-storage/src/database/entities/code.entity.ts deleted file mode 100644 index 1a747960ff..0000000000 --- a/idea/meta-storage/src/database/entities/code.entity.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Entity, ManyToOne, PrimaryColumn } from 'typeorm'; -import { SailsIdl } from './sails.entity'; - -@Entity() -export class Code { - constructor(props: Partial) { - Object.assign(this, props); - } - - @PrimaryColumn() - public id: string; - - @ManyToOne(() => SailsIdl, (sails) => sails.id) - public sails: SailsIdl; -} diff --git a/idea/meta-storage/src/database/entities/index.ts b/idea/meta-storage/src/database/entities/index.ts deleted file mode 100644 index a599f3bfc6..0000000000 --- a/idea/meta-storage/src/database/entities/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { Meta } from './meta.entity'; -export { SailsIdl } from './sails.entity'; -export { Code } from './code.entity'; diff --git a/idea/meta-storage/src/database/entities/meta.entity.ts b/idea/meta-storage/src/database/entities/meta.entity.ts deleted file mode 100644 index 5f87528e0f..0000000000 --- a/idea/meta-storage/src/database/entities/meta.entity.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Column, Entity, PrimaryColumn } from 'typeorm'; - -@Entity() -export class Meta { - constructor(props: Partial) { - Object.assign(this, props); - } - - @PrimaryColumn() - public hash: string; - - @Column({ nullable: true }) - public hex: string; - - @Column({ nullable: true }) - public hasState: boolean; -} diff --git a/idea/meta-storage/src/database/entities/sails.entity.ts b/idea/meta-storage/src/database/entities/sails.entity.ts deleted file mode 100644 index 39df64e265..0000000000 --- a/idea/meta-storage/src/database/entities/sails.entity.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Column, Entity, OneToMany, PrimaryColumn } from 'typeorm'; -import { Code } from './code.entity'; - -@Entity() -export class SailsIdl { - constructor(props: Partial) { - Object.assign(this, props); - } - - @PrimaryColumn() - public id: string; - - @Column() - public data: string; - - @OneToMany(() => Code, (code) => code.id) - public codes: Code[]; -} diff --git a/idea/meta-storage/src/database/index.ts b/idea/meta-storage/src/database/index.ts deleted file mode 100644 index 3900ae964b..0000000000 --- a/idea/meta-storage/src/database/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './entities'; -export * from './data-source'; diff --git a/idea/meta-storage/src/main.ts b/idea/meta-storage/src/main.ts deleted file mode 100644 index 7dc6ace679..0000000000 --- a/idea/meta-storage/src/main.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { logger } from '@gear-js/common'; - -import { AppDataSource } from './database'; -import { RMQService } from './rmq'; -import { MetaService } from './service'; - -const main = async () => { - await AppDataSource.initialize(); - logger.info('Connected to the database'); - - const metaService = new MetaService(); - - const rmq = new RMQService(metaService); - await rmq.init(); - - logger.info('Connected to RabbitMQ'); -}; - -main().catch((error) => { - logger.error("Can't start the indexer", { error, stack: error.stack }); - process.exit(1); -}); diff --git a/idea/meta-storage/src/rmq.ts b/idea/meta-storage/src/rmq.ts deleted file mode 100644 index 76038ee5e7..0000000000 --- a/idea/meta-storage/src/rmq.ts +++ /dev/null @@ -1,120 +0,0 @@ -import { Channel, connect, Connection } from 'amqplib'; -import { - FormResponse, - RMQServices, - META_STORAGE_METHODS, - META_STORAGE_INTERNAL_METHODS, - INDEXER_INTERNAL_METHODS, - logger, - RMQExchange, - RMQQueue, -} from '@gear-js/common'; - -import config from './config'; -import { MetaService } from './service'; - -export class RMQService { - private channel: Channel; - private indxrChannel: Channel; - private connection: Connection; - private methods: Record Promise>; - - constructor(private metaService: MetaService) { - this.methods = { - [META_STORAGE_METHODS.META_ADD]: this.metaService.addMetaDetails.bind(this.metaService), - [META_STORAGE_METHODS.META_GET]: this.metaService.get.bind(this.metaService), - [META_STORAGE_METHODS.SAILS_ADD]: this.metaService.addIdl.bind(this.metaService), - [META_STORAGE_METHODS.SAILS_GET]: this.metaService.getIdl.bind(this.metaService), - [META_STORAGE_INTERNAL_METHODS.META_HASH_ADD]: this.metaService.addMeta.bind(this.metaService), - }; - } - - public async init(): Promise { - this.connection = await connect(config.rmq.url); - - try { - this.channel = await this.connection.createChannel(); - - await this.setupMsgConsumer(); - await this.setupIndxrExchange(); - - this.connection.on('close', (error) => { - logger.error('RabbitMQ connection closed', { error }); - process.exit(1); - }); - } catch (error) { - logger.error('Failed to setup rabbitmq exchanges', { error, stack: error.stack }); - throw error; - } - } - - private async setupIndxrExchange() { - this.indxrChannel = await this.connection.createChannel(); - this.indxrChannel.assertExchange(RMQExchange.INDXR_META, 'fanout', { autoDelete: true }); - } - - private sendMsg(exchange: RMQExchange, queue: RMQQueue, params: any, correlationId?: string, method?: string): void { - const messageBuff = JSON.stringify(params); - this.channel.publish(exchange, queue, Buffer.from(messageBuff), { correlationId, headers: { method } }); - } - - private sendMsgToIndxrTopic(params: any, method: string) { - const msgBuf = Buffer.from(JSON.stringify(params)); - this.indxrChannel.publish('indxr_meta', '', msgBuf, { headers: { method } }); - } - - private async setupMsgConsumer(): Promise { - await this.channel.assertExchange(RMQExchange.DIRECT_EX, 'direct'); - const q = await this.channel.assertQueue(RMQServices.META_STORAGE, { - durable: true, - exclusive: false, - autoDelete: false, - }); - await this.channel.bindQueue(q.queue, RMQExchange.DIRECT_EX, RMQServices.META_STORAGE); - try { - await this.channel.consume( - q.queue, - async (msg) => { - if (!msg) { - return; - } - const method = msg.properties.headers.method; - - const params = JSON.parse(msg.content.toString()); - const correlationId = msg.properties.correlationId; - - try { - const result = await this.handleIncomingMsg(method, params); - - this.sendMsg(RMQExchange.DIRECT_EX, RMQQueue.REPLIES, result, correlationId); - } catch (error) { - logger.error('Failed to handle incoming message', { error: error.message, stack: error.stack }); - } - }, - { noAck: true }, - ); - } catch (error) { - logger.error('Direct exchange consumer error.', { error, stack: error.stack }); - } - } - - @FormResponse - private async handleIncomingMsg( - method: META_STORAGE_METHODS | META_STORAGE_INTERNAL_METHODS, - params: any, - ): Promise { - const result = await this.methods[method](params); - - if (META_STORAGE_METHODS.META_ADD === method) { - if (result.hasState === true) { - this.sendMsgToIndxrTopic([result.hash], INDEXER_INTERNAL_METHODS.META_HAS_STATE); - } - return { hash: result.hash, hex: result.hex }; - } else if (META_STORAGE_INTERNAL_METHODS.META_HASH_ADD === method) { - if (result.length > 0) { - this.sendMsgToIndxrTopic(result, INDEXER_INTERNAL_METHODS.META_HAS_STATE); - } - } - return result; - } -} diff --git a/idea/meta-storage/src/service.ts b/idea/meta-storage/src/service.ts deleted file mode 100644 index 54bfc8d5a6..0000000000 --- a/idea/meta-storage/src/service.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { - AddMetaDetailsParams, - AddMetahashParams, - GetMetaParams, - InvalidMetadataError, - InvalidParamsError, - logger, - MetaNotFoundError, - SailsIdlNotFoundError, -} from '@gear-js/common'; -import { ProgramMetadata, MetadataVersion, HumanTypesRepr } from '@gear-js/api'; -import { Repository } from 'typeorm'; -import * as crypto from 'crypto'; - -import { Meta, AppDataSource, SailsIdl } from './database'; -import { validateMetaHex } from './util/validate'; -import { Code } from './database/entities/code.entity'; - -const getHash = (data: string) => crypto.createHash('sha256').update(data).digest('hex'); - -export class MetaService { - private metaRepo: Repository; - private sailsRepo: Repository; - private codeRepo: Repository; - - constructor() { - this.metaRepo = AppDataSource.getRepository(Meta); - this.sailsRepo = AppDataSource.getRepository(SailsIdl); - this.codeRepo = AppDataSource.getRepository(Code); - } - - async addMeta({ metahash }: AddMetahashParams): Promise { - logger.info('Adding meta', { metahash }); - const meta = (await this.metaRepo.findOne({ where: { hash: metahash } })) || new Meta({ hash: metahash }); - - await this.metaRepo.save(meta); - - return meta.hasState ? [metahash] : []; - } - - async addMetaDetails(params: AddMetaDetailsParams): Promise> { - logger.info('Adding meta details', params); - if (!params.hash) { - throw new InvalidParamsError(); - } - - let meta = await this.metaRepo.findOneBy({ hash: params.hash }); - - if (!meta) { - meta = new Meta({ hash: params.hash }); - } - - if (meta.hex) { - return { hex: meta.hex, hash: meta.hash, hasState: meta.hasState }; - } - - validateMetaHex(params.hex, meta.hash); - - meta.hex = params.hex; - - let metadata: ProgramMetadata; - - try { - metadata = ProgramMetadata.from(meta.hex); - } catch (error) { - throw new InvalidMetadataError('Invalid metadata hex'); - } - - if (metadata.version === MetadataVersion.V1Rust) { - if (metadata.types.state != null) { - meta.hasState = true; - } - } else { - if ((metadata.types.state as HumanTypesRepr).output != null) { - meta.hasState = true; - } - } - - await this.metaRepo.save(meta); - - return { hex: meta.hex, hash: meta.hash, hasState: meta.hasState }; - } - - async get({ hash }: GetMetaParams): Promise> { - if (!hash) { - throw new InvalidParamsError(); - } - const meta = await this.metaRepo.findOne({ where: { hash } }); - - if (!meta) { - throw new MetaNotFoundError(); - } - - return meta; - } - - async getAllWithState(): Promise { - const meta = await this.metaRepo.find({ where: { hasState: true }, select: { hash: true } }); - return meta.map((m) => m.hash); - } - - async addIdl({ codeId, data }) { - if (!codeId || !data) { - throw new InvalidParamsError(); - } - - const hash = getHash(data); - - logger.info('Adding IDL', { codeId, hash }); - - let sails = await this.sailsRepo.findOne({ where: { id: hash } }); - - if (!sails) { - const code = await this.codeRepo.findOne({ where: { id: codeId } }); - if (code) { - throw new InvalidParamsError('Code already has IDL'); - } - sails = new SailsIdl({ id: hash, data }); - } - - const code = new Code({ id: codeId, sails }); - - await this.sailsRepo.save(sails); - await this.codeRepo.save(code); - - return { status: 'Sails idl added' }; - } - - async getIdl({ codeId }) { - const code = await this.codeRepo.findOne({ where: { id: codeId }, relations: { sails: true } }); - - if (!code) { - throw new SailsIdlNotFoundError(); - } - - return code.sails.data; - } -} diff --git a/idea/meta-storage/src/util/validate.ts b/idea/meta-storage/src/util/validate.ts deleted file mode 100644 index d052ebfb56..0000000000 --- a/idea/meta-storage/src/util/validate.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { HexString, generateCodeHash } from '@gear-js/api'; -import { InvalidMetadataError } from '@gear-js/common'; - -export function validateMetaHex(hex: HexString, hash: string) { - console.log(hex, hash, generateCodeHash(hex)); - if (hash !== generateCodeHash(hex)) { - throw new InvalidMetadataError(); - } -} diff --git a/idea/meta-storage/tsconfig.json b/idea/meta-storage/tsconfig.json deleted file mode 100644 index 759fb69bef..0000000000 --- a/idea/meta-storage/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./dist", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "allowSyntheticDefaultImports": true, - "strict": false - } -} diff --git a/idea/test-balance/.env.example b/idea/test-balance/.env.example deleted file mode 100644 index cb14f07c46..0000000000 --- a/idea/test-balance/.env.example +++ /dev/null @@ -1,10 +0,0 @@ -DB_USER=user -DB_PASSWORD=pwd -DB_NAME=name -DB_PORT=5432 -DB_HOST=localhost - -#gear -WS_PROVIDER=wss://rpc-node.gear-tech.io:443 -TEST_ACCOUNT_SEED=0x8999321253e3a76e31d91767d0e2a915223210e008089a0d34e1919c0d84da5 -TEST_BALANCE_VALUE=1000000 diff --git a/idea/test-balance/.eslintrc.js b/idea/test-balance/.eslintrc.js deleted file mode 100644 index 1332f6343f..0000000000 --- a/idea/test-balance/.eslintrc.js +++ /dev/null @@ -1,21 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - parserOptions: { - project: 'tsconfig.json', - sourceType: 'module', - }, - plugins: ['@typescript-eslint/eslint-plugin'], - extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], - root: true, - env: { - node: true, - jest: true, - }, - ignorePatterns: ['.eslintrc.js'], - rules: { - '@typescript-eslint/interface-name-prefix': 'off', - '@typescript-eslint/explicit-function-return-type': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-explicit-any': 'off', - }, -}; diff --git a/idea/test-balance/.gitignore b/idea/test-balance/.gitignore deleted file mode 100644 index ac41a48181..0000000000 --- a/idea/test-balance/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.env -node_modules/ -build/ -myapp.log \ No newline at end of file diff --git a/idea/test-balance/Dockerfile b/idea/test-balance/Dockerfile deleted file mode 100644 index bdd1fe695e..0000000000 --- a/idea/test-balance/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM node:18-alpine - -WORKDIR /src -COPY package.json . -COPY yarn.lock . -COPY tsconfig.json . -COPY .yarn .yarn -COPY .yarnrc.yml . -COPY ./idea/common idea/common -COPY ./idea/test-balance/ idea/test-balance -RUN yarn install -RUN yarn build:common -RUN yarn build:test-balance -CMD ["node", "idea/test-balance/dist/main.js"] diff --git a/idea/test-balance/README.md b/idea/test-balance/README.md deleted file mode 100644 index acb77fc8be..0000000000 --- a/idea/test-balance/README.md +++ /dev/null @@ -1 +0,0 @@ -# @gear-js/test-balance diff --git a/idea/test-balance/package.json b/idea/test-balance/package.json deleted file mode 100644 index eda596a8d5..0000000000 --- a/idea/test-balance/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "@gear-js/test-balance", - "version": "1.0.2", - "description": "", - "main": "main.js", - "scripts": { - "build": "tsc", - "start": "node dist/main.js", - "dev": "nodemon src/main.ts" - }, - "author": "", - "license": "ISC", - "dependencies": { - "@gear-js/api": "0.39.0", - "@gear-js/common": "workspace:^", - "@polkadot/api": "14.3.1", - "@types/amqplib": "0.8.2", - "amqplib": "0.10.3", - "chalk": "4.1.2", - "class-transformer": "0.5.1", - "cron": "^3.1.6", - "express": "4.18.1", - "nodemon": "2.0.16", - "pg": "8.7.1", - "postgres": "1.0.2", - "typeorm": "0.3.9", - "winston": "3.3.3" - }, - "devDependencies": { - "@types/express": "4.17.13", - "@typescript-eslint/eslint-plugin": "4.33.0", - "@typescript-eslint/parser": "4.33.0", - "dotenv": "10.0.0", - "eslint": "7.32.0", - "eslint-config-prettier": "8.5.0", - "eslint-plugin-prettier": "3.4.1", - "ts-node-dev": "2.0.0", - "typescript": "4.7.4" - }, - "lint-staged": { - "*.ts": [ - "eslint --fix", - "git add" - ] - } -} diff --git a/idea/test-balance/src/config.ts b/idea/test-balance/src/config.ts deleted file mode 100644 index 5051057ebd..0000000000 --- a/idea/test-balance/src/config.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { config } from 'dotenv'; -import { strict as assert } from 'assert'; -config(); - -const checkEnv = (envName: string) => { - const env = process.env[envName]; - assert.notStrictEqual(env, undefined, `${envName} is not specified`); - return env; -}; - -export default { - db: { - port: parseInt(process.env.DB_PORT, 10) || 5432, - user: checkEnv('DB_USER'), - password: checkEnv('DB_PASSWORD'), - name: checkEnv('DB_NAME'), - host: process.env.DB_HOST || 'localhost', - }, - gear: { - providerAddresses: checkEnv('WS_PROVIDER').split(','), - accountSeed: checkEnv('TEST_ACCOUNT_SEED'), - balanceToTransfer: checkEnv('TEST_BALANCE_VALUE'), - }, - rabbitmq: { - url: checkEnv('RABBIT_MQ_URL'), - }, - healthcheck: { - port: parseInt(process.env.PORT || '3010'), - }, -}; diff --git a/idea/test-balance/src/database/app-data-source.ts b/idea/test-balance/src/database/app-data-source.ts deleted file mode 100644 index bc1ca4de71..0000000000 --- a/idea/test-balance/src/database/app-data-source.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { DataSource } from 'typeorm'; - -import config from '../config'; -import { TransferBalance } from './transfer.entity'; - -export const AppDataSource = new DataSource({ - type: 'postgres', - host: config.db.host, - port: Number(config.db.port) || 5432, - username: config.db.user, - password: config.db.password, - database: config.db.name, - synchronize: true, - entities: [TransferBalance], - migrations: [], -}); - -export async function connectToDB(): Promise { - await AppDataSource.initialize(); -} diff --git a/idea/test-balance/src/database/index.ts b/idea/test-balance/src/database/index.ts deleted file mode 100644 index affd6b10d2..0000000000 --- a/idea/test-balance/src/database/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './transfer.entity'; -export * from './app-data-source'; diff --git a/idea/test-balance/src/database/transfer.entity.ts b/idea/test-balance/src/database/transfer.entity.ts deleted file mode 100644 index 821ac9f61d..0000000000 --- a/idea/test-balance/src/database/transfer.entity.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Column, Entity, PrimaryColumn } from 'typeorm'; - -@Entity() -export class TransferBalance { - constructor(props: TransferBalance) { - Object.assign(this, props); - } - - @PrimaryColumn() - account: string; - - @Column() - lastTransfer: Date; -} diff --git a/idea/test-balance/src/healthcheck.router.ts b/idea/test-balance/src/healthcheck.router.ts deleted file mode 100644 index 385b042947..0000000000 --- a/idea/test-balance/src/healthcheck.router.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { Request, Response, Router } from 'express'; - -export const healthcheckRouter = Router({}); - -const status = { - rabbitMQ: false, - database: false, - ws: false, -}; - -export const changeStatus = (service: 'rabbitMQ' | 'ws' | 'database') => { - status[service] = !status[service]; -}; - -healthcheckRouter - .get('/rabbitMQ', async (req: Request, res: Response) => { - res.status(status.rabbitMQ ? 200 : 500).json({ connected: status.rabbitMQ }); - }) - .get('/database', async (req: Request, res: Response) => { - res.status(status.database ? 200 : 500).json({ connected: status.database }); - }) - .get('/ws', (req: Request, res: Response) => { - res.status(status.ws ? 200 : 500).json({ connected: status.ws }); - }) - .get('', (req: Request, res: Response) => { - const { rabbitMQ, database, ws } = status; - const allTogether = rabbitMQ && database && ws; - res.status(allTogether ? 200 : 500).json({ connected: status }); - }); diff --git a/idea/test-balance/src/main.ts b/idea/test-balance/src/main.ts deleted file mode 100644 index 71b6f88f27..0000000000 --- a/idea/test-balance/src/main.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { logger } from '@gear-js/common'; -import express from 'express'; - -import config from './config'; -import { changeStatus, healthcheckRouter } from './healthcheck.router'; -import { connectToDB } from './database'; -import { GearService, RMQService, TransferService } from './services'; - -const app = express(); - -const port = config.healthcheck.port; - -app.use('/health', healthcheckRouter); - -const startApp = async () => { - app.listen(port, () => { - logger.info(`Healthckech server is running on port ${port}`); - }); - - await connectToDB(); - changeStatus('database'); - - const gearService = new GearService(); - await gearService.init(); - - const transferService = new TransferService(gearService); - - const rmqService = new RMQService(transferService, gearService); - await rmqService.init(); - - changeStatus('rabbitMQ'); -}; - -startApp(); diff --git a/idea/test-balance/src/services/gear.ts b/idea/test-balance/src/services/gear.ts deleted file mode 100644 index f90267e677..0000000000 --- a/idea/test-balance/src/services/gear.ts +++ /dev/null @@ -1,170 +0,0 @@ -import { KeyringPair } from '@polkadot/keyring/types'; -import { BN } from '@polkadot/util'; -import { logger } from '@gear-js/common'; -import { GearApi, TransferData } from '@gear-js/api'; -import { randomUUID } from 'node:crypto'; -import { CronJob } from 'cron'; - -import { createAccount } from '../utils'; -import config from '../config'; -import { changeStatus } from '../healthcheck.router'; - -const MAX_RECONNECTIONS = 10; -let reconnectionsCounter = 0; - -interface TBRequestParams { - addr: string; - correlationId: string; - cb: (error: string, result: string) => void; -} - -enum TransferEvent { - TRANSFER = 'Transfer', - EXTRINSIC_SUCCESS = 'ExtrinsicSuccess', - EXTRINSIC_FAILED = 'ExtrinsicFailed', -} - -export class GearService { - private account: KeyringPair; - private balanceToTransfer: BN; - private api: GearApi; - private genesis: string; - private providerAddress: string; - private queue: Array; - - constructor() { - this.providerAddress = config.gear.providerAddresses[0]; - this.queue = []; - } - - async init() { - this.account = await createAccount(config.gear.accountSeed); - this.balanceToTransfer = new BN(config.gear.balanceToTransfer); - await this.connect(); - this.processQueue(); - } - - get genesisHash() { - return this.genesis; - } - - async connect() { - if (!this.providerAddress) { - logger.error('There are no node addresses to connect to'); - process.exit(1); - } - - this.api = new GearApi({ providerAddress: this.providerAddress }); - - try { - await this.api.isReadyOrError; - } catch (error) { - logger.error(`Failed to connect to ${this.providerAddress}`, { error: error.message }); - await this.reconnect(); - } - await this.api.isReady; - this.api.on('disconnected', () => { - logger.error(`Disconnected from ${this.providerAddress}`); - this.reconnect(); - }); - this.genesis = this.api.genesisHash.toHex(); - logger.info(`Connected to ${await this.api.chain()} with genesis ${this.genesis}`); - changeStatus('ws'); - } - - async reconnect(): Promise { - this.genesis = null; - if (this.api) { - await this.api.disconnect(); - this.api = null; - } - - reconnectionsCounter++; - if (reconnectionsCounter > MAX_RECONNECTIONS) { - this.providerAddress = config.gear.providerAddresses.filter((address) => address !== this.providerAddress)[0]; - reconnectionsCounter = 0; - } - - logger.info('Attempting to reconnect'); - changeStatus('ws'); - return this.connect(); - } - - async sendBatch(addresses: string[]): Promise<[string[], string]> { - const txs = addresses.map((address) => this.api.tx.balances.transferKeepAlive(address, this.balanceToTransfer)); - const batch = this.api.tx.utility.forceBatch(txs); - const transferred = []; - let blockHash: string; - - const correlationId = randomUUID({}); - - logger.info(`Sending batch with ${addresses.length} transfers`, { addresses, correlationId }); - - try { - await new Promise((resolve, reject) => - batch - .signAndSend(this.account, ({ events, status }) => { - if (!status.isInBlock) { - return; - } - - blockHash = status.asInBlock.toHex(); - - for (const { event } of events) { - switch (event.method) { - case TransferEvent.TRANSFER: - transferred.push((event.data as TransferData).to.toHex()); - break; - case TransferEvent.EXTRINSIC_SUCCESS: - resolve(null); - break; - case TransferEvent.EXTRINSIC_FAILED: - reject({ blockHash, correlationId, error: this.api.getExtrinsicFailedError(event).docs }); - break; - } - } - }) - .catch((error) => { - reject({ error: error.message, correlationId }); - }), - ); - logger.info(`Batch success`, { blockHash, correlationId }); - } catch (err) { - logger.error(`Batch error`, { ...err }); - } - - return [transferred, blockHash]; - } - - requestBalance(addr: string, correlationId: string, cb: (error: string, result: string) => void) { - this.queue.push({ addr, correlationId, cb }); - } - - async processQueue() { - new CronJob( - '*/3 * * * * *', - async () => { - if (this.queue.length === 0) { - return; - } - const requests = this.queue; - logger.info('Processing queue', { q: this.queue.map(({ addr }) => addr) }); - this.queue = []; - - const [transferred, blockHash] = await this.sendBatch(requests.map((req) => req.addr)); - - requests.forEach((req) => { - if (transferred.includes(req.addr)) { - logger.info(`Balance transferred to ${req.addr}`, { blockHash, correlationId: req.correlationId }); - req.cb(null, this.balanceToTransfer.toString()); - } else { - logger.error(`Transfer balance to ${req.addr} failed`, { blockHash, correlationId: req.correlationId }); - req.cb(`Transfer balance to ${req.addr} failed`, null); - } - }); - }, - null, - true, - ); - } -} diff --git a/idea/test-balance/src/services/index.ts b/idea/test-balance/src/services/index.ts deleted file mode 100644 index 1a01013ae8..0000000000 --- a/idea/test-balance/src/services/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { GearService } from './gear'; -export { RMQService } from './rmq'; -export { TransferService } from './transfer'; diff --git a/idea/test-balance/src/services/rmq.ts b/idea/test-balance/src/services/rmq.ts deleted file mode 100644 index da43acba91..0000000000 --- a/idea/test-balance/src/services/rmq.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { logger, RMQExchange, RMQQueue, RMQServiceAction, RMQServices, TEST_BALANCE_METHODS } from '@gear-js/common'; -import { Channel, connect, Connection } from 'amqplib'; -import { randomUUID } from 'node:crypto'; - -import config from '../config'; -import { TransferService } from './transfer'; -import { GearService } from './gear'; - -export class RMQService { - private connection: Connection; - private mainChannel: Channel; - - constructor(private transferService: TransferService, private gearService: GearService) {} - - async init() { - try { - this.connection = await connect(config.rabbitmq.url); - } catch (error) { - logger.error('RabbitMQ connection error', { error: error.message, stack: error.stack }); - process.exit(1); - } - - this.connection.on('close', (error) => { - logger.error('RabbitMQ connection closed', { error: error.message, stack: error.stack }); - process.exit(1); - }); - - this.mainChannel = await this.connection.createChannel(); - - const genesis = this.gearService.genesisHash; - - const routingKey = `${RMQServices.TEST_BALANCE}.${genesis}`; - - await this.mainChannel.assertExchange(RMQExchange.DIRECT_EX, 'direct'); - await this.mainChannel.assertExchange(RMQExchange.GENESISES, 'fanout'); - - await this.mainChannel.assertQueue(routingKey, { - durable: false, - autoDelete: false, - exclusive: false, - }); - await this.mainChannel.bindQueue(routingKey, RMQExchange.DIRECT_EX, routingKey); - - await this.directMessageConsumer(routingKey); - await this.genesisesQSetup(); - - this.sendGenesis(this.gearService.genesisHash); - } - - async directMessageConsumer(queue: string): Promise { - try { - await this.mainChannel.consume( - queue, - async ({ content, properties: { headers, correlationId } }) => { - const payload = JSON.parse(content.toString()); - const method = headers.method; - - if (method === TEST_BALANCE_METHODS.TEST_BALANCE_GET && payload.genesis === this.gearService.genesisHash) { - logger.info('New balance request', { addr: payload.address, correlationId }); - const result = await this.transferService.transferBalance(payload, correlationId); - this.sendReply(correlationId, result); - } - }, - { noAck: true }, - ); - } catch (error) { - logger.error(`Direct exchange consumer error`, { error }); - } - } - - private async genesisesQSetup(): Promise { - const qName = RMQQueue.GENESISES_REQUEST; - - await this.mainChannel.assertQueue('', { - exclusive: true, - autoDelete: true, - }); - - await this.mainChannel.bindQueue('', RMQExchange.GENESISES, ''); - - try { - await this.mainChannel.consume( - '', - async (message) => { - if (!message) { - return; - } - - logger.info('Genesis request'); - if (this.gearService.genesisHash !== null) { - this.sendGenesis(this.gearService.genesisHash); - } - }, - { noAck: true }, - ); - } catch (error) { - logger.error('Topic exchange consumer error.', { error }); - } - } - - sendGenesis(genesis: string): void { - const correlationId = randomUUID(); - const messageBuff = JSON.stringify({ service: RMQServices.TEST_BALANCE, action: RMQServiceAction.ADD, genesis }); - logger.info('Send genesis', { genesis, correlationId }); - this.mainChannel.publish(RMQExchange.DIRECT_EX, RMQQueue.GENESIS, Buffer.from(messageBuff), { - headers: { correlationId }, - }); - } - - sendDeleteGenesis(genesis: string): void { - const messageBuff = JSON.stringify({ service: RMQServices.TEST_BALANCE, action: RMQServiceAction.DELETE, genesis }); - this.mainChannel.publish(RMQExchange.DIRECT_EX, RMQQueue.GENESIS, Buffer.from(messageBuff)); - } - - sendReply(correlationId: string, params: any): void { - const messageBuff = JSON.stringify(params); - this.mainChannel.publish(RMQExchange.DIRECT_EX, RMQQueue.REPLIES, Buffer.from(messageBuff), { - correlationId, - }); - } -} diff --git a/idea/test-balance/src/services/transfer.ts b/idea/test-balance/src/services/transfer.ts deleted file mode 100644 index 8753e75390..0000000000 --- a/idea/test-balance/src/services/transfer.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { JSONRPC_ERRORS, logger } from '@gear-js/common'; -import { Repository } from 'typeorm'; - -import { AppDataSource, TransferBalance } from '../database'; -import { validateAddress } from '../utils'; -import { GearService } from './gear'; - -type ResponseTransferBalance = { result: { status: string; transferredBalance: string } } | { error: string }; - -export class TransferService { - private repo: Repository; - - constructor(private gearService: GearService) { - this.repo = AppDataSource.getRepository(TransferBalance); - } - - async setTransferDate(account: string, genesis: string): Promise { - const record = new TransferBalance({ - account: `${account}.${genesis}`, - lastTransfer: new Date(), - }); - - return this.repo.save(record); - } - - async isPossibleToTransfer(account: string, genesis: string): Promise { - const transfer = await this.repo.findOneBy({ account: `${account}.${genesis}` }); - - if (!transfer) { - return true; - } - - return isLastTransferEarlierThanToday(transfer); - } - - async transferBalance( - { address, genesis }: { address: string; genesis: string }, - correlationId: string, - ): Promise { - let addr: string; - try { - addr = validateAddress(address); - } catch (err) { - logger.error('Invalid address', { address, correlationId }); - return { error: JSONRPC_ERRORS.InvalidAddress.name }; - } - - const isAllowed = await this.isPossibleToTransfer(addr, genesis); - - if (!isAllowed) { - logger.info(`Transfer limit reached`, { addr, correlationId }); - return { error: JSONRPC_ERRORS.TransferLimitReached.name }; - } - - try { - const result = await new Promise((resolve, reject) => - this.gearService.requestBalance(addr, correlationId, (error, result) => { - if (error) { - reject(error); - } else { - resolve(result); - } - }), - ); - await this.setTransferDate(addr, this.gearService.genesisHash); - return { result: { status: 'ok', transferredBalance: result } }; - } catch (error) { - return { error: JSONRPC_ERRORS.InternalError.name }; - } - } -} - -function isLastTransferEarlierThanToday(transfer: TransferBalance): boolean { - const now = new Date().setHours(0, 0, 0, 0); - - return transfer.lastTransfer.setHours(0, 0, 0, 0) < now; -} diff --git a/idea/test-balance/src/utils/create-account.ts b/idea/test-balance/src/utils/create-account.ts deleted file mode 100644 index ce74d6f783..0000000000 --- a/idea/test-balance/src/utils/create-account.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { GearKeyring } from '@gear-js/api'; -import { KeyringPair } from '@polkadot/keyring/types'; - -export function createAccount(seed: string): Promise { - if (seed.startsWith('//')) { - return GearKeyring.fromSuri(seed); - } - if (seed.startsWith('0x')) { - return GearKeyring.fromSeed(seed); - } - - return GearKeyring.fromMnemonic(seed); -} diff --git a/idea/test-balance/src/utils/index.ts b/idea/test-balance/src/utils/index.ts deleted file mode 100644 index ce4e34224e..0000000000 --- a/idea/test-balance/src/utils/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { createAccount } from './create-account'; -export { validateAddress } from './validate-address'; diff --git a/idea/test-balance/src/utils/validate-address.ts b/idea/test-balance/src/utils/validate-address.ts deleted file mode 100644 index 6c13f2e591..0000000000 --- a/idea/test-balance/src/utils/validate-address.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { decodeAddress } from '@polkadot/util-crypto'; -import { u8aToHex } from '@polkadot/util'; - -export function validateAddress(address: string) { - try { - const u8aAddr = decodeAddress(address); - if (u8aAddr.length !== 32) { - throw new Error('Invalid address'); - } - return u8aToHex(u8aAddr); - } catch (err) { - throw new Error('Invalid address'); - } -} diff --git a/idea/test-balance/tsconfig.json b/idea/test-balance/tsconfig.json deleted file mode 100644 index 759fb69bef..0000000000 --- a/idea/test-balance/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "./dist", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "allowSyntheticDefaultImports": true, - "strict": false - } -} diff --git a/idea/tests/.gitignore b/idea/tests/.gitignore deleted file mode 100644 index 74863850ce..0000000000 --- a/idea/tests/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -./wasm/ -.env -dist/ -.yarn/ -wasm-test/* -!wasm-test/app.opt.wasm -genesis - -target/ diff --git a/idea/tests/Makefile b/idea/tests/Makefile deleted file mode 100644 index f1e449772b..0000000000 --- a/idea/tests/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -API_PATH := ../../api -TEST_PROGRAM_TARGET_PATH := ../../api/programs/target/wasm32-unknown-unknown/release -TEST_META_TXT_PATH := ../../api/programs/test-meta/test_meta.meta.txt -MOVE_PROGRAM_PATH := ./wasm-test - -build_programs: - @echo "Build programs" - @cd $(API_PATH) && make all - -cp_build: - @echo "Copy built files" - @cp $(TEST_PROGRAM_TARGET_PATH)/test_meta.opt.wasm $(MOVE_PROGRAM_PATH) - @cp $(TEST_PROGRAM_TARGET_PATH)/test_meta_state_v1.meta.wasm $(MOVE_PROGRAM_PATH) - @cp $(TEST_PROGRAM_TARGET_PATH)/test_meta_state_v2.meta.wasm $(MOVE_PROGRAM_PATH) - @cp $(TEST_META_TXT_PATH) $(MOVE_PROGRAM_PATH) - -run_test: - @echo "Run test" - @yarn build && yarn test - @cd wasm-test && rm -rf meta.txt test_meta.opt.wasm test_meta_state_v1.meta.wasm test_meta_state_v2.meta.wasm - - -test: build_programs cp_build run_test diff --git a/idea/tests/README.md b/idea/tests/README.md deleted file mode 100644 index 3befae324a..0000000000 --- a/idea/tests/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# tests - -## Set up environments variables - -| name | description | -| :----------- | :------------------------------- | -| DB_HOST | database hostname | -| DB_PORT | database port | -| DB_USERNAME | database username | -| DB_PASSWORD | database password | -| DB_NAME | database name | -| API_ENDPOINT | address of api-gateway endpoint | -| WS_PROVIDER | address of the running gear node | - -## Run tests - -1. `yarn install` -2. `yarn test` diff --git a/idea/tests/babel.config.json b/idea/tests/babel.config.json deleted file mode 100644 index bfd21198b7..0000000000 --- a/idea/tests/babel.config.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "node": true - } - } - ], - "jest", - "@babel/preset-typescript" - ] -} diff --git a/idea/tests/e2e/config.ts b/idea/tests/e2e/config.ts deleted file mode 100644 index 40c0c0af60..0000000000 --- a/idea/tests/e2e/config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import assert from 'assert'; -import { config } from 'dotenv'; -config(); - -function checkEnv(name: string): string { - const env = process.env[name]; - assert.notStrictEqual(env, undefined, `${name} is not specified`); - return env as string; -} - -export default { - gear: { - wsProvider: checkEnv('WS_PROVIDER'), - api: checkEnv('API_ENDPOINT'), - }, -}; - -export const PATH_TO_PROGRAMS = './wasm-test'; diff --git a/idea/tests/e2e/indexer.test.ts b/idea/tests/e2e/indexer.test.ts deleted file mode 100644 index 5dfb1881fb..0000000000 --- a/idea/tests/e2e/indexer.test.ts +++ /dev/null @@ -1,847 +0,0 @@ -import { KeyringPair } from '@polkadot/keyring/types'; -import { GearApi, MessageQueued, ProgramMetadata, decodeAddress, generateCodeHash } from '@gear-js/api'; -import { HexString } from '@polkadot/util/types'; -import { waitReady } from '@polkadot/wasm-crypto'; -import { API_GATEWAY_METHODS, INDEXER_METHODS } from '@gear-js/common'; -import * as path from 'node:path'; -import * as fs from 'fs'; - -import base, { PATH_TO_PROGRAMS } from './config'; -import { getAccounts, sleep } from './utils'; -import { jsonrpcRequest } from './request'; - -function hasAllProps(obj: any, props: string[]) { - for (const p of props) { - expect(obj).toHaveProperty(p); - } - expect(Object.keys(obj)).toHaveLength(props.length); -} - -let genesis: HexString; -let api: GearApi; -let alice: KeyringPair; -let bob: KeyringPair; -let testMetaId: HexString; -let waitlistCodeId: HexString; -let metaCodeId: HexString; -let msgForReply: HexString; - -const programs: { programId: string; codeId: string; metahash?: string; hasState: boolean; status: string }[] = []; -const codes: { codeId: string; metahash: string; hasState: boolean; status: string }[] = []; -const sentMessages: { - id: string; - source: string; - destination: string; - payload: string; - entry: string; - value: string; -}[] = []; -const receivedMessages: { - id: string; - source: string; - destination: string; - payload: string; - value: string; - replyToMessageId: string; - expiration: number; -}[] = []; - -const metaHex = fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'test_meta.meta.txt'), 'utf-8'); -const testMetaMeta = ProgramMetadata.from(metaHex); - -beforeAll(async () => { - try { - api = await GearApi.create({ providerAddress: base.gear.wsProvider, throwOnConnect: true }); - } catch (error) { - console.log(error); - process.exit(0); - } - - genesis = api.genesisHash.toHex(); - fs.writeFileSync('./genesis', genesis, 'utf-8'); - await waitReady(); - const accounts = getAccounts(); - alice = accounts.alice; - bob = accounts.bob; - - listenToEvents(); -}); - -afterAll(async () => { - await api.disconnect(); - await sleep(); -}); - -async function listenToEvents() { - api.gearEvents.subscribeToGearEvent( - 'UserMessageSent', - async ({ - data: { - message: { id, source, destination, details, payload, value }, - expiration, - }, - }) => { - if (payload.toHex() === '0x147265706c79') { - msgForReply = id.toHex(); - } - receivedMessages.push({ - id: id.toHex(), - source: source.toHex(), - destination: destination.toHex(), - payload: payload.toHex(), - value: value.toString(), - replyToMessageId: details.isSome ? details.unwrap().to.toHex() : null, - expiration: expiration.isSome ? expiration.unwrap().toNumber() : null, - }); - }, - ); - - api.gearEvents.subscribeToGearEvent('UserMessageRead', ({ data: { reason, id } }) => { - const msg = receivedMessages.find((msg) => msg.id === id.toHex()); - if (msg) { - msg['readReason'] = reason.isSystem ? 'OutOfRent' : reason.asRuntime.isMessageClaimed ? 'Claimed' : 'Replied'; - } - }); -} - -const finalizationPromises = []; - -describe('prepare', () => { - test('upload test_meta', async () => { - const code = fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'test_meta.opt.wasm')); - - const metahash = await api.code.metaHashFromWasm(code); - const payload = testMetaMeta.createType(testMetaMeta.types.init.input!, [1, 2, 3]).toHex(); - - const { programId, codeId } = api.program.upload({ code, initPayload: payload, gasLimit: 200_000_000_000 }); - metaCodeId = codeId; - testMetaId = programId; - programs.push({ programId, codeId, metahash, hasState: true, status: 'active' }); - codes.push({ codeId, metahash, hasState: true, status: 'active' }); - const [mqid, mqsource, mqdestination]: [string, string, string] = await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - api.program.signAndSend(alice, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - events.forEach(({ event }) => { - if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } else if (event.method === 'MessageQueued') { - const { - data: { id, source, destination }, - } = event as MessageQueued; - resolve([id.toHex(), source.toHex(), destination.toHex()]); - } - }); - }); - }), - ); - }); - - sentMessages.push({ id: mqid, source: mqsource, destination: mqdestination, entry: 'init', payload, value: '0' }); - }); - - test('upload code test_waitlist', async () => { - const code = fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'test_waitlist.opt.wasm')); - const { codeHash } = await api.code.upload(code); - waitlistCodeId = codeHash; - codes.push({ codeId: codeHash, metahash: null, hasState: false, status: 'active' }); - - await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - api.code.signAndSend(alice, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - if (status.isInBlock) { - events.forEach(({ event }) => { - if (event.method === 'CodeChanged') { - resolve(0); - } else if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } - }); - } - }); - }), - ); - }); - }); - - test('upload codes in batch', async () => { - const code = fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'app.opt.wasm')); - const fakeCode = await api.code.upload(Buffer.from('0x12')); - const appCode = await api.code.upload(code); - const txs = [fakeCode.submitted, appCode.submitted]; - codes.push({ - codeId: generateCodeHash(code), - hasState: true, - metahash: await api.code.metaHashFromWasm(code), - status: 'active', - }); - - await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - api.tx.utility.forceBatch(txs).signAndSend(alice, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - if (status.isInBlock) { - events.forEach(({ event }) => { - if (event.method === 'ExtrinsicSuccess') { - resolve(0); - } else if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } - }); - } - }); - }), - ); - }); - }); - - test('upload test_waitlist', async () => { - const code = fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'test_waitlist.opt.wasm')); - const { programId, codeId } = api.program.upload({ code, gasLimit: 200_000_000_000 }); - programs.push({ programId, codeId, metahash: null, hasState: false, status: 'active' }); - const [mqid, mqsource, mqdestination]: [string, string, string] = await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - api.program.signAndSend(alice, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - if (status.isInBlock) { - events.forEach(({ event }) => { - if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } else if (event.method === 'MessageQueued') { - const { - data: { id, source, destination }, - } = event as MessageQueued; - resolve([id.toHex(), source.toHex(), destination.toHex()]); - } - }); - } - }); - }), - ); - }); - - sentMessages.push({ - id: mqid, - source: mqsource, - destination: mqdestination, - entry: 'init', - payload: '0x', - value: '0', - }); - }); - - test('create program test_waitlist', async () => { - const { programId } = api.program.create({ codeId: waitlistCodeId, gasLimit: 2_000_000_000 }); - programs.push({ programId, codeId: waitlistCodeId, metahash: null, hasState: false, status: 'active' }); - const [mqid, mqsource, mqdestination]: [string, string, string] = await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - api.program.signAndSend(alice, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - if (status.isInBlock) { - events.forEach(({ event }) => { - if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } else if (event.method === 'MessageQueued') { - const { - data: { id, source, destination }, - } = event as MessageQueued; - resolve([id.toHex(), source.toHex(), destination.toHex()]); - } - }); - } - }); - }), - ); - }); - - sentMessages.push({ - id: mqid, - source: mqsource, - destination: mqdestination, - entry: 'init', - payload: '0x', - value: '0', - }); - }); - - test('upload and create program in batch', async () => { - const txs = []; - const meta = ProgramMetadata.from(fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'test_gas.meta.txt'), 'utf-8')); - const payloads = [ - meta.createType(meta.types.init.input, { input: 'Init' }).toHex(), - testMetaMeta.createType(testMetaMeta.types.init.input, [1, 2, 3]).toHex(), - ]; - const code = fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'test_gas.opt.wasm')); - const gasProgram = api.program.upload({ code, initPayload: payloads[0], gasLimit: 2_000_000_000 }, meta); - txs.push(gasProgram.extrinsic); - const metahash = await api.code.metaHashFromWasm(code); - programs.push({ - programId: gasProgram.programId, - status: 'active', - metahash, - hasState: false, - codeId: gasProgram.codeId, - }); - codes.push({ codeId: generateCodeHash(code), metahash, hasState: false, status: 'active' }); - const metaProgram = api.program.create( - { codeId: metaCodeId, initPayload: payloads[1], gasLimit: 2_000_000_000 }, - testMetaMeta, - ); - programs.push({ - programId: metaProgram.programId, - status: 'active', - metahash: await api.code.metaHash(metaCodeId), - hasState: true, - codeId: metaCodeId, - }); - txs.push(metaProgram.extrinsic); - - const tx = api.tx.utility.batchAll(txs); - - let index = -1; - - await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - tx.signAndSend(alice, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - if (status.isInBlock) { - events.forEach(({ event }) => { - if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } else if (event.method === 'MessageQueued') { - index++; - const { - data: { id, source, destination }, - } = event as MessageQueued; - sentMessages.push({ - id: id.toHex(), - source: source.toHex(), - destination: destination.toHex(), - entry: 'init', - payload: payloads[index], - value: '0', - }); - } else if (event.method === 'ExtrinsicSuccess') { - resolve(0); - } - }); - } - }); - }), - ); - }); - - expect(index).toBe(1); - }); - - test('send message to test_meta', async () => { - const payload = testMetaMeta.createType(testMetaMeta.types.handle.input, { One: 'Alice' }).toHex(); - const tx = await api.message.send( - { destination: testMetaId, gasLimit: 200_000_000_000, payload, value: 10_000_000_000_000 }, - testMetaMeta, - ); - - await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - tx.signAndSend(alice, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - if (status.isInBlock) { - events.forEach(({ event }) => { - if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } else if (event.method === 'MessageQueued') { - const { - data: { id, source, destination }, - } = event as MessageQueued; - sentMessages.push({ - id: id.toHex(), - source: source.toHex(), - destination: destination.toHex(), - entry: 'handle', - payload, - value: '10000000000000', - }); - resolve(0); - } - }); - } - }); - }), - ); - }); - }); - - test('send batch of messages to test_meta', async () => { - const txs = []; - const payloads = [ - testMetaMeta.createType(testMetaMeta.types.handle.input, { Two: [[8, 16]] }).toHex(), - testMetaMeta - .createType(testMetaMeta.types.handle.input, { - Four: { array8: new Array(8).fill(0), array32: new Array(32).fill(1), actor: decodeAddress(alice.address) }, - }) - .toHex(), - ]; - - txs.push(api.message.send({ destination: testMetaId, payload: payloads[0], gasLimit: 200_000_000_000 })); - txs.push(api.message.send({ destination: testMetaId, payload: payloads[1], gasLimit: 200_000_000_000 })); - - const tx = api.tx.utility.batch(txs); - - let index = -1; - - await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - tx.signAndSend(alice, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - if (status.isInBlock) { - events.forEach(({ event }) => { - if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } else if (event.method === 'MessageQueued') { - index++; - const { - data: { id, source, destination }, - } = event as MessageQueued; - sentMessages.push({ - id: id.toHex(), - source: source.toHex(), - destination: destination.toHex(), - entry: 'handle', - payload: payloads[index], - value: '0', - }); - } else if (event.method === 'ExtrinsicSuccess') { - resolve(0); - } - }); - } - }); - }), - ); - }); - - expect(index).toBe(1); - }); - - test('send reply', async () => { - const payload = testMetaMeta.createType(testMetaMeta.types.reply, 'ok').toHex(); - const tx = await api.message.sendReply({ replyToId: msgForReply, payload, gasLimit: 2_000_000_000 }); - - await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - tx.signAndSend(alice, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - if (status.isInBlock) { - events.forEach(({ event }) => { - if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } else if (event.method === 'MessageQueued') { - const { - data: { id, source, destination }, - } = event as MessageQueued; - sentMessages.push({ - id: id.toHex(), - source: source.toHex(), - destination: destination.toHex(), - entry: 'reply', - payload, - value: '0', - }); - resolve(0); - } - }); - } - }); - }), - ); - }); - }); - - test('send message with voucher', async () => { - const { voucherId, extrinsic } = await api.voucher.issue( - decodeAddress(bob.address), - 30 * 1e12, - 600, - [testMetaId], - false, - ); - - await new Promise((resolve, reject) => - extrinsic.signAndSend(alice, ({ events, status }) => { - if (status.isInBlock) { - if (events.find(({ event: { method } }) => method === 'ExtrinsicSuccess')) { - resolve(0); - } else { - reject('Extrinsic failed'); - } - } - }), - ); - - const payload = testMetaMeta.createType(testMetaMeta.types.handle.input, { Two: [[8, 16]] }).toHex(); - - const msg = api.message.send({ - destination: testMetaId, - gasLimit: 200_000_000_000, - payload, - value: 0, - }); - - const call = api.voucher.call(voucherId, { SendMessage: msg }); - await new Promise((resolve, reject) => { - finalizationPromises.push( - new Promise((finResolve) => { - call.signAndSend(bob, ({ events, status }) => { - if (status.isFinalized) { - finResolve(0); - } - if (status.isInBlock) { - events.forEach(({ event }) => { - if (event.method === 'ExtrinsicFailed') { - reject(new Error(api.getExtrinsicFailedError(event).docs)); - } else if (event.method === 'MessageQueued') { - const { - data: { id, source, destination }, - } = event as MessageQueued; - sentMessages.push({ - id: id.toHex(), - source: source.toHex(), - destination: destination.toHex(), - entry: 'handle', - payload, - value: '0', - }); - } else if (event.method === 'ExtrinsicSuccess') { - resolve(0); - } - }); - } - }); - }), - ); - }); - }); - - test('wait for finalization', async () => { - await Promise.all(finalizationPromises); - await new Promise((resolve) => { - setTimeout(resolve, 3000); - }); - }); -}); - -describe('common methods', () => { - test(API_GATEWAY_METHODS.NETWORK_DATA_AVAILABLE, async () => { - const response = await jsonrpcRequest('networkData.available', { - genesis, - }); - - expect(response).toHaveProperty('result', true); - }); - - test(INDEXER_METHODS.BLOCKS_STATUS, async () => { - const response = await jsonrpcRequest('blocks.status', { genesis }); - - expect(response).toHaveProperty('result'); - expect(response.result).toHaveProperty('number'); - expect(response.result).toHaveProperty('hash'); - expect(response.result).toHaveProperty('timestamp'); - expect(response.result).toHaveProperty('genesis'); - }); -}); - -describe('program methods', () => { - test(INDEXER_METHODS.PROGRAM_ALL, async () => { - const response = await jsonrpcRequest('program.all', { genesis }); - expect(response).toHaveProperty('result.count', programs.length); - for (const p of programs) { - const receivedProgram = response.result.programs.find(({ id }) => id === p.programId); - expect(receivedProgram).toBeDefined(); - expect(receivedProgram.codeId).toEqual(p.codeId); - expect(receivedProgram.metahash).toEqual(p.metahash); - } - }); - - test(INDEXER_METHODS.PROGRAM_ALL + ' by owner', async () => { - const response = await jsonrpcRequest('program.all', { genesis, owner: decodeAddress(alice.address) }); - expect(response).toHaveProperty('result.count', programs.length); - expect(response.result.programs).toHaveLength(programs.length); - }); - - test(INDEXER_METHODS.PROGRAM_ALL + ' by status', async () => { - const response = await jsonrpcRequest('program.all', { genesis, status: 'active' }); - // TODO: check terminated status - expect(response).toHaveProperty('result.count', programs.length); - expect(response.result.programs).toHaveLength(programs.length); - }); - - test(INDEXER_METHODS.PROGRAM_ALL + ' by dates', async () => { - const toDate = new Date(); - const fromDate = new Date(toDate); - fromDate.setMinutes(fromDate.getMinutes() - 5); - - const response = await jsonrpcRequest('program.all', { genesis, fromDate, toDate }); - expect(response).toHaveProperty('result.count', programs.length); - expect(response.result.programs).toHaveLength(programs.length); - }); - - test(INDEXER_METHODS.PROGRAM_ALL + ' with query', async () => { - const response = await jsonrpcRequest('program.all', { genesis, query: programs[0].programId.substring(3, 17) }); - expect(response).toHaveProperty('result.count', 1); - expect(response.result.programs).toHaveLength(1); - expect(response.result.programs[0].id).toEqual(programs[0].programId); - }); - - test(INDEXER_METHODS.PROGRAM_ALL + ' with pagination', async () => { - const response = await jsonrpcRequest('program.all', { genesis, limit: 1 }); - expect(response).toHaveProperty('result.count', programs.length); - expect(response.result.programs).toHaveLength(1); - }); - - test(INDEXER_METHODS.PROGRAM_DATA, async () => { - for (const p of programs) { - const response = await jsonrpcRequest('program.data', { genesis, id: p.programId }); - - expect(response).toHaveProperty('result'); - - hasAllProps(response.result, [ - 'id', - '_id', - 'blockHash', - 'genesis', - 'owner', - 'name', - 'timestamp', - 'metahash', - 'status', - 'codeId', - 'hasState', - 'expiration', - ]); - // expect(response.result.hasState).toBe(p.hasState); TODO: check after meta is uploaded - expect(response.result.status).toBe(p.status); - expect(response.result.metahash).toBe(p.metahash); - expect(response.result.codeId).toBe(p.codeId); - } - }); - test.todo(INDEXER_METHODS.PROGRAM_NAME_ADD); -}); - -describe('code methods', () => { - test(INDEXER_METHODS.CODE_ALL, async () => { - const response = await jsonrpcRequest('code.all', { genesis }); - expect(response).toHaveProperty('result'); - hasAllProps(response.result, ['listCode', 'count']); - expect(response.result.count).toBe(codes.length); - for (const c of codes) { - const code = response.result.listCode.find(({ id }) => id === c.codeId); - expect(code).toBeDefined; - expect(code.metahash).toEqual(c.metahash); - } - }); - - test(INDEXER_METHODS.CODE_ALL + ' by dates', async () => { - const fromDate = new Date(); - fromDate.setMinutes(fromDate.getMinutes() - 3); - const toDate = new Date(); - const response = await jsonrpcRequest('code.all', { genesis, fromDate, toDate }); - expect(response).toHaveProperty('result'); - expect(response.result.count).toBe(codes.length); - }); - - test(INDEXER_METHODS.CODE_DATA, async () => { - for (const c of codes) { - const response = await jsonrpcRequest('code.data', { genesis, id: c.codeId }); - expect(response).toHaveProperty('result'); - hasAllProps(response.result, [ - 'id', - '_id', - 'uploadedBy', - 'name', - 'status', - 'expiration', - 'genesis', - 'blockHash', - 'timestamp', - 'metahash', - 'hasState', - ]); - expect(response.result.metahash).toBe(c.metahash); - expect(response.result.id).toBe(c.codeId); - } - }); - - test.todo(INDEXER_METHODS.CODE_NAME_ADD); -}); - -describe('message methods', () => { - test(INDEXER_METHODS.MESSAGE_ALL, async () => { - const response = await jsonrpcRequest('message.all', { genesis, limit: 21 }); - expect(response).toHaveProperty('result.count', sentMessages.length + receivedMessages.length); - hasAllProps(response.result, ['messages', 'count']); - expect(response.result.messages).toHaveLength(sentMessages.length + receivedMessages.length); - }); - - test(INDEXER_METHODS.MESSAGE_ALL + ' by dates', async () => { - const fromDate = new Date(); - fromDate.setMinutes(fromDate.getMinutes() - 3); - const toDate = new Date(); - const response = await jsonrpcRequest('message.all', { genesis, fromDate, toDate, limit: 21 }); - expect(response).toHaveProperty('result.count', sentMessages.length + receivedMessages.length); - hasAllProps(response.result, ['messages', 'count']); - expect(response.result.messages).toHaveLength(sentMessages.length + receivedMessages.length); - }); - - test(INDEXER_METHODS.MESSAGE_ALL + ' by program', async () => { - const response = await jsonrpcRequest('message.all', { - genesis, - source: testMetaId, - destination: testMetaId, - withPrograms: true, - }); - expect(response).toHaveProperty('result.count', 13); - expect(response).toHaveProperty('result.messages'); - hasAllProps(response.result, ['messages', 'count', 'programNames']); - expect(response.result.messages).toHaveLength(13); - expect(response.result.programNames).toHaveProperty(testMetaId); - expect(response.result.programNames[testMetaId]).toBe(testMetaId); - }); - - test(INDEXER_METHODS.MESSAGE_DATA, async () => { - const props = [ - 'id', - 'blockHash', - 'genesis', - 'timestamp', - 'destination', - 'source', - 'payload', - 'entry', - 'expiration', - 'replyToMessageId', - 'exitCode', - 'processedWithPanic', - 'value', - 'type', - 'readReason', - ]; - - for (const m of sentMessages) { - const withMetahash = Math.random() > 0.5; - const response = await jsonrpcRequest('message.data', { genesis, id: m.id, withMetahash }); - - expect(response).toHaveProperty('result'); - const { result } = response; - - if (withMetahash) { - props.indexOf('metahash') === -1 && props.push('metahash'); - } else { - props.indexOf('metahash') !== -1 && props.splice(props.indexOf('metahash'), 1); - } - - hasAllProps(response.result, props); - - expect(result.id).toEqual(m.id); - if (result.destination !== m.destination) { - console.log(result); - console.log(m); - } - expect(result.destination).toEqual(m.destination); - expect(result.source).toEqual(m.source); - expect(result.payload).toEqual(m.payload); - expect(result.entry).toEqual(m.entry); - expect(result.value).toEqual(m.value); - } - - for (const m of receivedMessages) { - const withMetahash = Math.random() > 0.5; - const response = await jsonrpcRequest('message.data', { genesis, id: m.id, withMetahash }); - expect(response).toHaveProperty('result'); - const { result } = response; - - if (withMetahash) { - props.indexOf('metahash') === -1 && props.push('metahash'); - } else { - props.indexOf('metahash') !== -1 && props.splice(props.indexOf('metahash'), 1); - } - - hasAllProps(response.result, props); - - expect(result.id).toEqual(m.id); - expect(result.destination).toEqual(m.destination); - expect(result.source).toEqual(m.source); - expect(result.payload).toEqual(m.payload); - expect(result.value).toEqual(m.value); - expect(result.expiration).toEqual(m.expiration); - expect(result.replyToMessageId).toEqual(m.replyToMessageId); - } - }); -}); - -describe('state methods', () => { - let stateId: string; - - test(INDEXER_METHODS.PROGRAM_STATE_ADD, async () => { - const buf = fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'test_meta_state_v1.meta.wasm'), 'base64'); - const data = { - genesis, - wasmBuffBase64: buf, - programId: testMetaId, - name: 'test_meta_state_v1.meta.wasm', - }; - const response = await jsonrpcRequest('program.state.add', data); - - expect(response).toHaveProperty('result.status', 'State added'); - expect(response.result).toHaveProperty('state'); - hasAllProps(response.result.state, ['id', 'name', 'wasmBuffBase64', 'functions']); - stateId = response.result.state.id; - }); - - test(INDEXER_METHODS.PROGRAM_STATE_ALL, async () => { - const response = await jsonrpcRequest('program.state.all', { genesis, programId: testMetaId }); - expect(response).toHaveProperty('result.states'); - expect(response).toHaveProperty('result.count', 1); - - expect(response.result.states).toHaveLength(1); - }); - - test(INDEXER_METHODS.STATE_GET, async () => { - const response = await jsonrpcRequest('state.get', { genesis, id: stateId }); - - expect(response).toHaveProperty('result.functions'); - expect(response).toHaveProperty('result.funcNames'); - expect(response).toHaveProperty('result.id'); - expect(response).toHaveProperty('result.name'); - expect(response).toHaveProperty('result.wasmBuffBase64'); - }); -}); - -test.todo('errors tests'); diff --git a/idea/tests/e2e/jsonrpc-errors.test.ts b/idea/tests/e2e/jsonrpc-errors.test.ts deleted file mode 100644 index 53dc207643..0000000000 --- a/idea/tests/e2e/jsonrpc-errors.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { JSONRPC_ERRORS } from '@gear-js/common'; -import { HexString, generateCodeHash } from '@gear-js/api'; -import * as fs from 'fs'; -import * as path from 'path'; - -import { baseRequest, jsonrpcRequest } from './request'; -import { PATH_TO_PROGRAMS } from './config'; - -const genesis = fs.readFileSync('./genesis', 'utf-8'); -const hex = ('0x' + fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'test_meta.meta.txt'), 'utf-8')) as HexString; -const hash = generateCodeHash(hex).replace('2', '3'); - -describe('jsonrpc errors', () => { - test(JSONRPC_ERRORS.InvalidRequest.name, async () => { - const response = await baseRequest([]); - expect(response).toHaveProperty('error.code', -32600); - expect(response).toHaveProperty('error.message', 'Invalid request'); - - const response2 = await baseRequest([1, 2]); - expect(response2).toHaveLength(2); - expect(response2[0]).toHaveProperty('error.code', -32600); - expect(response2[0]).toHaveProperty('error.message', 'Invalid request'); - expect(response2[1]).toHaveProperty('error.code', -32600); - expect(response2[1]).toHaveProperty('error.message', 'Invalid request'); - }); - - test(JSONRPC_ERRORS.MethodNotFound.name, async () => { - const response = await jsonrpcRequest('invalid.method', { genesis }); - expect(response).toHaveProperty('error.code', -32601); - expect(response).toHaveProperty('error.message', 'Method not found'); - }); - - test(JSONRPC_ERRORS.InvalidParams.name, async () => { - const response = await jsonrpcRequest('program.data', { genesis }); - expect(response).toHaveProperty('error.code', -32602); - expect(response).toHaveProperty('error.message', 'Invalid params'); - }); - - test(JSONRPC_ERRORS.NoGenesisFound.name, async () => { - const response = await jsonrpcRequest('program.all', {}); - console.log(response); - expect(response).toHaveProperty('error.code', -32605); - expect(response).toHaveProperty('error.message', 'Genesis not found in the request'); - }); - - test(JSONRPC_ERRORS.UnknownNetwork.name, async () => { - const response = await jsonrpcRequest('program.all', { genesis: '0x1234' }); - expect(response).toHaveProperty('error.code', -32605); - expect(response).toHaveProperty('error.message', 'Unknown network'); - }); - - test(JSONRPC_ERRORS.ProgramNotFound.name, async () => { - const response = await jsonrpcRequest('program.data', { genesis, id: '0x1234' }); - expect(response).toHaveProperty('error.code', -32404); - expect(response).toHaveProperty('error.message', 'Program not found'); - }); - - test(JSONRPC_ERRORS.CodeNotFound.name, async () => { - const response = await jsonrpcRequest('code.data', { genesis, id: '0x1234' }); - expect(response).toHaveProperty('error.code', -32404); - expect(response).toHaveProperty('error.message', 'Code not found'); - }); - - test(JSONRPC_ERRORS.MessageNotFound.name, async () => { - const response = await jsonrpcRequest('message.data', { genesis, id: '0x1234' }); - expect(response).toHaveProperty('error.code', -32404); - expect(response).toHaveProperty('error.message', 'Message not found'); - }); - - test(JSONRPC_ERRORS.InvalidMetaHex.name, async () => { - const response = await jsonrpcRequest('meta.add', { hash, hex: '0x' }); - expect(response).toHaveProperty('error.code', -32602); - expect(response).toHaveProperty('error.message', 'Invalid meta hex'); - }); - - test(JSONRPC_ERRORS.MetadataNotFound.name, async () => { - const response = await jsonrpcRequest('meta.get', { hash: '0x' }); - expect(response).toHaveProperty('error.code', -32404); - expect(response).toHaveProperty('error.message', 'Metadata not found'); - }); -}); diff --git a/idea/tests/e2e/meta-storage.test.ts b/idea/tests/e2e/meta-storage.test.ts deleted file mode 100644 index c7dea01344..0000000000 --- a/idea/tests/e2e/meta-storage.test.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { META_STORAGE_METHODS } from '@gear-js/common'; -import { jsonrpcRequest } from './request'; -import * as fs from 'fs'; -import * as path from 'path'; -import { PATH_TO_PROGRAMS } from './config'; -import { generateCodeHash, HexString } from '@gear-js/api'; - -const PING_WASM_PATH = './programs/target/wasm32-unknown-unknown/release/ping.opt.wasm'; -const PING_IDL_PATH = './programs/ping-sails/wasm/ping.idl'; - -const pingCode = fs.readFileSync(PING_WASM_PATH); -const pingIdl = fs.readFileSync(PING_IDL_PATH, 'utf-8'); - -const meta: HexString = `0x${fs.readFileSync(path.join(PATH_TO_PROGRAMS, 'test_meta.meta.txt'), 'utf-8')}`; -const hash = generateCodeHash(meta); - -describe('meta-storage methods', () => { - test(META_STORAGE_METHODS.META_ADD, async () => { - const response = await jsonrpcRequest('meta.add', { hash, hex: meta }); - - expect(response).toHaveProperty('result'); - expect(response.result).toHaveProperty('hash'); - expect(response.result).toHaveProperty('hex'); - }); - - test(META_STORAGE_METHODS.META_GET, async () => { - const response = await jsonrpcRequest('meta.get', { hash }); - - expect(response).toHaveProperty('result'); - expect(response.result).toHaveProperty('hash', hash); - expect(response.result).toHaveProperty('hex', meta); - }); - - test(META_STORAGE_METHODS.SAILS_ADD, async () => { - const codehash = generateCodeHash(pingCode); - const response = await jsonrpcRequest(META_STORAGE_METHODS.SAILS_ADD, { codeId: codehash, data: pingIdl }); - - expect(response).toHaveProperty('result'); - expect(response.result).toHaveProperty('status', 'Sails idl added'); - }); - - test(META_STORAGE_METHODS.SAILS_GET, async () => { - const codehash = generateCodeHash(pingCode); - const response = await jsonrpcRequest(META_STORAGE_METHODS.SAILS_GET, { codeId: codehash }); - - expect(response).toHaveProperty('result'); - expect(response.result).toBe(pingIdl); - }); -}); diff --git a/idea/tests/e2e/request.ts b/idea/tests/e2e/request.ts deleted file mode 100644 index 5faa4e26dc..0000000000 --- a/idea/tests/e2e/request.ts +++ /dev/null @@ -1,29 +0,0 @@ -import base from './config'; - -export async function baseRequest(body: any) { - const response = await fetch(base.gear.api, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(body), - }); - return response.json(); -} - -export async function jsonrpcRequest(method: string, params: any) { - const body = { jsonrpc: '2.0', id: Math.floor(Math.random() * 100) + 1, method, params }; - - return baseRequest(body); -} - -export function batchRequest(body: { method: string; params: any }[]) { - return baseRequest( - body.map((item) => ({ - jsonrpc: '2.0', - id: Math.floor(Math.random() * 100), - method: item.method, - params: item.params, - })), - ); -} diff --git a/idea/tests/e2e/test-balance.test.ts b/idea/tests/e2e/test-balance.test.ts deleted file mode 100644 index fac40771ed..0000000000 --- a/idea/tests/e2e/test-balance.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { API_GATEWAY_METHODS, TEST_BALANCE_METHODS } from '@gear-js/common'; -import { jsonrpcRequest } from './request'; -import * as fs from 'fs'; - -const genesis = fs.readFileSync('./genesis', 'utf-8'); - -describe('test-balance methods', () => { - test(API_GATEWAY_METHODS.TEST_BALANCE_AVAILABLE, async () => { - const response = await jsonrpcRequest('testBalance.available', { - genesis, - }); - - expect(response).toHaveProperty('result', true); - }); - - test(TEST_BALANCE_METHODS.TEST_BALANCE_GET, async () => { - const response = await jsonrpcRequest('testBalance.get', { - genesis, - address: '5FyVYRtJ3z92om1JmLWYbwANWaXLHLbPbXG7rQqHRzUL2BdV', - token: 'test_token', - }); - expect(response).toHaveProperty('result'); - }); - - test(TEST_BALANCE_METHODS.TEST_BALANCE_GET + ' several reqests at a time', async () => { - const [res1, res2, res3] = await Promise.all([ - jsonrpcRequest('testBalance.get', { - genesis, - address: '5HpG9w8EBLe5XCrbczpwq5TSXvedjrBGCwqxK1iQ7qUsSWFc', - token: 'test_token', - }), - jsonrpcRequest('testBalance.get', { - genesis, - address: '5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y', - token: 'test_token', - }), - jsonrpcRequest('testBalance.get', { - genesis, - address: '5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy', - token: 'test_token', - }), - ]); - - expect(res1).toHaveProperty('result'); - expect(res2).toHaveProperty('result'); - expect(res3).toHaveProperty('result'); - }); -}); diff --git a/idea/tests/e2e/utils.ts b/idea/tests/e2e/utils.ts deleted file mode 100644 index e7a306784f..0000000000 --- a/idea/tests/e2e/utils.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Keyring } from '@polkadot/keyring'; -import { KeyringPair } from '@polkadot/keyring/types'; - -export function sleep(time = 2000) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(0); - }, time); - }); -} - -export function getAccounts(): { alice: KeyringPair; bob: KeyringPair } { - const keyring = new Keyring({ type: 'sr25519' }); - return { alice: keyring.addFromUri('//Alice'), bob: keyring.addFromUri('//Bob') }; -} diff --git a/idea/tests/jest.config.js b/idea/tests/jest.config.js deleted file mode 100644 index 1999b3a054..0000000000 --- a/idea/tests/jest.config.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * For a detailed explanation regarding each configuration property, visit: - * https://jestjs.io/docs/configuration - */ - -module.exports = { - roots: ['/e2e'], - clearMocks: true, - coverageProvider: 'v8', - transformIgnorePatterns: ['node_modules/(?!@polkadot)/'], - verbose: true, - preset: 'ts-jest/presets/js-with-babel', - testTimeout: 30_000, -}; diff --git a/idea/tests/package.json b/idea/tests/package.json deleted file mode 100644 index 74a70e31da..0000000000 --- a/idea/tests/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@gear-js/web-tests", - "scripts": { - "test": "jest --clearCache && jest --runInBand", - "build": "rm -rf build && tsc" - }, - "devDependencies": { - "@types/jest": "29.2.3", - "typescript": "4.9.3" - }, - "dependencies": { - "@babel/plugin-transform-typescript": "7.20.2", - "@babel/preset-env": "7.20.2", - "@babel/preset-typescript": "7.18.6", - "@gear-js/api": "0.39.0", - "@gear-js/common": "workspace:^", - "@polkadot/api": "14.3.1", - "babel-jest": "28.1.3", - "dotenv": "16.0.3", - "jest": "^29.1.2", - "node-fetch": "2.6.7", - "ts-jest": "29.1.1", - "ts-node": "10.9.1" - }, - "lint-staged": { - "*.ts": [ - "eslint --fix", - "git add" - ] - } -} diff --git a/idea/tests/programs/Cargo.lock b/idea/tests/programs/Cargo.lock deleted file mode 100644 index 2c013ebf4a..0000000000 --- a/idea/tests/programs/Cargo.lock +++ /dev/null @@ -1,5726 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "actor-system-error" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f8a6550b9526fc02453c364913479fe4b1bb096c9d7ac1611b62c3363cf508a" -dependencies = [ - "derive_more", -] - -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli 0.27.3", -] - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli 0.28.1", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom 0.2.15", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "getrandom 0.2.15", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - -[[package]] -name = "anyhow" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" - -[[package]] -name = "array-bytes" -version = "6.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5dde061bd34119e902bbb2d9b90c5692635cf59fb91d582c2b68043f1b8293" - -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - -[[package]] -name = "arrayvec" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -dependencies = [ - "nodrop", -] - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "async-trait" -version = "0.1.80" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "backtrace" -version = "0.3.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" -dependencies = [ - "addr2line 0.21.0", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object 0.32.2", - "rustc-demangle", -] - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "blake2-rfc" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" -dependencies = [ - "arrayvec 0.4.12", - "constant_time_eq 0.1.5", -] - -[[package]] -name = "blake2b_simd" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" -dependencies = [ - "arrayref", - "arrayvec 0.7.4", - "constant_time_eq 0.3.0", -] - -[[package]] -name = "blake3" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" -dependencies = [ - "arrayref", - "arrayvec 0.7.4", - "cc", - "cfg-if", - "constant_time_eq 0.3.0", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "bounded-collections" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca548b6163b872067dc5eb82fd130c56881435e30367d2073594a3d9744120dd" -dependencies = [ - "log", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - -[[package]] -name = "bs58" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "bytecheck" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" -dependencies = [ - "bytecheck_derive", - "ptr_meta", - "simdutf8", -] - -[[package]] -name = "bytecheck_derive" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" - -[[package]] -name = "camino" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "cargo_toml" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be" -dependencies = [ - "serde", - "toml", -] - -[[package]] -name = "cc" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" - -[[package]] -name = "cfg-expr" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" -dependencies = [ - "smallvec", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-targets 0.52.5", -] - -[[package]] -name = "colored" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" -dependencies = [ - "lazy_static", - "windows-sys 0.48.0", -] - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "const-random" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" -dependencies = [ - "const-random-macro", -] - -[[package]] -name = "const-random-macro" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" -dependencies = [ - "getrandom 0.2.15", - "once_cell", - "tiny-keccak", -] - -[[package]] -name = "const_format" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" -dependencies = [ - "const_format_proc_macros", -] - -[[package]] -name = "const_format_proc_macros" -version = "0.2.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" -dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "core-processor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236806467c5f5e08191835709e5900787a1997f1cb52187004aed6a6354bae38" -dependencies = [ - "actor-system-error", - "derive_more", - "gear-core", - "gear-core-backend", - "gear-core-errors", - "gear-lazy-pages-common", - "gear-lazy-pages-interface", - "gear-wasm-instrument", - "gsys", - "log", - "scale-info", -] - -[[package]] -name = "corosensei" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80128832c58ea9cbd041d2a759ec449224487b2c1e400453d99d244eead87a8e" -dependencies = [ - "autocfg", - "cfg-if", - "libc", - "scopeguard", - "windows-sys 0.33.0", -] - -[[package]] -name = "cpp_demangle" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeaa953eaad386a53111e47172c2fedba671e5684c8dd601a5f474f4f118710f" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - -[[package]] -name = "cranelift-bforest" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38faa2a16616c8e78a18d37b4726b98bfd2de192f2fdc8a39ddf568a408a0f75" -dependencies = [ - "cranelift-entity 0.82.3", -] - -[[package]] -name = "cranelift-codegen" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26f192472a3ba23860afd07d2b0217dc628f21fcc72617aa1336d98e1671f33b" -dependencies = [ - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-entity 0.82.3", - "gimli 0.26.2", - "log", - "regalloc", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32ddb89e9b89d3d9b36a5b7d7ea3261c98235a76ac95ba46826b8ec40b1a24" -dependencies = [ - "cranelift-codegen-shared", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc" - -[[package]] -name = "cranelift-entity" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf" - -[[package]] -name = "cranelift-entity" -version = "0.95.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" -dependencies = [ - "serde", -] - -[[package]] -name = "cranelift-frontend" -version = "0.82.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a006e3e32d80ce0e4ba7f1f9ddf66066d052a8c884a110b91d05404d6ce26dce" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array 0.14.7", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array 0.14.7", - "typenum", -] - -[[package]] -name = "crypto-mac" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" -dependencies = [ - "generic-array 0.14.7", - "subtle", -] - -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array 0.14.7", - "subtle", -] - -[[package]] -name = "curve25519-dalek" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a9b85542f99a2dfa2a1b8e192662741c9859a846b296bef1c92ef9b58b5a216" -dependencies = [ - "byteorder", - "digest 0.8.1", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek" -version = "4.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest 0.10.7", - "fiat-crypto", - "platforms", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "darling" -version = "0.20.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "darling_macro" -version = "0.20.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "der" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "derive-syn-parse" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "convert_case 0.4.0", - "proc-macro2", - "quote", - "rustc_version", - "syn 1.0.109", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.4", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array 0.14.7", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer 0.10.4", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "downcast-rs" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" - -[[package]] -name = "dyn-clonable" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9232f0e607a262ceb9bd5141a3dfb3e4db6994b31989bbfd845878cba59fd4" -dependencies = [ - "dyn-clonable-impl", - "dyn-clone", -] - -[[package]] -name = "dyn-clonable-impl" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "dyn-clone" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" - -[[package]] -name = "dynasm" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add9a102807b524ec050363f09e06f1504214b0e1c7797f64261c891022dce8b" -dependencies = [ - "bitflags 1.3.2", - "byteorder", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "dynasmrt" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64fba5a42bd76a17cad4bfa00de168ee1cbfa06a5e8ce992ae880218c05641a9" -dependencies = [ - "byteorder", - "dynasm", - "memmap2", -] - -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature 2.2.0", - "spki", -] - -[[package]] -name = "ed25519" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" -dependencies = [ - "signature 1.6.4", -] - -[[package]] -name = "ed25519-dalek" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek 3.2.0", - "ed25519", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "ed25519-zebra" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" -dependencies = [ - "curve25519-dalek 3.2.0", - "hashbrown 0.12.3", - "hex", - "rand_core 0.6.4", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "either" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" - -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest 0.10.7", - "ff", - "generic-array 0.14.7", - "group", - "pkcs8", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "enum-iterator" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6" -dependencies = [ - "enum-iterator-derive 0.7.0", -] - -[[package]] -name = "enum-iterator" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd242f399be1da0a5354aa462d57b4ab2b4ee0683cc552f7c007d2d12d36e94" -dependencies = [ - "enum-iterator-derive 1.4.0", -] - -[[package]] -name = "enum-iterator-derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "enum-iterator-derive" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "enumset" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226c0da7462c13fb57e5cc9e0dc8f0635e7d27f276a3a7fd30054647f669007d" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "env_logger" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "environmental" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48c92028aaa870e83d51c64e5d4e0b6981b360c522198c23959f219a4e1b15b" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "etc" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b241177c7107d9829286c2ffdc5eee98d992d6356f3515e7f412f988b1a72fd" - -[[package]] -name = "expander" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00e83c02035136f1592a47964ea60c05a50e4ed8b5892cfac197063850898d4d" -dependencies = [ - "blake2", - "fs-err", - "prettier-please", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "fastrand" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" - -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "fiat-crypto" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" - -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand 0.8.5", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "frame-metadata" -version = "16.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cf1549fba25a6fcac22785b61698317d958e96cac72a59102ea45b9ae64692" -dependencies = [ - "cfg-if", - "parity-scale-codec", - "scale-info", - "serde", -] - -[[package]] -name = "frame-support" -version = "22.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ab435a28c0b92be45e871a20faae7307a5f1153168aed11076892511b97332" -dependencies = [ - "bitflags 1.3.2", - "environmental", - "frame-metadata", - "frame-support-procedural", - "impl-trait-for-tuples", - "k256", - "log", - "macro_magic", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "smallvec", - "sp-api", - "sp-arithmetic", - "sp-core", - "sp-core-hashing-proc-macro", - "sp-debug-derive", - "sp-inherents", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-state-machine", - "sp-std 9.0.0", - "sp-tracing 11.0.0", - "sp-weights", - "tt-call", -] - -[[package]] -name = "frame-support-procedural" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3515d87fdbf82fa3e5a03b4318ee897c3b2adda928625146dd7d33d52bc2978" -dependencies = [ - "Inflector", - "cfg-expr", - "derive-syn-parse", - "expander", - "frame-support-procedural-tools", - "itertools", - "macro_magic", - "proc-macro-warning", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "frame-support-procedural-tools" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072beafb884cd1c046188c64d593cacb6860314f50478a3713438cc56bee42de" -dependencies = [ - "frame-support-procedural-tools-derive", - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "frame-support-procedural-tools-derive" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3562da4b7b8e24189036c58d459b260e10c8b7af2dd180b7869ae29bb66277" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "frame-system" -version = "22.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c5104921b9e4e8ffee5251caf7d28defa4e97080554b0e57f93a72b1ec8b915" -dependencies = [ - "cfg-if", - "frame-support", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 9.0.0", - "sp-version", - "sp-weights", -] - -[[package]] -name = "fs-err" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" -dependencies = [ - "autocfg", -] - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-executor" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "galloc" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eec05cbaee718ae5fe97e62dacbec2807186c942ed24e72e6984e6bb2e81ab3f" -dependencies = [ - "gear-dlmalloc", -] - -[[package]] -name = "gcore" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dcd57f0ef3eada83210201b59f0cff9fe2c3849563eccf03f5942943adb4ae8" -dependencies = [ - "gear-core-errors", - "gear-stack-buffer", - "gsys", - "parity-scale-codec", -] - -[[package]] -name = "gear-common" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d0d189a85244cc0f2da12bed3ab52bb31aea2455702e5e62a624b1332dfc96f" -dependencies = [ - "derive_more", - "enum-iterator 1.5.0", - "frame-support", - "frame-system", - "gear-common-codegen", - "gear-core", - "gear-wasm-instrument", - "gsys", - "log", - "primitive-types", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 9.0.0", -] - -[[package]] -name = "gear-common-codegen" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4952f29b83939ab19c2ed52afc219776d0dc43541864d607e869c5af85a52f3b" -dependencies = [ - "quote", - "syn 2.0.65", -] - -[[package]] -name = "gear-core" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6d6e9d3d4eee34166236bff1622b1ee22379097ccd03c2cd843ccd790fac5f" -dependencies = [ - "blake2-rfc", - "byteorder", - "derive_more", - "enum-iterator 1.5.0", - "gear-core-errors", - "gear-wasm-instrument", - "gsys", - "hashbrown 0.14.5", - "hex", - "log", - "num-traits", - "numerated", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "wasmparser-nostd", -] - -[[package]] -name = "gear-core-backend" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b58fcea032ed4e65ae0e01c43e5cf417180b887daf4214a26730b37a3d0ea3a" -dependencies = [ - "actor-system-error", - "blake2-rfc", - "derive_more", - "gear-core", - "gear-core-errors", - "gear-lazy-pages-common", - "gear-sandbox", - "gear-sandbox-env", - "gear-wasm-instrument", - "gsys", - "log", - "parity-scale-codec", -] - -[[package]] -name = "gear-core-errors" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee3baa8a387c829d5045015f788a31a35b6cd50df72f25420bb850d2bd432416" -dependencies = [ - "derive_more", - "enum-iterator 1.5.0", - "scale-info", - "serde", -] - -[[package]] -name = "gear-dlmalloc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b88fcd5524e7ab9f156c17b14e754d6ba122ef9b00586d632d2ae3dbc7bfadb" -dependencies = [ - "libc", - "libc-print", - "page_size", - "static_assertions", - "str-buf", -] - -[[package]] -name = "gear-lazy-pages" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f7dc103df0762cb9bb8d7542eb592025438e8eefe6ba0ef0feefd3fbfd6a0bc" -dependencies = [ - "cfg-if", - "derive_more", - "errno", - "gear-core", - "gear-lazy-pages-common", - "gear-sandbox-host", - "libc", - "log", - "mach", - "nix", - "numerated", - "region", - "sp-wasm-interface-common", - "winapi", -] - -[[package]] -name = "gear-lazy-pages-common" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc7eb677fe5858fbe9986a7efb0e9f4edb8485e179ad673c620b25f058de46d" -dependencies = [ - "gear-core", - "num_enum", - "parity-scale-codec", -] - -[[package]] -name = "gear-lazy-pages-interface" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835118723f4f9c92397c200b4010e3e9b786ad4a4f76ce4cb3f9195ef400ad79" -dependencies = [ - "byteorder", - "gear-common", - "gear-core", - "gear-lazy-pages-common", - "gear-runtime-interface", - "log", - "sp-std 9.0.0", -] - -[[package]] -name = "gear-pwasm-utils" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ea09901ce41f64d1be7369b8c2efc774e89b200ac434496ab24e6af96e68f97" -dependencies = [ - "byteorder", - "gear-wasm", - "log", -] - -[[package]] -name = "gear-runtime-interface" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acafa1d430af6cacb236cde58d351898a8fdb6bc578bdb3358d9d81f65f75628" -dependencies = [ - "byteorder", - "gear-core", - "gear-lazy-pages", - "gear-lazy-pages-common", - "gear-sandbox-host", - "gp-runtime-interface", - "gp-wasm-interface", - "log", - "parity-scale-codec", - "sp-io", - "sp-std 9.0.0", - "winapi", -] - -[[package]] -name = "gear-sandbox" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fc632508a89bb79b53f9908e698b6ca1ebca0741c2139927ac2e66ae09cb13" -dependencies = [ - "gear-runtime-interface", - "gear-sandbox-env", - "gwasmi", - "log", - "parity-scale-codec", - "sp-core", - "sp-std 9.0.0", - "sp-wasm-interface-common", -] - -[[package]] -name = "gear-sandbox-env" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d46c37e2aa67d4ec9e398d622024d3f009fa25fcccd606d29d6694cddc95727" -dependencies = [ - "parity-scale-codec", - "sp-debug-derive", - "sp-std 9.0.0", - "sp-wasm-interface-common", -] - -[[package]] -name = "gear-sandbox-host" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef003d6736020d54c242e040aeb42666068b7e4b5ec6d5472d43529fc8cbd13b" -dependencies = [ - "environmental", - "gear-sandbox-env", - "gp-allocator", - "log", - "parity-scale-codec", - "sp-wasm-interface-common", - "tempfile", - "thiserror", - "uluru", - "wasmer", - "wasmer-cache", - "wasmer-types", - "wasmi", -] - -[[package]] -name = "gear-ss58" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8a82173968491c367a0fd0a315337f942228d3663322a9c08b66e057903858" -dependencies = [ - "anyhow", - "blake2", - "bs58 0.5.1", -] - -[[package]] -name = "gear-stack-buffer" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c49ff4ab26f2949996266c3edce0cb3494931d546e4ee8ae928c65c3a50fce" - -[[package]] -name = "gear-utils" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ea24c1f22c250523656ec9c1cfefd4ddec91131435a58a9fc48a5ab468e896" -dependencies = [ - "env_logger", - "gear-core", - "hex", - "nonempty", - "parity-scale-codec", - "path-clean", - "serde", - "serde_json", -] - -[[package]] -name = "gear-wasm" -version = "0.45.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfbfa701dc65e683fcd2fb24f046bcef22634acbdf47ad14724637dc39ad05b" - -[[package]] -name = "gear-wasm-builder" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048074283e5e81f039668709de25d69fb63d43adc9260a5dfb7a0fb7ba8b314" -dependencies = [ - "anyhow", - "cargo_metadata", - "chrono", - "colored", - "dirs", - "gear-core", - "gear-pwasm-utils", - "gear-wasm-instrument", - "gmeta", - "log", - "once_cell", - "pathdiff", - "regex", - "rustc_version", - "thiserror", - "toml", - "wasmparser-nostd", - "which", -] - -[[package]] -name = "gear-wasm-instrument" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a30f5b93b1278ed6157924b60afae8d7b9d1697ba893b71be8f36f3527622cf" -dependencies = [ - "derive_more", - "enum-iterator 1.5.0", - "gwasm-instrument", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom_or_panic" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea1015b5a70616b688dc230cfe50c8af89d972cb132d5a622814d29773b10b9" -dependencies = [ - "rand_core 0.6.4", -] - -[[package]] -name = "gimli" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" -dependencies = [ - "fallible-iterator", - "indexmap 1.9.3", - "stable_deref_trait", -] - -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" -dependencies = [ - "fallible-iterator", - "indexmap 1.9.3", - "stable_deref_trait", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "gmeta" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ab99c1c5b31b55620dac12ba4bd042fac156a6f2842c9c4edcfd278caf8c6ae" -dependencies = [ - "blake2-rfc", - "derive_more", - "hex", - "scale-info", -] - -[[package]] -name = "gp-allocator" -version = "4.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93cfb4525b5362966a1971125ff8f9825e6a511403635dccf883273d20c43bdf" -dependencies = [ - "log", - "parity-scale-codec", - "sp-wasm-interface-common", - "thiserror", -] - -[[package]] -name = "gp-runtime-interface" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dfb3786bf8fe51099c67dfe7c9a925fe0bfb78ffe938aa07b598995ee48d0e3" -dependencies = [ - "bytes", - "gp-runtime-interface-proc-macro", - "gp-wasm-interface", - "impl-trait-for-tuples", - "parity-scale-codec", - "primitive-types", - "sp-externalities", - "sp-std 9.0.0", - "sp-storage", - "sp-tracing 10.0.0", - "static_assertions", -] - -[[package]] -name = "gp-runtime-interface-proc-macro" -version = "12.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1e4d907f86db64e8b9d9af0b5adfd59e62b4023fd88511e13d62028ed101f2c" -dependencies = [ - "Inflector", - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "gp-wasm-interface" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de334e40147f969276463ad04d0ddfe519aebb6254832ea0637a300c6d637c11" -dependencies = [ - "anyhow", - "gp-allocator", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "sp-std 9.0.0", - "sp-wasm-interface-common", - "wasmtime", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "gstd" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "191118e6cdbc43811c17d96aaa4cf52a402e474f5f626936825bc0d1b330fc68" -dependencies = [ - "arrayvec 0.7.4", - "const_format", - "futures", - "galloc", - "gcore", - "gear-core-errors", - "gstd-codegen", - "hashbrown 0.14.5", - "hex", - "parity-scale-codec", - "primitive-types", - "scale-info", -] - -[[package]] -name = "gstd-codegen" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0122a5b154e398c88b477644ca560e59296de2001f20bf4d16f21760923f3ce" -dependencies = [ - "gear-ss58", - "hex", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "gsys" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e26e485e593d193dbea49821a9f67f83ffaec4f82c289b860b56dd2fd092462" - -[[package]] -name = "gtest" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70c5f0d488266355a09b6b1777fd3b10d1a5875027604cbff3c6449c8ed2dd14" -dependencies = [ - "cargo_toml", - "colored", - "core-processor", - "derive_more", - "env_logger", - "etc", - "gear-core", - "gear-core-errors", - "gear-lazy-pages", - "gear-lazy-pages-common", - "gear-utils", - "gear-wasm-instrument", - "gsys", - "hex", - "indexmap 2.2.6", - "log", - "parity-scale-codec", - "path-clean", - "rand 0.8.5", -] - -[[package]] -name = "gwasm-instrument" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c5fda64a6f7f331a6425df8d678dfc542f3135b43e3cc229d431d391ff3c7d" -dependencies = [ - "gear-wasm", -] - -[[package]] -name = "gwasmi" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "540bef71ad072d770140dc3f47f6bcc2b2b0492aa6a3ff236a13a7cd9427c58b" -dependencies = [ - "gwasmi_core", - "intx", - "smallvec", - "spin", - "wasmi_arena", - "wasmparser-nostd", -] - -[[package]] -name = "gwasmi_core" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47443d9a0eaa456c80525cebb42178fc47690fee77f9729eeece6ff70906fdcf" -dependencies = [ - "downcast-rs", - "libm", - "num-traits", - "paste", - "region", -] - -[[package]] -name = "handlebars" -version = "4.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faa67bab9ff362228eb3d00bd024a4965d8231bbb7921167f0cfa66c6626b225" -dependencies = [ - "log", - "pest", - "pest_derive", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "hash-db" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e7d7786361d7425ae2fe4f9e407eb0efaa0840f5212d109cc018c40c35c6ab4" - -[[package]] -name = "hash256-std-hasher" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92c171d55b98633f4ed3860808f004099b36c1cc29c42cfc53aa8591b21efcf2" -dependencies = [ - "crunchy", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.8", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.8", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.11", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash 0.8.11", - "allocator-api2", -] - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac 0.8.0", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" -dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "hmac-drbg" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" -dependencies = [ - "digest 0.9.0", - "generic-array 0.14.7", - "hmac 0.8.1", -] - -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "iana-time-zone" -version = "0.1.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" -dependencies = [ - "equivalent", - "hashbrown 0.14.5", -] - -[[package]] -name = "indexmap-nostd" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" - -[[package]] -name = "integer-sqrt" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" -dependencies = [ - "num-traits", -] - -[[package]] -name = "intx" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "is-terminal" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "k256" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2 0.10.8", -] - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - -[[package]] -name = "libc" -version = "0.2.155" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" - -[[package]] -name = "libc-print" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a660208db49e35faf57b37484350f1a61072f2a5becf0592af6015d9ddd4b0" -dependencies = [ - "libc", -] - -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.5.0", - "libc", -] - -[[package]] -name = "libsecp256k1" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" -dependencies = [ - "arrayref", - "base64", - "digest 0.9.0", - "hmac-drbg", - "libsecp256k1-core", - "libsecp256k1-gen-ecmult", - "libsecp256k1-gen-genmult", - "rand 0.8.5", - "serde", - "sha2 0.9.9", - "typenum", -] - -[[package]] -name = "libsecp256k1-core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" -dependencies = [ - "crunchy", - "digest 0.9.0", - "subtle", -] - -[[package]] -name = "libsecp256k1-gen-ecmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "libsecp256k1-gen-genmult" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" -dependencies = [ - "libsecp256k1-core", -] - -[[package]] -name = "linux-raw-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "loupe" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6a72dfa44fe15b5e76b94307eeb2ff995a8c5b283b55008940c02e0c5b634d" -dependencies = [ - "indexmap 1.9.3", - "loupe-derive", - "rustversion", -] - -[[package]] -name = "loupe-derive" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0fbfc88337168279f2e9ae06e157cfed4efd3316e14dc96ed074d4f2e6c5952" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - -[[package]] -name = "mach2" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" -dependencies = [ - "libc", -] - -[[package]] -name = "macro_magic" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aee866bfee30d2d7e83835a4574aad5b45adba4cc807f2a3bbba974e5d4383c9" -dependencies = [ - "macro_magic_core", - "macro_magic_macros", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "macro_magic_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e766a20fd9c72bab3e1e64ed63f36bd08410e75803813df210d1ce297d7ad00" -dependencies = [ - "const-random", - "derive-syn-parse", - "macro_magic_core_macros", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "macro_magic_core_macros" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d710e1214dffbab3b5dacb21475dde7d6ed84c69ff722b3a47a782668d44fbac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "macro_magic_macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fb85ec1620619edf2984a7693497d4ec88a9665d8b87e942856884c92dbf2a" -dependencies = [ - "macro_magic_core", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "matchers" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" -dependencies = [ - "regex-automata 0.1.10", -] - -[[package]] -name = "memchr" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" - -[[package]] -name = "memfd" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" -dependencies = [ - "rustix 0.38.34", -] - -[[package]] -name = "memmap2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memory-db" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" -dependencies = [ - "hash-db", -] - -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - -[[package]] -name = "merlin" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e261cf0f8b3c42ded9f7d2bb59dea03aa52bc8a1cbc7482f9fc3fd1229d3b42" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "merlin" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" -dependencies = [ - "byteorder", - "keccak", - "rand_core 0.6.4", - "zeroize", -] - -[[package]] -name = "miniz_oxide" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" -dependencies = [ - "adler", -] - -[[package]] -name = "more-asserts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" - -[[package]] -name = "nix" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.7.1", - "pin-utils", -] - -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[package]] -name = "nonempty" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeaf4ad7403de93e699c191202f017118df734d3850b01e13a3a8b2e6953d3c9" - -[[package]] -name = "num-bigint" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-format" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" -dependencies = [ - "arrayvec 0.7.4", - "itoa", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "numerated" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d916380bb26b78ca4f72aedba04025728a57339514cb14fa9c49e5fe95c1eee3" -dependencies = [ - "derive_more", - "num-traits", - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "object" -version = "0.28.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" -dependencies = [ - "crc32fast", - "hashbrown 0.11.2", - "indexmap 1.9.3", - "memchr", -] - -[[package]] -name = "object" -version = "0.30.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" -dependencies = [ - "crc32fast", - "hashbrown 0.13.2", - "indexmap 1.9.3", - "memchr", -] - -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - -[[package]] -name = "page_size" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "parity-scale-codec" -version = "3.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" -dependencies = [ - "arrayvec 0.7.4", - "bitvec", - "byte-slice-cast", - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" -dependencies = [ - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "parity-wasm" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" - -[[package]] -name = "parking_lot" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.5", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "path-clean" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef" - -[[package]] -name = "pathdiff" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" - -[[package]] -name = "pbkdf2" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95f5254224e617595d2cc3cc73ff0a5eaf2637519e25f03388154e9378b6ffa" -dependencies = [ - "crypto-mac 0.11.1", -] - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pest" -version = "2.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "pest_meta" -version = "2.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" -dependencies = [ - "once_cell", - "pest", - "sha2 0.10.8", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "ping" -version = "0.1.0" -dependencies = [ - "gear-wasm-builder", - "ping-app", - "sails-idl-gen", - "sails-rtl", -] - -[[package]] -name = "ping-app" -version = "0.1.0" -dependencies = [ - "sails-rtl", -] - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "platforms" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "prettier-please" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22020dfcf177fcc7bf5deaf7440af371400c67c0de14c399938d8ed4fb4645d3" -dependencies = [ - "proc-macro2", - "syn 2.0.65", -] - -[[package]] -name = "primitive-types" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-serde", - "scale-info", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - -[[package]] -name = "proc-macro-crate" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" -dependencies = [ - "toml_edit 0.21.1", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro-warning" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1eaa7fa0aa1929ffdf7eeb6eac234dde6268914a14ad44d23521ab6a9b258e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "proc-macro2" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "psm" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" -dependencies = [ - "cc", -] - -[[package]] -name = "ptr_meta" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" -dependencies = [ - "ptr_meta_derive", -] - -[[package]] -name = "ptr_meta_derive" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "quote" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.15", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" -dependencies = [ - "bitflags 2.5.0", -] - -[[package]] -name = "redox_users" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" -dependencies = [ - "getrandom 0.2.15", - "libredox", - "thiserror", -] - -[[package]] -name = "ref-cast" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "regalloc" -version = "0.0.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62446b1d3ebf980bdc68837700af1d77b37bc430e524bf95319c6eada2a4cc02" -dependencies = [ - "log", - "rustc-hash", - "smallvec", -] - -[[package]] -name = "regex" -version = "1.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.3", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" - -[[package]] -name = "region" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b6ebd13bc009aef9cd476c1310d49ac354d36e240cf1bd753290f3dc7199a7" -dependencies = [ - "bitflags 1.3.2", - "libc", - "mach2", - "windows-sys 0.52.0", -] - -[[package]] -name = "rend" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" -dependencies = [ - "bytecheck", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac 0.12.1", - "subtle", -] - -[[package]] -name = "rkyv" -version = "0.7.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" -dependencies = [ - "bitvec", - "bytecheck", - "bytes", - "hashbrown 0.12.3", - "ptr_meta", - "rend", - "rkyv_derive", - "seahash", - "tinyvec", - "uuid", -] - -[[package]] -name = "rkyv_derive" -version = "0.7.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.36.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305efbd14fde4139eb501df5f136994bb520b033fa9fbdce287507dc23b8c7ed" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.1.4", - "windows-sys 0.45.0", -] - -[[package]] -name = "rustix" -version = "0.38.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" -dependencies = [ - "bitflags 2.5.0", - "errno", - "libc", - "linux-raw-sys 0.4.14", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustversion" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "sails-idl-gen" -version = "0.0.1" -source = "git+https://github.com/gear-tech/sails#fe8e795493fd5a4d9648d322c3ac720b3e7b3edd" -dependencies = [ - "convert_case 0.6.0", - "handlebars", - "sails-rtl", - "scale-info", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "sails-macros" -version = "0.0.1" -source = "git+https://github.com/gear-tech/sails#fe8e795493fd5a4d9648d322c3ac720b3e7b3edd" -dependencies = [ - "proc-macro-error", - "sails-macros-core", -] - -[[package]] -name = "sails-macros-core" -version = "0.0.1" -source = "git+https://github.com/gear-tech/sails#fe8e795493fd5a4d9648d322c3ac720b3e7b3edd" -dependencies = [ - "const_format", - "convert_case 0.6.0", - "parity-scale-codec", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "sails-rtl" -version = "0.0.1" -source = "git+https://github.com/gear-tech/sails#fe8e795493fd5a4d9648d322c3ac720b3e7b3edd" -dependencies = [ - "futures", - "gear-core-errors", - "gstd", - "gtest", - "hashbrown 0.14.5", - "hex", - "parity-scale-codec", - "primitive-types", - "sails-macros", - "scale-info", - "thiserror-no-std", -] - -[[package]] -name = "scale-info" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" -dependencies = [ - "bitvec", - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", - "serde", -] - -[[package]] -name = "scale-info-derive" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" -dependencies = [ - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "schnellru" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a8ef13a93c54d20580de1e5c413e624e53121d42fc7e2c11d10ef7f8b02367" -dependencies = [ - "ahash 0.8.11", - "cfg-if", - "hashbrown 0.13.2", -] - -[[package]] -name = "schnorrkel" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "021b403afe70d81eea68f6ea12f6b3c9588e5d536a94c3bf80f15e7faa267862" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "curve25519-dalek 2.1.3", - "getrandom 0.1.16", - "merlin 2.0.1", - "rand 0.7.3", - "rand_core 0.5.1", - "sha2 0.8.2", - "subtle", - "zeroize", -] - -[[package]] -name = "schnorrkel" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de18f6d8ba0aad7045f5feae07ec29899c1112584a38509a84ad7b04451eaa0" -dependencies = [ - "arrayref", - "arrayvec 0.7.4", - "curve25519-dalek 4.1.2", - "getrandom_or_panic", - "merlin 3.0.0", - "rand_core 0.6.4", - "sha2 0.10.8", - "subtle", - "zeroize", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "seahash" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" - -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array 0.14.7", - "pkcs8", - "subtle", - "zeroize", -] - -[[package]] -name = "secp256k1" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" -dependencies = [ - "cc", -] - -[[package]] -name = "secrecy" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" -dependencies = [ - "zeroize", -] - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] - -[[package]] -name = "serde" -version = "1.0.202" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_bytes" -version = "0.11.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.202" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "serde_json" -version = "1.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" -dependencies = [ - "serde", -] - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug 0.3.1", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.7", - "keccak", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "signature" -version = "1.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest 0.10.7", - "rand_core 0.6.4", -] - -[[package]] -name = "simdutf8" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "sp-api" -version = "20.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa63dcdd3fb081a894189f83115dd683be1339a919cd7d3f98f145d1870626c" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec", - "scale-info", - "sp-api-proc-macro", - "sp-core", - "sp-externalities", - "sp-metadata-ir", - "sp-runtime", - "sp-state-machine", - "sp-std 9.0.0", - "sp-trie", - "sp-version", - "thiserror", -] - -[[package]] -name = "sp-api-proc-macro" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a062dfff051064bfa1837566b74d00a49050b36e3887b2283ab667cef4f3a85e" -dependencies = [ - "Inflector", - "blake2", - "expander", - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "sp-application-crypto" -version = "24.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b49d62089ef6fdd52a6f90f670d533ccb365235258cf517dbd5bd571febcfbd" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-std 9.0.0", -] - -[[package]] -name = "sp-arithmetic" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0241327405688cac3fcc29114fd35f99224e321daa37e19920e50e4b2fdd0645" -dependencies = [ - "integer-sqrt", - "num-traits", - "parity-scale-codec", - "scale-info", - "serde", - "sp-std 9.0.0", - "static_assertions", -] - -[[package]] -name = "sp-core" -version = "22.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0de478e02efd547693b33ad02515e09933d5b69b7f3036fa890b92e50fd9dfc" -dependencies = [ - "array-bytes", - "bitflags 1.3.2", - "blake2", - "bounded-collections", - "bs58 0.4.0", - "dyn-clonable", - "ed25519-zebra", - "futures", - "hash-db", - "hash256-std-hasher", - "impl-serde", - "lazy_static", - "libsecp256k1", - "log", - "merlin 2.0.1", - "parity-scale-codec", - "parking_lot", - "paste", - "primitive-types", - "rand 0.8.5", - "regex", - "scale-info", - "schnorrkel 0.9.1", - "secp256k1", - "secrecy", - "serde", - "sp-core-hashing", - "sp-debug-derive", - "sp-externalities", - "sp-runtime-interface", - "sp-std 9.0.0", - "sp-storage", - "ss58-registry", - "substrate-bip39", - "thiserror", - "tiny-bip39", - "tracing", - "zeroize", -] - -[[package]] -name = "sp-core-hashing" -version = "10.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e360755a2706a76886d58776665cad0db793dece3c7d390455b28e8a1efd6285" -dependencies = [ - "blake2b_simd", - "byteorder", - "digest 0.10.7", - "sha2 0.10.8", - "sha3", - "twox-hash", -] - -[[package]] -name = "sp-core-hashing-proc-macro" -version = "10.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dc707d9f5bf155d584900783e328cb3dc79c950f898a18a8f24066f41f040a5" -dependencies = [ - "quote", - "sp-core-hashing", - "syn 2.0.65", -] - -[[package]] -name = "sp-debug-derive" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12dae7cf6c1e825d13ffd4ce16bd9309db7c539929d0302b4443ed451a9f4e5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "sp-externalities" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3313e2c5f2523b06062e541dff9961bde88ad5a28861621dc7b7b47a32bb0f7c" -dependencies = [ - "environmental", - "parity-scale-codec", - "sp-std 9.0.0", - "sp-storage", -] - -[[package]] -name = "sp-inherents" -version = "20.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30fe27930fbcc1ddf8e73446c65b2696f3544adeb30d1f5171d360e5c7072c9c" -dependencies = [ - "async-trait", - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "sp-runtime", - "sp-std 9.0.0", - "thiserror", -] - -[[package]] -name = "sp-io" -version = "24.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6194309bfe055d93177c6c9d2ed4c7b66040617cf3003a15e509c432cf3b62" -dependencies = [ - "bytes", - "ed25519", - "ed25519-dalek", - "libsecp256k1", - "log", - "parity-scale-codec", - "rustversion", - "secp256k1", - "sp-core", - "sp-externalities", - "sp-keystore", - "sp-runtime-interface", - "sp-state-machine", - "sp-std 9.0.0", - "sp-tracing 11.0.0", - "sp-trie", - "tracing", - "tracing-core", -] - -[[package]] -name = "sp-keystore" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eda1d2572a15340927a9f7db75ffe74366b645eaf9212015b4a96ad8e9d4c46" -dependencies = [ - "parity-scale-codec", - "parking_lot", - "sp-core", - "sp-externalities", - "thiserror", -] - -[[package]] -name = "sp-metadata-ir" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369e75e418bcfdeede4acb92563ef2d514ad0e7d81c350ba9ae98841a237f3c" -dependencies = [ - "frame-metadata", - "parity-scale-codec", - "scale-info", - "sp-std 9.0.0", -] - -[[package]] -name = "sp-panic-handler" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c67eb0a0d11d3017ef43c975068ba76c7b0e83aca1ee3d68ba0ce270ecebe7" -dependencies = [ - "backtrace", - "lazy_static", - "regex", -] - -[[package]] -name = "sp-runtime" -version = "25.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d056e4cccf36a45be5d471b47c09e8be91b825f1d8352f20aa01f9f693176e7" -dependencies = [ - "either", - "hash256-std-hasher", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "paste", - "rand 0.8.5", - "scale-info", - "serde", - "sp-application-crypto", - "sp-arithmetic", - "sp-core", - "sp-io", - "sp-std 9.0.0", - "sp-weights", -] - -[[package]] -name = "sp-runtime-interface" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf9781c72848efe6750116eb96edaeb105ee7e0bd7f38a4e46371bf810b3db7b" -dependencies = [ - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec", - "primitive-types", - "sp-externalities", - "sp-runtime-interface-proc-macro", - "sp-std 9.0.0", - "sp-storage", - "sp-tracing 11.0.0", - "sp-wasm-interface", - "static_assertions", -] - -[[package]] -name = "sp-runtime-interface-proc-macro" -version = "12.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7402572a08aa1ae421ea5bab10918764b0ae72301b27710913e5d804862f2448" -dependencies = [ - "Inflector", - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "sp-staking" -version = "20.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4883e5d0a533009175746e3c35d44aa031805064153749baefd6cac915e70ba5" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-runtime", - "sp-std 9.0.0", -] - -[[package]] -name = "sp-state-machine" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2e84d8ed3acc6aed5a3d5cfd500fb5b99c1e299c86086b2fe82c3e4be93178f" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec", - "parking_lot", - "rand 0.8.5", - "smallvec", - "sp-core", - "sp-externalities", - "sp-panic-handler", - "sp-std 9.0.0", - "sp-trie", - "thiserror", - "tracing", - "trie-db", -] - -[[package]] -name = "sp-std" -version = "8.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53458e3c57df53698b3401ec0934bea8e8cfce034816873c0b0abbd83d7bac0d" - -[[package]] -name = "sp-std" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d5bbc9339227d1b6a9b7ccd9b2920c818653d40eef1512f1e2e824d72e7a336" - -[[package]] -name = "sp-storage" -version = "14.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21245c3a7799ff6d3f1f159b496f9ac72eb32cd6fe68c6f73013155289aa9f1" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive", - "sp-std 9.0.0", -] - -[[package]] -name = "sp-tracing" -version = "10.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357f7591980dd58305956d32f8f6646d0a8ea9ea0e7e868e46f53b68ddf00cec" -dependencies = [ - "parity-scale-codec", - "sp-std 8.0.0", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-tracing" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5ba26db1f7513d5975970d1ba1f0580d7a1b8da8c86ea3f9f0f8dbe2cfa96e" -dependencies = [ - "parity-scale-codec", - "sp-std 9.0.0", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-trie" -version = "23.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf63ea90ffb5d61048d8fb2fac669114dac198fc2739e913e615f0fd2c36c3e7" -dependencies = [ - "ahash 0.8.11", - "hash-db", - "hashbrown 0.13.2", - "lazy_static", - "memory-db", - "nohash-hasher", - "parity-scale-codec", - "parking_lot", - "scale-info", - "schnellru", - "sp-core", - "sp-std 9.0.0", - "thiserror", - "tracing", - "trie-db", - "trie-root", -] - -[[package]] -name = "sp-version" -version = "23.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccae066042a53a83017a2afeee2fd608efa42b564c1a44ea1260d5a2c264ac66" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "parity-wasm", - "scale-info", - "serde", - "sp-core-hashing-proc-macro", - "sp-runtime", - "sp-std 9.0.0", - "sp-version-proc-macro", - "thiserror", -] - -[[package]] -name = "sp-version-proc-macro" -version = "9.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e569853a50ad02a4b45640e7b96206bcb4569bb85ce7cdf8754a207fcfba54" -dependencies = [ - "parity-scale-codec", - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "sp-wasm-interface" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07945f592d2792632e6f030108769757e928a0fd78cf8659c9c210a5e341e55" -dependencies = [ - "anyhow", - "impl-trait-for-tuples", - "log", - "parity-scale-codec", - "sp-std 9.0.0", - "wasmtime", -] - -[[package]] -name = "sp-wasm-interface-common" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03223ee788e1490f6341eb5b76501f83abf931fa8b5d83b5f49a4fecaf83f4ae" -dependencies = [ - "parity-scale-codec", - "sp-std 9.0.0", - "wasmi", -] - -[[package]] -name = "sp-weights" -version = "21.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7699b853471c2eb5dc06ea1d8ea847bfa1415371218ebb4c86325c9d0232bc" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "smallvec", - "sp-arithmetic", - "sp-core", - "sp-debug-derive", - "sp-std 9.0.0", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "ss58-registry" -version = "1.47.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4743ce898933fbff7bbf414f497c459a782d496269644b3d650a398ae6a487ba" -dependencies = [ - "Inflector", - "num-format", - "proc-macro2", - "quote", - "serde", - "serde_json", - "unicode-xid", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "str-buf" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ceb97b7225c713c2fd4db0153cb6b3cab244eb37900c3f634ed4d43310d8c34" - -[[package]] -name = "substrate-bip39" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a7590dc041b9bc2825e52ce5af8416c73dbe9d0654402bfd4b4941938b94d8f" -dependencies = [ - "hmac 0.11.0", - "pbkdf2 0.8.0", - "schnorrkel 0.11.4", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "target-lexicon" -version = "0.12.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" - -[[package]] -name = "tempfile" -version = "3.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" -dependencies = [ - "cfg-if", - "fastrand", - "rustix 0.38.34", - "windows-sys 0.52.0", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "thiserror-impl-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58e6318948b519ba6dc2b442a6d0b904ebfb8d411a3ad3e07843615a72249758" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "thiserror-no-std" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3ad459d94dd517257cc96add8a43190ee620011bb6e6cdc82dafd97dfafafea" -dependencies = [ - "thiserror-impl-no-std", -] - -[[package]] -name = "thread_local" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "tiny-bip39" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62cc94d358b5a1e84a5cb9109f559aa3c4d634d2b1b4de3d0fa4adc7c78e2861" -dependencies = [ - "anyhow", - "hmac 0.12.1", - "once_cell", - "pbkdf2 0.11.0", - "rand 0.8.5", - "rustc-hash", - "sha2 0.10.8", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "toml" -version = "0.8.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.22.13", -] - -[[package]] -name = "toml_datetime" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.2.6", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap 2.2.6", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" -dependencies = [ - "indexmap 2.2.6", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.6.8", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "log", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-serde" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" -dependencies = [ - "serde", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" -dependencies = [ - "ansi_term", - "chrono", - "lazy_static", - "matchers", - "regex", - "serde", - "serde_json", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", - "tracing-serde", -] - -[[package]] -name = "trie-db" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "767abe6ffed88a1889671a102c2861ae742726f52e0a5a425b92c9fbfa7e9c85" -dependencies = [ - "hash-db", - "hashbrown 0.13.2", - "log", - "rustc-hex", - "smallvec", -] - -[[package]] -name = "trie-root" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" -dependencies = [ - "hash-db", -] - -[[package]] -name = "tt-call" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "digest 0.10.7", - "rand 0.8.5", - "static_assertions", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "uluru" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c8a2469e56e6e5095c82ccd3afb98dad95f7af7929aab6d8ba8d6e0f73657da" -dependencies = [ - "arrayvec 0.7.4", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" - -[[package]] -name = "unicode-width" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "url" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "uuid" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.65", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - -[[package]] -name = "wasm-encoder" -version = "0.208.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6425e84e42f7f558478e40ecc2287912cb319f2ca68e5c0bb93c61d4fc63fa17" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasmer" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea8d8361c9d006ea3d7797de7bd6b1492ffd0f91a22430cfda6c1658ad57bedf" -dependencies = [ - "cfg-if", - "indexmap 1.9.3", - "js-sys", - "loupe", - "more-asserts", - "target-lexicon", - "thiserror", - "wasm-bindgen", - "wasmer-artifact", - "wasmer-compiler", - "wasmer-compiler-cranelift", - "wasmer-compiler-singlepass", - "wasmer-derive", - "wasmer-engine", - "wasmer-engine-dylib", - "wasmer-engine-universal", - "wasmer-types", - "wasmer-vm", - "wat", - "winapi", -] - -[[package]] -name = "wasmer-artifact" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aaf9428c29c1d8ad2ac0e45889ba8a568a835e33fd058964e5e500f2f7ce325" -dependencies = [ - "enumset", - "loupe", - "thiserror", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-cache" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0def391ee1631deac5ac1e6ce919c07a5ccb936ad0fd44708cdc2365c49561a4" -dependencies = [ - "blake3", - "hex", - "thiserror", - "wasmer", -] - -[[package]] -name = "wasmer-compiler" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67a6cd866aed456656db2cfea96c18baabbd33f676578482b85c51e1ee19d2c" -dependencies = [ - "enumset", - "loupe", - "rkyv", - "serde", - "serde_bytes", - "smallvec", - "target-lexicon", - "thiserror", - "wasmer-types", - "wasmparser 0.83.0", -] - -[[package]] -name = "wasmer-compiler-cranelift" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48be2f9f6495f08649e4f8b946a2cbbe119faf5a654aa1457f9504a99d23dae0" -dependencies = [ - "cranelift-codegen", - "cranelift-entity 0.82.3", - "cranelift-frontend", - "gimli 0.26.2", - "loupe", - "more-asserts", - "rayon", - "smallvec", - "target-lexicon", - "tracing", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-compiler-singlepass" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ca2a35204d8befa85062bc7aac259a8db8070b801b8a783770ba58231d729e" -dependencies = [ - "byteorder", - "dynasm", - "dynasmrt", - "gimli 0.26.2", - "lazy_static", - "loupe", - "more-asserts", - "rayon", - "smallvec", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-derive" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00e50405cc2a2f74ff574584710a5f2c1d5c93744acce2ca0866084739284b51" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "wasmer-engine" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f98f010978c244db431b392aeab0661df7ea0822343334f8f2a920763548e45" -dependencies = [ - "backtrace", - "enumset", - "lazy_static", - "loupe", - "memmap2", - "more-asserts", - "rustc-demangle", - "serde", - "serde_bytes", - "target-lexicon", - "thiserror", - "wasmer-artifact", - "wasmer-compiler", - "wasmer-types", - "wasmer-vm", -] - -[[package]] -name = "wasmer-engine-dylib" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0358af9c154724587731175553805648d9acb8f6657880d165e378672b7e53" -dependencies = [ - "cfg-if", - "enum-iterator 0.7.0", - "enumset", - "leb128", - "libloading", - "loupe", - "object 0.28.4", - "rkyv", - "serde", - "tempfile", - "tracing", - "wasmer-artifact", - "wasmer-compiler", - "wasmer-engine", - "wasmer-object", - "wasmer-types", - "wasmer-vm", - "which", -] - -[[package]] -name = "wasmer-engine-universal" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "440dc3d93c9ca47865a4f4edd037ea81bf983b5796b59b3d712d844b32dbef15" -dependencies = [ - "cfg-if", - "enumset", - "leb128", - "loupe", - "region", - "rkyv", - "wasmer-compiler", - "wasmer-engine", - "wasmer-engine-universal-artifact", - "wasmer-types", - "wasmer-vm", - "winapi", -] - -[[package]] -name = "wasmer-engine-universal-artifact" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f1db3f54152657eb6e86c44b66525ff7801dad8328fe677da48dd06af9ad41" -dependencies = [ - "enum-iterator 0.7.0", - "enumset", - "loupe", - "rkyv", - "thiserror", - "wasmer-artifact", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-object" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d831335ff3a44ecf451303f6f891175c642488036b92ceceb24ac8623a8fa8b" -dependencies = [ - "object 0.28.4", - "thiserror", - "wasmer-compiler", - "wasmer-types", -] - -[[package]] -name = "wasmer-types" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39df01ea05dc0a9bab67e054c7cb01521e53b35a7bb90bd02eca564ed0b2667f" -dependencies = [ - "backtrace", - "enum-iterator 0.7.0", - "indexmap 1.9.3", - "loupe", - "more-asserts", - "rkyv", - "serde", - "thiserror", -] - -[[package]] -name = "wasmer-vm" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d965fa61f4dc4cdb35a54daaf7ecec3563fbb94154a6c35433f879466247dd" -dependencies = [ - "backtrace", - "cc", - "cfg-if", - "corosensei", - "enum-iterator 0.7.0", - "indexmap 1.9.3", - "lazy_static", - "libc", - "loupe", - "mach", - "memoffset 0.6.5", - "more-asserts", - "region", - "rkyv", - "scopeguard", - "serde", - "thiserror", - "wasmer-artifact", - "wasmer-types", - "winapi", -] - -[[package]] -name = "wasmi" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" -dependencies = [ - "parity-wasm", - "wasmi-validation", - "wasmi_core", -] - -[[package]] -name = "wasmi-validation" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" -dependencies = [ - "parity-wasm", -] - -[[package]] -name = "wasmi_arena" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" - -[[package]] -name = "wasmi_core" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" -dependencies = [ - "downcast-rs", - "libm", - "memory_units", - "num-rational", - "num-traits", - "region", -] - -[[package]] -name = "wasmparser" -version = "0.83.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" - -[[package]] -name = "wasmparser" -version = "0.102.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" -dependencies = [ - "indexmap 1.9.3", - "url", -] - -[[package]] -name = "wasmparser-nostd" -version = "0.100.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" -dependencies = [ - "indexmap-nostd", -] - -[[package]] -name = "wasmtime" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" -dependencies = [ - "anyhow", - "bincode", - "cfg-if", - "indexmap 1.9.3", - "libc", - "log", - "object 0.30.4", - "once_cell", - "paste", - "psm", - "serde", - "target-lexicon", - "wasmparser 0.102.0", - "wasmtime-environ", - "wasmtime-jit", - "wasmtime-runtime", - "windows-sys 0.45.0", -] - -[[package]] -name = "wasmtime-asm-macros" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "wasmtime-environ" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" -dependencies = [ - "anyhow", - "cranelift-entity 0.95.1", - "gimli 0.27.3", - "indexmap 1.9.3", - "log", - "object 0.30.4", - "serde", - "target-lexicon", - "thiserror", - "wasmparser 0.102.0", - "wasmtime-types", -] - -[[package]] -name = "wasmtime-jit" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" -dependencies = [ - "addr2line 0.19.0", - "anyhow", - "bincode", - "cfg-if", - "cpp_demangle", - "gimli 0.27.3", - "log", - "object 0.30.4", - "rustc-demangle", - "serde", - "target-lexicon", - "wasmtime-environ", - "wasmtime-jit-icache-coherence", - "wasmtime-runtime", - "windows-sys 0.45.0", -] - -[[package]] -name = "wasmtime-jit-debug" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" -dependencies = [ - "once_cell", -] - -[[package]] -name = "wasmtime-jit-icache-coherence" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" -dependencies = [ - "cfg-if", - "libc", - "windows-sys 0.45.0", -] - -[[package]] -name = "wasmtime-runtime" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" -dependencies = [ - "anyhow", - "cc", - "cfg-if", - "indexmap 1.9.3", - "libc", - "log", - "mach", - "memfd", - "memoffset 0.8.0", - "paste", - "rand 0.8.5", - "rustix 0.36.17", - "wasmtime-asm-macros", - "wasmtime-environ", - "wasmtime-jit-debug", - "windows-sys 0.45.0", -] - -[[package]] -name = "wasmtime-types" -version = "8.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" -dependencies = [ - "cranelift-entity 0.95.1", - "serde", - "thiserror", - "wasmparser 0.102.0", -] - -[[package]] -name = "wast" -version = "208.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00b3f023b4e2ccd2e054e240294263db52ae962892e6523e550783c83a67f1" -dependencies = [ - "bumpalo", - "leb128", - "memchr", - "unicode-width", - "wasm-encoder", -] - -[[package]] -name = "wat" -version = "1.208.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58ed38e59176550214c025ea2bd0eeefd8e86b92d0af6698d5ba95020ec2e07b" -dependencies = [ - "wast", -] - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix 0.38.34", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.5", -] - -[[package]] -name = "windows-sys" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" -dependencies = [ - "windows_aarch64_msvc 0.33.0", - "windows_i686_gnu 0.33.0", - "windows_i686_msvc 0.33.0", - "windows_x86_64_gnu 0.33.0", - "windows_x86_64_msvc 0.33.0", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.5", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" -dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" - -[[package]] -name = "windows_i686_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" - -[[package]] -name = "windows_i686_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" -dependencies = [ - "memchr", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "zerocopy" -version = "0.7.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - -[[package]] -name = "zeroize" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] diff --git a/idea/tests/programs/Cargo.toml b/idea/tests/programs/Cargo.toml deleted file mode 100644 index 62829c08df..0000000000 --- a/idea/tests/programs/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[workspace.package] -version = "0.0.1" -authors = ["Gear Technologies"] -edition = "2021" -license = "GPL-3.0" - -[workspace] -resolver = "2" -members = [ - "ping-sails/app", - "ping-sails/wasm", -] - -[workspace.dependencies] -sails-rtl = { git = "https://github.com/gear-tech/sails" } -gstd = "1.4.1" -gwasm-builder = { package = "gear-wasm-builder", version = "1.4.1" } -sails-idl-gen = { git = "https://github.com/gear-tech/sails" } diff --git a/idea/tests/programs/ping-sails/README.md b/idea/tests/programs/ping-sails/README.md deleted file mode 100644 index 3e774330e1..0000000000 --- a/idea/tests/programs/ping-sails/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# simple ping example - - diff --git a/idea/tests/programs/ping-sails/app/Cargo.toml b/idea/tests/programs/ping-sails/app/Cargo.toml deleted file mode 100644 index 2f4a81d079..0000000000 --- a/idea/tests/programs/ping-sails/app/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "ping-app" -version = "0.1.0" -edition = "2021" - -[dependencies] -sails-rtl.workspace = true diff --git a/idea/tests/programs/ping-sails/app/src/lib.rs b/idea/tests/programs/ping-sails/app/src/lib.rs deleted file mode 100644 index edc864d21f..0000000000 --- a/idea/tests/programs/ping-sails/app/src/lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![no_std] - -use sails_rtl::gstd::gprogram; -use service::PingService; - -pub mod service; - -#[derive(Default)] -pub struct Program; - -#[gprogram] -impl Program { - pub fn new() -> Self { - Self - } - - pub fn ping(&self) -> service::PingService { - PingService::new() - } -} diff --git a/idea/tests/programs/ping-sails/app/src/service.rs b/idea/tests/programs/ping-sails/app/src/service.rs deleted file mode 100644 index 7d42493b08..0000000000 --- a/idea/tests/programs/ping-sails/app/src/service.rs +++ /dev/null @@ -1,19 +0,0 @@ -use sails_rtl::{gstd::gservice, prelude::*}; - -#[derive(Default)] -pub struct PingService {} - -#[gservice] -impl PingService { - pub fn new() -> Self { - Self {} - } - - pub fn ping(&mut self, input: String) -> Result { - if input != "ping" { - Err("Invalid input".into()) - } else { - Ok("pong".into()) - } - } -} diff --git a/idea/tests/programs/ping-sails/wasm/.binpath b/idea/tests/programs/ping-sails/wasm/.binpath deleted file mode 100644 index 54b49b32f6..0000000000 --- a/idea/tests/programs/ping-sails/wasm/.binpath +++ /dev/null @@ -1 +0,0 @@ -../../target/wasm32-unknown-unknown/release/ping \ No newline at end of file diff --git a/idea/tests/programs/ping-sails/wasm/Cargo.toml b/idea/tests/programs/ping-sails/wasm/Cargo.toml deleted file mode 100644 index 67cf85d1d5..0000000000 --- a/idea/tests/programs/ping-sails/wasm/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "ping" -version = "0.1.0" -edition = "2021" - -[dependencies] -ping-app = { path = "../app" } -sails-rtl.workspace = true - -[build-dependencies] -gwasm-builder.workspace = true -ping-app = { path = "../app" } -sails-idl-gen.workspace = true diff --git a/idea/tests/programs/ping-sails/wasm/build.rs b/idea/tests/programs/ping-sails/wasm/build.rs deleted file mode 100644 index 4e2fde89fd..0000000000 --- a/idea/tests/programs/ping-sails/wasm/build.rs +++ /dev/null @@ -1,15 +0,0 @@ -use ping_app::Program; -use sails_idl_gen::program; -use std::{env, fs::File, path::PathBuf}; - -fn main() { - gwasm_builder::build(); - - let manifest_dir_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); - - let idl_file_path = manifest_dir_path.join("ping.idl"); - - let idl_file = File::create(idl_file_path).unwrap(); - - program::generate_idl::(idl_file).unwrap(); -} diff --git a/idea/tests/programs/ping-sails/wasm/ping.idl b/idea/tests/programs/ping-sails/wasm/ping.idl deleted file mode 100644 index 9952a2b7be..0000000000 --- a/idea/tests/programs/ping-sails/wasm/ping.idl +++ /dev/null @@ -1,8 +0,0 @@ -constructor { - New : (); -}; - -service Ping { - Ping : (input: str) -> result (str, str); -}; - diff --git a/idea/tests/programs/ping-sails/wasm/src/lib.rs b/idea/tests/programs/ping-sails/wasm/src/lib.rs deleted file mode 100644 index 438939cded..0000000000 --- a/idea/tests/programs/ping-sails/wasm/src/lib.rs +++ /dev/null @@ -1,4 +0,0 @@ -#![no_std] - -#[cfg(target_arch = "wasm32")] -pub use ping_app::wasm::*; diff --git a/idea/tests/tsconfig.json b/idea/tests/tsconfig.json deleted file mode 100644 index b3ad075a1e..0000000000 --- a/idea/tests/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "esnext", - "experimentalDecorators": true, - "allowJs": true, - "module": "commonjs", - "allowSyntheticDefaultImports": true, - "baseUrl": "./src", - "outDir": "./dist", - "esModuleInterop": true, - "moduleResolution": "Node", - "resolveJsonModule": true, - "pretty": true, - "skipLibCheck": true, - "emitDecoratorMetadata": true - } -} diff --git a/idea/tests/wasm-test/app.opt.wasm b/idea/tests/wasm-test/app.opt.wasm deleted file mode 100644 index ae6a13078ab542147b0b14a3345d5a02fe3f703e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14312 zcmeI3U5s5S>^RB9laPH+{9sE-aa9z%;cL!Fv2jDNRUz6wB_?q` z?saTtVjMtW#=&;vNNE9ywp5@dpcYeTR4R&8`W3gL5>+b{N)ag!B~57`+6SnLL|Ovw z@4xmvcgA*tLR%hMbrR3{+I#J_*Iw(tKK34W=)niPbIv#Aoqo;T>D--RjcdNfkK>hJ zyEEgK3-_ybZ%ug7S>>l~>(|05-_H&oJyG1da>vTycN}@Q%kFe9Ecdpzu`6`OyIfG?Sssradtma)>s9xG z!w(!=d3SJ|vsYc$>3Ekr??X3u-wXX-@I~gjF3c3JlXv_(e4cmvOs6?{^1Lg1yF0}L zhmRk+@6dzyxtaX_qxTo&h?=K1k;pY@r<<=3JgcEVx|&D`zzVst}4>&xgG7u~qYmg{UZ%wv|m zWQ)8LG0?%sFdBx-h6$;qE1wR%#B}>xjMsU~dbo`B&V=>AEW6MRv3rwq znn9Nt47*I5iG#xGpr29-Kg)$&BhulE`7O*SI$iG(Q@2na0pJnooAT?vI=K zWkl885u6RxiQU*g5k1d!H|EDzG<9!%5DXINM4Oj*HnJ{eLl2J~>+>?L%UDQWuo+>H zuHq_0IFW#v=45(WpdsQ+)5}@`{$!BkZg9=6aqYIV#?372*tlkURctc_Yhr^+RQj}Q zwB3~-_8uK^&9~oo-rdgi{3GYxf#q8n)iuSqnym(NC1Oe+_6|_7p%07gf0OqNM&nKW z4#e~moK)<*+dBwczs)r(n+~eSC2$F4gDj9tlQTyf+kP>*W;ObUmRZ5_b6KmwZb!(` zK5uM==3UD}A6?|FV_?4N4Qm+|n-4sCUazCuXA^ilJ?>>mU3G(oJwSZcv1=@84xQ5IM#sa&a}>YEM%x!*NDvw~ zH9yVWbnhWU0E61VrXX zXk>mM=ZR-b7MlrcDC>t9ij}Cttpm3$)5lPoogsqT1{kCXX%yYLYrG*qG*GFRzoqs_Gt$PcNuZG)V zFJEi607+6hW3|~j<{mw7wyc!H8NDoqd0347raDo>5SPY}>kdKy4R~Q{UWH+wi2(>M z_HVW2En}w&+mK5Pre;D80DJ^1&|#$tI&4WgwRP0=l7`HVBDxMvHO0slA!ZA-D*#BX zyDd`>t=5oVT$rHV}N_mE9Oe0ZThD5?Kai^ zf#0|UQ_G23rMp0JyEth^-g!c-`C1Wah_bNVbQjxp){cV zFZNRpw;yr1p>Q-ZPc*}bo0UO=A*!59kp`%)Qm+D|=n0j%pOpv5(cl8j#gh6cn4CDc zhyMhEq}>JDh89$%Mk&++xy4|kJ>!_flG~kWUSH%Pv=58px;weoWinx3VRJaY=yqnV z&QiY}sJLa z^4Fi(zB_vpkB|NB=b!(jul&ic7P~RfeCe5gc=4}3e)>zNe`8Ij?;Z z=*cq5jy7iR8E%52e{am_k4nvt(9{8nzv*0)orq3N$90LtkA?*%GTX%AjB(bNepj*3 z<%+$GirJ}ip-T~G1oATzAg|&TXDt-(Mx!Svb4$c+rov19VJ4Zy&f9QZhS&Cf zQw&c%TyKe+-l}guzfgw-sk8cRiFPk*!Z>%jon{?o7D#Njdt>xTcpHUOOF&IAbS7Ik z^)}cLInz8S2%z&NJtkad?=hJWCeY4}Zge2qTV%&fU}Fz!Hk7Y1AOuMbIlCi7r2r66 zb;BM|7RUAMcGrSYBZL&}R!FcG+(Mv5-vNul+dhlZ^p5aQ>|dy_Xgo^L61)3p_V1AD9azC<7Qu^JC&T4O*( z`b6j^A$i#3Xe7eU_U z;1TA=ax=F=%g(i$T<7gN3&=??W_M;4K*weN$ABIG>wxZDT`Bjx+)y@{7MUM9f?Ox2 z)qCk47n>Hy?iGqzrMe z7rw|!NTB8MU8%Ir4c$~dyV;@)6U0m@8)4}ILo6w&I&k)5ICa!b@F_hjX!<$P4ru&SZ;PJ0jsY1Exv=rOanM49tm3k98>G z++_AMkff^dmJPEX+w5m9o4rP)E+R;qVd6;yGYG>fCQOQs8XTRl@Xp9eJ<5@NTkkI6 zO$4!_PsuVcQ#27hV0q9A)^}VEwJ^-gL0~dtH<>Z6WI{kQmKOwv(P=4@SM#``rB+DV zj>IMK;mi>SB5qBlF;;kXaT_z(8)_9Gt{s0m~E#ygmd0Sv|?TfrbS0ibj&Um)QITueSsj zWB5qmKY7;^?r%1@mubu-j*Qkt&7)pXV~{71iJ;n;NF1Q|B(=(8;}x+QD;DWmf-V!X zEK9-oQt#|~G=3^(OBa6d{qKGETi3@`(ep z&jAKPvh60xHd0Zt9f`uJd$zucDsLMmhDi3%|KYmPzdY!DsU8vliZ%&)@oDQp@0$RH zmkWAXHxxl7UZ(EjRp*)u4o8z#k97*ID(IDkylvczm=Lpx#eM;l=6xl6p_0Ni)`!q` z$0%jQZprV?A|sO4%C&4JKPSt@@$xXQ2lvMGKxyC_V zy~1Qa%%sOe0?Ig0*J@#y@iFj}iI=Q#3ca_f{E(^8pf*x9QFPkWU|0*U%RltUN4LCb zOS%@OEb2EMKONqzf+lz0bX3Gc;D7y?p?uMgH*w$72>+JRkn3-U@uo6g|H%k@c>SGh zys2Y9*7MnX?|_X1l_~cP@Q|}b+4$KW)e+g2Z{E-A96vbAuUzq1N7Y-ji1}?Rn{J6B zl)u@{tRS?C#8_-)#_o)kYG+oEviLK#SJl9;R}Hvrs|LDVuNwFbRRh1FYT&0;14yMx zgcD7YytcZ*ZA(+P>ona4nr;J4H>C+Ft3-IKMEuVaJ|j`g*Jz!R7Pl0C1c|(2?w9`h zkxzZ()Bo|lubo?4WsDz#aGw46m%sIAzx9t#-?VyW>8T%l^_zcl=KG&~)~!Cg^yFVY z{mZ}hxsN?D^DrS!M@yf@?vF6X|D&sZX6fq3V((#Hc4t+2I^=Ct6%-EC+bw3*ucG$K zK2rT5OZ5lZuxrYWCjo4OmjS-m=kUj|D9nuXf1$Pl=TvFsyf3g;jwq zxH`qN%>18CM*E8zl8rFw1L<8<+YY{@C_fvDRtl5rD${<33bJbG+UOKc+h%4#`77XA z7}wcOBUQAFqDjs+V^C5Vc7z?(RZNFCI#=3Yd8(+=S4n>{p7{Ant!uVTyxDR zW|JYcL#m*pqM78Lo+(S4WW~JgX+!E3mpAM(TO=cYs2wS$(XmQ2g3)g3-_2aTL1@#` zyS>{`isw0%<|Wca!ZK-6>&t5@;M4F#MMvegDw7d2Z75mR9jbAevapjG*_j1aEQjPx z2i0mXX>CD?`SxDySe>nn3W(}jc{{X&#kGVY1qM{cwN)o^DNu;s?kf1j?Xt-Iq~1B| z-EBVg)lXfC87Mb8!a6&PcA8J~c0YL`+uD9-7KgJ?+%aNG6m+wEO=eInP?Tp+5rI-N zQe>hgaiB4^kQI7C2Ya;eL@c$>+Po0U?K6v}4Ts6IlacKa=QoGfaG^N1O9fXlTrHmp zxSdl-PJ;|>iIM7mNw`EMmq@nNGO<(7G0`Mwr|^g=Rc6=|O;iE7-prdMY}(-BDc_;0 zCbMiRGi-KO?8=6;i9gH|9Qg?xsYFbuU$8dCf&$7yz{H6HAp^Po@p=k}qmq1dLl8yoP7|S&!B2})#8ie--gY*mH=vYuuvJfBJfTz;p&(DA zy+EOq)J?o(>nKGSMjaw%QpeXbXEeQf-|XsZozTvBX#ejk{#;{ZvT;iCgw4;tDD-wp~Y> ze5G;hnK_9tt5dZ*xbdYAzH(uowL+MYBS z2I@ARxrN3@tRh=(&i?)5oV7X8yx^AE8(0xvIJ(=Y+Us}>v(HwPd7b>&Gbn>Kv-2_} zg|qC?=-iVaPFm!fPD+C--neF448hjoAg6I46I}}RM*o84pBv^LEgOJmzDMdY5Q$^3=p?(dd0Do zjp6ux0Mkp1=q?_S z$21~Jdhv+abi@tfN}_@+%WS8j5V}gDQ=#c(44zgR&noO66jPybIBzO6jO{X^sgKgZ zRy)`$?=;sBI}J`o%7Cu1_ax}a8XBP_{#~X~BH;jht6?HCBCrl?`9`aMy z@X4PTH`gyi5z6}(jt|K|wWq{FO_WN(F11ubRc1xJs`E1*jq28!ZP{hoj`GQ>`L2eP znVaiQH2LxfFg6R=x1bLTjLOadgG6sI4Cg2!nQg)}JBzhp;VdHC@XT4L)z~>6i&PU9 zr;n~k6N@7V5$cg9`4Pj58n>tInq@MO-Sg%Et$mnf_%a zGcgz2Tf|6S&Rong*@LrFMH}W7P|&crJ{)<-^duXy5AEp~71?N|BSx}>#~)4jvi=r1 z>Rbgf6~X4iG@#_fGU-k=91!m07jyvQNnX_HES(H!T-DSPbcBxOvh|*h2|P&>Pn={Y zgFxy;<>|hr1OzNPUQ1GDf;vuB)kD{ITnFgd(0W3A*lqbXRqJT26jj)AIjx6|M!`Qs zGdpoan!ub*?gBogDUsq5%aBkHqptR|Jl)$@7*oR-+87_{)Kee^%;fKFZ99rcI@JyG zvCI`0KTIdRJU%Mm;^e9leqgxOKW>+gQ>`Nu!; zrC%ujAavFfU75kW4l0I4=<+aI`;?t*MgJVApN?;4DH`F}mcYlxQ#}A}mn-!aj4B8B z^dUaa0A36~Q&x+ogo>pwA%$fmYX$?As>4B!0*{A0v{W2UbS*E}0z_?~WCRp1urvfZ zI^V|eK~8JRhnmen3##eKnM-Z`Dk>Pvvt#)9ZY4#`w5qXWo{6KWL#QV)v}P<5)aE$a zO6g$|$=c`gquGY~Qgbrk5b)RFE0uYusK}fAwZ~tREa9)SFMc9r!|`-BD0K+ggE>;8J}mAR02(X?4r*K zmQwgfA%ATeLc=GYvJ*sEnz0~tJr<10q99np8!mQ|_lOl6MHd#eD4)-|>zeIBZ^0rF zkapQSjB9^Q0i&kiXtCLnwrg-Xk|7ubCZtxanWJ(oF6qRuPu7d1C)O*46Q^eD_F9l; zdWb&WDs@fS2s{!2GMHID+eB!4zzJf-r`kqhAfhldjS|=MgUQKkHOQ4F;$E=EkP;-WDJ`0CbyiuE zW+RqSk^tVw7+XF#XzfxQ$Y`0eNHw(D?g%-Hu&^7D*71sqK1-988UiHIFX$U}o}!f} z;FmAj2HM6>Yyoa3`1=s+VQ^%w2pnP@6qZ*4XHnuPzZ?YG&%-d4ya_XmG5m5%WMU$& ze7pVOOIS4BVwU=o1l%vw_`533wRlFpzEsR+-boh@A!{^*oV*W0(z$cx<1L~H^TCsp z(EXyYacfV4FGuZRaf@4X{XKkv%l@gKeG>u)`G-HXq^|BJ7B=H7pK=$&ua{Lg1z z|EkZu?T>%z`&T^n_Ghk2cIfUK3VD>+8@uwdsdD;5bsQXhPGqpo$LKl%Xmpc`!hA#X+ diff --git a/idea/voucher-indexer/.gitignore b/idea/voucher-indexer/.gitignore deleted file mode 100644 index 79667bb5c9..0000000000 --- a/idea/voucher-indexer/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -/node_modules -/lib -/builds - -/**Versions.json -/**Versions.jsonl - -# IDE files -/.idea -.env diff --git a/idea/voucher-indexer/Dockerfile b/idea/voucher-indexer/Dockerfile deleted file mode 100644 index b594322a51..0000000000 --- a/idea/voucher-indexer/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM node:20-alpine - -WORKDIR /src - -COPY package.json . -COPY yarn.lock . -COPY tsconfig.json . -COPY .yarn .yarn -COPY .yarnrc.yml . -COPY ./idea/common idea/common -COPY ./idea/voucher-indexer idea/voucher-indexer - -RUN yarn install - -RUN yarn build:common -RUN yarn build:voucher-indexer - -WORKDIR /src/idea/voucher-indexer - -CMD ["node", "lib/main.js"] diff --git a/idea/voucher-indexer/README.md b/idea/voucher-indexer/README.md deleted file mode 100644 index ffb2cb5912..0000000000 --- a/idea/voucher-indexer/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# @gear-js/voucher-indexer - -# API - -This document describes the API of the `@gear-js/voucher-indexer` service. - -## Overview - -## Endpoints - -### GET /api/voucher/:id - -Get a voucher by its ID. - -#### Request - -- **id** (string): The ID of the voucher. - -#### Response - -- **200**: The voucher was found. -- **404**: The voucher was not found. - -```json -{ - "id": "0x123", - "owner": "0x456", - "spender": "0x789", - "amount": "11000000000000", - "balance": "10000000000000", - "programs": ["0xabc", "0xdef"], - "codeUploading": false, - "expiryAtBlock": 1000, - "expiryAt": "2021-01-01T00:00:00Z", - "issuedAtBlock": 100, - "issuedAt": "2020-01-01T00:00:00Z", - "updatedAtBlock": 200, - "updatedAt": "2020-01-02T00:00:00Z", - "isDeclined": false -} -``` - -### POST /api/vouchers - -Get a list of vouchers. - -#### Request - -- **owner** (string): The owner of the vouchers. -- **spender** (string): The spender of the vouchers. -- **programs** (string[]): The programs of the vouchers. -- **codeUploading** (boolean): Whether the vouchers are in code uploading state. -- **declined** (boolean): Whether the vouchers are declined. -- **expired** (boolean): Whether the vouchers are expired. -- **limit** (number): The maximum number of vouchers to return. -- **offset** (number): The offset of the vouchers to return. - -#### Response - -- **200**: The vouchers were found. - -```json -{ - "vouchers": [ - { - "id": "0x123", - "owner": "0x456", - "spender": "0x789", - "amount": "11000000000000", - "balance": "10000000000000", - "programs": ["0xabc", "0xdef"], - "codeUploading": false, - "expiryAtBlock": 1000, - "expiryAt": "2021-01-01T00:00:00Z", - "issuedAtBlock": 100, - "issuedAt": "2020-01-01T00:00:00Z", - "updatedAtBlock": 200, - "updatedAt": "2020-01-02T00:00:00Z", - "isDeclined": false - } - ], - "count": 1 -} -``` diff --git a/idea/voucher-indexer/package.json b/idea/voucher-indexer/package.json deleted file mode 100644 index bb187985d7..0000000000 --- a/idea/voucher-indexer/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@gear-js/voucher-indexer", - "private": true, - "engines": { - "node": ">=16" - }, - "scripts": { - "build": "rm -rf lib && tsc", - "dev": "clear && ts-node src/main.ts", - "start": "node lib/main.js" - }, - "dependencies": { - "@gear-js/common": "workspace:^", - "@subsquid/archive-registry": "^3.3.0", - "@subsquid/graphql-server": "^4.5.0", - "@subsquid/ss58": "^2.0.2", - "@subsquid/substrate-processor": "^8.1.1", - "@subsquid/substrate-runtime": "^1.0.3", - "@subsquid/typeorm-migration": "^1.3.0", - "@subsquid/typeorm-store": "^1.2.6", - "dotenv": "^16.4.4", - "express": "^4.19.1", - "pg": "8.11.3", - "ts-node": "^10.9.2", - "typeorm": "^0.3.20" - }, - "devDependencies": { - "@subsquid/substrate-metadata-explorer": "^3.1.2", - "@subsquid/substrate-typegen": "^8.0.2", - "@subsquid/typeorm-codegen": "^1.3.3", - "@types/express": "^4.17.21", - "@types/node": "^20.11.17", - "ts-node-dev": "^2.0.0", - "typescript": "^5.3.3" - } -} diff --git a/idea/voucher-indexer/src/common/enum.ts b/idea/voucher-indexer/src/common/enum.ts deleted file mode 100644 index 78cfd4428d..0000000000 --- a/idea/voucher-indexer/src/common/enum.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum EventName { - VoucherIssued = 'GearVoucher.VoucherIssued', - VoucherUpdated = 'GearVoucher.VoucherUpdated', - VoucherRevoked = 'GearVoucher.VoucherRevoked', - VoucherDeclined = 'GearVoucher.VoucherDeclined', - Transfer = 'Balances.Transfer', -} diff --git a/idea/voucher-indexer/src/common/index.ts b/idea/voucher-indexer/src/common/index.ts deleted file mode 100644 index bdd505d9ca..0000000000 --- a/idea/voucher-indexer/src/common/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './enum'; diff --git a/idea/voucher-indexer/src/config.ts b/idea/voucher-indexer/src/config.ts deleted file mode 100644 index 2c6e2688e8..0000000000 --- a/idea/voucher-indexer/src/config.ts +++ /dev/null @@ -1,27 +0,0 @@ -import * as dotenv from 'dotenv'; -import assert from 'assert/strict'; - -dotenv.config(); - -const getEnv = (name: string, defaultValue: string) => { - const value = process.env[name] || defaultValue; - - assert.notStrictEqual(value, undefined, `Environment variable ${name} is not set`); - - return value as string; -}; - -export const config = { - network: { - archive: getEnv('SQUID_ARCHIVE', 'vara'), - rpcEndpoint: getEnv('RPC_ENDPOINT', 'http://localhost:9944'), - fromBlock: Number(getEnv('FROM_BLOCK', '0')), - }, - db: { - host: getEnv('DB_HOST', 'localhost'), - port: Number(getEnv('DB_PORT', '5432')), - user: getEnv('DB_USER', 'postgres'), - password: getEnv('DB_PASS', 'password'), - database: getEnv('DB_NAME', 'voucher_indexer'), - }, -}; diff --git a/idea/voucher-indexer/src/main.ts b/idea/voucher-indexer/src/main.ts deleted file mode 100644 index 4b33311330..0000000000 --- a/idea/voucher-indexer/src/main.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { runProcessor } from './processor'; -import { Server } from './server'; -import { VoucherService } from './service'; - -const main = async () => { - const voucherService = new VoucherService(); - await voucherService.init(); - - const server = new Server(voucherService); - - server.start(); - - runProcessor(); -}; - -main().catch((error) => { - console.log(error); - process.exit(1); -}); diff --git a/idea/voucher-indexer/src/model/index.ts b/idea/voucher-indexer/src/model/index.ts deleted file mode 100644 index f7c9c6da0f..0000000000 --- a/idea/voucher-indexer/src/model/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './voucher.model'; diff --git a/idea/voucher-indexer/src/model/voucher.model.ts b/idea/voucher-indexer/src/model/voucher.model.ts deleted file mode 100644 index ae9c9df2df..0000000000 --- a/idea/voucher-indexer/src/model/voucher.model.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Column, Entity, PrimaryColumn } from 'typeorm'; - -@Entity() -export class Voucher { - constructor(props?: Voucher) { - Object.assign(this, props); - } - - @PrimaryColumn() - id!: string; - - @Column() - owner!: string; - - @Column() - spender!: string; - - @Column('bigint') - amount!: bigint; - - @Column('bigint') - balance!: bigint; - - @Column('jsonb', { default: [] }) - programs?: string[]; - - @Column({ name: 'code_uploading' }) - codeUploading!: boolean; - - @Column('bigint', { name: 'duration' }) - expiryAtBlock!: bigint; - - @Column('timestamp without time zone', { name: 'expiry_at' }) - expiryAt!: Date; - - @Column('bigint', { name: 'issued_at_block' }) - issuedAtBlock!: bigint; - - @Column('timestamp without time zone', { name: 'issued_at' }) - issuedAt!: Date; - - @Column('bigint', { name: 'updated_at_block' }) - updatedAtBlock!: bigint; - - @Column('timestamp without time zone', { name: 'created_at' }) - updatedAt!: Date; - - @Column({ name: 'is_declined', default: false }) - isDeclined?: boolean; -} diff --git a/idea/voucher-indexer/src/processor.ts b/idea/voucher-indexer/src/processor.ts deleted file mode 100644 index 6c24d8fb9a..0000000000 --- a/idea/voucher-indexer/src/processor.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { lookupArchive } from '@subsquid/archive-registry'; -import { - BlockHeader, - DataHandlerContext, - SubstrateBatchProcessor, - SubstrateBatchProcessorFields, - Event as _Event, - Call as _Call, - Extrinsic as _Extrinsic, -} from '@subsquid/substrate-processor'; -import { config } from './config'; -import { EventName } from './common'; -import { BatchState } from './state'; -import { TypeormDatabase } from '@subsquid/typeorm-store'; - -export const processor = new SubstrateBatchProcessor() - .setGateway(lookupArchive(config.network.archive, { release: 'ArrowSquid' })) - .setRpcEndpoint({ - url: config.network.rpcEndpoint, - rateLimit: 40, - }) - .addEvent({ - name: Object.values(EventName), - call: true, - }) - .setFields({ - event: { - args: true, - name: true, - }, - call: { - args: true, - }, - block: { - timestamp: true, - }, - }) - .setBlockRange({ from: config.network.fromBlock }); - -export type Fields = SubstrateBatchProcessorFields; -export type Block = BlockHeader; -export type Event = _Event; -export type Call = _Call; -export type Extrinsic = _Extrinsic; -export type ProcessorContext = DataHandlerContext; - -const VOUCHERS_FROM_SPEC_VERSION = 1100; - -const state = new BatchState(); - -export const runProcessor = () => - processor.run(new TypeormDatabase(), async (ctx) => { - state.new(ctx.store); - - for (const block of ctx.blocks) { - if (block.events.length === 0) continue; - if (block.header.specVersion < VOUCHERS_FROM_SPEC_VERSION) continue; - - for (const e of block.events) { - switch (e.name) { - case EventName.VoucherIssued: { - state.issued(e.args, e.call!.args, block.header); - break; - } - case EventName.VoucherUpdated: { - await state.updated(e.args, e.call!.args, block.header); - break; - } - case EventName.VoucherDeclined: { - await state.declined(e.args, block.header); - break; - } - case EventName.VoucherRevoked: { - await state.revoked(e.args, block.header); - break; - } - case EventName.Transfer: { - state.transfer(e.args); - break; - } - } - } - } - - await state.save(); - }); diff --git a/idea/voucher-indexer/src/server.ts b/idea/voucher-indexer/src/server.ts deleted file mode 100644 index 4ec36cb4cb..0000000000 --- a/idea/voucher-indexer/src/server.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { logger } from '@gear-js/common'; -import express, { Express } from 'express'; - -import { VoucherService } from './service'; - -export class Server { - private _app: Express; - - constructor(private _service: VoucherService) { - this._app = express(); - this._app.use(express.json()); - } - - public start() { - this._app - .get('/api/voucher/:id', async (req, res) => { - try { - const voucher = await this._service.getVoucher(req.params.id); - res.json(voucher); - } catch (error) { - logger.error('Failed to get voucher', { id: req.params.id, error: error.message, stack: error.stack }); - res.status(500).json({ error: 'Internal server error' }); - } - }) - .post('/api/vouchers', async (req, res) => { - try { - const vouchers = await this._service.getVouchers(req.body); - res.json(vouchers); - } catch (error) { - console.error('Failed to get vouchers', { req: req.body, error: error.message, stack: error.stack }); - res.status(500).json({ error: 'Internal server error' }); - } - }); - - this._app.listen(3000, () => { - logger.info(`Server started on port 3000`); - }); - } -} diff --git a/idea/voucher-indexer/src/service.ts b/idea/voucher-indexer/src/service.ts deleted file mode 100644 index 6779492145..0000000000 --- a/idea/voucher-indexer/src/service.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { DataSource, Repository } from 'typeorm'; -import { config } from './config'; -import { Voucher } from './model'; - -interface GetVouchersParams extends Partial> { - declined?: boolean; - expired?: boolean; - includeAllPrograms?: boolean; - limit?: number; - offset?: number; -} - -const dataSource = new DataSource({ - type: 'postgres', - host: config.db.host, - port: config.db.port, - username: config.db.user, - database: config.db.database, - password: config.db.password, - synchronize: true, - entities: [Voucher], - logging: ['error'], -}); - -export class VoucherService { - private _repo: Repository; - - async init() { - await dataSource.initialize(); - this._repo = dataSource.getRepository(Voucher); - } - - public getVoucher(id: string) { - return this._repo.findOneBy({ id }); - } - - public async getVouchers({ - id, - owner, - spender, - declined, - codeUploading, - programs, - limit, - offset, - expired, - includeAllPrograms, - }: GetVouchersParams) { - const qb = this._repo.createQueryBuilder('v'); - - if (id) { - if (id.length === 66) { - qb.andWhere('v.id = :id', { id }); - } else { - qb.andWhere('v.id LIKE :id', { id: `%${id}%` }); - } - } - - if (declined !== undefined) { - qb.andWhere('v.isDeclined = :declined', { declined }); - } - - if (codeUploading !== undefined) { - qb.andWhere('v.codeUploading = :codeUploading', { codeUploading }); - } - - if (programs || includeAllPrograms) { - const params: Record = {}; - - const conditions = - programs?.map((_, i) => { - params[`p${i}`] = programs[i]; - return `v.programs::jsonb ? :p${i}`; - }) || []; - - if (includeAllPrograms) { - conditions.push(`jsonb_array_length(v.programs) = 0`); - } - - qb.andWhere(`(${conditions.join(' OR ')})`, params); - } - - if (expired !== undefined) { - const now = new Date(); - if (expired) { - qb.andWhere('v.expiryAt < :now', { now }); - } else { - qb.andWhere('v.expiryAt >= :now', { now }); - } - } - - if (owner && spender) { - qb.andWhere('(v.owner = :owner OR v.spender = :spender)', { owner, spender }); - } else if (owner) { - qb.andWhere('v.owner = :owner', { owner }); - } else if (spender) { - qb.andWhere('v.spender = :spender', { spender }); - } - - qb.limit(limit || 20); - qb.offset(offset || 0); - qb.orderBy('v.issuedAt', 'DESC'); - - const [vouchers, count] = await qb.getManyAndCount(); - - return { - vouchers, - count, - }; - } -} diff --git a/idea/voucher-indexer/src/state.ts b/idea/voucher-indexer/src/state.ts deleted file mode 100644 index 16f751805c..0000000000 --- a/idea/voucher-indexer/src/state.ts +++ /dev/null @@ -1,179 +0,0 @@ -import { Store } from '@subsquid/typeorm-store'; -import { Voucher } from './model'; -import { Block } from './processor'; -import { - BalanceTransferArgs, - IssueVoucherTxArgs, - UpdateVoucherTxArgs, - VoucherIssuedArgs, - VoucherUpdatedArgs, -} from './types'; -import { logger } from '@gear-js/common'; -import { In } from 'typeorm'; - -export class BatchState { - private _vouchers: Map; - private _revoked: Set; - private _store: Store; - private _transfers: Map; - - constructor() { - this._vouchers = new Map(); - this._revoked = new Set(); - this._transfers = new Map(); - } - - public new(store: Store) { - this._vouchers.clear(); - this._revoked.clear(); - this._transfers.clear(); - this._store = store; - } - - public issued(event: VoucherIssuedArgs, tx: IssueVoucherTxArgs, block: Block) { - logger.info(`Voucher issued`, { id: event.voucherId, block: block.height }); - const balance = BigInt(tx.balance); - const atBlock = BigInt(block.height); - const atTime = new Date(block.timestamp!); - - this._vouchers.set( - event.voucherId, - new Voucher({ - id: event.voucherId, - owner: event.owner, - spender: event.spender, - amount: balance, - balance: BigInt(0), // it will be set by transfer event - programs: tx.programs, - codeUploading: tx.codeUploading, - expiryAtBlock: atBlock + BigInt(tx.duration), - expiryAt: new Date(block.timestamp! + tx.duration * 3000), - issuedAtBlock: atBlock, - issuedAt: atTime, - updatedAtBlock: atBlock, - updatedAt: atTime, - }), - ); - } - - public async updated(event: VoucherUpdatedArgs, tx: UpdateVoucherTxArgs, block: Block) { - logger.info(`Voucher updated`, { id: event.voucherId, block: block.height }); - const atBlock = BigInt(block.height); - const atTime = new Date(block.timestamp!); - - const voucher = await this._getVoucher(event.voucherId); - - if (!voucher) { - return; - } - - voucher.updatedAtBlock = atBlock; - voucher.updatedAt = atTime; - - if (tx.moveOwnership) { - voucher.owner = tx.moveOwnership; - } - - if (tx.balanceTopUp) { - voucher.amount = BigInt(voucher.amount) + BigInt(tx.balanceTopUp); - } - - if (tx.appendPrograms.__kind === 'Some') { - voucher.programs!.push(...tx.appendPrograms.value); - } - - if (tx.codeUploading) { - voucher.codeUploading = tx.codeUploading; - } - - if (tx.prolongDuration) { - voucher.expiryAtBlock = atBlock + BigInt(tx.prolongDuration); - voucher.expiryAt = new Date(block.timestamp! + tx.prolongDuration * 3000); - } - } - - public async declined(event: VoucherUpdatedArgs, block: Block) { - logger.info(`Voucher declined`, { id: event.voucherId, block: block.height }); - const voucher = await this._getVoucher(event.voucherId); - - if (!voucher) { - return; - } - - voucher.isDeclined = true; - } - - public async revoked(event: VoucherUpdatedArgs, block: Block) { - logger.info(`Voucher revoked`, { id: event.voucherId, block: block.height }); - - this._revoked.add(event.voucherId); - } - - public transfer(event: BalanceTransferArgs) { - const fromBalance = this._transfers.has(event.from) ? this._transfers.get(event.from)! : BigInt(0); - const toBalance = this._transfers.has(event.to) ? this._transfers.get(event.to)! : BigInt(0); - - this._transfers.set(event.from, fromBalance - BigInt(event.amount)); - this._transfers.set(event.to, toBalance + BigInt(event.amount)); - } - - private async _getVoucher(id: string): Promise { - if (this._vouchers.has(id)) { - return this._vouchers.get(id)!; - } - - const voucher = await this._store.findOneBy(Voucher, { id }); - - if (!voucher) { - return null; - } - - voucher.balance = BigInt(voucher.balance); - - this._vouchers.set(id, voucher); - - return voucher; - } - - async save() { - if (this._vouchers.size > 0) { - const voucherIds = Array.from(this._vouchers.keys()); - - for (const id of voucherIds) { - if (this._transfers.has(id)) { - this._vouchers.get(id)!.balance += this._transfers.get(id)!; - this._transfers.delete(id); - } - if (this._revoked.has(id)) { - this._vouchers.delete(id); - this._revoked.delete(id); - } - } - - const vouchers = Array.from(this._vouchers.values()); - await this._store.upsert(vouchers); - logger.info(`Vouchers saved`, { size: this._vouchers.size }); - } - - if (this._revoked.size > 0) { - const revoked = Array.from(this._revoked); - await this._store.remove(Voucher, revoked); - logger.info(`Vouchers removed`, { size: this._revoked.size }); - } - - const trasnferIds = Array.from(this._transfers.keys()); - if (trasnferIds.length > 0) { - const voucherTransfers = await this._store.find(Voucher, { where: { id: In(trasnferIds) } }); - - if (voucherTransfers.length > 0) { - for (const voucher of voucherTransfers) { - const balance = this._transfers.get(voucher.id)!; - voucher.balance = BigInt(voucher.balance) + balance; - } - - await this._store.upsert(voucherTransfers); - logger.info(`Transfers saved`, { size: voucherTransfers.length }); - } - } - } -} diff --git a/idea/voucher-indexer/src/types/call.ts b/idea/voucher-indexer/src/types/call.ts deleted file mode 100644 index a20e6b26ba..0000000000 --- a/idea/voucher-indexer/src/types/call.ts +++ /dev/null @@ -1,17 +0,0 @@ -export interface IssueVoucherTxArgs { - spender: string; - balance: string; - programs: string[]; - codeUploading: boolean; - duration: number; -} - -export interface UpdateVoucherTxArgs { - spender: string; - voucherId: string; - moveOwnership?: string; - balanceTopUp?: string; - appendPrograms: { __kind: 'None' | 'Some'; value: string[] }; - codeUploading?: boolean; - prolongDuration?: number; -} diff --git a/idea/voucher-indexer/src/types/event.ts b/idea/voucher-indexer/src/types/event.ts deleted file mode 100644 index 4d3f1e81cc..0000000000 --- a/idea/voucher-indexer/src/types/event.ts +++ /dev/null @@ -1,17 +0,0 @@ -export interface VoucherIssuedArgs { - owner: string; - spender: string; - voucherId: string; -} - -export interface VoucherUpdatedArgs extends Omit {} - -export interface VoucherDeclinedArgs extends VoucherUpdatedArgs {} - -export interface VoucherRevokedArgs extends VoucherUpdatedArgs {} - -export interface BalanceTransferArgs { - from: string; - to: string; - amount: string; -} diff --git a/idea/voucher-indexer/src/types/index.ts b/idea/voucher-indexer/src/types/index.ts deleted file mode 100644 index 3d631980fd..0000000000 --- a/idea/voucher-indexer/src/types/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './event'; -export * from './call' \ No newline at end of file diff --git a/idea/voucher-indexer/tsconfig.json b/idea/voucher-indexer/tsconfig.json deleted file mode 100644 index 53a4699702..0000000000 --- a/idea/voucher-indexer/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es2020", - "outDir": "lib", - "rootDir": "src", - "strict": true, - "declaration": false, - "sourceMap": true, - "esModuleInterop": true, - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "skipLibCheck": true, - "strictPropertyInitialization": false, - "useUnknownInCatchVariables": false - }, - "include": ["src"], - "exclude": ["node_modules"] -} diff --git a/k8s/gear-node/Dockerfile b/k8s/gear-node/Dockerfile deleted file mode 100644 index 62bcf72674..0000000000 --- a/k8s/gear-node/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:22.04 -MAINTAINER GEAR -WORKDIR opt -RUN apt update -RUN apt install wget -y -RUN apt install xz-utils -y -RUN wget https://get.gear.rs/gear-nightly-x86_64-unknown-linux-gnu.tar.xz -RUN tar -xvf gear-nightly-x86_64-unknown-linux-gnu.tar.xz -RUN chmod +x gear - -CMD ["/opt/gear", "--dev", "--tmp", "--unsafe-rpc-external", "--rpc-methods", "Unsafe", "--rpc-cors", "all"] diff --git a/k8s/staging-env/api-gateway/api-gateway.yaml b/k8s/staging-env/api-gateway/api-gateway.yaml deleted file mode 100644 index 3d49fb7b71..0000000000 --- a/k8s/staging-env/api-gateway/api-gateway.yaml +++ /dev/null @@ -1,56 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: api-gateway - labels: - app: api-gateway -spec: - replicas: 1 - selector: - matchLabels: - app: api-gateway - template: - metadata: - labels: - app: api-gateway - spec: - containers: - - name: api-gateway - image: ghcr.io/gear-tech/gear-js-api-gateway:dev - ports: - - containerPort: 3000 - env: - - name: KAFKA_CLIENT_ID - value: gear-data-storage - - name: KAFKA_GROUP_ID - value: gear-main - - name: KAFKA_BROKERS - value: kafka-cluster:9094 - - name: KAFKA_SASL_USERNAME - valueFrom: - secretKeyRef: - name: kafka-secrets - key: username - - name: KAFKA_SASL_PASSWORD - valueFrom: - secretKeyRef: - name: kafka-secrets - key: password - imagePullPolicy: Always - ---- -apiVersion: v1 -kind: Service -metadata: - name: api-gateway - namespace: dev-1 - labels: - app: api-gateway -spec: - ports: - - port: 3000 - name: api-gateway - selector: - app: api-gateway - diff --git a/k8s/staging-env/data-storage/data-storage-testnet.yaml b/k8s/staging-env/data-storage/data-storage-testnet.yaml deleted file mode 100644 index 8600d3f511..0000000000 --- a/k8s/staging-env/data-storage/data-storage-testnet.yaml +++ /dev/null @@ -1,58 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: data-storage-testnet - labels: - app: data-storage-testnet -spec: - replicas: 1 - selector: - matchLabels: - app: data-storage-testnet - template: - metadata: - labels: - app: data-storage-testnet - spec: - containers: - - name: data-storage-testnet - image: ghcr.io/gear-tech/gear-js-data-storage:dev - env: - - name: DB_NAME - valueFrom: - secretKeyRef: - name: pg-secrets - key: db - - name: DB_USER - valueFrom: - secretKeyRef: - name: pg-secrets - key: user - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: pg-secrets - key: password - - name: DB_HOST - value: postgres - - name: KAFKA_CLIENT_ID - value: gear-data-storage - - name: KAFKA_GROUP_ID - value: gear-main - - name: KAFKA_BROKERS - value: kafka-cluster:9094 - - name: KAFKA_SASL_USERNAME - valueFrom: - secretKeyRef: - name: kafka-secrets - key: username - - name: KAFKA_SASL_PASSWORD - valueFrom: - secretKeyRef: - name: kafka-secrets - key: password - - name: GEAR_WS_PROVIDER - value: wss://rpc-node.gear-tech.io:443 - imagePullPolicy: Always - diff --git a/k8s/staging-env/data-storage/data-storage-workshop-node.yaml b/k8s/staging-env/data-storage/data-storage-workshop-node.yaml deleted file mode 100644 index 9cec227b28..0000000000 --- a/k8s/staging-env/data-storage/data-storage-workshop-node.yaml +++ /dev/null @@ -1,58 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: data-storage-workshop-node - labels: - app: data-storage-workshop-node -spec: - replicas: 1 - selector: - matchLabels: - app: data-storage-workshop-node - template: - metadata: - labels: - app: data-storage-workshop-node - spec: - containers: - - name: data-storage-workshop-node - image: ghcr.io/gear-tech/gear-js-data-storage:dev - env: - - name: DB_NAME - valueFrom: - secretKeyRef: - name: pg-secrets - key: db - - name: DB_USER - valueFrom: - secretKeyRef: - name: pg-secrets - key: user - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: pg-secrets - key: password - - name: DB_HOST - value: postgres - - name: KAFKA_CLIENT_ID - value: gear-data-storage - - name: KAFKA_GROUP_ID - value: gear-main - - name: KAFKA_BROKERS - value: kafka-cluster:9094 - - name: KAFKA_SASL_USERNAME - valueFrom: - secretKeyRef: - name: kafka-secrets - key: username - - name: KAFKA_SASL_PASSWORD - valueFrom: - secretKeyRef: - name: kafka-secrets - key: password - - name: GEAR_WS_PROVIDER - value: wss://node-workshop.gear.rs:443 - imagePullPolicy: Always - diff --git a/k8s/staging-env/frontend-nginx/frontend-nginx-template.yaml b/k8s/staging-env/frontend-nginx/frontend-nginx-template.yaml deleted file mode 100644 index 6a4998d4b0..0000000000 --- a/k8s/staging-env/frontend-nginx/frontend-nginx-template.yaml +++ /dev/null @@ -1,79 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: frontend-nginx - labels: - app: frontend-nginx -spec: - replicas: 1 - selector: - matchLabels: - app: frontend-nginx - template: - metadata: - labels: - app: frontend-nginx - spec: - containers: - - name: frontend-nginx - image: mithriy/gear-frontend:nightly - volumeMounts: - - name: nginx-gear-frontend - mountPath: "/etc/nginx/conf.d/" - readOnly: true - - name: nginx-gear-backend - mountPath: "/etc/nginx/conf.d/" - readOnly: true - ports: - - containerPort: 80 - imagePullPolicy: Always - env: - - name: REACT_APP_API_URL - value: https://node-workshop.gear.rs/api - - name: REACT_APP_NODE_ADDRESS - value: wss://rpc-node.gear-tech.io - - name: REACT_APP_WASM_COMPILER_URL - value: https://idea.gear-tech.io/wasm-compiler - volumes: - - name: nginx-gear-frontend - configMap: - name: nginx-gear-frontend - - name: nginx-gear-backend - configMap: - name: nginx-gear-backend - ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend-nginx - namespace: dev-1 - labels: - app: frontend-nginx -spec: - ports: - - port: 80 - name: frontend-nginx - selector: - app: frontend-nginx - ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: nginx-gear-frontend - namespace: dev-1 -data: - gear-frontend.conf: | - put here configuration - ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: nginx-gear-backend - namespace: dev-1 -data: - gear-backend.conf: | - put here configuration diff --git a/k8s/staging-env/frontend-nginx/frontend-nginx.yaml b/k8s/staging-env/frontend-nginx/frontend-nginx.yaml deleted file mode 100644 index 6fa76f4270..0000000000 --- a/k8s/staging-env/frontend-nginx/frontend-nginx.yaml +++ /dev/null @@ -1,61 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: frontend-nginx - labels: - app: frontend-nginx -spec: - replicas: 1 - selector: - matchLabels: - app: frontend-nginx - template: - metadata: - labels: - app: frontend-nginx - spec: - containers: - - name: frontend-nginx - image: ghcr.io/gear-tech/gear-js-frontend:dev - volumeMounts: - - name: nginx-gear-frontend - mountPath: '/etc/nginx/conf.d/' - readOnly: true - - name: nginx-gear-backend - mountPath: '/etc/nginx/conf.d/' - readOnly: true - ports: - - containerPort: 80 - imagePullPolicy: Always - env: - - name: REACT_APP_API_URL - value: https://node-workshop.gear.rs/api - - name: REACT_APP_NODE_ADDRESS - value: wss://rpc-node.gear-tech.io - - name: REACT_APP_WASM_COMPILER_URL - value: https://idea.gear-tech.io/wasm-compiler - - name: REACT_APP_DEFAULT_NODES_URL - value: http://13.56.230.75/gear-nodes - volumes: - - name: nginx-gear-frontend - configMap: - name: nginx-gear-frontend - - name: nginx-gear-backend - configMap: - name: nginx-gear-backend - ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend-nginx - namespace: dev-1 - labels: - app: frontend-nginx -spec: - ports: - - port: 80 - name: frontend-nginx - selector: - app: frontend-nginx diff --git a/k8s/staging-env/kafka/kafka-template.yaml b/k8s/staging-env/kafka/kafka-template.yaml deleted file mode 100644 index 64be0d4284..0000000000 --- a/k8s/staging-env/kafka/kafka-template.yaml +++ /dev/null @@ -1,96 +0,0 @@ ---- -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: kafka - labels: - app: kafka -spec: - replicas: 1 - selector: - matchLabels: - app: kafka - template: - metadata: - labels: - app: kafka - spec: - containers: - - name: kafka - image: wurstmeister/kafka - volumeMounts: - - name: kafka-auth - mountPath: "/etc/kafka" - readOnly: true - ports: - - containerPort: 9092 - - containerPort: 9094 - env: - - name: KAFKA_ADVERTISED_PORT - value: "9092" - - name: KAFKA_ADVERTISED_HOST_NAME - value: "kafka-service" - - name: KAFKA_ZOOKEEPER_CONNECT - value: zookeeper:2181 - - name: KAFKA_BROKER_ID - value: "0" - - name: KAFKA_LISTENERS - value: SASL_PLAINTEXT://:9094 - - name: KAFKA_ADVERTISED_LISTENERS - value: SASL_PLAINTEXT://kafka-cluster:9094 - - name: KAFKA_INTER_BROKER_LISTENER_NAME - value: SASL_PLAINTEXT - - name: KAFKA_SASL_ENABLED_MECHANISMS - value: PLAIN - - name: KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL - value: PLAIN - - name: KAFKA_OPTS - value: "-Djava.security.auth.login.config=/etc/kafka/kafka_server_jaas.conf" - volumes: - - name: kafka-auth - configMap: - name: kafka-auth - ---- -apiVersion: v1 -kind: Service -metadata: - name: kafka-cluster - namespace: dev-1 - labels: - app: kafka -spec: - ports: - - port: 9092 - name: kafka-inside - - port: 9094 - name: kafka-outside - selector: - app: kafka - ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: kafka-auth - namespace: dev-1 -data: - kafka_server_jaas.conf: | - KafkaServer { - org.apache.kafka.common.security.plain.PlainLoginModule required - username="" --> specify username - password="" --> specify password - user_kafka_gear_user=""; --> specify password - }; - ---- -apiVersion: v1 -kind: Secret -metadata: - namespace: dev-1 - name: kafka-secrets -type: Opaque -data: - username: --> specify username - password: --> specify password diff --git a/k8s/staging-env/kafka/kafka-ui.yaml b/k8s/staging-env/kafka/kafka-ui.yaml deleted file mode 100644 index ae161e76f1..0000000000 --- a/k8s/staging-env/kafka/kafka-ui.yaml +++ /dev/null @@ -1,44 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: kafka-ui - labels: - app: kafka-ui -spec: - replicas: 1 - selector: - matchLabels: - app: kafka-ui - template: - metadata: - labels: - app: kafka-ui - spec: - containers: - - name: kafka-ui - image: provectuslabs/kafka-ui - ports: - - containerPort: 8080 - env: - - name: KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS - value: kafka-cluster:9094 - - name: KAFKA_CLUSTERS_0_ZOOKEEPER - value: zookeeper:2181 - ---- -apiVersion: v1 -kind: Service -metadata: - name: kafka-ui - namespace: dev-1 - labels: - app: kafka-ui -spec: - ports: - - port: 8080 - nodePort: 31100 - name: kafka-ui - selector: - app: kafka-ui - type: NodePort diff --git a/k8s/staging-env/kafka/kafka.yaml b/k8s/staging-env/kafka/kafka.yaml deleted file mode 100644 index b58cdc27cb..0000000000 --- a/k8s/staging-env/kafka/kafka.yaml +++ /dev/null @@ -1,70 +0,0 @@ ---- -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: kafka - labels: - app: kafka -spec: - replicas: 1 - selector: - matchLabels: - app: kafka - template: - metadata: - labels: - app: kafka - spec: - containers: - - name: kafka - image: wurstmeister/kafka - volumeMounts: - - name: kafka-auth - mountPath: "/etc/kafka" - readOnly: true - ports: - - containerPort: 9092 - - containerPort: 9094 - env: - - name: KAFKA_ADVERTISED_PORT - value: "9092" - - name: KAFKA_ADVERTISED_HOST_NAME - value: "kafka-service" - - name: KAFKA_ZOOKEEPER_CONNECT - value: zookeeper:2181 - - name: KAFKA_BROKER_ID - value: "0" - - name: KAFKA_LISTENERS - value: SASL_PLAINTEXT://:9094 - - name: KAFKA_ADVERTISED_LISTENERS - value: SASL_PLAINTEXT://kafka-cluster:9094 - - name: KAFKA_INTER_BROKER_LISTENER_NAME - value: SASL_PLAINTEXT - - name: KAFKA_SASL_ENABLED_MECHANISMS - value: PLAIN - - name: KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL - value: PLAIN - - name: KAFKA_OPTS - value: "-Djava.security.auth.login.config=/etc/kafka/kafka_server_jaas.conf" - volumes: - - name: kafka-auth - configMap: - name: kafka-auth - ---- -apiVersion: v1 -kind: Service -metadata: - name: kafka-cluster - namespace: dev-1 - labels: - app: kafka -spec: - ports: - - port: 9092 - name: kafka-inside - - port: 9094 - name: kafka-outside - selector: - app: kafka diff --git a/k8s/staging-env/kafka/zookeeper.yaml b/k8s/staging-env/kafka/zookeeper.yaml deleted file mode 100644 index 888592906c..0000000000 --- a/k8s/staging-env/kafka/zookeeper.yaml +++ /dev/null @@ -1,50 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: zookeeper - labels: - app: zookeeper -spec: - replicas: 1 - selector: - matchLabels: - app: zookeeper - template: - metadata: - labels: - app: zookeeper - spec: - volumes: - - name: zk-data - # This AWS EBS volume must already exist. - awsElasticBlockStore: - volumeID: "vol-0b82009bc9cba06b4" - fsType: ext4 - containers: - - name: zookeeper - image: zookeeper - ports: - - containerPort: 2181 - volumeMounts: - - name: zk-data - readOnly: false - mountPath: "/data/zk-data" - env: - - name: ZOO_DATA_DIR - value: '/data/zk-data' - ---- -apiVersion: v1 -kind: Service -metadata: - name: zookeeper - namespace: dev-1 - labels: - app: zookeeper -spec: - ports: - - port: 2181 - name: zookeeper - selector: - app: zookeeper diff --git a/k8s/staging-env/kubernetes-dashboard/kubernetes-dashboard.yaml b/k8s/staging-env/kubernetes-dashboard/kubernetes-dashboard.yaml deleted file mode 100644 index c7efe711b2..0000000000 --- a/k8s/staging-env/kubernetes-dashboard/kubernetes-dashboard.yaml +++ /dev/null @@ -1,282 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: kubernetes-dashboard - ---- -kind: Deployment -apiVersion: apps/v1 -metadata: - labels: - k8s-app: dashboard-metrics-scraper - name: dashboard-metrics-scraper - namespace: kubernetes-dashboard -spec: - replicas: 1 - revisionHistoryLimit: 10 - selector: - matchLabels: - k8s-app: dashboard-metrics-scraper - template: - metadata: - labels: - k8s-app: dashboard-metrics-scraper - spec: - securityContext: - seccompProfile: - type: RuntimeDefault - containers: - - name: dashboard-metrics-scraper - image: kubernetesui/metrics-scraper:v1.0.7 - ports: - - containerPort: 8000 - protocol: TCP - livenessProbe: - httpGet: - scheme: HTTP - path: / - port: 8000 - initialDelaySeconds: 30 - timeoutSeconds: 30 - volumeMounts: - - mountPath: /tmp - name: tmp-volume - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsUser: 1001 - runAsGroup: 2001 - serviceAccountName: kubernetes-dashboard - nodeSelector: - "kubernetes.io/os": linux - # Comment the following tolerations if Dashboard must not be deployed on master - tolerations: - - key: node-role.kubernetes.io/master - effect: NoSchedule - volumes: - - name: tmp-volume - emptyDir: {} ---- -kind: Deployment -apiVersion: apps/v1 -metadata: - name: kubernetes-dashboard - namespace: kubernetes-dashboard -spec: - replicas: 1 - selector: - matchLabels: - k8s-app: kubernetes-dashboard - template: - metadata: - creationTimestamp: null - labels: - k8s-app: kubernetes-dashboard - spec: - volumes: - - name: kubernetes-dashboard-certs - secret: - secretName: kubernetes-dashboard-certs - - name: tmp-volume - emptyDir: {} - serviceAccountName: kubernetes-dashboard - containers: - - name: kubernetes-dashboard - image: 'kubernetesui/dashboard:v2.5.0' - args: - - '--namespace=kubernetes-dashboard' - - '--enable-skip-login' - ports: - - containerPort: 9090 - protocol: TCP - resources: {} - volumeMounts: - - name: kubernetes-dashboard-certs - mountPath: /certs - # Create on-disk volume to store exec logs - - mountPath: /tmp - name: tmp-volume - livenessProbe: - httpGet: - path: / - port: 9090 - scheme: HTTP - initialDelaySeconds: 30 - timeoutSeconds: 30 - periodSeconds: 10 - successThreshold: 1 - failureThreshold: 3 - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - imagePullPolicy: Always - securityContext: - runAsUser: 1001 - runAsGroup: 2001 - readOnlyRootFilesystem: true - allowPrivilegeEscalation: false - restartPolicy: Always - terminationGracePeriodSeconds: 30 - dnsPolicy: ClusterFirst - ---- -kind: Service -apiVersion: v1 -metadata: - name: kubernetes-dashboard - namespace: kubernetes-dashboard - labels: - k8s-app: kubernetes-dashboard -spec: - ports: - - name: ui - protocol: TCP - port: 80 - targetPort: 9090 - nodePort: 31000 - selector: - k8s-app: kubernetes-dashboard - type: NodePort - sessionAffinity: None - externalTrafficPolicy: Cluster -status: - loadBalancer: {} - ---- -kind: Service -apiVersion: v1 -metadata: - labels: - k8s-app: dashboard-metrics-scraper - name: dashboard-metrics-scraper - namespace: kubernetes-dashboard -spec: - ports: - - port: 8000 - targetPort: 8000 - selector: - k8s-app: dashboard-metrics-scraper - ---- -apiVersion: v1 -kind: Secret -metadata: - labels: - k8s-app: kubernetes-dashboard - name: kubernetes-dashboard-certs - namespace: kubernetes-dashboard -type: Opaque - ---- -apiVersion: v1 -kind: Secret -metadata: - labels: - k8s-app: kubernetes-dashboard - name: kubernetes-dashboard-csrf - namespace: kubernetes-dashboard -type: Opaque -data: - csrf: "" - ---- -apiVersion: v1 -kind: Secret -metadata: - labels: - k8s-app: kubernetes-dashboard - name: kubernetes-dashboard-key-holder - namespace: kubernetes-dashboard -type: Opaque - ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - k8s-app: kubernetes-dashboard - name: kubernetes-dashboard - namespace: kubernetes-dashboard - - ---- -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - labels: - k8s-app: kubernetes-dashboard - name: kubernetes-dashboard -rules: - # Allow Metrics Scraper to get metrics from the Metrics server - - apiGroups: ["metrics.k8s.io"] - resources: ["pods", "nodes"] - verbs: ["get", "list", "watch"] - ---- -kind: Role -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - labels: - k8s-app: kubernetes-dashboard - name: kubernetes-dashboard - namespace: kubernetes-dashboard -rules: - # Allow Dashboard to get, update and delete Dashboard exclusive secrets. - - apiGroups: [""] - resources: ["secrets"] - resourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs", "kubernetes-dashboard-csrf"] - verbs: ["get", "update", "delete"] - # Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map. - - apiGroups: [""] - resources: ["configmaps"] - resourceNames: ["kubernetes-dashboard-settings"] - verbs: ["get", "update"] - # Allow Dashboard to get metrics. - - apiGroups: [""] - resources: ["services"] - resourceNames: ["heapster", "dashboard-metrics-scraper"] - verbs: ["proxy"] - - apiGroups: [""] - resources: ["services/proxy"] - resourceNames: ["heapster", "http:heapster:", "https:heapster:", "dashboard-metrics-scraper", "http:dashboard-metrics-scraper"] - verbs: ["get"] - ---- -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - labels: - k8s-app: kubernetes-dashboard - name: kubernetes-dashboard -rules: - # Allow Metrics Scraper to get metrics from the Metrics server - - apiGroups: ["metrics.k8s.io"] - resources: ["pods", "nodes"] - verbs: ["get", "list", "watch"] - # Other resources - - apiGroups: [""] - resources: ["nodes", "namespaces", "pods", "serviceaccounts", "services", "configmaps", "endpoints", "persistentvolumeclaims", "replicationcontrollers", "replicationcontrollers/scale", "persistentvolumeclaims", "persistentvolumes", "bindings", "events", "limitranges", "namespaces/status", "pods/log", "pods/status", "replicationcontrollers/status", "resourcequotas", "resourcequotas/status"] - verbs: ["get", "list", "watch"] - - apiGroups: ["apps"] - resources: ["daemonsets", "deployments", "deployments/scale", "replicasets", "replicasets/scale", "statefulsets"] - verbs: ["get", "list", "watch"] - - apiGroups: ["autoscaling"] - resources: ["horizontalpodautoscalers"] - verbs: ["get", "list", "watch"] - - apiGroups: ["batch"] - resources: ["cronjobs", "jobs"] - verbs: ["get", "list", "watch"] - - apiGroups: ["extensions"] - resources: ["daemonsets", "deployments", "deployments/scale", "networkpolicies", "replicasets", "replicasets/scale", "replicationcontrollers/scale"] - verbs: ["get", "list", "watch"] - - apiGroups: ["networking.k8s.io"] - resources: ["ingresses", "networkpolicies"] - verbs: ["get", "list", "watch"] - - apiGroups: ["policy"] - resources: ["poddisruptionbudgets"] - verbs: ["get", "list", "watch"] - - apiGroups: ["storage.k8s.io"] - resources: ["storageclasses", "volumeattachments"] - verbs: ["get", "list", "watch"]` - - apiGroups: ["rbac.authorization.k8s.io"] - resources: ["clusterrolebindings", "clusterroles", "roles", "rolebindings", ] - verbs: ["get", "list", "watch"] diff --git a/k8s/staging-env/kubernetes-dashboard/metrics.yaml b/k8s/staging-env/kubernetes-dashboard/metrics.yaml deleted file mode 100644 index bd49296d47..0000000000 --- a/k8s/staging-env/kubernetes-dashboard/metrics.yaml +++ /dev/null @@ -1,186 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - labels: - k8s-app: metrics-server - name: metrics-server - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - k8s-app: metrics-server - rbac.authorization.k8s.io/aggregate-to-admin: "true" - rbac.authorization.k8s.io/aggregate-to-edit: "true" - rbac.authorization.k8s.io/aggregate-to-view: "true" - name: system:aggregated-metrics-reader -rules: -- apiGroups: - - metrics.k8s.io - resources: - - pods - - nodes - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - k8s-app: metrics-server - name: system:metrics-server -rules: -- apiGroups: - - "" - resources: - - pods - - nodes - - nodes/stats - - namespaces - - configmaps - verbs: - - get - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - k8s-app: metrics-server - name: metrics-server-auth-reader - namespace: kube-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: extension-apiserver-authentication-reader -subjects: -- kind: ServiceAccount - name: metrics-server - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - k8s-app: metrics-server - name: metrics-server:system:auth-delegator -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:auth-delegator -subjects: -- kind: ServiceAccount - name: metrics-server - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - k8s-app: metrics-server - name: system:metrics-server -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:metrics-server -subjects: -- kind: ServiceAccount - name: metrics-server - namespace: kube-system ---- -apiVersion: v1 -kind: Service -metadata: - labels: - k8s-app: metrics-server - name: metrics-server - namespace: kube-system -spec: - ports: - - name: https - port: 443 - protocol: TCP - targetPort: https - selector: - k8s-app: metrics-server ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - k8s-app: metrics-server - name: metrics-server - namespace: kube-system -spec: - selector: - matchLabels: - k8s-app: metrics-server - strategy: - rollingUpdate: - maxUnavailable: 0 - template: - metadata: - labels: - k8s-app: metrics-server - spec: - containers: - - args: - - --cert-dir=/tmp - - --secure-port=4443 - - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname - - --kubelet-use-node-status-port - image: k8s.gcr.io/metrics-server/metrics-server:v0.4.2 - imagePullPolicy: IfNotPresent - livenessProbe: - failureThreshold: 3 - httpGet: - path: /livez - port: https - scheme: HTTPS - periodSeconds: 10 - name: metrics-server - ports: - - containerPort: 4443 - name: https - protocol: TCP - readinessProbe: - failureThreshold: 3 - httpGet: - path: /readyz - port: https - scheme: HTTPS - periodSeconds: 10 - securityContext: - readOnlyRootFilesystem: true - runAsNonRoot: true - runAsUser: 1000 - volumeMounts: - - mountPath: /tmp - name: tmp-dir - nodeSelector: - kubernetes.io/os: linux - priorityClassName: system-cluster-critical - serviceAccountName: metrics-server - volumes: - - emptyDir: {} - name: tmp-dir ---- -apiVersion: apiregistration.k8s.io/v1 -kind: APIService -metadata: - labels: - k8s-app: metrics-server - name: v1beta1.metrics.k8s.io -spec: - group: metrics.k8s.io - groupPriorityMinimum: 100 - insecureSkipTLSVerify: true - service: - name: metrics-server - namespace: kube-system - version: v1beta1 - versionPriority: 100 diff --git a/k8s/staging-env/postgres/postgres-template.yaml b/k8s/staging-env/postgres/postgres-template.yaml deleted file mode 100644 index 6e459ae101..0000000000 --- a/k8s/staging-env/postgres/postgres-template.yaml +++ /dev/null @@ -1,77 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: dev-1 - name: postgres - labels: - app: postgres -spec: - replicas: 1 - selector: - matchLabels: - app: postgres - template: - metadata: - labels: - app: postgres - spec: - containers: - - name: postgres - image: postgres:14.2 - ports: - - containerPort: 5432 - env: - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: pg-secrets - key: db - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: pg-secrets - key: user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: pg-secrets - key: password - volumeMounts: - - mountPath: "/var/lib/postgresql/data" - name: "pgdata" - subPath: "postgres" - volumes: - - name: pgdata - # This AWS EBS volume must already exist. - awsElasticBlockStore: - volumeID: "" # Put here id of created volume - fsType: ext4 - ---- -apiVersion: v1 -kind: Secret -metadata: - namespace: dev-1 - name: pg-secrets -type: Opaque -data: - db: #put here encode base64 db name - user: #put here username - password: #put here password - ---- -kind: Service -apiVersion: v1 -metadata: - name: postgres - namespace: dev-1 - labels: - app: postgres -spec: - ports: - - name: pgql - protocol: TCP - port: 5432 - targetPort: 5432 - selector: - app: postgres diff --git a/k8s/staging-env/postgres/postgres-testbalance.yaml b/k8s/staging-env/postgres/postgres-testbalance.yaml deleted file mode 100644 index cfc389b5e7..0000000000 --- a/k8s/staging-env/postgres/postgres-testbalance.yaml +++ /dev/null @@ -1,63 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: dev-1 - name: postgres-testbalance - labels: - app: postgres-testbalance -spec: - replicas: 1 - selector: - matchLabels: - app: postgres-testbalance - template: - metadata: - labels: - app: postgres-testbalance - spec: - containers: - - name: postgres-testbalance - image: postgres:14.2 - ports: - - containerPort: 5432 - env: - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: pg-testbalance-secrets - key: db - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: pg-testbalance-secrets - key: user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: pg-testbalance-secrets - key: password - volumeMounts: - - mountPath: "/var/lib/postgresql/data" - name: "pgdata-testbalance" - subPath: "postgres" - volumes: - - name: pgdata-testbalance - # This AWS EBS volume must already exist. - awsElasticBlockStore: - volumeID: "vol-040959283a18ed913" - fsType: ext4 - ---- -kind: Service -apiVersion: v1 -metadata: - name: postgres-testbalance - namespace: dev-1 -spec: - ports: - - name: pgql-testbalance - protocol: TCP - port: 5432 - targetPort: 5432 - selector: - app: postgres-testbalance diff --git a/k8s/staging-env/postgres/postgres.yaml b/k8s/staging-env/postgres/postgres.yaml deleted file mode 100644 index 3b541cb570..0000000000 --- a/k8s/staging-env/postgres/postgres.yaml +++ /dev/null @@ -1,65 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: dev-1 - name: postgres - labels: - app: postgres -spec: - replicas: 1 - selector: - matchLabels: - app: postgres - template: - metadata: - labels: - app: postgres - spec: - containers: - - name: postgres - image: postgres:14.2 - ports: - - containerPort: 5432 - env: - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: pg-secrets - key: db - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: pg-secrets - key: user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: pg-secrets - key: password - volumeMounts: - - mountPath: "/var/lib/postgresql/data" - name: "pgdata" - subPath: "postgres" - volumes: - - name: pgdata - # This AWS EBS volume must already exist. - awsElasticBlockStore: - volumeID: "vol-02f06733d6bd7c009" - fsType: ext4 - ---- -kind: Service -apiVersion: v1 -metadata: - name: postgres - namespace: dev-1 - labels: - app: postgres -spec: - ports: - - name: pgql - protocol: TCP - port: 5432 - targetPort: 5432 - selector: - app: postgres diff --git a/k8s/staging-env/test-balance/test-balance-workshop-node.yaml b/k8s/staging-env/test-balance/test-balance-workshop-node.yaml deleted file mode 100644 index 9c3284cba8..0000000000 --- a/k8s/staging-env/test-balance/test-balance-workshop-node.yaml +++ /dev/null @@ -1,65 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: dev-1 - name: test-balance-workshop-node - labels: - app: test-balance-workshop-node -spec: - replicas: 1 - selector: - matchLabels: - app: test-balance-workshop-node - template: - metadata: - labels: - app: test-balance-workshop-node - spec: - containers: - - name: test-balance-workshop-node - image: ghcr.io/gear-tech/gear-js-test-balance:dev - env: - - name: DB_HOST - value: postgres-testbalance - - name: DB_NAME - valueFrom: - secretKeyRef: - name: pg-testbalance-secrets - key: db - - name: DB_USER - valueFrom: - secretKeyRef: - name: pg-testbalance-secrets - key: user - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: pg-testbalance-secrets - key: password - - name: KAFKA_CLIENT_ID - value: test-balance-workshop - - name: KAFKA_GROUP_ID - value: gear-workshop - - name: KAFKA_BROKERS - value: kafka-cluster:9094 - - name: KAFKA_SASL_USERNAME - valueFrom: - secretKeyRef: - name: kafka-secrets - key: username - - name: KAFKA_SASL_PASSWORD - valueFrom: - secretKeyRef: - name: kafka-secrets - key: password - - name: WS_PROVIDER - value: wss://node-workshop.gear.rs:443 - - name: ROOT_ACCOUNT_SEED - value: //Alice - - name: TEST_ACCOUNT_SEED - value: put here value - - name: TEST_ACCOUNT_BALANCE - value: "9000000000000" - - name: TEST_BALANCE_VALUE - value: "19999999999" - imagePullPolicy: Always diff --git a/k8s/test-env/api-gateway/api-gateway.yaml b/k8s/test-env/api-gateway/api-gateway.yaml deleted file mode 100644 index efaabd797a..0000000000 --- a/k8s/test-env/api-gateway/api-gateway.yaml +++ /dev/null @@ -1,61 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: test-env - name: api-gateway-testenv - labels: - app: api-gateway-testenv -spec: - replicas: 1 - selector: - matchLabels: - app: api-gateway-testenv - template: - metadata: - labels: - app: api-gateway-testenv - spec: - containers: - - name: api-gateway-test - image: ghcr.io/gear-tech/gear-js-api-gateway:dev - ports: - - containerPort: 3000 - env: - - name: KAFKA_CLIENT_ID - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: KAFKA_GROUP_ID - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: KAFKA_BROKERS - value: kafka-testenv:9094 - - name: KAFKA_SASL_USERNAME - valueFrom: - secretKeyRef: - name: kafka-testenv-secrets - key: username - - name: KAFKA_SASL_PASSWORD - valueFrom: - secretKeyRef: - name: kafka-testenv-secrets - key: password - imagePullPolicy: Always - ---- -apiVersion: v1 -kind: Service -metadata: - name: api-gateway-testenv - namespace: test-env - labels: - app: api-gateway-testenv -spec: - ports: - - port: 3000 - name: api-gateway-testenv - selector: - app: api-gateway-testenv diff --git a/k8s/test-env/data-storage/data-storage.yaml b/k8s/test-env/data-storage/data-storage.yaml deleted file mode 100644 index cc6b3594f5..0000000000 --- a/k8s/test-env/data-storage/data-storage.yaml +++ /dev/null @@ -1,64 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: test-env - name: data-storage-testenv - labels: - app: data-storage-testenv -spec: - replicas: 1 - selector: - matchLabels: - app: data-storage-testenv - template: - metadata: - labels: - app: data-storage-testenv - spec: - containers: - - name: data-storage-testenv - image: ghcr.io/gear-tech/gear-js-data-storage:dev - env: - - name: DB_NAME - valueFrom: - secretKeyRef: - name: pg-secrets-testenv - key: db - - name: DB_USER - valueFrom: - secretKeyRef: - name: pg-secrets-testenv - key: user - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: pg-secrets-testenv - key: password - - name: DB_HOST - value: postgres-testenv - - name: KAFKA_CLIENT_ID - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: KAFKA_GROUP_ID - valueFrom: - fieldRef: - apiVersion: v1 - fieldPath: metadata.name - - name: KAFKA_BROKERS - value: kafka-testenv:9094 - - name: KAFKA_SASL_USERNAME - valueFrom: - secretKeyRef: - name: kafka-testenv-secrets - key: username - - name: KAFKA_SASL_PASSWORD - valueFrom: - secretKeyRef: - name: kafka-testenv-secrets - key: password - - name: GEAR_WS_PROVIDER - value: ws://gear-node:9944 - imagePullPolicy: Always - diff --git a/k8s/test-env/frontend-nginx/frontend-nginx.yaml b/k8s/test-env/frontend-nginx/frontend-nginx.yaml deleted file mode 100644 index fef189ff99..0000000000 --- a/k8s/test-env/frontend-nginx/frontend-nginx.yaml +++ /dev/null @@ -1,70 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: test-env - name: frontend-nginx-testenv - labels: - app: frontend-nginx-testenv -spec: - replicas: 1 - selector: - matchLabels: - app: frontend-nginx-testenv - template: - metadata: - labels: - app: frontend-nginx-testenv - spec: - containers: - - name: frontend-nginx-testenv - image: ghcr.io/gear-tech/gear-js-frontend:dev - volumeMounts: - - name: nginx-gear-frontend-testenv - readOnly: true - mountPath: /etc/nginx/conf.d/ - - name: gear-nodes-testenv - readOnly: true - mountPath: /opt/gear-nodes/ - - name: nginx-conf-testenv - mountPath: /etc/nginx/nginx.conf - subPath: nginx.conf - ports: - - containerPort: 80 - imagePullPolicy: Always - env: - - name: REACT_APP_API_URL - value: https://test-env.gear-tech.io/api - - name: REACT_APP_NODE_ADDRESS - value: wss://test-env.gear-tech.io/gear-testnet - - name: REACT_APP_WASM_COMPILER_URL - value: https://idea.gear-tech.io/wasm-compiler - - name: REACT_APP_DEFAULT_NODES_URL - value: https://test-env.gear-tech.io/gear-nodes - volumes: - - name: nginx-gear-frontend-testenv - configMap: - name: nginx-gear-frontend-testenv - defaultMode: 420 - - name: gear-nodes-testenv - configMap: - name: gear-nodes-testenv - defaultMode: 420 - - name: nginx-conf-testenv - configMap: - name: nginx-conf-testenv - defaultMode: 420 - ---- -apiVersion: v1 -kind: Service -metadata: - name: frontend-nginx-testenv - namespace: test-env - labels: - app: frontend-nginx-testenv -spec: - ports: - - port: 80 - name: frontend-nginx-testenv - selector: - app: frontend-nginx-testenv diff --git a/k8s/test-env/gear-node/gear-node.yaml b/k8s/test-env/gear-node/gear-node.yaml deleted file mode 100644 index 2b1b679f1f..0000000000 --- a/k8s/test-env/gear-node/gear-node.yaml +++ /dev/null @@ -1,39 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: test-env - name: gear-node - labels: - app: gear-node -spec: - replicas: 1 - selector: - matchLabels: - app: gear-node - template: - metadata: - labels: - app: gear-node - spec: - containers: - - name: gear-node - image: sergeyfilyanin/gear-node:latest - ports: - - containerPort: 9944 - ---- -kind: Service -apiVersion: v1 -metadata: - name: gear-node - namespace: test-env - labels: - app: gear-node -spec: - ports: - - name: gear-node - protocol: TCP - port: 9944 - targetPort: 9944 - selector: - app: gear-node diff --git a/k8s/test-env/kafka/kafka.yaml b/k8s/test-env/kafka/kafka.yaml deleted file mode 100644 index 96f1b368d0..0000000000 --- a/k8s/test-env/kafka/kafka.yaml +++ /dev/null @@ -1,70 +0,0 @@ ---- -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: test-env - name: kafka-testenv - labels: - app: kafka-testenv -spec: - replicas: 1 - selector: - matchLabels: - app: kafka-testenv - template: - metadata: - labels: - app: kafka-testenv - spec: - containers: - - name: kafka - image: wurstmeister/kafka - volumeMounts: - - name: kafka-auth-testenv - mountPath: "/etc/kafka" - readOnly: true - ports: - - containerPort: 9092 - - containerPort: 9094 - env: - - name: KAFKA_ADVERTISED_PORT - value: "9092" - - name: KAFKA_ADVERTISED_HOST_NAME - value: "kafka-service" - - name: KAFKA_ZOOKEEPER_CONNECT - value: zookeeper-testenv:2181 - - name: KAFKA_BROKER_ID - value: "0" - - name: KAFKA_LISTENERS - value: SASL_PLAINTEXT://:9094 - - name: KAFKA_ADVERTISED_LISTENERS - value: SASL_PLAINTEXT://kafka-testenv:9094 - - name: KAFKA_INTER_BROKER_LISTENER_NAME - value: SASL_PLAINTEXT - - name: KAFKA_SASL_ENABLED_MECHANISMS - value: PLAIN - - name: KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL - value: PLAIN - - name: KAFKA_OPTS - value: "-Djava.security.auth.login.config=/etc/kafka/kafka_server_jaas.conf" - volumes: - - name: kafka-auth-testenv - configMap: - name: kafka-auth-testenv - ---- -apiVersion: v1 -kind: Service -metadata: - name: kafka-testenv - namespace: test-env - labels: - app: kafka-testenv -spec: - ports: - - port: 9092 - name: kafka-inside-test - - port: 9094 - name: kafka-outside-test - selector: - app: kafka-testenv diff --git a/k8s/test-env/kafka/zookeeper.yaml b/k8s/test-env/kafka/zookeeper.yaml deleted file mode 100644 index b2aae49bfe..0000000000 --- a/k8s/test-env/kafka/zookeeper.yaml +++ /dev/null @@ -1,37 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: test-env - name: zookeeper-testenv - labels: - app: zookeeper-testenv -spec: - replicas: 1 - selector: - matchLabels: - app: zookeeper-testenv - template: - metadata: - labels: - app: zookeeper-testenv - spec: - containers: - - name: zookeeper-testenv - image: zookeeper - ports: - - containerPort: 2181 - ---- -apiVersion: v1 -kind: Service -metadata: - name: zookeeper-testenv - namespace: test-env - labels: - app: zookeeper-testenv -spec: - ports: - - port: 2181 - name: zookeeper-testenv - selector: - app: zookeeper-testenv diff --git a/k8s/test-env/postgres/postgres-testbalance.yaml b/k8s/test-env/postgres/postgres-testbalance.yaml deleted file mode 100644 index 57db4d7c60..0000000000 --- a/k8s/test-env/postgres/postgres-testbalance.yaml +++ /dev/null @@ -1,53 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: test-env - name: postgres-testbalance-testenv - labels: - app: postgres-testbalance-testenv -spec: - replicas: 1 - selector: - matchLabels: - app: postgres-testbalance-testenv - template: - metadata: - labels: - app: postgres-testbalance-testenv - spec: - containers: - - name: postgres-testbalance-testenv - image: postgres:14.2 - ports: - - containerPort: 5432 - env: - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: pg-testbalance-testenv-secrets - key: db - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: pg-testbalance-testenv-secrets - key: user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: pg-testbalance-testenv-secrets - key: password - ---- -kind: Service -apiVersion: v1 -metadata: - name: postgres-testbalance-testenv - namespace: test-env -spec: - ports: - - name: pgql-testbalance-testenv - protocol: TCP - port: 5432 - targetPort: 5432 - selector: - app: postgres-testbalance-testenv diff --git a/k8s/test-env/postgres/postgres.yaml b/k8s/test-env/postgres/postgres.yaml deleted file mode 100644 index 816cd822fd..0000000000 --- a/k8s/test-env/postgres/postgres.yaml +++ /dev/null @@ -1,55 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - namespace: test-env - name: postgres-testenv - labels: - app: postgres-testenv -spec: - replicas: 1 - selector: - matchLabels: - app: postgres-testenv - template: - metadata: - labels: - app: postgres-testenv - spec: - containers: - - name: postgres-testenv - image: postgres:14.2 - ports: - - containerPort: 5432 - env: - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: pg-secrets-testenv - key: db - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: pg-secrets-testenv - key: user - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: pg-secrets-testenv - key: password - ---- -kind: Service -apiVersion: v1 -metadata: - name: postgres-testenv - namespace: test-env - labels: - app: postgres-testenv -spec: - ports: - - name: pgql-testenv - protocol: TCP - port: 5432 - targetPort: 5432 - selector: - app: postgres-testenv diff --git a/k8s/test-env/test-balance/test-balance.yaml b/k8s/test-env/test-balance/test-balance.yaml deleted file mode 100644 index 90d173d26f..0000000000 --- a/k8s/test-env/test-balance/test-balance.yaml +++ /dev/null @@ -1,65 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - namespace: test-env - name: test-balance-testenv - labels: - app: test-balance-testenv -spec: - replicas: 1 - selector: - matchLabels: - app: test-balance-testenv - template: - metadata: - labels: - app: test-balance-testenv - spec: - containers: - - name: test-balance-testenv - image: ghcr.io/gear-tech/gear-js-test-balance:dev - env: - - name: DB_HOST - value: postgres-testbalance-testenv - - name: DB_NAME - valueFrom: - secretKeyRef: - name: pg-testbalance-testenv-secrets - key: db - - name: DB_USER - valueFrom: - secretKeyRef: - name: pg-testbalance-testenv-secrets - key: user - - name: DB_PASSWORD - valueFrom: - secretKeyRef: - name: pg-testbalance-testenv-secrets - key: password - - name: KAFKA_CLIENT_ID - value: test-balance-workshop - - name: KAFKA_GROUP_ID - value: gear-workshop - - name: KAFKA_BROKERS - value: kafka-testenv:9094 - - name: KAFKA_SASL_USERNAME - valueFrom: - secretKeyRef: - name: kafka-testenv-secrets - key: username - - name: KAFKA_SASL_PASSWORD - valueFrom: - secretKeyRef: - name: kafka-testenv-secrets - key: password - - name: WS_PROVIDER - value: ws://gear-node:9944 - - name: ROOT_ACCOUNT_SEED - value: //Alice - - name: TEST_ACCOUNT_SEED - value: 0x8999331c53e3a76e31d91767d0e2a91529e96e0e008089a0d34e1919c0d84da5 - - name: TEST_ACCOUNT_BALANCE - value: "9000000000000" - - name: TEST_BALANCE_VALUE - value: "19999999999" - imagePullPolicy: Always diff --git a/k8s/vara-node/Dockerfile b/k8s/vara-node/Dockerfile deleted file mode 100644 index fe62bf168e..0000000000 --- a/k8s/vara-node/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM debian:stable-slim -MAINTAINER GEAR -WORKDIR opt -RUN apt update -RUN apt install wget -y -RUN apt install xz-utils -y -RUN wget https://get.gear.rs/vara-nightly-linux-x86_64.tar.xz -RUN tar -xvf vara-nightly-linux-x86_64.tar.xz -RUN chmod +x gear - -CMD ["/opt/gear", "--chain", "vara-dev", "--alice", "--validator", "--tmp", "--unsafe-ws-external", "--unsafe-rpc-external", "--rpc-methods", "Unsafe", "--rpc-cors", "all"]