Compare commits

..

No commits in common. "main" and "registry-v0.9.2" have entirely different histories.

74 changed files with 13027 additions and 6968 deletions

View File

@ -1,3 +1,3 @@
{
".": "0.9.4"
".": "0.9.2"
}

View File

@ -7,7 +7,6 @@ on:
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/snapshot.yml"
- "!.github/workflows/tests.yml"
types:
- "labeled"
- "synchronize"
@ -21,7 +20,6 @@ on:
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/snapshot.yml"
- "!.github/workflows/tests.yml"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
@ -69,4 +67,3 @@ jobs:
with:
ref: ${{ github.ref }}
nox-image: "${{ needs.nox-snapshot.outputs.nox-image }}"
if-no-artifacts-found: warn

View File

@ -125,7 +125,7 @@ jobs:
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: main
version: stage
- name: Build service
run: ./build.sh

View File

@ -7,7 +7,6 @@ on:
- ".github/**"
- "!.github/workflows/run-tests.yml"
- "!.github/workflows/tests.yml"
- "!.github/workflows/e2e.yml"
types:
- "labeled"
- "synchronize"
@ -21,7 +20,6 @@ on:
- ".github/**"
- "!.github/workflows/run-tests.yml"
- "!.github/workflows/tests.yml"
- "!.github/workflows/e2e.yml"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"

View File

@ -57,7 +57,7 @@ jobs:
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: main
version: stage
- name: Import secrets
if: inputs.snapshot == true

View File

@ -14,11 +14,7 @@ on:
fcli-version:
description: "@fluencelabs/cli version"
type: string
default: "main"
if-no-artifacts-found:
description: "What to do when no artifacts found in setup-* actions"
type: string
default: "error"
default: "stage"
cargo-dependencies:
description: "Cargo dependencies map"
type: string
@ -85,7 +81,6 @@ jobs:
with:
artifact: fcli
version: ${{ inputs.fcli-version }}
if-no-artifact-found: ${{ inputs.if-no-artifacts-found }}
- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1

5
.gitignore vendored
View File

@ -14,8 +14,9 @@ distro/registry-service/
**/dist
*.drawio
aqua/*.tgz
examples/src/generated/**
# Remove after https://github.com/fluencelabs/aqua/issues/287
aqua/target/typescript/**
example/src/generated/**
**/__pycache__
tmp

View File

