From 633d8e6648f344487da68b610857ee9837d0c081 Mon Sep 17 00:00:00 2001 From: shamsartem Date: Wed, 20 Dec 2023 19:33:42 +0100 Subject: [PATCH] feat: use new aqua packages (#310) * feat: use new aqua packages * restore * fix imports * fix path * fix * add spell * use new imports in test * remove node_modules import * fix * move * fix * improve * set marine and mrepl * Update aqua-tests/package.json * use --dry to check aqua is compiling --- .github/workflows/release.yml | 2 +- .github/workflows/snapshot.yml | 2 +- .github/workflows/tests.yml | 2 +- .gitignore | 3 +- .../aqua-dependencies/package-lock.json | 67 +++ aqua-tests/.fluence/project-secrets.yaml | 34 -- .../.fluence/secrets/test_create_resource.txt | 1 + .../.fluence/secrets/test_get_resource.txt | 1 + .../test_register_record_unregister.txt | 1 + ...test_register_unregister_remote_record.txt | 1 + aqua-tests/.gitignore | 1 + aqua-tests/fluence.yaml | 14 +- aqua-tests/package-lock.json | 40 -- aqua-tests/package.json | 29 -- {spell => aqua-tests/spell}/spell.aqua | 4 +- {spell => aqua-tests/spell}/spell.yaml | 0 aqua-tests/test_aqua.py | 3 +- aqua/.fluence/schemas/fluence.yaml.json | 459 ------------------ aqua/fluence.yaml | 10 - aqua/package.json | 3 +- build.sh | 11 +- 21 files changed, 99 insertions(+), 589 deletions(-) create mode 100644 aqua-tests/.fluence/aqua-dependencies/package-lock.json delete mode 100644 aqua-tests/.fluence/project-secrets.yaml create mode 100644 aqua-tests/.fluence/secrets/test_create_resource.txt create mode 100644 aqua-tests/.fluence/secrets/test_get_resource.txt create mode 100644 aqua-tests/.fluence/secrets/test_register_record_unregister.txt create mode 100644 aqua-tests/.fluence/secrets/test_register_unregister_remote_record.txt rename {spell => aqua-tests/spell}/spell.aqua (95%) rename {spell => aqua-tests/spell}/spell.yaml (100%) delete mode 100644 aqua/.fluence/schemas/fluence.yaml.json delete mode 100644 aqua/fluence.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1758917..b85d7cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -125,7 +125,7 @@ jobs: - name: Setup fcli uses: fluencelabs/setup-fluence@v1 with: - version: stage + version: main - name: Build service run: ./build.sh diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 561cb1b..30666bd 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -57,7 +57,7 @@ jobs: - name: Setup fcli uses: fluencelabs/setup-fluence@v1 with: - version: stage + version: main - name: Import secrets if: inputs.snapshot == true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6459759..26e24e2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,7 @@ on: fcli-version: description: "@fluencelabs/cli version" type: string - default: "stage" + default: "main" cargo-dependencies: description: "Cargo dependencies map" type: string diff --git a/.gitignore b/.gitignore index 86969f2..4a0baea 100644 --- a/.gitignore +++ b/.gitignore @@ -14,8 +14,7 @@ distro/registry-service/ **/dist *.drawio -# Remove after https://github.com/fluencelabs/aqua/issues/287 -aqua/target/typescript/** +aqua/*.tgz example/src/generated/** **/__pycache__ diff --git a/aqua-tests/.fluence/aqua-dependencies/package-lock.json b/aqua-tests/.fluence/aqua-dependencies/package-lock.json new file mode 100644 index 0000000..7caa216 --- /dev/null +++ b/aqua-tests/.fluence/aqua-dependencies/package-lock.json @@ -0,0 +1,67 @@ +{ + "name": "aqua-dependencies", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "@fluencelabs/aqua-lib": "0.8.1", + "@fluencelabs/registry": "0.8.7", + "@fluencelabs/spell": "0.5.33", + "@fluencelabs/trust-graph": "3.1.2" + } + }, + "node_modules/@fluencelabs/aqua-lib": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.8.1.tgz", + "integrity": "sha512-VLslkhi3hsNLWkgsoCyceCediqkicWphMVHZ+9eEkgMumepvo7TcqiYC14bl2LpZjn7YZ6y/OzK+Ffy8ADfKdA==" + }, + "node_modules/@fluencelabs/registry": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/@fluencelabs/registry/-/registry-0.8.7.tgz", + "integrity": "sha512-43bmb1v4p5ORvaiLBrUAl+hRPo3luxxBVrJgqTvipJa2OEg2wCRA/Wo9s4M7Lchnv3NoYLOyNTzNyFopQRKILA==", + "dependencies": { + "@fluencelabs/aqua-lib": "0.7.0", + "@fluencelabs/trust-graph": "0.4.1" + } + }, + "node_modules/@fluencelabs/registry/node_modules/@fluencelabs/aqua-lib": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.7.0.tgz", + "integrity": "sha512-mJEaxfAQb6ogVM4l4qw7INK6kvLA2Y161ErwL7IVeVSkKXIeYq/qio2p2au35LYvhBNsKc7XP2qc0uztCmxZzA==" + }, + "node_modules/@fluencelabs/registry/node_modules/@fluencelabs/trust-graph": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@fluencelabs/trust-graph/-/trust-graph-0.4.1.tgz", + "integrity": "sha512-V/6ts4q/Y0uKMS6orVpPyxfdd99YFMkm9wN9U2IFtlBUWNsQZG369FK9qEizwsSRCqTchMHYs8Vh4wgZ2uRfuQ==", + "dependencies": { + "@fluencelabs/aqua-lib": "^0.7.0" + } + }, + "node_modules/@fluencelabs/spell": { + "version": "0.5.33", + "resolved": "https://registry.npmjs.org/@fluencelabs/spell/-/spell-0.5.33.tgz", + "integrity": "sha512-JZ+CWTrBXwX6DilzxsJfg39DMsQN9P/h1jyujcDwIpOKynbGCD84g5t9hsplNVH/pEZwcYtGajDH293Sg54bwA==", + "dependencies": { + "@fluencelabs/aqua-lib": "0.8.1" + }, + "engines": { + "node": ">=18", + "pnpm": ">=8" + } + }, + "node_modules/@fluencelabs/trust-graph": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@fluencelabs/trust-graph/-/trust-graph-3.1.2.tgz", + "integrity": "sha512-HpyHtiomh09wv6/83z+bhbkqVngIUdqNGEXRTIPg4sArVPMZ9UCXBrkQsHDRqdMUx0lBAcgB3IjlbdhkwHGaXA==", + "dependencies": { + "@fluencelabs/aqua-lib": "^0.5.2" + } + }, + "node_modules/@fluencelabs/trust-graph/node_modules/@fluencelabs/aqua-lib": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.5.2.tgz", + "integrity": "sha512-fmoFFE8myhLH9d+YR0+0ZPL2YIQyR6M1woAGu5d1xXI02Sjzn4id6dE4PpxHb8cSBPRie8AwsKobHCNqGxI8oA==" + } + } +} diff --git a/aqua-tests/.fluence/project-secrets.yaml b/aqua-tests/.fluence/project-secrets.yaml deleted file mode 100644 index 71d5661..0000000 --- a/aqua-tests/.fluence/project-secrets.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# yaml-language-server: $schema=schemas/project-secrets.yaml.json - -# Defines project's secret keys that are used only in the scope of this particular Fluence project. You can manage project's keys using commands from `fluence key` group of commands - -# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/project-secrets.md - -version: 0 -keyPairs: - [ - { - peerId: 12D3KooWAtJ3RXGiW2WzZYUk7XxAEyfwLdqJHsPXmb7xd1dY7uZK, - secretKey: BNidntUryx+hxr7NK2z9nci23sMn3fURB6bTH1K2Ll4=, - publicKey: CAESIA/dWDmfLpI+PmldVAgQblramknRSyfivJ5x/Y0W6EQC, - name: test_create_resource - }, - { - peerId: 12D3KooWDZkoijNBri8gVwyUikaJUQG2ArKBko2jYeXjP2inKsWZ, - secretKey: e72l3wuItcfCcQBP6Rn4L0uQRsKmyckZRbYXP1ms59Q=, - publicKey: CAESIDewocN3uUk3VzqIhGpbi1XQEOjmEZy8ZYrU04Saz4A6, - name: test_get_resource - }, - { - peerId: 12D3KooWBnhoqKKSS75Zshmi1DawFLH4ybhhqomuU8DMsp1ogLBU, - secretKey: rZxZGGCxECt1opnXjnxrSpV2g6Qt2Fl0KTDoJkox008=, - publicKey: CAESIB1Kay0XOU+P6iv4sPLGx8OooOf6tLng5x+tgT8vGcPD, - name: test_register_record_unregister - }, - { - peerId: 12D3KooWHVLy7L6u1LXjeEwaJz6JNrQowLBoEpgiDjPTNfpHN4Ph, - secretKey: I/ZUMsjlt47e9LxYxbk/LamZJUzNxoBikPA+Qqy8yYA=, - publicKey: CAESIHH+Gj7XJv2LPgknFGKCm+6FDQOcNtgCYblCh5lrQtM4, - name: test_register_unregister_remote_record - } - ] diff --git a/aqua-tests/.fluence/secrets/test_create_resource.txt b/aqua-tests/.fluence/secrets/test_create_resource.txt new file mode 100644 index 0000000..8cf44c4 --- /dev/null +++ b/aqua-tests/.fluence/secrets/test_create_resource.txt @@ -0,0 +1 @@ +BNidntUryx+hxr7NK2z9nci23sMn3fURB6bTH1K2Ll4= \ No newline at end of file diff --git a/aqua-tests/.fluence/secrets/test_get_resource.txt b/aqua-tests/.fluence/secrets/test_get_resource.txt new file mode 100644 index 0000000..ed82988 --- /dev/null +++ b/aqua-tests/.fluence/secrets/test_get_resource.txt @@ -0,0 +1 @@ +e72l3wuItcfCcQBP6Rn4L0uQRsKmyckZRbYXP1ms59Q= \ No newline at end of file diff --git a/aqua-tests/.fluence/secrets/test_register_record_unregister.txt b/aqua-tests/.fluence/secrets/test_register_record_unregister.txt new file mode 100644 index 0000000..0839ea6 --- /dev/null +++ b/aqua-tests/.fluence/secrets/test_register_record_unregister.txt @@ -0,0 +1 @@ +rZxZGGCxECt1opnXjnxrSpV2g6Qt2Fl0KTDoJkox008= \ No newline at end of file diff --git a/aqua-tests/.fluence/secrets/test_register_unregister_remote_record.txt b/aqua-tests/.fluence/secrets/test_register_unregister_remote_record.txt new file mode 100644 index 0000000..784aa4f --- /dev/null +++ b/aqua-tests/.fluence/secrets/test_register_unregister_remote_record.txt @@ -0,0 +1 @@ +I/ZUMsjlt47e9LxYxbk/LamZJUzNxoBikPA+Qqy8yYA= \ No newline at end of file diff --git a/aqua-tests/.gitignore b/aqua-tests/.gitignore index 18f40e4..5d3d1ed 100644 --- a/aqua-tests/.gitignore +++ b/aqua-tests/.gitignore @@ -1 +1,2 @@ /.fluence/schemas +/.fluence/aqua-dependencies/package.json diff --git a/aqua-tests/fluence.yaml b/aqua-tests/fluence.yaml index 011debc..fbf32ca 100644 --- a/aqua-tests/fluence.yaml +++ b/aqua-tests/fluence.yaml @@ -1,14 +1,18 @@ -# yaml-language-server: $schema=.fluence/schemas/fluence.yaml.json +# yaml-language-server: $schema=.fluence/schemas/fluence.json # Defines Fluence Project, most importantly - what exactly you want to deploy and how. You can use `fluence init` command to generate a template for new Fluence project # Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence.md -version: 2 +version: 5 + +aquaInputPath: aqua/test.aqua + dependencies: - npm: - "@fluencelabs/aqua-lib": 0.7.1 cargo: marine: 0.14.1 mrepl: 0.21.3 -aquaInputPath: aqua/test.aqua + npm: + '@fluencelabs/aqua-lib': 0.8.1 + '@fluencelabs/spell': 0.5.33 + '@fluencelabs/trust-graph': 3.1.2 diff --git a/aqua-tests/package-lock.json b/aqua-tests/package-lock.json index fbe5117..0c57ed5 100644 --- a/aqua-tests/package-lock.json +++ b/aqua-tests/package-lock.json @@ -1,58 +1,18 @@ { "name": "aqua-tests", - "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "aqua-tests", - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "@fluencelabs/aqua-lib": "0.8.2", - "@fluencelabs/registry": "file:../aqua", - "@fluencelabs/trust-graph": "3.1.2" - }, "devDependencies": { "@fluencelabs/fluence-network-environment": "1.1.2" } }, - "../aqua": { - "name": "@fluencelabs/registry", - "version": "0.9.1", - "license": "MIT", - "dependencies": { - "@fluencelabs/aqua-lib": "0.8.2", - "@fluencelabs/trust-graph": "3.1.2" - } - }, - "node_modules/@fluencelabs/aqua-lib": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.8.2.tgz", - "integrity": "sha512-z3kKy5hlgqA3yYvbofdSgcUcM2x0FLIj8t80UTwRwAyDmNfvKcLKNRD4BkbPqWfvLfz9NfASgqak9QAJ5h9/JQ==" - }, "node_modules/@fluencelabs/fluence-network-environment": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@fluencelabs/fluence-network-environment/-/fluence-network-environment-1.1.2.tgz", "integrity": "sha512-1Bp2gBy3oMEILMynFpOIFK/q2Pj792xpnb3AJs5QcTQAaHz9V2nrEI8OOPwBAFTmjmLBirXBqQQX63O+ePH7yg==", "dev": true - }, - "node_modules/@fluencelabs/registry": { - "resolved": "../aqua", - "link": true - }, - "node_modules/@fluencelabs/trust-graph": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@fluencelabs/trust-graph/-/trust-graph-3.1.2.tgz", - "integrity": "sha512-HpyHtiomh09wv6/83z+bhbkqVngIUdqNGEXRTIPg4sArVPMZ9UCXBrkQsHDRqdMUx0lBAcgB3IjlbdhkwHGaXA==", - "dependencies": { - "@fluencelabs/aqua-lib": "^0.5.2" - } - }, - "node_modules/@fluencelabs/trust-graph/node_modules/@fluencelabs/aqua-lib": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.5.2.tgz", - "integrity": "sha512-fmoFFE8myhLH9d+YR0+0ZPL2YIQyR6M1woAGu5d1xXI02Sjzn4id6dE4PpxHb8cSBPRie8AwsKobHCNqGxI8oA==" } } } diff --git a/aqua-tests/package.json b/aqua-tests/package.json index 2f49227..0daf6ea 100644 --- a/aqua-tests/package.json +++ b/aqua-tests/package.json @@ -1,33 +1,4 @@ { - "name": "aqua-tests", - "version": "1.0.0", - "description": "Aqua Registry library", - "dependencies": { - "@fluencelabs/aqua-lib": "0.8.2", - "@fluencelabs/registry": "file:../aqua", - "@fluencelabs/trust-graph": "3.1.2" - }, - "scripts": { - "compile-aqua": "fluence aqua -i . -o ./target/typescript", - "generate-aqua": "../service/build.sh", - "build": "npm run compile-aqua", - "secret": "fluence key new" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/fluencelabs/registry.git", - "directory": "aqua" - }, - "keywords": [ - "aqua", - "fluence" - ], - "author": "Fluence Labs", - "license": "MIT", - "bugs": { - "url": "https://github.com/fluencelabs/registry/issues" - }, - "homepage": "https://github.com/fluencelabs/registry", "devDependencies": { "@fluencelabs/fluence-network-environment": "1.1.2" } diff --git a/spell/spell.aqua b/aqua-tests/spell/spell.aqua similarity index 95% rename from spell/spell.aqua rename to aqua-tests/spell/spell.aqua index a9f8252..e9f6a34 100644 --- a/spell/spell.aqua +++ b/aqua-tests/spell/spell.aqua @@ -2,8 +2,8 @@ import Op, Debug, Peer, Kademlia from "@fluencelabs/aqua-lib/builtin.aqua" import Spell from "@fluencelabs/spell/spell_service.aqua" import Compare from "@fluencelabs/aqua-lib/math.aqua" -import "../aqua/registry-service.aqua" -import "../aqua/registry-api.aqua" +import "@fluencelabs/registry/registry-service.aqua" +import "@fluencelabs/registry/registry-api.aqua" import "@fluencelabs/trust-graph/trust-graph.aqua" data SpellConfig: diff --git a/spell/spell.yaml b/aqua-tests/spell/spell.yaml similarity index 100% rename from spell/spell.yaml rename to aqua-tests/spell/spell.yaml diff --git a/aqua-tests/test_aqua.py b/aqua-tests/test_aqua.py index 2ad8d1e..0fd40d5 100644 --- a/aqua-tests/test_aqua.py +++ b/aqua-tests/test_aqua.py @@ -5,7 +5,6 @@ import os import inspect from config import get_local -delegator.run("fluence dep npm i", block=True) default_peers = json.loads(delegator.run( f"node ./getDefaultPeers.js", block=True).out) @@ -58,7 +57,7 @@ def run_aqua(func, args, relay=get_random_relay()): # when running one test at a time, the stack is shorter so we need to use a different index test_name = inspect.stack()[-32][3] - command = f"fluence run -k {test_name} --relay {relay} -f '{call}' --data '{json.dumps(data)}' --import 'node_modules' --quiet --particle-id" + command = f"fluence run -k {test_name} --relay {relay} -f '{call}' --data '{json.dumps(data)}' --quiet --particle-id" print(command) c = delegator.run(command, block=True) lines = c.out.splitlines() diff --git a/aqua/.fluence/schemas/fluence.yaml.json b/aqua/.fluence/schemas/fluence.yaml.json deleted file mode 100644 index 796fdf4..0000000 --- a/aqua/.fluence/schemas/fluence.yaml.json +++ /dev/null @@ -1,459 +0,0 @@ -{ - "type": "object", - "properties": { - "services": { - "title": "Services", - "description": "A map with service names as keys and Service configs as values. You can have any number of services listed here (According to JSON schema they are called 'additionalProperties') as long as service name keys start with a lowercase letter and contain only letters numbers and underscores. You can use `fluence service add` command to add a service to this config", - "type": "object", - "additionalProperties": { - "title": "Service config", - "description": "Service names as keys (must start with a lowercase letter and contain only letters numbers and underscores) and Service config (defines where the service is and how to deploy it) as values", - "type": "object", - "properties": { - "get": { - "type": "string", - "description": "Path to service directory or URL to the tar.gz archive with the service" - }, - "overrideModules": { - "type": "object", - "title": "Overrides", - "description": "A map of modules to override", - "additionalProperties": { - "type": "object", - "title": "Module overrides", - "description": "Module names as keys and overrides for the module config as values", - "properties": { - "get": { - "type": "string", - "nullable": true, - "description": "Path to module directory or URL to the tar.gz archive with the module" - }, - "maxHeapSize": { - "type": "string", - "nullable": true, - "description": "Max size of the heap that a module can allocate in format: [number][whitespace?][specificator?] where ? is an optional field and specificator is one from the following (case-insensitive):\n\nK, Kb - kilobyte\n\nKi, KiB - kibibyte\n\nM, Mb - megabyte\n\nMi, MiB - mebibyte\n\nG, Gb - gigabyte\n\nGi, GiB - gibibyte\n\nCurrent limit is 4 GiB" - }, - "loggerEnabled": { - "type": "boolean", - "nullable": true, - "description": "Set true to allow module to use the Marine SDK logger" - }, - "loggingMask": { - "type": "number", - "nullable": true, - "description": "Used for logging management. Example:\n```rust\nconst TARGET_MAP: [(&str, i64); 4] = [\n(\"instruction\", 1 << 1),\n(\"data_cache\", 1 << 2),\n(\"next_peer_pks\", 1 << 3),\n(\"subtree_complete\", 1 << 4),\n];\npub fn main() {\nuse std::collections::HashMap;\nuse std::iter::FromIterator;\n\nlet target_map = HashMap::from_iter(TARGET_MAP.iter().cloned());\n\nmarine_rs_sdk::WasmLoggerBuilder::new()\n .with_target_map(target_map)\n .build()\n .unwrap();\n}\n#[marine]\npub fn foo() {\nlog::info!(target: \"instruction\", \"this will print if (loggingMask & 1) != 0\");\nlog::info!(target: \"data_cache\", \"this will print if (loggingMask & 2) != 0\");\n}\n```\n" - }, - "volumes": { - "type": "object", - "nullable": true, - "required": [], - "title": "Volumes", - "description": "A map of accessible files and their aliases. Aliases should be used in Marine module development because it's hard to know the full path to a file" - }, - "envs": { - "type": "object", - "title": "Environment variables", - "nullable": true, - "required": [], - "description": "environment variables accessible by a particular module with standard Rust env API like this: std::env::var(IPFS_ADDR_ENV_NAME).\n\nPlease note that Marine adds three additional environment variables. Module environment variables could be examined with repl" - }, - "mountedBinaries": { - "title": "Mounted binaries", - "type": "object", - "nullable": true, - "required": [], - "description": "A map of binary executable files that module is allowed to call. Example: curl: /usr/bin/curl" - } - }, - "required": [], - "nullable": true - }, - "nullable": true, - "required": [] - }, - "deploy": { - "type": "array", - "title": "Deployment list", - "nullable": true, - "description": "List of deployments for the particular service", - "items": { - "type": "object", - "title": "Deployment", - "description": "A small config for a particular deployment. You can have specific overrides for each and specific deployment properties like count, etc.", - "properties": { - "keyPairName": { - "type": "string", - "nullable": true, - "description": "The name of the Key Pair to use. It is resolved in the following order (from the lowest to the highest priority):\n1. \"defaultKeyPairName\" property from user-secrets.yaml\n1. \"defaultKeyPairName\" property from project-secrets.yaml\n1. \"keyPairName\" property from the top level of fluence.yaml\n1. \"keyPairName\" property from the \"services\" level of fluence.yaml\n1. \"keyPairName\" property from the individual \"deploy\" property item level of fluence.yaml" - }, - "deployId": { - "type": "string", - "description": "This id can be used in Aqua to access actually deployed peer and service ids. The ID must start with a lowercase letter and contain only letters, numbers, and underscores." - }, - "count": { - "type": "number", - "minimum": 1, - "nullable": true, - "description": "Number of services to deploy. Default: 1 or if \"peerIds\" property is provided - exactly the number of peerIds" - }, - "peerId": { - "type": "string", - "nullable": true, - "description": "Peer id or peer id name to deploy to. Default: Peer ids from the \"relay\" property of fluence.yaml are selected for each deploy. Named peerIds can be listed in \"peerIds\" property of fluence.yaml)" - }, - "peerIds": { - "type": "array", - "items": { - "type": "string" - }, - "nullable": true, - "title": "Peer ids", - "description": "Peer ids or peer id names to deploy to. Overrides \"peerId\" property. Named peerIds can be listed in \"peerIds\" property of fluence.yaml)" - }, - "overrideModules": { - "type": "object", - "title": "Overrides", - "description": "A map of modules to override", - "additionalProperties": { - "type": "object", - "title": "Module overrides", - "description": "Module names as keys and overrides for the module config as values", - "properties": { - "get": { - "type": "string", - "nullable": true, - "description": "Path to module directory or URL to the tar.gz archive with the module" - }, - "maxHeapSize": { - "type": "string", - "nullable": true, - "description": "Max size of the heap that a module can allocate in format: [number][whitespace?][specificator?] where ? is an optional field and specificator is one from the following (case-insensitive):\n\nK, Kb - kilobyte\n\nKi, KiB - kibibyte\n\nM, Mb - megabyte\n\nMi, MiB - mebibyte\n\nG, Gb - gigabyte\n\nGi, GiB - gibibyte\n\nCurrent limit is 4 GiB" - }, - "loggerEnabled": { - "type": "boolean", - "nullable": true, - "description": "Set true to allow module to use the Marine SDK logger" - }, - "loggingMask": { - "type": "number", - "nullable": true, - "description": "Used for logging management. Example:\n```rust\nconst TARGET_MAP: [(&str, i64); 4] = [\n(\"instruction\", 1 << 1),\n(\"data_cache\", 1 << 2),\n(\"next_peer_pks\", 1 << 3),\n(\"subtree_complete\", 1 << 4),\n];\npub fn main() {\nuse std::collections::HashMap;\nuse std::iter::FromIterator;\n\nlet target_map = HashMap::from_iter(TARGET_MAP.iter().cloned());\n\nmarine_rs_sdk::WasmLoggerBuilder::new()\n .with_target_map(target_map)\n .build()\n .unwrap();\n}\n#[marine]\npub fn foo() {\nlog::info!(target: \"instruction\", \"this will print if (loggingMask & 1) != 0\");\nlog::info!(target: \"data_cache\", \"this will print if (loggingMask & 2) != 0\");\n}\n```\n" - }, - "volumes": { - "type": "object", - "nullable": true, - "required": [], - "title": "Volumes", - "description": "A map of accessible files and their aliases. Aliases should be used in Marine module development because it's hard to know the full path to a file" - }, - "envs": { - "type": "object", - "title": "Environment variables", - "nullable": true, - "required": [], - "description": "environment variables accessible by a particular module with standard Rust env API like this: std::env::var(IPFS_ADDR_ENV_NAME).\n\nPlease note that Marine adds three additional environment variables. Module environment variables could be examined with repl" - }, - "mountedBinaries": { - "title": "Mounted binaries", - "type": "object", - "nullable": true, - "required": [], - "description": "A map of binary executable files that module is allowed to call. Example: curl: /usr/bin/curl" - } - }, - "required": [], - "nullable": true - }, - "nullable": true, - "required": [] - } - }, - "required": [ - "deployId" - ] - } - }, - "keyPairName": { - "type": "string", - "nullable": true, - "description": "The name of the Key Pair to use. It is resolved in the following order (from the lowest to the highest priority):\n1. \"defaultKeyPairName\" property from user-secrets.yaml\n1. \"defaultKeyPairName\" property from project-secrets.yaml\n1. \"keyPairName\" property from the top level of fluence.yaml\n1. \"keyPairName\" property from the \"services\" level of fluence.yaml\n1. \"keyPairName\" property from the individual \"deploy\" property item level of fluence.yaml" - } - }, - "required": [ - "get" - ] - }, - "required": [], - "nullable": true - }, - "relays": { - "title": "Relays", - "description": "List of Fluence Peer multi addresses or a name of the network. This multi addresses are used for connecting to the Fluence network when deploying. Peer ids from these addresses are also used for deploying in case if you don't specify \"peerId\" or \"peerIds\" property in the deployment config. Default: kras", - "type": [ - "string", - "array", - "null" - ], - "oneOf": [ - { - "type": "string", - "title": "Network name", - "enum": [ - "kras", - "stage", - "testnet" - ] - }, - { - "type": "array", - "title": "Multi addresses", - "items": { - "type": "string" - }, - "minItems": 1 - } - ], - "nullable": true - }, - "peerIds": { - "title": "Peer ids", - "description": "A map of named peerIds. Example:\n\nMY_PEER: 12D3KooWCMr9mU894i8JXAFqpgoFtx6qnV1LFPSfVc3Y34N4h4LS", - "type": "object", - "nullable": true, - "required": [], - "additionalProperties": { - "type": "string", - "description": "Peer id names as keys and the actual peer ids as values" - } - }, - "keyPairName": { - "type": "string", - "nullable": true, - "description": "The name of the Key Pair to use. It is resolved in the following order (from the lowest to the highest priority):\n1. \"defaultKeyPairName\" property from user-secrets.yaml\n1. \"defaultKeyPairName\" property from project-secrets.yaml\n1. \"keyPairName\" property from the top level of fluence.yaml\n1. \"keyPairName\" property from the \"services\" level of fluence.yaml\n1. \"keyPairName\" property from the individual \"deploy\" property item level of fluence.yaml" - }, - "version": { - "type": "number", - "const": 2 - }, - "dependencies": { - "type": "object", - "title": "Dependencies", - "nullable": true, - "description": "(For advanced users) Overrides for the project dependencies", - "properties": { - "npm": { - "type": "object", - "title": "npm dependencies", - "nullable": true, - "description": "A map of npm dependency versions. CLI ensures dependencies are installed each time you run aqua", - "required": [] - }, - "cargo": { - "type": "object", - "title": "Cargo dependencies", - "nullable": true, - "description": "A map of cargo dependency versions. CLI ensures dependencies are installed each time you run commands that depend on Marine or Marine REPL", - "required": [] - } - }, - "required": [] - }, - "aquaInputPath": { - "type": "string", - "nullable": true, - "description": "Path to the aqua file or directory with aqua files that you want to compile by default. Must be relative to the project root dir" - }, - "aquaOutputTSPath": { - "type": "string", - "nullable": true, - "description": "Path to the default compilation target dir from aqua to ts. Must be relative to the project root dir" - }, - "aquaOutputJSPath": { - "type": "string", - "nullable": true, - "description": "Path to the default compilation target dir from aqua to js. Must be relative to the project root dir. Overrides 'aquaOutputTSPath' property" - }, - "hosts": { - "description": "A map of objects with worker names as keys, each object defines a list of peer IDs to host the worker on", - "type": "object", - "nullable": true, - "additionalProperties": { - "type": "object", - "properties": { - "peerIds": { - "type": "array", - "description": "An array of peer IDs to deploy on", - "items": { - "type": "string" - } - } - }, - "required": [ - "peerIds" - ] - }, - "required": [] - }, - "workers": { - "nullable": true, - "description": "A Map with worker names as keys and worker configs as values", - "type": "object", - "additionalProperties": { - "type": "object", - "description": "Worker config", - "properties": { - "services": { - "description": "An array of service names to include in this worker. Service names must be listed in fluence.yaml", - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - }, - "spells": { - "description": "An array of spell names to include in this worker. Spell names must be listed in fluence.yaml", - "type": "array", - "items": { - "type": "string" - }, - "nullable": true - } - }, - "required": [] - }, - "required": [] - }, - "deals": { - "description": "A map of objects with worker names as keys, each object defines a deal", - "type": "object", - "nullable": true, - "additionalProperties": { - "type": "object", - "properties": { - "minWorkers": { - "type": "number", - "description": "Required workers to activate the deal", - "default": 1, - "nullable": true, - "minimum": 1 - }, - "targetWorkers": { - "type": "number", - "description": "Max workers in the deal", - "default": 3, - "nullable": true, - "minimum": 1 - } - }, - "required": [] - }, - "required": [] - }, - "chainNetwork": { - "type": "string", - "description": "The network in which the transactions will be carried out", - "enum": [ - "local", - "testnet" - ], - "default": "testnet", - "nullable": true - }, - "spells": { - "type": "object", - "nullable": true, - "description": "A map with spell names as keys and spell configs as values", - "additionalProperties": { - "type": "object", - "description": "Spell config", - "properties": { - "get": { - "type": "string", - "description": "Path to spell" - }, - "version": { - "type": "number", - "const": 0 - }, - "aquaFilePath": { - "type": "string", - "description": "Path to Aqua file which contains an Aqua function that you want to use as a spell", - "nullable": true - }, - "function": { - "type": "string", - "description": "Name of the Aqua function that you want to use as a spell", - "nullable": true - }, - "initArgs": { - "type": "object", - "description": "A map of Aqua function arguments names as keys and arguments values as values. They will be passed to the spell function and will be stored in the key-value storage for this particular spell.", - "nullable": true - }, - "clock": { - "type": "object", - "nullable": true, - "description": "Trigger the spell execution periodically. If you want to disable this property by overriding it in fluence.yaml - pass empty config for it like this: `clock: {}`", - "properties": { - "periodSec": { - "type": "number", - "description": "How often the spell will be executed. If set to 0, the spell will be executed only once. If this value not provided at all - the spell will never be executed", - "minimum": 0, - "maximum": 3153600000, - "nullable": true - }, - "startTimestamp": { - "type": "string", - "description": "An ISO timestamp when the periodic execution should start. If this property or `startDelaySec` not specified, periodic execution will start immediately. If it is set to 0 - the spell will never be executed", - "nullable": true - }, - "endTimestamp": { - "type": "string", - "description": "An ISO timestamp when the periodic execution should end. If this property or `endDelaySec` not specified, periodic execution will never end. If it is in the past at the moment of spell creation on Rust peer - the spell will never be executed", - "nullable": true - }, - "startDelaySec": { - "type": "number", - "description": "How long to wait before the first execution in seconds. If this property or `startTimestamp` not specified, periodic execution will start immediately. WARNING! Currently your computer's clock is used to determine a final timestamp that is sent to the server. This property conflicts with `startTimestamp`. You can specify only one of them", - "nullable": true, - "minimum": 0, - "maximum": 4294967295 - }, - "endDelaySec": { - "type": "number", - "description": "How long to wait before the last execution in seconds. If this property or `endTimestamp` not specified, periodic execution will never end. WARNING! Currently your computer's clock is used to determine a final timestamp that is sent to the server. If it is in the past at the moment of spell creation - the spell will never be executed. This property conflicts with `endTimestamp`. You can specify only one of them", - "nullable": true, - "minimum": 0, - "maximum": 4294967295 - } - }, - "required": [] - } - }, - "required": [ - "get" - ] - }, - "required": [] - }, - "aquaImports": { - "type": "array", - "description": "A list of path to be considered by aqua compiler to be used as imports. First dependency in the list has the highest priority. Priority of imports is considered in the following order: imports from --import flags, imports from aquaImports property in fluence.yaml, project's .fluence/aqua dir, npm dependencies from fluence.yaml, npm dependencies from user's .fluence/config.yaml, npm dependencies recommended by fluence", - "items": { - "type": "string" - }, - "nullable": true - }, - "cliVersion": { - "type": "string", - "description": "The version of the CLI that is compatible with this project. Set this to enforce a particular set of versions of all fluence components", - "nullable": true - } - }, - "required": [ - "version" - ], - "$id": "https://fluence.dev/schemas/fluence.yaml", - "title": "fluence.yaml", - "description": "Defines Fluence Project, most importantly - what exactly you want to deploy and how. You can use `fluence init` command to generate a template for new Fluence project" -} diff --git a/aqua/fluence.yaml b/aqua/fluence.yaml deleted file mode 100644 index 147e247..0000000 --- a/aqua/fluence.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# yaml-language-server: $schema=.fluence/schemas/fluence.yaml.json - -# Defines Fluence Project, most importantly - what exactly you want to deploy and how. You can use `fluence init` command to generate a template for new Fluence project - -# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence.md - -version: 2 -dependencies: - npm: - "@fluencelabs/aqua-lib": 0.7.1 diff --git a/aqua/package.json b/aqua/package.json index c9bba5b..3cec0cc 100644 --- a/aqua/package.json +++ b/aqua/package.json @@ -10,9 +10,8 @@ "@fluencelabs/trust-graph": "3.1.2" }, "scripts": { - "compile-aqua": "fluence aqua -i . -o ./target/typescript", "generate-aqua": "../service/build.sh", - "build": "npm run compile-aqua" + "build": "fluence aqua -i . --dry" }, "repository": { "type": "git", diff --git a/build.sh b/build.sh index 0c86982..6434c0a 100755 --- a/build.sh +++ b/build.sh @@ -11,7 +11,16 @@ DISTRO_TARGET=distro/registry-service mkdir -p "$DISTRO_TARGET" cd ./aqua -fluence aqua -i ../spell/spell.aqua --no-relay --air -o "../$DISTRO_TARGET/air" +npm pack +cd - + +packed_archive_file_name_pattern="fluencelabs-registry-" +packed_archive_file_name=$(find "./aqua" -type f -name "${packed_archive_file_name_pattern}*") + +cd ./aqua-tests +echo " '@fluencelabs/registry': file:../../.$packed_archive_file_name" >> "./fluence.yaml" +fluence dep npm i +fluence aqua -i ./spell/spell.aqua --no-relay --air -o "../$DISTRO_TARGET/air" cd - cp service/artifacts/registry.wasm service/artifacts/sqlite3.wasm distro/Config.toml "$DISTRO_TARGET"