@ -1,34 +1,5 @@
# Changelog
## [0.9.4](https://github.com/fluencelabs/registry/compare/registry-v0.9.3...registry-v0.9.4) (2024-01-04)
### Features
* **registry:** Use `aqua` keyword instead of `module` ([#313](https://github.com/fluencelabs/registry/issues/313)) ([b9bce2e](https://github.com/fluencelabs/registry/commit/b9bce2e7641d0431d8199d6a104f8c3d2fe3eee5))
### Bug Fixes
* **deps:** update dependency @fluencelabs/aqua-lib to v0.9.0 ([#328](https://github.com/fluencelabs/registry/issues/328)) ([5c9af8b](https://github.com/fluencelabs/registry/commit/5c9af8bd3a36493802b8e913d917e2fbd1621977))
* **deps:** update marine things ([#307](https://github.com/fluencelabs/registry/issues/307)) ([f78212d](https://github.com/fluencelabs/registry/commit/f78212d49bca9fe30def6702ec65aa187fe9deb1))
* **deps:** update rust crate fluence-keypair to v0.10.4 ([#318](https://github.com/fluencelabs/registry/issues/318)) ([b71b85c](https://github.com/fluencelabs/registry/commit/b71b85ca1eb0472176b78c237e421ec04418e0d9))
* **deps:** update sqlite wasm to 0.18.2 ([#320](https://github.com/fluencelabs/registry/issues/320)) ([7d9327b](https://github.com/fluencelabs/registry/commit/7d9327bcfd11c2dd63b360c96fed045f3f0952c3))
* **registry:** Revert release registry 0.9.4 ([#331](https://github.com/fluencelabs/registry/issues/331)) ([e9ba1ad](https://github.com/fluencelabs/registry/commit/e9ba1ad248418e3811fa8d7653545028b7e48127))
## [0.9.3](https://github.com/fluencelabs/registry/compare/registry-v0.9.2...registry-v0.9.3) (2023-12-21)
### Features
* use new aqua packages ([#310](https://github.com/fluencelabs/registry/issues/310)) ([633d8e6](https://github.com/fluencelabs/registry/commit/633d8e6648f344487da68b610857ee9837d0c081))
### Bug Fixes
* **deps:** update dependency @fluencelabs/trust-graph to v3.1.2 ([#189](https://github.com/fluencelabs/registry/issues/189)) ([7ba20dc](https://github.com/fluencelabs/registry/commit/7ba20dcabd9747256609e9b986bd63f47c94e691))
* **spell:** update spell api ([#315](https://github.com/fluencelabs/registry/issues/315)) ([3092907](https://github.com/fluencelabs/registry/commit/3092907e5e5d38caeeda15a83ea11e0462022f41))
## [0.9.2](https://github.com/fluencelabs/registry/compare/registry-v0.9.1...registry-v0.9.2) (2023-12-19)

View File

@ -7,7 +7,7 @@ dependencies:
npm:
"@fluencelabs/registry": 0.6.2
```
And then run `fluence dep i`
And then run `fluence dep npm i`
If you are developing from scratch without Fluence CLI, you should install it via npm:

View File

@ -1,67 +0,0 @@
{
"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=="
}
}
}

View File

@ -0,0 +1,34 @@
# 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
}
]

View File

@ -1 +0,0 @@
BNidntUryx+hxr7NK2z9nci23sMn3fURB6bTH1K2Ll4=

View File

@ -1 +0,0 @@
e72l3wuItcfCcQBP6Rn4L0uQRsKmyckZRbYXP1ms59Q=

View File

@ -1 +0,0 @@
rZxZGGCxECt1opnXjnxrSpV2g6Qt2Fl0KTDoJkox008=

View File

@ -1 +0,0 @@
I/ZUMsjlt47e9LxYxbk/LamZJUzNxoBikPA+Qqy8yYA=

View File

@ -1,2 +1 @@
/.fluence/schemas
/.fluence/aqua-dependencies/package.json

View File

@ -1,8 +1,7 @@
aqua Test
module Test
import "@fluencelabs/aqua-lib/builtin.aqua"
import "@fluencelabs/registry/resources-api.aqua"
export getResource, createResource, getResourceId, get_peer_id, registerService, resolveResource, unregisterService
func get_peer_id() -> PeerId:

View File

@ -1,18 +1,14 @@
# yaml-language-server: $schema=.fluence/schemas/fluence.json
# 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: 5
aquaInputPath: aqua/test.aqua
version: 2
dependencies:
npm:
"@fluencelabs/aqua-lib": 0.7.1
cargo:
marine: 0.14.1
mrepl: 0.21.3
npm:
'@fluencelabs/aqua-lib': 0.9.1
'@fluencelabs/spell': 0.6.9
'@fluencelabs/trust-graph': 0.4.11
aquaInputPath: aqua/test.aqua

View File

@ -1,18 +1,58 @@
{
"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.0.4"
},
"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": "0.4.7"
}
},
"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.0.4",
"resolved": "https://registry.npmjs.org/@fluencelabs/trust-graph/-/trust-graph-3.0.4.tgz",
"integrity": "sha512-4CWe/dBuZwrj5iU6mTrLz5JCSy5v1fw7dYjD65Pz05xWAbLH2jw72YIJfbMX0utzb1qiM8CooXv1XKPgutCIHQ==",
"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=="
}
}
}

View File

@ -1,4 +1,33 @@
{
"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.0.4"
},
"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"
}

View File

@ -5,6 +5,7 @@ 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)
@ -57,7 +58,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)}' --quiet --particle-id"
command = f"fluence run -k {test_name} --relay {relay} -f '{call}' --data '{json.dumps(data)}' --import 'node_modules' --quiet --particle-id"
print(command)
c = delegator.run(command, block=True)
lines = c.out.splitlines()

View File

@ -0,0 +1,459 @@
{
"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"
}

View File

@ -1,5 +1,3 @@
aqua Constants declares *
-- the number of peers to which data will be replicated during the API call
const INITIAL_REPLICATION_FACTOR = 1
-- the minimal number of peers requested to obtain the data.

10
aqua/fluence.yaml Normal file
View File

@ -0,0 +1,10 @@
# 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

View File

@ -1,5 +1,3 @@
aqua Misc declares *
import "@fluencelabs/aqua-lib/builtin.aqua"
import "registry-service.aqua"
import "constants.aqua"

27
aqua/package-lock.json generated
View File

@ -1,30 +1,35 @@
{
"name": "@fluencelabs/registry",
"version": "0.9.4",
"version": "0.9.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@fluencelabs/registry",
"version": "0.9.4",
"version": "0.9.2",
"license": "MIT",
"dependencies": {
"@fluencelabs/aqua-lib": "0.9.1",
"@fluencelabs/trust-graph": "0.4.11"
"@fluencelabs/aqua-lib": "0.8.2",
"@fluencelabs/trust-graph": "0.4.7"
}
},
"node_modules/@fluencelabs/aqua-lib": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.9.1.tgz",
"integrity": "sha512-W4KBhUkFC/kb3Mvjmhpnz0vvtr1kqpV8IWTWlbitzzS1k5FhODQYP2k7ROkDyjEztg/7Bn5eunstEHr9Sxj6qA=="
"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/trust-graph": {
"version": "0.4.11",
"resolved": "https://registry.npmjs.org/@fluencelabs/trust-graph/-/trust-graph-0.4.11.tgz",
"integrity": "sha512-tjtwahYw9Ol+P3SQuqiiucAqaZ9ftDXqUkNeJ/SxrJYR4zFu65yzyyQhZvUQe7msc+csLbhn03cGHqK0MKV0gA==",
"version": "0.4.7",
"resolved": "https://registry.npmjs.org/@fluencelabs/trust-graph/-/trust-graph-0.4.7.tgz",
"integrity": "sha512-e4TxWimUh9GBWjqSO8WGsSqjZfyIs6f39/8Pzfo6PCcNoSf8FPaaO817Pw4FmAXYEKR1IalIUX3CDdym3NlHWw==",
"dependencies": {
"@fluencelabs/aqua-lib": "^0.9.0"
"@fluencelabs/aqua-lib": "^0.7.0"
}
},
"node_modules/@fluencelabs/trust-graph/node_modules/@fluencelabs/aqua-lib": {
"version": "0.7.7",
"resolved": "https://registry.npmjs.org/@fluencelabs/aqua-lib/-/aqua-lib-0.7.7.tgz",
"integrity": "sha512-/RvIwaLGmNuzkoFTRXOp66BTiVVkmljiY1Do3f/wRnYWZO8jdjQ/bmO+v1rhGZ7+DYzTL1YT54Vxt5/ralnPvA=="
}
}
}

View File

@ -1,17 +1,18 @@
{
"name": "@fluencelabs/registry",
"version": "0.9.4",
"version": "0.9.2",
"description": "Aqua Registry library",
"files": [
"*.aqua"
],
"dependencies": {
"@fluencelabs/aqua-lib": "0.9.1",
"@fluencelabs/trust-graph": "0.4.11"
"@fluencelabs/aqua-lib": "0.8.2",
"@fluencelabs/trust-graph": "0.4.7"
},
"scripts": {
"compile-aqua": "fluence aqua -i . -o ./target/typescript",
"generate-aqua": "../service/build.sh",
"build": "fluence aqua -i . --dry"
"build": "npm run compile-aqua"
},
"repository": {
"type": "git",

View File

@ -1,10 +1,3 @@
aqua RegistryApi declares *
export getKeySignature, getRecordMetadata
export getRecordSignature, getTombstoneSignature
export registerKey, putRecord, addTombstone
export getKeyMetadata, republishKey
import "registry-service.aqua"
import PeerId, Peer, Sig, SignResult from "@fluencelabs/aqua-lib/builtin.aqua"
import "@fluencelabs/trust-graph/trust-graph.aqua"

View File

@ -1,4 +1,4 @@
aqua Registry.Scheduled declares *
module Registry.Scheduled declares *
export clearExpired_86400, replicate_3600, renew_43200

View File

@ -1,4 +1,4 @@
aqua Registry declares *
module Registry declares *
data ClearExpiredResult:
success: bool

View File

@ -1,4 +1,4 @@
aqua Registry.ResourcesAPI declares *
module Registry.ResourcesAPI declares *
import "registry-service.aqua"
import "registry-api.aqua"
@ -6,6 +6,10 @@ import "misc.aqua"
import "constants.aqua"
import "@fluencelabs/aqua-lib/builtin.aqua"
alias ResourceId: string
alias Resource: Key
alias Error: string
func getResource(resource_id: ResourceId) -> ?Resource, *Error:
on HOST_PEER_ID:
result, error <- getResourceHelper(resource_id)

View File

@ -1,744 +0,0 @@
/* eslint-disable */
// @ts-nocheck
/**
*
* This file is auto-generated. Do not edit manually: changes may be erased.
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
* Aqua version: 0.11.9-release-please-1c9388a-1275-1
*
*/
import type { IFluenceClient as IFluenceClient$$, CallParams as CallParams$$ } from '@fluencelabs/js-client.api';
import {
v5_callFunction as callFunction$$,
v5_registerService as registerService$$,
} from '@fluencelabs/js-client.api';
// Services
// Functions
export const getResourceHelper_script = `
(seq
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "resource_id") [] resource_id)
)
(xor
(new $resources
(new $successful
(new $result
(seq
(seq
(seq
(seq
(seq
(seq
(call %init_peer_id% ("op" "string_to_b58") [resource_id] k)
(call %init_peer_id% ("kad" "neighborhood") [k [] []] nodes)
)
(par
(fold nodes n-0
(par
(xor
(seq
(new $-ephemeral-stream-
(new #-ephemeral-canon-
(canon -relay- $-ephemeral-stream- #-ephemeral-canon-)
)
)
(xor
(seq
(call n-0 ("registry" "get_key_metadata") [resource_id] get_result)
(xor
(seq
(seq
(match get_result.$.success true
(seq
(ap get_result.$.key $resources)
(ap true $successful)
)
)
(new $-ephemeral-stream-
(new #-ephemeral-canon-
(canon -relay- $-ephemeral-stream- #-ephemeral-canon-)
)
)
)
(new $-ephemeral-stream-
(new #-ephemeral-canon-
(canon %init_peer_id% $-ephemeral-stream- #-ephemeral-canon-)
)
)
)
(seq
(seq
(seq
(call n-0 ("op" "concat_strings") [get_result.$.error " on "] e)
(call n-0 ("op" "concat_strings") [e n-0] $error)
)
(new $-ephemeral-stream-
(new #-ephemeral-canon-
(canon -relay- $-ephemeral-stream- #-ephemeral-canon-)
)
)
)
(new $-ephemeral-stream-
(new #-ephemeral-canon-
(canon %init_peer_id% $-ephemeral-stream- #-ephemeral-canon-)
)
)
)
)
)
(null)
)
)
(seq
(seq
(new $-ephemeral-stream-
(new #-ephemeral-canon-
(canon -relay- $-ephemeral-stream- #-ephemeral-canon-)
)
)
(new $-ephemeral-stream-
(new #-ephemeral-canon-
(canon %init_peer_id% $-ephemeral-stream- #-ephemeral-canon-)
)
)
)
(fail %last_error%)
)
)
(next n-0)
)
(never)
)
(null)
)
)
(new $status
(new $result-0
(seq
(seq
(seq
(par
(seq
(seq
(seq
(call %init_peer_id% ("math" "sub") [1 1] sub)
(new $successful_test
(seq
(seq
(seq
(call %init_peer_id% ("math" "add") [sub 1] successful_incr)
(fold $successful successful_fold_var
(seq
(seq
(ap successful_fold_var $successful_test)
(canon %init_peer_id% $successful_test #successful_iter_canon)
)
(xor
(match #successful_iter_canon.length successful_incr
(null)
)
(next successful_fold_var)
)
)
(never)
)
)
(canon %init_peer_id% $successful_test #successful_result_canon)
)
(ap #successful_result_canon successful_gate)
)
)
)
(call %init_peer_id% ("math" "sub") [1 1] sub-0)
)
(ap "ok" $status)
)
(call %init_peer_id% ("peer" "timeout") [6000 "timeout"] $status)
)
(new $status_test
(seq
(seq
(seq
(call %init_peer_id% ("math" "add") [0 1] status_incr)
(fold $status status_fold_var
(seq
(seq
(ap status_fold_var $status_test)
(canon %init_peer_id% $status_test #status_iter_canon)
)
(xor
(match #status_iter_canon.length status_incr
(null)
)
(next status_fold_var)
)
)
(never)
)
)
(canon %init_peer_id% $status_test #status_result_canon)
)
(ap #status_result_canon status_gate)
)
)
)
(xor
(match status_gate.$.[0] "ok"
(ap true $result-0)
)
(ap false $result-0)
)
)
(new $result-0_test
(seq
(seq
(seq
(call %init_peer_id% ("math" "add") [0 1] result-0_incr)
(fold $result-0 result-0_fold_var
(seq
(seq
(ap result-0_fold_var $result-0_test)
(canon %init_peer_id% $result-0_test #result-0_iter_canon)
)
(xor
(match #result-0_iter_canon.length result-0_incr
(null)
)
(next result-0_fold_var)
)
)
(never)
)
)
(canon %init_peer_id% $result-0_test #result-0_result_canon)
)
(ap #result-0_result_canon result-0_gate)
)
)
)
)
)
)
(xor
(match result-0_gate.$.[0] false
(ap "resource not found: timeout exceeded" $error)
)
(seq
(seq
(canon %init_peer_id% $resources #resources_canon)
(call %init_peer_id% ("registry" "merge_keys") [#resources_canon] merge_result)
)
(xor
(match merge_result.$.success true
(ap merge_result.$.key $result)
)
(ap merge_result.$.error $error)
)
)
)
)
(canon %init_peer_id% $result #-result-fix-0)
)
(ap #-result-fix-0 -result-flat-0)
)
)
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 0])
)
)
(canon %init_peer_id% $error #error_canon)
)
(call %init_peer_id% ("callbackSrv" "response") [-result-flat-0 #error_canon])
)
`
export type GetResourceHelperResult = [{ challenge: number[]; challenge_type: string; id: string; label: string; owner_peer_id: string; signature: number[]; timestamp_created: number; } | null, string[]]
export function getResourceHelper(
resource_id: string,
config?: {ttl?: number}
): Promise<GetResourceHelperResult>;
export function getResourceHelper(
peer: IFluenceClient$$,
resource_id: string,
config?: {ttl?: number}
): Promise<GetResourceHelperResult>;
export function getResourceHelper(...args: any) {
return callFunction$$(
args,
{
"functionName" : "getResourceHelper",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"resource_id" : {
"tag" : "scalar",
"name" : "string"
}
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "option",
"type" : {
"tag" : "struct",
"name" : "Key",
"fields" : {
"challenge" : {
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "u8"
}
},
"label" : {
"tag" : "scalar",
"name" : "string"
},
"signature" : {
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "u8"
}
},
"id" : {
"tag" : "scalar",
"name" : "string"
},
"owner_peer_id" : {
"tag" : "scalar",
"name" : "string"
},
"challenge_type" : {
"tag" : "scalar",
"name" : "string"
},
"timestamp_created" : {
"tag" : "scalar",
"name" : "u64"
}
}
}
},
{
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
getResourceHelper_script
)
}
export const appendErrors_script = `
(seq
(seq
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "error1") [] error1-iter)
)
(fold error1-iter error1-item-0
(seq
(ap error1-item-0 $error1)
(next error1-item-0)
)
)
)
(call %init_peer_id% ("getDataSrv" "error2") [] error2-iter)
)
(fold error2-iter error2-item-0
(seq
(ap error2-item-0 $error2)
(next error2-item-0)
)
)
)
(xor
(seq
(canon %init_peer_id% $error2 #error2_canon)
(fold #error2_canon e-0
(seq
(ap e-0 $error1-0)
(next e-0)
)
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 0])
)
)
`
export function appendErrors(
error1: string[],
error2: string[],
config?: {ttl?: number}
): Promise<void>;
export function appendErrors(
peer: IFluenceClient$$,
error1: string[],
error2: string[],
config?: {ttl?: number}
): Promise<void>;
export function appendErrors(...args: any) {
return callFunction$$(
args,
{
"functionName" : "appendErrors",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"error1" : {
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
},
"error2" : {
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
}
},
"codomain" : {
"tag" : "nil"
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
appendErrors_script
)
}
export const getNeighbors_script = `
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "resource_id") [] resource_id)
)
(xor
(seq
(call %init_peer_id% ("op" "string_to_b58") [resource_id] k)
(call %init_peer_id% ("kad" "neighborhood") [k [] []] nodes)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 0])
)
)
(call %init_peer_id% ("callbackSrv" "response") [nodes])
)
`
export function getNeighbors(
resource_id: string,
config?: {ttl?: number}
): Promise<string[]>;
export function getNeighbors(
peer: IFluenceClient$$,
resource_id: string,
config?: {ttl?: number}
): Promise<string[]>;
export function getNeighbors(...args: any) {
return callFunction$$(
args,
{
"functionName" : "getNeighbors",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"resource_id" : {
"tag" : "scalar",
"name" : "string"
}
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "string"
}
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
getNeighbors_script
)
}
export const wait_script = `
(seq
(seq
(seq
(seq
(seq
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(call %init_peer_id% ("getDataSrv" "successful") [] successful-iter)
)
(fold successful-iter successful-item-0
(seq
(ap successful-item-0 $successful)
(next successful-item-0)
)
)
)
(call %init_peer_id% ("getDataSrv" "len") [] len)
)
(call %init_peer_id% ("getDataSrv" "timeout") [] timeout)
)
(xor
(new $status
(new $result
(seq
(seq
(seq
(par
(seq
(seq
(seq
(call %init_peer_id% ("math" "sub") [len 1] sub)
(new $successful_test
(seq
(seq
(seq
(call %init_peer_id% ("math" "add") [sub 1] successful_incr)
(fold $successful successful_fold_var
(seq
(seq
(ap successful_fold_var $successful_test)
(canon %init_peer_id% $successful_test #successful_iter_canon)
)
(xor
(match #successful_iter_canon.length successful_incr
(null)
)
(next successful_fold_var)
)
)
(never)
)
)
(canon %init_peer_id% $successful_test #successful_result_canon)
)
(ap #successful_result_canon successful_gate)
)
)
)
(call %init_peer_id% ("math" "sub") [len 1] sub-0)
)
(ap "ok" $status)
)
(call %init_peer_id% ("peer" "timeout") [timeout "timeout"] $status)
)
(new $status_test
(seq
(seq
(seq
(call %init_peer_id% ("math" "add") [0 1] status_incr)
(fold $status status_fold_var
(seq
(seq
(ap status_fold_var $status_test)
(canon %init_peer_id% $status_test #status_iter_canon)
)
(xor
(match #status_iter_canon.length status_incr
(null)
)
(next status_fold_var)
)
)
(never)
)
)
(canon %init_peer_id% $status_test #status_result_canon)
)
(ap #status_result_canon status_gate)
)
)
)
(xor
(match status_gate.$.[0] "ok"
(ap true $result)
)
(ap false $result)
)
)
(new $result_test
(seq
(seq
(seq
(call %init_peer_id% ("math" "add") [0 1] result_incr)
(fold $result result_fold_var
(seq
(seq
(ap result_fold_var $result_test)
(canon %init_peer_id% $result_test #result_iter_canon)
)
(xor
(match #result_iter_canon.length result_incr
(null)
)
(next result_fold_var)
)
)
(never)
)
)
(canon %init_peer_id% $result_test #result_result_canon)
)
(ap #result_result_canon result_gate)
)
)
)
)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 0])
)
)
(call %init_peer_id% ("callbackSrv" "response") [result_gate.$.[0]])
)
`
export function wait(
successful: boolean[],
len: number,
timeout: number,
config?: {ttl?: number}
): Promise<boolean>;
export function wait(
peer: IFluenceClient$$,
successful: boolean[],
len: number,
timeout: number,
config?: {ttl?: number}
): Promise<boolean>;
export function wait(...args: any) {
return callFunction$$(
args,
{
"functionName" : "wait",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
"successful" : {
"tag" : "array",
"type" : {
"tag" : "scalar",
"name" : "bool"
}
},
"len" : {
"tag" : "scalar",
"name" : "i16"
},
"timeout" : {
"tag" : "scalar",
"name" : "u16"
}
}
},
"codomain" : {
"tag" : "unlabeledProduct",
"items" : [
{
"tag" : "scalar",
"name" : "bool"
}
]
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
wait_script
)
}
/* eslint-enable */

File diff suppressed because it is too large Load Diff

View File

@ -1,322 +0,0 @@
/* eslint-disable */
// @ts-nocheck
/**
*
* This file is auto-generated. Do not edit manually: changes may be erased.
* Generated by Aqua compiler: https://github.com/fluencelabs/aqua/.
* If you find any bugs, please write an issue on GitHub: https://github.com/fluencelabs/aqua/issues
* Aqua version: 0.11.9-release-please-1c9388a-1275-1
*
*/
import type { IFluenceClient as IFluenceClient$$, CallParams as CallParams$$ } from '@fluencelabs/js-client.api';
import {
v5_callFunction as callFunction$$,
v5_registerService as registerService$$,
} from '@fluencelabs/js-client.api';
// Services
// Functions
export const replicate_3600_script = `
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(xor
(xor
(seq
(seq
(call -relay- ("peer" "timestamp_sec") [] t)
(call -relay- ("registry" "evict_stale") [t] res)
)
(par
(fold res.$.results r-0
(par
(seq
(seq
(call -relay- ("op" "string_to_b58") [r-0.$.key.id] k)
(call -relay- ("kad" "neighborhood") [k [] []] nodes)
)
(par
(fold nodes n-0
(par
(new $records_weights
(xor
(seq
(seq
(seq
(seq
(seq
(call n-0 ("peer" "timestamp_sec") [] tt)
(call n-0 ("trust-graph" "get_weight") [r-0.$.key.owner_peer_id tt] key_weight)
)
(call n-0 ("registry" "republish_key") [r-0.$.key key_weight tt])
)
(fold r-0.$.records record-0
(seq
(call n-0 ("trust-graph" "get_weight") [record-0.$.metadata.issued_by tt] $records_weights)
(next record-0)
)
)
)
(canon n-0 $records_weights #records_weights_canon)
)
(call n-0 ("registry" "republish_records") [r-0.$.records #records_weights_canon tt])
)
(fail %last_error%)
)
)
(next n-0)
)
(never)
)
(null)
)
)
(next r-0)
)
(never)
)
(null)
)
)
(fail %last_error%)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 0])
)
)
`
export function replicate_3600(
config?: {ttl?: number}
): Promise<void>;
export function replicate_3600(
peer: IFluenceClient$$,
config?: {ttl?: number}
): Promise<void>;
export function replicate_3600(...args: any) {
return callFunction$$(
args,
{
"functionName" : "replicate_3600",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
}
},
"codomain" : {
"tag" : "nil"
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
replicate_3600_script
)
}
export const clearExpired_86400_script = `
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(xor
(xor
(seq
(call -relay- ("peer" "timestamp_sec") [] t)
(call -relay- ("registry" "clear_expired") [t])
)
(fail %last_error%)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 0])
)
)
`
export function clearExpired_86400(
config?: {ttl?: number}
): Promise<void>;
export function clearExpired_86400(
peer: IFluenceClient$$,
config?: {ttl?: number}
): Promise<void>;
export function clearExpired_86400(...args: any) {
return callFunction$$(
args,
{
"functionName" : "clearExpired_86400",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
}
},
"codomain" : {
"tag" : "nil"
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
clearExpired_86400_script
)
}
export const renew_43200_script = `
(seq
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
(xor
(xor
(seq
(seq
(call -relay- ("peer" "timestamp_sec") [] t)
(call -relay- ("registry" "get_stale_local_records") [t] res)
)
(par
(fold res.$.result r-0
(par
(seq
(seq
(seq
(new $signature
(seq
(xor
(mismatch r-0.$.metadata.peer_id %init_peer_id%
(xor
(seq
(call r-0.$.metadata.peer_id ("registry" "get_record_bytes") [r-0.$.metadata t] bytes)
(call r-0.$.metadata.peer_id ("sig" "sign") [bytes] $signature)
)
(fail %last_error%)
)
)
(xor
(seq
(call -relay- ("registry" "get_record_bytes") [r-0.$.metadata t] bytess)
(xor
(call %init_peer_id% ("sig" "sign") [bytess] $signature)
(fail %last_error%)
)
)
(fail %last_error%)
)
)
(new $signature_test
(seq
(seq
(seq
(call -relay- ("math" "add") [0 1] signature_incr)
(fold $signature signature_fold_var
(seq
(seq
(ap signature_fold_var $signature_test)
(canon -relay- $signature_test #signature_iter_canon)
)
(xor
(match #signature_iter_canon.length signature_incr
(null)
)
(next signature_fold_var)
)
)
(never)
)
)
(canon -relay- $signature_test #signature_result_canon)
)
(ap #signature_result_canon signature_gate)
)
)
)
)
(call -relay- ("peer" "timestamp_sec") [] t-0)
)
(call -relay- ("trust-graph" "get_weight") [r-0.$.metadata.issued_by t-0] weight)
)
(call -relay- ("registry" "put_record") [r-0.$.metadata t signature_gate.$.[0].signature.[0] weight t-0] result)
)
(next r-0)
)
(never)
)
(null)
)
)
(fail %last_error%)
)
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 0])
)
)
`
export function renew_43200(
config?: {ttl?: number}
): Promise<void>;
export function renew_43200(
peer: IFluenceClient$$,
config?: {ttl?: number}
): Promise<void>;
export function renew_43200(...args: any) {
return callFunction$$(
args,
{
"functionName" : "renew_43200",
"arrow" : {
"tag" : "arrow",
"domain" : {
"tag" : "labeledProduct",
"fields" : {
}
},
"codomain" : {
"tag" : "nil"
}
},
"names" : {
"relay" : "-relay-",
"getDataSrv" : "getDataSrv",
"callbackSrv" : "callbackSrv",
"responseSrv" : "callbackSrv",
"responseFnName" : "response",
"errorHandlingSrv" : "errorHandlingSrv",
"errorFnName" : "error"
}
},
renew_43200_script
)
}
/* eslint-enable */

View File

@ -1,7 +1,5 @@
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
set -x
# set current working directory to script directory to run script from everywhere
cd "$(dirname "$0")"
@ -13,16 +11,7 @@ DISTRO_TARGET=distro/registry-service
mkdir -p "$DISTRO_TARGET"
cd ./aqua
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 i
fluence aqua -i ./spell/spell.aqua --no-relay --air -o "../$DISTRO_TARGET/air"
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"

2
distro/Cargo.lock generated
View File

@ -22,7 +22,7 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "registry-distro"
version = "0.9.4"
version = "0.9.2"
dependencies = [
"built",
"maplit",

View File

@ -1,6 +1,6 @@
[package]
name = "registry-distro"
version = "0.9.4"
version = "0.9.2"
edition = "2021"
build = "built.rs"
include = [ "/src", "built.rs", "Cargo.toml", "registry-service"]

8
example/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
.idea
.DS_Store
.fluence
**/node_modules
**/target/
.repl_history
generated
.vscode/settings.json

View File

@ -89,7 +89,9 @@ It uses `createResource` function from Resources API to register the Resource wi
You should see output similar to this:
```
5pYpWB3ozi6fi1EjNs9X5kE156aA6iLECxTuVdJgUaLB
[
"5pYpWB3ozi6fi1EjNs9X5kE156aA6iLECxTuVdJgUaLB"
]
```
It is `resourceId`, which we will use to register our services, and then we will be able to use the same `resourceId` to discover and call our services
@ -103,8 +105,9 @@ This command calls [registerEchoService](src/aqua/main.aqua#L26) aqua function,
You should see this output:
```
[
true,
[]
[
true
]
]
```
It means the service is registered in Registry and should be accessible by anyone who only has the `resourceId` of this service.

View File

@ -8,7 +8,7 @@ name = "echo_service"
path = "src/main.rs"
[dependencies]
marine-rs-sdk = "0.10.2"
marine-rs-sdk = "=0.10.2"
[dev-dependencies]
marine-rs-sdk-test = "=0.12.0"

View File

@ -0,0 +1,5 @@
# yaml-language-server: $schema=../../../.fluence/schemas/module.yaml.json
version: 0
type: rust
name: echo_service

View File

@ -0,0 +1,7 @@
# yaml-language-server: $schema=../.fluence/schemas/service.yaml.json
version: 0
name: echo_service
modules:
facade:
get: modules/echo_service

21
example/fluence.yaml Normal file
View File

@ -0,0 +1,21 @@
# yaml-language-server: $schema=.fluence/schemas/fluence.yaml.json
version: 2
services:
echo_service:
get: ./echo_service
deploy:
- deployId: default
dependencies:
npm:
"@fluencelabs/aqua": 0.9.2
"@fluencelabs/registry": 0.6.2
"@fluencelabs/aqua-lib": 0.7.0
cargo:
marine: 0.12.4
mrepl: 0.18.6
relays:
- /dns4/stage.fluence.dev/tcp/19002/wss/p2p/12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU

11841
example/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

21
example/package.json Normal file
View File

@ -0,0 +1,21 @@
{
"name": "echo",
"version": "0.0.0",
"description": "Fluence Peer with echo service",
"scripts": {
"compile-aqua": "fluence aqua -i ./src/aqua/export.aqua -o ./src/generated",
"start": "npm run compile-aqua && npx ts-node src/echo.ts"
},
"keywords": [
"aqua",
"dht",
"p2p"
],
"author": "Fluence Labs",
"dependencies": {
"@fluencelabs/fluence": "0.28.0",
"@fluencelabs/fluence-network-environment": "1.1.2",
"@fluencelabs/trust-graph": "3.0.4"
},
"prettier": {}
}

View File

@ -0,0 +1,28 @@
module Main
export and
func and(l: bool, r: bool) -> bool:
res: ?bool
if l:
res <<- r
else:
res <<- false
<- res!
func or(l: bool, r: bool) -> bool:
res: ?bool
if l:
res <<- true
else:
res <<- r
<- res!
func not(u: bool) -> bool:
res: ?bool
if u:
res <<- false
else:
res <<- true
<- res!

View File

@ -13,33 +13,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Fluence, KeyPair } from '@fluencelabs/js-client';
import { registerEchoJSService } from './compiled-aqua/main.ts';
import { Fluence, KeyPair, setLogLevel } from "@fluencelabs/fluence";
import { stage } from "@fluencelabs/fluence-network-environment";
import { registerEchoService, registerService } from "./generated/export";
import assert from "node:assert";
// don't store your secret key in the code. This is just for the example
const secretKey = "Iz3HUmNIB78lkNNVmMkDKrju0nCivtkJNyObrFAr774=";
async function main() {
const keyPair = await KeyPair.fromEd25519SK(Buffer.from(secretKey, "base64"));
const keypair = await KeyPair.fromEd25519SK(Buffer.from(secretKey, "base64"));
const connectTo = stage[0];
assert(connectTo !== undefined);
await Fluence.connect({
multiaddr:
"/ip4/127.0.0.1/tcp/9991/ws/p2p/12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR",
peerId: "12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR",
}, { keyPair: {
type: 'Ed25519',
source: keyPair.toEd25519PrivateKey()
}});
const peerId = Fluence.getClient().getPeerId();
const relayId = Fluence.getClient().getRelayPeerId();
// connect to the Fluence network
await Fluence.start({ connectTo, KeyPair: keypair });
setLogLevel("SILENT");
const peerId = Fluence.getStatus().peerId;
const relayId = Fluence.getStatus().relayPeerId;
assert(peerId !== null && relayId !== null);
console.log(`📗 created a fluence peer ${peerId} with relay ${relayId}`);
const serviceId = "echo";
// register local service with serviceId "echo"
registerEchoJSService(serviceId, {
await registerEchoService(serviceId, {
echo(msg) {
console.log(`Received message: ${msg}`);
return `${peerId}: ${msg}`;
@ -57,13 +56,13 @@ async function main() {
fluence run -f 'echoJS("${peerId}", "${relayId}", "${serviceId}", "hi")'`
);
} else {
// const [success, error] = await registerService(
// resourceId,
// "echo",
// peerId,
// serviceId
// );
// console.log(`Registration result: ${success || error}`);
const [success, error] = await registerService(
resourceId,
"echo",
peerId,
serviceId
);
console.log(`Registration result: ${success || error}`);
}
console.log("\nPress any key to stop fluence js peer");
@ -72,7 +71,7 @@ async function main() {
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.on("data", async () => {
await Fluence.disconnect();
await Fluence.stop();
process.exit(0);
});
}

View File

@ -1,24 +0,0 @@
aqua Deals declares *
data Deal:
definition: string
timestamp: string
dealIdOriginal: string
dealId: string
chainNetwork: string
chainNetworkId: u64
data Deals:
dealName: ?Deal
func get() -> Deals:
<- Deals(
dealName=?[Deal(
definition="bafkreidqtqpmmferdscg4bqrs74cl6ckib3vyhvejhrc4watln5xxcrj2i",
timestamp="2023-12-19T20:01:24.334Z",
dealIdOriginal="0xEb92A1B5c10AD7BFdcaf23Cb7DDA9ea062CD07E8",
dealId="eb92a1b5c10ad7bfdcaf23cb7dda9ea062cd07e8",
chainNetwork="local",
chainNetworkId=31337
)]
)

View File

@ -1,4 +0,0 @@
aqua Hosts declares *
func get() -> ?u8:
<- nil

View File

@ -1,2 +0,0 @@
service EchoService("echo_service"):
echo(msg: string) -> string

View File

@ -1,20 +0,0 @@
aquavm_pool_size = 2
tcp_port = 7_771
websocket_port = 9_991
http_port = 18_080
[system_services]
enable = [ "registry", "decider" ]
[system_services.aqua_ipfs]
external_api_multiaddr = "/ip4/127.0.0.1/tcp/5001"
local_api_multiaddr = "/dns4/ipfs/tcp/5001"
[system_services.decider]
decider_period_sec = 10
worker_ipfs_multiaddr = "/dns4/ipfs/tcp/5001"
network_api_endpoint = "http://chain:8545"
network_id = 31_337
start_block = "earliest"
matcher_address = "0x0e1F3B362E22B2Dc82C9E35d6e62998C7E8e2349"
wallet_key = "0x3cc23e0227bd17ea5d6ea9d42b5eaa53ad41b1974de4755c79fe236d361a6fd5"

View File

@ -1,20 +0,0 @@
aquavm_pool_size = 2
tcp_port = 7_772
websocket_port = 9_992
http_port = 18_081
[system_services]
enable = [ "registry", "decider" ]
[system_services.aqua_ipfs]
external_api_multiaddr = "/ip4/127.0.0.1/tcp/5001"
local_api_multiaddr = "/dns4/ipfs/tcp/5001"
[system_services.decider]
decider_period_sec = 10
worker_ipfs_multiaddr = "/dns4/ipfs/tcp/5001"
network_api_endpoint = "http://chain:8545"
network_id = 31_337
start_block = "earliest"
matcher_address = "0x0e1F3B362E22B2Dc82C9E35d6e62998C7E8e2349"
wallet_key = "0x089162470bcfc93192b95bff0a1860d063266875c782af9d882fcca125323b41"

View File

@ -1,20 +0,0 @@
aquavm_pool_size = 2
tcp_port = 7_773
websocket_port = 9_993
http_port = 18_082
[system_services]
enable = [ "registry", "decider" ]
[system_services.aqua_ipfs]
external_api_multiaddr = "/ip4/127.0.0.1/tcp/5001"
local_api_multiaddr = "/dns4/ipfs/tcp/5001"
[system_services.decider]
decider_period_sec = 10
worker_ipfs_multiaddr = "/dns4/ipfs/tcp/5001"
network_api_endpoint = "http://chain:8545"
network_id = 31_337
start_block = "earliest"
matcher_address = "0x0e1F3B362E22B2Dc82C9E35d6e62998C7E8e2349"
wallet_key = "0xdacd4b197ee7e9efdd5db1921c6c558d88e2c8b69902b8bafc812fb226a6b5e0"

View File

@ -1,102 +0,0 @@
# yaml-language-server: $schema=schemas/docker-compose.json
# Defines a multi-containers based application.
# Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/docker-compose.md
version: "3"
services:
chain:
image: fluencelabs/chain-rpc:0.2.20
ports:
- 8545:8545
ipfs:
image: ipfs/go-ipfs
ports:
- 5001:5001
- 4001:4001
environment:
IPFS_PROFILE: server
volumes:
- ./ipfs/:/container-init.d/
nox-0:
image: fluencelabs/nox:0.16.3
pull_policy: always
ports:
- 7771:7771
- 9991:9991
environment:
WASM_LOG: info
RUST_LOG: debug,particle_reap=debug,aquamarine=warn,aquamarine::particle_functions=debug,aquamarine::log=debug,aquamarine::aqua_runtime=error,ipfs_effector=off,ipfs_pure=off,system_services=debug,marine_core::module::marine_module=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,cranelift_codegen=info,wasmer_wasi=info,run-console=trace,wasmtime_cranelift=off,wasmtime_jit=off,libp2p_tcp=off,libp2p_swarm=off,particle_protocol::libp2p_protocol::upgrade=info,libp2p_mplex=off,particle_reap=off,netlink_proto=warn
FLUENCE_MAX_SPELL_PARTICLE_TTL: 9s
FLUENCE_ROOT_KEY_PAIR__PATH: /run/secrets/nox-0
command:
- --config=/run/configs/nox-0_Config.toml
- --external-maddrs
- /dns4/nox-0/tcp/7771
- /dns4/nox-0/tcp/9991/ws
- --allow-private-ips
- --local
depends_on:
- ipfs
volumes:
- ./configs/nox-0_Config.toml:/run/configs/nox-0_Config.toml
secrets:
- nox-0
nox-1:
image: fluencelabs/nox:0.16.3
pull_policy: always
ports:
- 7772:7772
- 9992:9992
environment:
WASM_LOG: info
RUST_LOG: debug,particle_reap=debug,aquamarine=warn,aquamarine::particle_functions=debug,aquamarine::log=debug,aquamarine::aqua_runtime=error,ipfs_effector=off,ipfs_pure=off,system_services=debug,marine_core::module::marine_module=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,cranelift_codegen=info,wasmer_wasi=info,run-console=trace,wasmtime_cranelift=off,wasmtime_jit=off,libp2p_tcp=off,libp2p_swarm=off,particle_protocol::libp2p_protocol::upgrade=info,libp2p_mplex=off,particle_reap=off,netlink_proto=warn
FLUENCE_MAX_SPELL_PARTICLE_TTL: 9s
FLUENCE_ROOT_KEY_PAIR__PATH: /run/secrets/nox-1
command:
- --config=/run/configs/nox-1_Config.toml
- --external-maddrs
- /dns4/nox-1/tcp/7772
- /dns4/nox-1/tcp/9992/ws
- --allow-private-ips
- --bootstraps=/dns/nox-0/tcp/7771
depends_on:
- ipfs
volumes:
- ./configs/nox-1_Config.toml:/run/configs/nox-1_Config.toml
secrets:
- nox-1
nox-2:
image: fluencelabs/nox:0.16.3
pull_policy: always
ports:
- 7773:7773
- 9993:9993
environment:
WASM_LOG: info
RUST_LOG: debug,particle_reap=debug,aquamarine=warn,aquamarine::particle_functions=debug,aquamarine::log=debug,aquamarine::aqua_runtime=error,ipfs_effector=off,ipfs_pure=off,system_services=debug,marine_core::module::marine_module=info,tokio_threadpool=info,tokio_reactor=info,mio=info,tokio_io=info,soketto=info,yamux=info,multistream_select=info,libp2p_secio=info,libp2p_websocket::framed=info,libp2p_ping=info,libp2p_core::upgrade::apply=info,libp2p_kad::kbucket=info,cranelift_codegen=info,wasmer_wasi=info,cranelift_codegen=info,wasmer_wasi=info,run-console=trace,wasmtime_cranelift=off,wasmtime_jit=off,libp2p_tcp=off,libp2p_swarm=off,particle_protocol::libp2p_protocol::upgrade=info,libp2p_mplex=off,particle_reap=off,netlink_proto=warn
FLUENCE_MAX_SPELL_PARTICLE_TTL: 9s
FLUENCE_ROOT_KEY_PAIR__PATH: /run/secrets/nox-2
command:
- --config=/run/configs/nox-2_Config.toml
- --external-maddrs
- /dns4/nox-2/tcp/7773
- /dns4/nox-2/tcp/9993/ws
- --allow-private-ips
- --bootstraps=/dns/nox-0/tcp/7771
depends_on:
- ipfs
volumes:
- ./configs/nox-2_Config.toml:/run/configs/nox-2_Config.toml
secrets:
- nox-2
secrets:
nox-0:
file: secrets/nox-0.txt
nox-1:
file: secrets/nox-1.txt
nox-2:
file: secrets/nox-2.txt

View File

@ -1,17 +0,0 @@
# yaml-language-server: $schema=schemas/workers.json
# A result of app deployment. This file is created automatically after successful deployment using `fluence workers deploy` command
# Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/workers.md
version: 1
deals:
local:
dealName:
definition: bafkreidqtqpmmferdscg4bqrs74cl6ckib3vyhvejhrc4watln5xxcrj2i
timestamp: 2023-12-19T20:01:24.334Z
dealIdOriginal: "0xEb92A1B5c10AD7BFdcaf23Cb7DDA9ea062CD07E8"
dealId: eb92a1b5c10ad7bfdcaf23cb7dda9ea062cd07e8
chainNetwork: local
chainNetworkId: 31337

View File

@ -1,12 +0,0 @@
.idea
.DS_Store
/.fluence/secrets
/.fluence/env.yaml
/.fluence/schemas
/.fluence/tmp
**/node_modules
**/target/
.repl_history
/.vscode/settings.json
/src/ts/src/aqua
/src/js/src/aqua

View File

@ -1,2 +0,0 @@
[workspace]
members = [ "src/services/echo_service/modules/echo_service" ]

View File

@ -1,24 +0,0 @@
# 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/cli/tree/main/docs/configs/fluence.md
version: 5
aquaInputPath: src/aqua/main.aqua
deals:
dealName:
minWorkers: 1
targetWorkers: 3
services: [ echo_service ]
spells: []
services:
echo_service:
get: src/services/echo_service
relaysPath: src/frontend/src
aquaOutputTSPath: src/frontend/src/compiled-aqua

View File

@ -1,32 +0,0 @@
# yaml-language-server: $schema=.fluence/schemas/provider.json
# Defines config used for provider set up
# Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/provider.md
version: 0
env: local
nox:
systemServices:
enable:
- registry
- decider
computePeers:
nox-0:
computeUnits: 1
nox-1:
computeUnits: 1
nox-2:
computeUnits: 1
offers:
offer-0:
maxCollateralPerWorker: 1
minPricePerWorkerEpoch: 0.1
computePeers:
- nox-0
- nox-1
- nox-2

View File

@ -1,73 +0,0 @@
import "@fluencelabs/aqua-lib/builtin.aqua"
import "@fluencelabs/aqua-lib/subnet.aqua"
import createResource, registerService, resolveResource from "@fluencelabs/registry/resources-api.aqua"
use "deals.aqua"
use "hosts.aqua"
import "services.aqua"
service EchoJSService:
echo(msg: string) -> string
func echo(msg: string) -> string:
deals <- Deals.get()
dealId = deals.dealName!.dealIdOriginal
on HOST_PEER_ID:
subnet <- Subnet.resolve(dealId)
if subnet.success == false:
Console.print(["Failed to resolve subnet: ", subnet.error])
w = subnet.workers!
on w.worker_id! via w.host_id:
res <- EchoService.echo(msg)
<- res
func echoJS(peerId: string, relayId: string, serviceId: string, msg: string) -> string:
on peerId via relayId:
EchoService serviceId
res <- EchoService.echo(msg)
<- res
func createRes(label: string) -> ?string:
resourceId, error <- createResource(label)
<- error
func registerResourceService(resourceId: string, serviceId: string) -> bool, *string:
on HOST_PEER_ID:
-- TODO: change hardcoded local peer to resolve
res, message <- registerService(resourceId, "" , "12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR", [serviceId])
<- res, message
func echoAll(resourceId: string, msg: string) -> *string:
-- 2 is the min number of peers we want to ask
records <- resolveResource(resourceId, 2)
results: *string
for r <- records!:
on HOST_PEER_ID:
EchoService r.metadata.service_id!
results <- EchoService.echo(msg)
<- results
func showSubnets() -> *string:
deals <- Deals.get()
dealId = deals.dealName!.dealIdOriginal
on HOST_PEER_ID:
results: *string
subnet <- Subnet.resolve(dealId)
if subnet.success == false:
Console.print(["Failed to resolve subnet: ", subnet.error])
for w <- subnet.workers:
results <<- w.host_id
<- results

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
{
"type": "module",
"private": true,
"name": "echo",
"version": "0.0.0",
"description": "Fluence Peer with echo service",
"scripts": {
"start": "node --loader ts-node/esm src/echo.ts"
},
"keywords": [
"aqua",
"dht",
"p2p"
],
"author": "Fluence Labs",
"dependencies": {
"@fluencelabs/js-client": "0.5.3"
},
"devDependencies": {
"@fluencelabs/registry": "^0.9.2",
"ts-node": "10.9.2",
"typescript": "5.0.2"
}
}

View File

@ -1,14 +0,0 @@
[
{
"multiaddr": "/ip4/127.0.0.1/tcp/9991/ws/p2p/12D3KooWJTYHn4U8jJtL1XZvTonAgv2Tn6EEbZSauw56dhr3SNKg",
"peerId": "12D3KooWJTYHn4U8jJtL1XZvTonAgv2Tn6EEbZSauw56dhr3SNKg"
},
{
"multiaddr": "/ip4/127.0.0.1/tcp/9992/ws/p2p/12D3KooWQrMQg2Ksqag5465Tnu8VQH3c4Z4NSosdS854bAsHEcwo",
"peerId": "12D3KooWQrMQg2Ksqag5465Tnu8VQH3c4Z4NSosdS854bAsHEcwo"
},
{
"multiaddr": "/ip4/127.0.0.1/tcp/9993/ws/p2p/12D3KooWQCYhkDv4jPe7ymEo8AwRNMzLZRmfyrbV53vKpVS7fZA7",
"peerId": "12D3KooWQCYhkDv4jPe7ymEo8AwRNMzLZRmfyrbV53vKpVS7fZA7"
}
]

View File

@ -1,23 +0,0 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}

View File

@ -1,11 +0,0 @@
# yaml-language-server: $schema=../../../../../.fluence/schemas/module.json
# Defines [Marine Module](https://fluence.dev/docs/build/concepts/#modules). You can use `fluence module new` command to generate a template for new module
# Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/module.md
version: 0
type: rust
name: echo_service

View File

@ -1,13 +0,0 @@
# yaml-language-server: $schema=../../../.fluence/schemas/service.json
# Defines a [Marine service](https://fluence.dev/docs/build/concepts/#services), most importantly the modules that the service consists of. You can use `fluence service new` command to generate a template for new service
# Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/service.md
version: 0
name: echo_service
modules:
facade:
get: modules/echo_service

208
service/Cargo.lock generated
View File

@ -319,7 +319,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "577de6cff7c2a47d6b13efe5dd28bf116bd7f8f7db164ea95b7cc2640711f522"
dependencies = [
"ambient-authority",
"rand",
"rand 0.8.5",
]
[[package]]
@ -599,6 +599,19 @@ dependencies = [
"subtle",
]
[[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.1"
@ -763,6 +776,16 @@ dependencies = [
"winapi",
]
[[package]]
name = "ed25519"
version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7"
dependencies = [
"serde",
"signature 1.6.4",
]
[[package]]
name = "ed25519"
version = "2.2.3"
@ -770,8 +793,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"
dependencies = [
"pkcs8",
"signature 2.2.0",
]
[[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 1.5.3",
"rand 0.7.3",
"serde",
"signature",
"serde_bytes",
"sha2 0.9.9",
"zeroize",
]
[[package]]
@ -780,9 +817,8 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f628eaec48bfd21b865dc2950cfa014450c01d2fa2b69a86c2fd5844ec523c0"
dependencies = [
"curve25519-dalek",
"ed25519",
"rand_core",
"curve25519-dalek 4.1.1",
"ed25519 2.2.3",
"serde",
"sha2 0.10.8",
"subtle",
@ -898,19 +934,19 @@ dependencies = [
[[package]]
name = "fluence-keypair"
version = "0.10.4"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "273ecbe8b6757f46e9d2b61f56ac636f27defa88aebc17a4fd6a7b78bf84cca3"
checksum = "0b635af10c462212b4a2da1512bf62c0100795b688be8b08c3e7fa337ec33d46"
dependencies = [
"asn1_der 0.6.3",
"bs58",
"ed25519-dalek",
"ed25519-dalek 1.0.1",
"eyre",
"lazy_static",
"libp2p-identity",
"libsecp256k1",
"multihash 0.18.1",
"rand",
"rand 0.8.5",
"ring 0.16.20",
"serde",
"serde_bytes",
@ -1060,6 +1096,17 @@ dependencies = [
"version_check",
]
[[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.11"
@ -1068,7 +1115,7 @@ checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
dependencies = [
"cfg-if",
"libc",
"wasi",
"wasi 0.11.0+wasi-snapshot-preview1",
]
[[package]]
@ -1429,12 +1476,12 @@ checksum = "999ec70441b2fb35355076726a6bc466c932e9bdc66f6a11c6c0aa17c7ab9be0"
dependencies = [
"asn1_der 0.7.6",
"bs58",
"ed25519-dalek",
"ed25519-dalek 2.1.0",
"hkdf",
"libsecp256k1",
"multihash 0.19.1",
"quick-protobuf",
"rand",
"rand 0.8.5",
"ring 0.17.5",
"sha2 0.10.8",
"thiserror",
@ -1466,7 +1513,7 @@ dependencies = [
"libsecp256k1-core",
"libsecp256k1-gen-ecmult",
"libsecp256k1-gen-genmult",
"rand",
"rand 0.8.5",
"serde",
"sha2 0.9.9",
"typenum",
@ -1550,18 +1597,18 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "marine-build-rs-generator"
version = "0.12.1"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "733bc760227adf6efd733341d67e948d0cbaa71e9a64bd9076de5a79ab595d25"
checksum = "ba5881a385788dae5e23b2e063ef212ada2e402a97833a6c066bbae26bbe8bd9"
dependencies = [
"marine-test-macro-impl",
]
[[package]]
name = "marine-call-parameters"
version = "0.10.3"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef9a7c6ed5fa9052474c1cd76d3b3e67dbc4c455c76263c2c043214e12cce6bd"
checksum = "60dfc6d5a00b2d5aadbd60a13bdd6c6d6a5f46b31bf8db9f80ad295032f3bda3"
dependencies = [
"marine-macro",
"marine-rs-sdk-main",
@ -1645,11 +1692,11 @@ dependencies = [
[[package]]
name = "marine-macro"
version = "0.10.3"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acdaa50f8239afa104ef8a99d4219288f68169e29c913485bbd094a35fe79113"
checksum = "3f4bef66ff0a930272053bc622e60ae07a444b6bdd6b2406ee2e85ee93fa34a8"
dependencies = [
"marine-macro-impl 0.10.3",
"marine-macro-impl 0.10.2",
"marine-rs-sdk-main",
]
@ -1668,9 +1715,9 @@ dependencies = [
[[package]]
name = "marine-macro-impl"
version = "0.10.3"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "460ef42c1bf6dbb88976a00514f8e1b97a7ccb60e3e6009cbb563b0d163166c7"
checksum = "51866ba9045c01e96a716343c30b2d9302d1451c969ceba8f8e3cb52b78053c8"
dependencies = [
"proc-macro2",
"quote",
@ -1725,9 +1772,9 @@ dependencies = [
[[package]]
name = "marine-rs-sdk"
version = "0.10.3"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "034cab8adf708e87db08f093e0c7b8ea49359cc875ed2a778c1bf245b5d9d9f8"
checksum = "d189b674dfcebfbb5668ead5335c3ba52fd4f8e8947b6f2d48869765ab403bd9"
dependencies = [
"marine-call-parameters",
"marine-macro",
@ -1738,9 +1785,9 @@ dependencies = [
[[package]]
name = "marine-rs-sdk-main"
version = "0.10.3"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "031eeea016dab58c1ccb0c65b798cb5e47d214b05115c8c06198717d18275756"
checksum = "d3b4d597243fa88bf33fe91e080ab155cc1679ac4970e1a20dce6b58df084673"
dependencies = [
"log",
"serde",
@ -1748,9 +1795,9 @@ dependencies = [
[[package]]
name = "marine-rs-sdk-test"
version = "0.12.1"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d549eb527d35885391ec73786a7b36c91507ff1e2f2ca5ec5015953f3d8320a2"
checksum = "6233297b96919aba3c98aa553ceef6167b50f2ff0cd61018d6393e3166063e74"
dependencies = [
"fluence-app-service",
"marine-build-rs-generator",
@ -1791,9 +1838,9 @@ dependencies = [
[[package]]
name = "marine-sqlite-connector"
version = "0.9.3"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c12d7fb48bd7ee88276a26b2e14f25e9bc884884f375116544689994d5d280ad"
checksum = "41e6a51c5a4480dfee082aff7253656ee10aa669631fa9922967f41a70049550"
dependencies = [
"bytesize",
"marine-rs-sdk",
@ -1801,9 +1848,9 @@ dependencies = [
[[package]]
name = "marine-test-macro"
version = "0.12.1"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17d51e361ae860da35f2a8f189a89a36dcb6657d0e44057dc3658dc7236fe630"
checksum = "9fe9c6bde18966329b631d913f708d546b68174e6d51f18a498567bdcce4021f"
dependencies = [
"marine-test-macro-impl",
"proc-macro-error",
@ -1814,9 +1861,9 @@ dependencies = [
[[package]]
name = "marine-test-macro-impl"
version = "0.12.1"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3a7c981122443dd9ab5e4192ff34d41805dfb3402a03be4c3a39c0d425675f6"
checksum = "8c3004eb4239e8d5866c9a54872f4d9c1e13d782de2ff553cf07cc95dd187503"
dependencies = [
"darling",
"fluence-app-service",
@ -1832,9 +1879,9 @@ dependencies = [
[[package]]
name = "marine-timestamp-macro"
version = "0.10.3"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f812a03cb13b79ab75e38053a77ecc4b4738a1b485b650d971dec3dbbcb2561"
checksum = "d1465b4dcc7d85940cf33f8d64fd0bb2f98093cc3a5384e2d224bf6e50069adb"
dependencies = [
"chrono",
"quote",
@ -1930,7 +1977,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
dependencies = [
"libc",
"wasi",
"wasi 0.11.0+wasi-snapshot-preview1",
"windows-sys 0.48.0",
]
@ -2205,6 +2252,19 @@ dependencies = [
"proc-macro2",
]
[[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"
@ -2212,8 +2272,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
"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]]
@ -2223,7 +2293,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
"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]]
@ -2232,7 +2311,16 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
"getrandom 0.2.11",
]
[[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]]
@ -2270,7 +2358,7 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
dependencies = [
"getrandom",
"getrandom 0.2.11",
"libredox",
"thiserror",
]
@ -2290,7 +2378,7 @@ dependencies = [
[[package]]
name = "registry"
version = "0.9.4"
version = "0.9.2"
dependencies = [
"boolinator",
"bs58",
@ -2329,7 +2417,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b"
dependencies = [
"cc",
"getrandom",
"getrandom 0.2.11",
"libc",
"spin 0.9.8",
"untrusted 0.9.0",
@ -2530,13 +2618,19 @@ dependencies = [
"dirs",
]
[[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 = [
"rand_core",
"rand_core 0.6.4",
]
[[package]]
@ -2913,7 +3007,7 @@ version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560"
dependencies = [
"getrandom",
"getrandom 0.2.11",
]
[[package]]
@ -2966,6 +3060,12 @@ dependencies = [
"syn 1.0.109",
]
[[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"
@ -3400,7 +3500,7 @@ dependencies = [
"memfd",
"memoffset",
"paste",
"rand",
"rand 0.8.5",
"rustix",
"sptr",
"wasm-encoder 0.32.0",
@ -3850,6 +3950,20 @@ 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.39",
]
[[package]]
name = "zstd"

View File

@ -1,6 +1,6 @@
[package]
name = "registry"
version = "0.9.4"
version = "0.9.2"
authors = ["Fluence Labs"]
edition = "2018"
publish = false
@ -11,20 +11,20 @@ path = "src/main.rs"
[dependencies]
bs58 = "=0.5.0"
marine-rs-sdk = "=0.10.3"
marine-sqlite-connector = "=0.9.3"
marine-rs-sdk = "=0.10.2"
marine-sqlite-connector = "=0.9.2"
fstrings = "=0.2.3"
boolinator = "=2.4.0"
toml = "=0.8.8"
serde = { version = "1.0.188", features = ["derive"] }
thiserror = "=1.0.50"
sha2 = "=0.10.8"
fluence-keypair = "=0.10.4"
fluence-keypair = "=0.10.3"
libp2p-identity = "=0.2.8"
[dev-dependencies]
marine-rs-sdk-test = "=0.12.1"
marine-rs-sdk-test = "=0.12.0"
rusqlite = "=0.30.0"
[build-dependencies]
marine-rs-sdk-test = "=0.12.1"
marine-rs-sdk-test = "=0.12.0"

View File

@ -13,7 +13,7 @@ mkdir -p artifacts
cp target/wasm32-wasi/release/registry.wasm artifacts/
# download SQLite 3 to use in tests
curl -L https://github.com/fluencelabs/sqlite/releases/download/sqlite-wasm-v0.18.2/sqlite3.wasm -o artifacts/sqlite3.wasm
curl -L https://github.com/fluencelabs/sqlite/releases/download/sqlite-wasm-v0.18.1/sqlite3.wasm -o artifacts/sqlite3.wasm
# generate Aqua bindings
marine aqua artifacts/registry.wasm -s Registry -i registry >../aqua/registry-service.aqua

View File

@ -1,13 +1,9 @@
aqua TestSpell
export spell
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 "@fluencelabs/registry/registry-service.aqua"
import "@fluencelabs/registry/registry-api.aqua"
import "../aqua/registry-service.aqua"
import "../aqua/registry-api.aqua"
import "@fluencelabs/trust-graph/trust-graph.aqua"
data SpellConfig:
@ -60,7 +56,7 @@ func spell(config: SpellConfig):
check_and_run = (key: string, now:u32, interval: u32, job: u32 -> ()):
last_run <- Spell.get_u32(key)
need_to_run = !last_run.success || ((now - last_run.value) >= interval)
need_to_run = !last_run.success || ((now - last_run.num) >= interval)
if need_to_run == true:
log(Op.concat_strings(Op.concat_strings("Running ", key), "job"))
job(now)
@ -72,3 +68,4 @@ func spell(config: SpellConfig):
check_and_run("clear_expired", now, config.expired_interval, clear_expired)
check_and_run("renew", now, config.renew_interval, renew)
check_and_run("replicate", now, config.replicate_interval, replicate)