Compare commits

...

67 Commits

Author SHA1 Message Date
Dima
41e9b5ac87
chore(aqua): Fix type duplication (#341) 2024-02-07 15:27:03 +03:00
Anatolios Laskaris
be6ca2e4b4
chore: Fail if fluence-cli artifact is no found (#338)
Fail if fluence-cli artifact is no found
2024-01-25 16:28:27 +00:00
Dima
4efd6b2645
fix(tests): Changle dep npm i to dep i (#337)
Co-authored-by: Artsiom Shamsutdzinau <shamsartem@gmail.com>
2024-01-22 09:59:39 +00:00
InversionSpaces
586249873f
fix(tests): Add aqua header to spell source (#336)
Add aqua header
2024-01-18 08:44:41 +00:00
renovate[bot]
f4829267d0
fix(deps): update dependency @fluencelabs/trust-graph to v0.4.11 (#335)
* fix(deps): update dependency @fluencelabs/trust-graph to v0.4.11

* Update fluence.yaml

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: InversionSpaces <inversionspaces@vivaldi.net>
2024-01-17 13:24:37 +01:00
InversionSpaces
2181b22142
fix(deps): Bump tests aqua dependencies (#334)
Bump test deps
2024-01-17 09:28:00 +00:00
renovate[bot]
fed52dcd06
fix(deps): update dependency @fluencelabs/aqua-lib to v0.9.1 (#332)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-16 12:38:59 +00:00
fluencebot
aaf7f68ce8
chore(main): release registry 0.9.4 (#329)
* chore(main): release registry 0.9.4

* chore: Bump registry version to 0.9.4
2024-01-04 13:00:15 +01:00
InversionSpaces
e9ba1ad248
fix(registry): Revert release registry 0.9.4 (#331)
Revert "chore(main): release registry 0.9.4 (#319)"

This reverts commit e000e46128857788351e28f789750c0030c4cc9f.
2024-01-04 10:29:26 +00:00
InversionSpaces
a100d2f5d2
chore(deps): Update trust-graph to 0.4.10 (#327)
* Update aqua-lib and trust-graph

* Add line

* Add line
2024-01-04 11:05:07 +01:00
renovate[bot]
5c9af8bd3a
fix(deps): update dependency @fluencelabs/aqua-lib to v0.9.0 (#328)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-03 12:56:08 +01:00
fluencebot
e000e46128
chore(main): release registry 0.9.4 (#319) 2023-12-29 01:17:45 +00:00
renovate[bot]
f78212d49b
fix(deps): update marine things (#307)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-28 21:48:31 -03:00
renovate[bot]
b71b85ca1e
fix(deps): update rust crate fluence-keypair to v0.10.4 (#318)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-28 21:47:27 -03:00
Valery Antopol
7d9327bcfd
fix(deps): update sqlite wasm to 0.18.2 (#320)
update sqlite wasm
2023-12-26 18:30:24 -03:00
InversionSpaces
b9bce2e764
feat(registry): Use aqua keyword instead of module (#313)
Use aqua keyword
2023-12-26 14:10:14 +01:00
fluencebot
c6c579479e
chore(main): release registry 0.9.3 (#311)
* chore(main): release registry 0.9.3

* chore: Bump registry version to 0.9.3
2023-12-21 19:40:29 +00:00
folex
3092907e5e
fix(spell): update spell api (#315) 2023-12-21 16:19:52 -03:00
Akim
01d8cb4052
chore: archive registry example (#312)
* Half-update and archive registry example

* Rename folder
2023-12-21 18:18:06 +07:00
shamsartem
633d8e6648
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
2023-12-20 18:33:42 +00:00
renovate[bot]
7ba20dcabd
fix(deps): update dependency @fluencelabs/trust-graph to v3.1.2 (#189)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-19 16:07:48 -03:00
fluencebot
ddce821a57
chore(main): release registry 0.9.2 (#306)
* chore(main): release registry 0.9.2

* chore: Bump registry version to 0.9.2
2023-12-19 17:16:07 +00:00
renovate[bot]
c207f7fa54
fix(deps): update dependency @fluencelabs/aqua-lib to v0.8.2 (#308)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-19 13:48:56 -03:00
Valery Antopol
863ae55f35
feat: update marine sdk's, sqlite conector and config (#309)
* update marine and configs

* update sqlite
2023-12-19 13:44:07 -03:00
renovate[bot]
a6aeeea3f5
fix(deps): update dependency @fluencelabs/trust-graph to v0.4.7 (#257) 2023-12-13 17:35:42 +00:00
renovate[bot]
66a42f7b93
fix(deps): update dependency @fluencelabs/aqua-lib to v0.8.1 (#249)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-12 21:26:51 +02:00
Aleksey Proshutinskiy
7b892678b1
fix(ci): setup fcli in release step (#305) 2023-12-12 20:31:32 +02:00
fluencebot
64b3b4b9c9
chore(main): release registry 0.9.1 (#300)
* chore(main): release registry 0.9.1

* chore: Bump registry version to 0.9.1
2023-12-06 16:08:39 +01:00
shamsartem
c160475157
fix: remove binary import (#304) 2023-12-06 15:43:53 +01:00
shamsartem
d77fd12b4d
feat: use non-npm Fluence CLI (#302)
* feat: use non-npm Fluence CLI

* Replace nox version

* Setup fcli in cargo tests

* Fix

* remove npx

---------

Co-authored-by: Anatoly Laskaris <github_me@nahsi.dev>
2023-12-05 12:27:53 +01:00
renovate[bot]
2405f41702
fix(deps): update rust crate marine-rs-sdk-test to v0.11.1 (#292)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-02 17:14:43 +04:00
renovate[bot]
2a440a8b1f
fix(deps): update dependency @fluencelabs/cli to v0.13.0 (#290)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-02 15:34:21 +05:30
Aleksey Proshutinskiy
19f064519d
chore(renovate): disable respectLatest (#299) 2023-12-02 15:08:51 +05:30
Aleksey Proshutinskiy
9e5dc63fb2
chore(ci): do not pin cargo workspaces (#298) 2023-12-02 14:53:49 +05:30
Anatolios Laskaris
5ea6ff36ed
chore: Do not pin cargo workspaces (#295)
Do not pin cargo workspaces
2023-11-22 19:45:44 +02:00
fluencebot
517872aa84
chore(main): release registry 0.9.0 (#294) 2023-11-22 16:56:06 +02:00
Aleksey Proshutinskiy
a6514ffce9
chore: revert release (#293)
Revert "chore(main): release registry 0.9.0 (#286)"

This reverts commit d9a8a20d58b3684a8f32a66c5cfd809168bb1510.
2023-11-22 16:54:15 +02:00
fluencebot
d9a8a20d58
chore(main): release registry 0.9.0 (#286) 2023-11-22 16:41:48 +02:00
Aleksey Proshutinskiy
0985109026
chore: bump toolchain and test sdk (#291) 2023-11-21 20:58:27 +02:00
Anatolios Laskaris
acfa42850b
chore: Bump toolchain (#287) 2023-11-21 16:55:05 +02:00
Anatolios Laskaris
0394560c06
chore: Update nox-snapshot job in e2e (#289)
Fix
2023-11-21 13:40:10 +02:00
Anatolios Laskaris
3d378b92fb
chore: Rename flox to fcli (#288)
Fix
2023-11-21 13:08:48 +02:00
Anatolios Laskaris
394b5b8395
chore: Use older cargo-edit (#285)
Use older cargo-edit
2023-11-18 15:27:41 +02:00
Aleksey Proshutinskiy
81f15d4eb7
feat(subnetwork)!: deprecate registry-based subnets [NET-633] (#283) 2023-11-15 19:55:39 +02:00
fluencebot
d5c2c7c6c1
chore(main): release registry 0.8.8 (#256) 2023-11-07 21:22:56 +02:00
InversionSpaces
19f5d47add
feat(registry): Use streams instead of options [LNG-277] (#282)
Use streams instead of options
2023-11-07 16:29:43 +01:00
renovate[bot]
2259425976
fix(deps): update dependency @fluencelabs/cli (#276)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-01 12:24:19 +02:00
renovate[bot]
8ff086a206
fix(deps): update dependency @fluencelabs/fluence-network-environment to v1.1.2 (#277)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-01 12:18:40 +02:00
Anatolios Laskaris
a7051d748b
chore: Cleanup fcli dirs (#279) 2023-10-24 20:43:12 +03:00
renovate[bot]
1f44cdc3b1
fix(deps): update marine things (#278) 2023-10-24 19:53:03 +03:00
Anatolios Laskaris
9b7c2807dc
chore: Fix renovate config (#274)
* Fix renovate config

* Add lints for renovate
2023-10-24 18:56:15 +03:00
Valery Antopol
4cb1b90a95
fix(deps): unlock and update rust crate serde to 1.0.188 (#273)
update rust crate serde to 1.0.188
2023-10-23 21:51:49 +03:00
Akim
0ac1b76fe1
fix(deps): Update cli to 0.11.0 (#272)
Update cli
2023-10-11 21:06:22 +07:00
Aleksey Proshutisnkiy
d63183a7d7
chore(aqua-tests): update cli (#271) 2023-10-10 01:16:35 +02:00
shamsartem
2c29fea098
feat: prepare cli update (#270) 2023-10-02 11:50:31 +02:00
renovate[bot]
9b4142dc95
fix(deps): update rust crate marine-rs-sdk to v0.9.0 (#265)
* fix(deps): update rust crate marine-sqlite-connector to v0.9.0

* fix(deps): update rust crate marine-rs-sdk-test to v0.10.2

* fix(deps): update rust crate marine-rs-sdk to v0.9.0

* Fix lock

* Fix

* Update renovate config

* Fix

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Anatoly Laskaris <github_me@nahsi.dev>
2023-09-14 11:22:40 +03:00
Anatolios Laskaris
19128039df
chore: Revert docker-compose action update (#268)
Fix
2023-09-12 19:02:46 +03:00
renovate[bot]
8901137546
chore(deps): update all github-actions (#266)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-12 18:07:38 +03:00
renovate[bot]
5269c1ebf6
chore(deps): update all github-actions (major) (#267)
chore(deps): update all github-actions

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-09-12 18:07:27 +03:00
Anatolios Laskaris
1a12a56f3e
chore: Use marine from checks (#263)
Use marine from checks
2023-09-04 14:57:56 +03:00
renovate[bot]
be441e86cb
fix(deps): update dependency @fluencelabs/cli to v0.6.0 (#238)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-10 16:34:42 +03:00
Anatolios Laskaris
bb33b8cc22
chore: Update CI to use registry distro in E2E (#260)
* Get rid of buildin package

* Add snapshot workflow

* Cleanup

* Change name

* Typo

* Fix

* Fix

* Setup node

* Disable rust cache

* Build nox snapshot

* Fix

* Fix
2023-08-03 13:17:07 +03:00
Anatolios Laskaris
6b47a7c423
chore: Rename flox to cli (#259)
Fix
2023-07-14 12:12:11 +03:00
Anatolios Laskaris
0b603e7ff3
chore: Fix errors/warnings in CI summary (#258)
* Disable cache

* Fix

* Fix warining

* Use default rustflags
2023-07-11 12:04:03 +03:00
Anatolios Laskaris
14d63141cb
chore: Renaming things (#254)
* Use flox

* Fix

* Fix

* Fix

* Fix
2023-07-10 09:39:18 +03:00
folex
257516e74f
fix(ci): use unstable nox image (#255)
* fix(ci): use unstable nox image

* fix(ci): use flox 0.5.0
2023-06-30 10:25:19 -06:00
Anatolios Laskaris
3c0e44488f
chore: Update CI after aqua CI refactoring (#253)
* Prepare CI for aqua CI refactoring

* Fix

* Use private registry
2023-06-22 10:42:10 +03:00
97 changed files with 11128 additions and 129878 deletions

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
PEERS=(
"/ip4/127.0.0.1/tcp/9991/ws/p2p/12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR"
"/ip4/127.0.0.1/tcp/9992/ws/p2p/12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK"
"/ip4/127.0.0.1/tcp/9993/ws/p2p/12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ"
"/ip4/127.0.0.1/tcp/9994/ws/p2p/12D3KooWBzLSu9RL7wLP6oUowzCbkCj2AGBSXkHSJKuq4wwTfwof"
"/ip4/127.0.0.1/tcp/9995/ws/p2p/12D3KooWBf6hFgrnXwHkBnwPGMysP3b1NJe5HGtAWPYfwmQ2MBiU"
"/ip4/127.0.0.1/tcp/9996/ws/p2p/12D3KooWPisGn7JhooWhggndz25WM7vQ2JmA121EV8jUDQ5xMovJ"
)
cd ${GITHUB_WORKSPACE}/aqua-tests
for PEER_ADDR in ${PEERS[@]}; do
echo "Checking ${PEER_ADDR}"
if ! npx fluence aqua remote get_interface --addr ${PEER_ADDR} --id registry | jq -ec 'has("function_signatures")'; then
exit 1
fi
done

View File

@ -1,13 +1,13 @@
networks:
fluence:
nox:
driver: bridge
ipam:
config:
- subnet: 10.50.10.0/24
services:
fluence-1:
image: ${RUST_PEER_IMAGE}
nox-1:
image: ${NOX_IMAGE}
ports:
- 7771:7771
- 9991:9991
@ -17,21 +17,19 @@ services:
- -w=9991
- -x=10.50.10.10
- --external-maddrs
- /dns4/fluence-1/tcp/7771
- /dns4/fluence-1/tcp/9991/ws
- /dns4/nox-1/tcp/7771
- /dns4/nox-1/tcp/9991/ws
- --allow-private-ips
- --local
# - --bootstraps=/dns/fluence-1/tcp/7771
# - --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
- -k=hK62afickoeP2uZbmSkAYXxxqP8ozq16VRN7qfTP719EHC5V5tjrtW57BSjUr8GvsEXmJRbtejUWyPZ2rZMyQdq
volumes:
- ../../registry:/builtins/registry
networks:
fluence:
nox:
ipv4_address: 10.50.10.10
fluence-2:
image: ${RUST_PEER_IMAGE}
nox-2:
image: ${NOX_IMAGE}
ports:
- 7772:7772
- 9992:9992
@ -41,20 +39,18 @@ services:
- -w=9992
- -x=10.50.10.20
- --external-maddrs
- /dns4/fluence-2/tcp/7772
- /dns4/fluence-2/tcp/9992/ws
- /dns4/nox-2/tcp/7772
- /dns4/nox-2/tcp/9992/ws
- --allow-private-ips
- --bootstraps=/dns/fluence-1/tcp/7771
- --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK
- -k=2WijTVdhVRzyZamWjqPx4V4iNMrajegNMwNa2PmvPSZV6RRpo5M2fsPWdQr22HVRubuJhhSw8BrWiGt6FPhFAuXy
volumes:
- ../../registry:/builtins/registry
networks:
fluence:
nox:
ipv4_address: 10.50.10.20
fluence-3:
image: ${RUST_PEER_IMAGE}
nox-3:
image: ${NOX_IMAGE}
ports:
- 7773:7773
- 9993:9993
@ -64,20 +60,18 @@ services:
- -w=9993
- -x=10.50.10.30
- --external-maddrs
- /dns4/fluence-3/tcp/7773
- /dns4/fluence-3/tcp/9993/ws
- /dns4/nox-3/tcp/7773
- /dns4/nox-3/tcp/9993/ws
- --allow-private-ips
- --bootstraps=/dns/fluence-1/tcp/7771
- --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ
- -k=2n2wBVanBeu2GWtvKBdrYK9DJAocgG3PrTUXMharq6TTfxqTL4sLdXL9BF23n6rsnkAY5pR9vBtx2uWYDQAiZdrX
volumes:
- ../../registry:/builtins/registry
networks:
fluence:
nox:
ipv4_address: 10.50.10.30
fluence-4:
image: ${RUST_PEER_IMAGE}
nox-4:
image: ${NOX_IMAGE}
ports:
- 7774:7774
- 9994:9994
@ -87,20 +81,18 @@ services:
- -w=9994
- -x=10.50.10.40
- --external-maddrs
- /dns4/fluence-4/tcp/7774
- /dns4/fluence-4/tcp/9994/ws
- /dns4/nox-4/tcp/7774
- /dns4/nox-4/tcp/9994/ws
- --allow-private-ips
- --bootstraps=/dns/fluence-1/tcp/7771
- --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWBzLSu9RL7wLP6oUowzCbkCj2AGBSXkHSJKuq4wwTfwof
- -k=4zp8ucAikkjB8CmkufYiFBW4QCDUCbQG7yMjviX7W8bMyN5rfChQ2Pi5QCWThrCTbAm9uq5nbFbxtFcNZq3De4dX
volumes:
- ../../registry:/builtins/registry
networks:
fluence:
nox:
ipv4_address: 10.50.10.40
fluence-5:
image: ${RUST_PEER_IMAGE}
nox-5:
image: ${NOX_IMAGE}
ports:
- 7775:7775
- 9995:9995
@ -110,20 +102,18 @@ services:
- -w=9995
- -x=10.50.10.50
- --external-maddrs
- /dns4/fluence-5/tcp/7775
- /dns4/fluence-5/tcp/9995/ws
- /dns4/nox-5/tcp/7775
- /dns4/nox-5/tcp/9995/ws
- --allow-private-ips
- --bootstraps=/dns/fluence-1/tcp/7771
- --bootstraps=/dns/nox-1/tcp/7771
# 12D3KooWBf6hFgrnXwHkBnwPGMysP3b1NJe5HGtAWPYfwmQ2MBiU
- -k=3ry26rm5gkJXvdqRH4FoM3ezWq4xVVsBQF7wtKq4E4pbuaa6p1F84tNqifUS7DdfJL9hs2gcdW64Wc342vHZHMUp
volumes:
- ../../registry:/builtins/registry
networks:
fluence:
nox:
ipv4_address: 10.50.10.50
fluence-6:
image: ${RUST_PEER_IMAGE}
nox-6:
image: ${NOX_IMAGE}
ports:
- 7776:7776
- 9996:9996
@ -131,16 +121,14 @@ services:
- --aqua-pool-size=2
- -t=7776
- -w=9996
- --bootstraps=/dns/fluence-1/tcp/7771
- --bootstraps=/dns/nox-1/tcp/7771
- -x=10.50.10.60
- --external-maddrs
- /dns4/fluence-6/tcp/7776
- /dns4/fluence-6/tcp/9996/ws
- /dns4/nox-6/tcp/7776
- /dns4/nox-6/tcp/9996/ws
- --allow-private-ips
# 12D3KooWPisGn7JhooWhggndz25WM7vQ2JmA121EV8jUDQ5xMovJ
- -k=5Qh8bB1sF28uLPwr3HTvEksCeC6mAWQvebCfcgv9y6j4qKwSzNKm2tzLUg4nACUEo2KZpBw11gNCnwaAdM7o1pEn
volumes:
- ../../registry:/builtins/registry
networks:
fluence:
nox:
ipv4_address: 10.50.10.60

View File

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

10
.github/renovate.json vendored
View File

@ -7,6 +7,7 @@
"enabledManagers": ["cargo", "npm", "github-actions", "pip_requirements"],
"rangeStrategy": "pin",
"schedule": "every weekend",
"respectLatest": false,
"packageRules": [
{
"matchManagers": ["cargo", "npm"],
@ -19,6 +20,15 @@
"semanticCommitScope": "deps",
"schedule": "at any time"
},
{
"matchManagers": ["cargo"],
"groupName": "marine things",
"matchPackagePatterns": [
"marine-rs-sdk",
"marine-rs-sdk-test",
"marine-sqlite-connector"
],
},
{
"matchDepTypes": ["devDependencies"],
"prPriority": -1,

72
.github/workflows/e2e.yml vendored Normal file
View File

@ -0,0 +1,72 @@
name: "e2e"
on:
pull_request:
paths-ignore:
- "**.md"
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/snapshot.yml"
- "!.github/workflows/tests.yml"
types:
- "labeled"
- "synchronize"
- "opened"
- "reopened"
push:
branches:
- "main"
paths-ignore:
- "**.md"
- ".github/**"
- "!.github/workflows/e2e.yml"
- "!.github/workflows/snapshot.yml"
- "!.github/workflows/tests.yml"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
snapshot:
if: >
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'e2e')
name: "registry"
uses: ./.github/workflows/snapshot.yml
with:
ref: ${{ github.ref }}
nox:
needs:
- snapshot
uses: fluencelabs/nox/.github/workflows/build.yml@master
with:
cargo-dependencies: |
[
{
"package": "registry-distro",
"version": "=${{ needs.snapshot.outputs.cargo-version }}",
"registry": "fluence",
"manifest": "crates/system-services/Cargo.toml"
}
]
nox-snapshot:
name: "nox"
needs:
- nox
uses: fluencelabs/nox/.github/workflows/container.yml@master
with:
image-name: "docker.fluence.dev/registry"
aqua-tests:
name: "registry"
needs:
- nox-snapshot
uses: ./.github/workflows/tests.yml
with:
ref: ${{ github.ref }}
nox-image: "${{ needs.nox-snapshot.outputs.nox-image }}"
if-no-artifacts-found: warn

21
.github/workflows/lint-pr.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: lint PR
on:
pull_request:
types:
- opened
- edited
- synchronize
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
pr:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -2,29 +2,20 @@ name: lint
on:
pull_request:
types:
- opened
- edited
- synchronize
paths:
- ".github/workflows/**"
- ".github/renovate.json"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
pr:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
reviewdog:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Lint actions
uses: reviewdog/action-actionlint@v1
@ -33,3 +24,14 @@ jobs:
with:
reporter: github-pr-check
fail_on_error: true
renovate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Renovate Config Validator
uses: tj-actions/renovate-config-validator@v2
with:
config_file: .github/renovate.json

View File

@ -45,15 +45,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: dsherret/rust-toolchain-file@v1
- name: Install cargo-edit
uses: baptiste0928/cargo-install@v2.0.0
uses: baptiste0928/cargo-install@v2.2.0
with:
crate: cargo-edit
@ -101,10 +101,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github
@ -117,11 +117,16 @@ jobs:
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: dsherret/rust-toolchain-file@v1
- name: Setup marine
uses: fluencelabs/setup-marine@v1
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: main
- name: Build service
run: ./build.sh
working-directory: service
@ -144,45 +149,8 @@ jobs:
run: npm publish --access public
working-directory: aqua
- name: Install ipfs
uses: nahsi/setup-ipfs@v1
- name: Create builtin distribution package
run: ./builtin-package/package.sh
- name: Calculate SHA256
id: sha
run: |
# Calculate sha256
du -hs registry.tar.gz
sha256sum registry.tar.gz
sha=($(sha256sum registry.tar.gz))
echo "sha256=${sha}" >> $GITHUB_OUTPUT
- name: Upload registry package
if: needs.release-please.outputs.release-created
uses: softprops/action-gh-release@v1
with:
files: registry.tar.gz
tag_name: ${{ needs.release-please.outputs.tag-name }}
- name: Update version in node-distro repo
if: needs.release-please.outputs.release-created
uses: benc-uk/workflow-dispatch@v1
with:
workflow: update_service
repo: fluencelabs/node-distro
ref: "main"
token: ${{ secrets.PERSONAL_TOKEN }}
inputs: '{
"name": "registry",
"version": "${{ needs.release-please.outputs.version }}",
"url": "https://github.com/fluencelabs/registry/releases/download/${{ needs.release-please.outputs.tag-name }}/registry.tar.gz",
"sha256": "${{ steps.sha.outputs.sha256 }}"
}'
- name: Import secrets
uses: hashicorp/vault-action@v2.4.3
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github
@ -198,10 +166,9 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v2.0.0
uses: baptiste0928/cargo-install@v2.2.0
with:
crate: cargo-workspaces
version: v0.2.37
- name: Build distro
run: ./build.sh
@ -243,7 +210,7 @@ jobs:
echo "found any?:" "${{ steps.status.outputs.found }}"
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github

View File

@ -7,6 +7,7 @@ on:
- ".github/**"
- "!.github/workflows/run-tests.yml"
- "!.github/workflows/tests.yml"
- "!.github/workflows/e2e.yml"
types:
- "labeled"
- "synchronize"
@ -20,17 +21,13 @@ on:
- ".github/**"
- "!.github/workflows/run-tests.yml"
- "!.github/workflows/tests.yml"
- "!.github/workflows/e2e.yml"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
registry:
uses: ./.github/workflows/tests.yml
with:
ref: ${{ github.ref }}
cargo:
name: "registry / Run cargo tests"
runs-on: builder
@ -41,10 +38,12 @@ jobs:
working-directory: service
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: false
- name: Setup marine
uses: fluencelabs/setup-marine@v1
@ -56,18 +55,33 @@ jobs:
run: cargo fmt --all -- --check
- name: Run cargo clippy
env:
RUSTFLAGS: ""
run: cargo clippy -Z unstable-options --all -- -D warnings
- name: Install cargo-nextest
uses: baptiste0928/cargo-install@v2.0.0
uses: baptiste0928/cargo-install@v2.2.0
with:
crate: cargo-nextest
version: 0.9.22
- name: Run cargo nextest
env:
RUSTFLAGS: ""
NEXTEST_RETRIES: 2
NEXTEST_TEST_THREADS: 1
run: cargo nextest run --release --all-features --no-fail-fast
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all --manifest-path service/Cargo.toml -- --check

104
.github/workflows/snapshot.yml vendored Normal file
View File

@ -0,0 +1,104 @@
name: Build snapshot
on:
workflow_call:
inputs:
cargo-dependencies:
description: "Cargo dependencies map"
type: string
default: "null"
ref:
description: "git ref to checkout to"
type: string
default: "master"
snapshot:
description: "Whether to publish snapshots"
type: boolean
default: true
outputs:
cargo-version:
description: "Cargo snapshot version"
value: ${{ jobs.snapshot.outputs.version }}
jobs:
snapshot:
name: "Build crate"
runs-on: builder
timeout-minutes: 60
outputs:
version: "${{ steps.snapshot.outputs.version }}"
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
repository: fluencelabs/registry
ref: ${{ inputs.ref }}
- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1
- name: Set dependencies
if: inputs.cargo-dependencies != 'null'
uses: fluencelabs/github-actions/cargo-set-dependency@main
with:
dependencies: ${{ inputs.cargo-dependencies }}
path: service/
- name: Setup marine
uses: fluencelabs/setup-marine@v1
with:
artifact-name: marine
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: main
- name: Import secrets
if: inputs.snapshot == true
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/cargo-registry/users/ci token | CARGO_REGISTRIES_FLUENCE_TOKEN
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "aqua/package-lock.json"
cache: "npm"
- run: npm i
working-directory: aqua
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v2.2.0
with:
crate: cargo-workspaces
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- name: Build distro
run: ./build.sh
- name: Publish crate snapshots
id: snapshot
uses: fluencelabs/github-actions/cargo-publish-snapshot@main
with:
id: ${{ steps.version.outputs.id }}
path: distro

View File

@ -7,18 +7,18 @@ on:
description: "Fluence enviroment to run tests agains"
type: string
default: "local"
rust-peer-image:
description: "rust-peer image tag"
nox-image:
description: "nox image tag"
type: string
default: "fluencelabs/rust-peer:minimal"
aqua-version:
description: "@fluencelabs/aqua version"
type: string
default: "null"
fluence-cli-version:
default: "fluencelabs/nox:unstable"
fcli-version:
description: "@fluencelabs/cli version"
type: string
default: "null"
default: "main"
if-no-artifacts-found:
description: "What to do when no artifacts found in setup-* actions"
type: string
default: "error"
cargo-dependencies:
description: "Cargo dependencies map"
type: string
@ -30,7 +30,7 @@ on:
env:
CI: true
FORCE_COLOR: true
RUST_PEER_IMAGE: "${{ inputs.rust-peer-image }}"
NOX_IMAGE: "${{ inputs.nox-image }}"
FLUENCE_ENV: "${{ inputs.fluence-env }}"
jobs:
@ -45,7 +45,7 @@ jobs:
steps:
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
uses: hashicorp/vault-action@v2.7.3
with:
url: https://vault.fluence.dev
path: jwt/github
@ -59,7 +59,7 @@ jobs:
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
- name: Checkout registry
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: fluencelabs/registry
ref: ${{ inputs.ref }}
@ -80,55 +80,20 @@ jobs:
run: npm install
working-directory: aqua-tests
- name: Set fluence-cli version
if: inputs.fluence-cli-version != 'null'
uses: fluencelabs/github-actions/npm-set-dependency@main
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
package: "@fluencelabs/cli"
version: ${{ inputs.fluence-cli-version }}
working-directory: aqua-tests
flags: "--save-dev"
- name: Set aqua version
if: inputs.aqua-version != 'null'
uses: fluencelabs/github-actions/npm-set-dependency@main
with:
package: "@fluencelabs/aqua"
version: ${{ inputs.aqua-version }}
working-directory: aqua
flags: "--save-dev"
- name: Set versions in fluence.yaml
uses: fluencelabs/github-actions/fluence-set-dependency@main
env:
NPM_CONFIG_REGISTRY: "https://npm.fluence.dev"
with:
path: aqua-tests
versions: >
{
"npm": {
"@fluencelabs/aqua": "${{ inputs.aqua-version }}"
}
}
artifact: fcli
version: ${{ inputs.fcli-version }}
if-no-artifact-found: ${{ inputs.if-no-artifacts-found }}
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Download marine artifact
id: marine
uses: actions/download-artifact@v3
continue-on-error: true
with:
name: marine
path: ~/.local/bin
- name: Make marine executable
if: steps.marine.outcome == 'success'
run: chmod +x ~/.local/bin/marine
uses: dsherret/rust-toolchain-file@v1
- name: Setup marine
if: steps.marine.outcome == 'failure'
uses: fluencelabs/setup-marine@v1
with:
artifact-name: marine
- name: Set dependencies
if: inputs.cargo-dependencies != ''
@ -138,32 +103,27 @@ jobs:
path: service/
- name: Build service
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: ./build.sh
working-directory: service
- name: Build distro
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: ./build.sh
- name: Install ipfs
uses: nahsi/setup-ipfs@v1
- name: Create builtin distribution package
run: ./builtin-package/package.sh
- name: Unpack registry package
run: tar xvf registry.tar.gz
- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: docker.fluence.dev
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Pull rust-peer image
run: docker pull $RUST_PEER_IMAGE
- name: Pull nox image
run: docker pull $NOX_IMAGE
- name: Run rust-peer
- name: Run nox network
uses: isbang/compose-action@v1.4.1
with:
compose-file: ".github/e2e/docker-compose.yml"
@ -180,30 +140,20 @@ jobs:
run: pip install -r requirements.txt
working-directory: aqua-tests
# - name: Wait for registry to be deployed
# uses: nick-fields/retry@v2
# with:
# timeout_seconds: 30
# max_attempts: 5
# shell: bash
# command: ${{ github.workspace }}/.github/check-registry.sh
#
- name: Temporarely wait with sleep
run: sleep 20
- name: Install fluence-cli dependencies
- name: Install fcli dependencies
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
run: npx fluence dep i --no-input
run: fluence dep i --no-input
working-directory: aqua-tests
- name: Print Fluence CLI version
- name: Print fcli version
run: pytest -s test_fluence_cli_version.py
working-directory: aqua-tests
- name: Run aqua tests
env:
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
NPM_CONFIG_REGISTRY: "https://npm.fluence.dev"
run: pytest test_aqua.py
working-directory: aqua-tests
@ -214,18 +164,16 @@ jobs:
cat <<SNAPSHOT >> $GITHUB_STEP_SUMMARY
## Used versions
\`\`\`
$(npx fluence dep v)
$(fluence dep v)
\`\`\`
SNAPSHOT
- name: Dump rust-peer logs on failure
- name: Dump container logs
if: always()
uses: jwalton/gh-docker-logs@v2
- name: Remove registry directory
- name: Cleanup
if: always()
run: sudo rm -rf registry
- name: Remove tmp directory
if: always()
run: sudo rm -rf tmp
run: |
rm -rf tmp ~/.fluence
sudo rm -rf registry

5
.gitignore vendored
View File

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

View File

@ -1,5 +1,94 @@
# 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)
### Features
* update marine sdk's, sqlite conector and config ([#309](https://github.com/fluencelabs/registry/issues/309)) ([863ae55](https://github.com/fluencelabs/registry/commit/863ae55f35bbe5452b636c064f9f8b377bb10ee8))
### Bug Fixes
* **ci:** setup fcli in release step ([#305](https://github.com/fluencelabs/registry/issues/305)) ([7b89267](https://github.com/fluencelabs/registry/commit/7b892678b1003bcf0c0fc834b7b49ceb2172e388))
* **deps:** update dependency @fluencelabs/aqua-lib to v0.8.1 ([#249](https://github.com/fluencelabs/registry/issues/249)) ([66a42f7](https://github.com/fluencelabs/registry/commit/66a42f7b935e82af9133e2d5bc2c864cb4296e2f))
* **deps:** update dependency @fluencelabs/aqua-lib to v0.8.2 ([#308](https://github.com/fluencelabs/registry/issues/308)) ([c207f7f](https://github.com/fluencelabs/registry/commit/c207f7fa549702c45dd8f25d0f97d95944472e6e))
* **deps:** update dependency @fluencelabs/trust-graph to v0.4.7 ([#257](https://github.com/fluencelabs/registry/issues/257)) ([a6aeeea](https://github.com/fluencelabs/registry/commit/a6aeeea3f5eb4f06a99ec272e0f5d3b4b0a2a8a7))
## [0.9.1](https://github.com/fluencelabs/registry/compare/registry-v0.9.0...registry-v0.9.1) (2023-12-06)
### Features
* use non-npm Fluence CLI ([#302](https://github.com/fluencelabs/registry/issues/302)) ([d77fd12](https://github.com/fluencelabs/registry/commit/d77fd12b4dfe2d57ae3e35f729e35e2f6ad1c63c))
### Bug Fixes
* **deps:** update dependency @fluencelabs/cli to v0.13.0 ([#290](https://github.com/fluencelabs/registry/issues/290)) ([2a440a8](https://github.com/fluencelabs/registry/commit/2a440a8b1ff8aa922bd2faa982b8b75c9beb3bc7))
* **deps:** update rust crate marine-rs-sdk-test to v0.11.1 ([#292](https://github.com/fluencelabs/registry/issues/292)) ([2405f41](https://github.com/fluencelabs/registry/commit/2405f41702543d1ff70620923787a6a7621cc7d5))
* remove binary import ([#304](https://github.com/fluencelabs/registry/issues/304)) ([c160475](https://github.com/fluencelabs/registry/commit/c16047515751f1400cb1f7231abcc83e2f6bcf4f))
## [0.9.0](https://github.com/fluencelabs/registry/compare/registry-v0.8.8...registry-v0.9.0) (2023-11-22)
### ⚠ BREAKING CHANGES
* **subnetwork:** deprecate registry-based subnets [NET-633] ([#283](https://github.com/fluencelabs/registry/issues/283))
### Features
* **subnetwork:** deprecate registry-based subnets [NET-633] ([#283](https://github.com/fluencelabs/registry/issues/283)) ([81f15d4](https://github.com/fluencelabs/registry/commit/81f15d4eb74b730fca331f1ea4ef6b960a02f9c8))
## [0.8.8](https://github.com/fluencelabs/registry/compare/registry-v0.8.7...registry-v0.8.8) (2023-11-07)
### Features
* prepare cli update ([#270](https://github.com/fluencelabs/registry/issues/270)) ([2c29fea](https://github.com/fluencelabs/registry/commit/2c29fea09808e2f98c4f58a10a1587aa5a571ad0))
* **registry:** Use streams instead of options [LNG-277] ([#282](https://github.com/fluencelabs/registry/issues/282)) ([19f5d47](https://github.com/fluencelabs/registry/commit/19f5d47add949f62085a022a01b84c83d3fc0389))
### Bug Fixes
* **ci:** use unstable nox image ([#255](https://github.com/fluencelabs/registry/issues/255)) ([257516e](https://github.com/fluencelabs/registry/commit/257516e74ff78807f78a7570ccc9e2d685af48f9))
* **deps:** unlock and update rust crate serde to 1.0.188 ([#273](https://github.com/fluencelabs/registry/issues/273)) ([4cb1b90](https://github.com/fluencelabs/registry/commit/4cb1b90a95bdc49b87b1dd1336e604cc71444de3))
* **deps:** Update cli to 0.11.0 ([#272](https://github.com/fluencelabs/registry/issues/272)) ([0ac1b76](https://github.com/fluencelabs/registry/commit/0ac1b76fe1c0635bfa5cf1105ffaf899db36b300))
* **deps:** update dependency @fluencelabs/cli ([#276](https://github.com/fluencelabs/registry/issues/276)) ([2259425](https://github.com/fluencelabs/registry/commit/22594259767fbd5be59904eab080d74733e7ea3e))
* **deps:** update dependency @fluencelabs/cli to v0.6.0 ([#238](https://github.com/fluencelabs/registry/issues/238)) ([be441e8](https://github.com/fluencelabs/registry/commit/be441e86cbc07a51636edfd07ec0fc80933b31cf))
* **deps:** update dependency @fluencelabs/fluence-network-environment to v1.1.2 ([#277](https://github.com/fluencelabs/registry/issues/277)) ([8ff086a](https://github.com/fluencelabs/registry/commit/8ff086a206d37edaeebe986661b626277e456d95))
* **deps:** update marine things ([#278](https://github.com/fluencelabs/registry/issues/278)) ([1f44cdc](https://github.com/fluencelabs/registry/commit/1f44cdc3b1188ef9daaba33a73ee85980c0c8bc6))
* **deps:** update rust crate marine-rs-sdk to v0.9.0 ([#265](https://github.com/fluencelabs/registry/issues/265)) ([9b4142d](https://github.com/fluencelabs/registry/commit/9b4142dc951414270f5a76b0519aa749c8835eb6))
## [0.8.7](https://github.com/fluencelabs/registry/compare/registry-v0.8.6...registry-v0.8.7) (2023-06-20)

View File

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

View File

@ -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=="
}
}
}

View File

@ -0,0 +1,9 @@
# yaml-language-server: $schema=schemas/env.json
# Defines user project preferences
# Documentation: https://github.com/fluencelabs/cli/tree/main/docs/configs/env.md
version: 0
fluenceEnv: local

View File

@ -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
}
]

View File

@ -1,89 +0,0 @@
{
"type": "object",
"$id": "https://fluence.dev/schemas/app.yaml",
"title": "app.yaml",
"description": "Defines what exactly is already deployed and where. This config is automatically generated by Fluence CLI after you deploy services defined in [fluence.yaml](./fluence.md) using `fluence deploy` or remove previously deployed services using `fluence remove`. In most of the cases you are not expected to modify this by hand",
"properties": {
"services": {
"type": "object",
"title": "Services",
"description": "A map of the deployed services",
"additionalProperties": {
"type": "object",
"title": "Deployment results",
"description": "Service names as keys and Deployment results as values",
"additionalProperties": {
"title": "A list of deployed services",
"type": "array",
"items": {
"type": "object",
"title": "Deployed service info",
"properties": {
"peerId": {
"type": "string"
},
"serviceId": {
"type": "string"
},
"blueprintId": {
"type": "string"
},
"keyPairName": {
"type": "string"
}
},
"required": [
"peerId",
"serviceId",
"blueprintId",
"keyPairName"
]
}
},
"required": []
},
"required": []
},
"timestamp": {
"type": "string",
"description": "ISO timestamp of the time when the services were deployed"
},
"relays": {
"title": "Relays",
"description": "Relays that you can connect to to find the peers where services are deployed",
"type": [
"string",
"array",
"null"
],
"oneOf": [
{
"type": "string",
"title": "Network name",
"enum": [
"kras",
"stage",
"testnet"
]
},
{
"type": "array",
"title": "Multi addresses",
"items": {
"type": "string"
}
}
],
"nullable": true
},
"version": {
"type": "number",
"const": 3
}
},
"required": [
"version",
"services",
"timestamp"
]
}

View File

@ -1,29 +0,0 @@
{
"type": "object",
"$id": "https://fluence.dev/schemas/fluence-lock.yaml",
"title": "fluence-lock.yaml",
"description": "Defines a lock file for Fluence Project dependencies. When dependencies are installed - their exact versions are saved here.",
"properties": {
"npm": {
"type": "object",
"title": "npm dependencies",
"description": "A map of the exact npm dependency versions. CLI ensures dependencies are installed each time you run aqua",
"required": [],
"nullable": true
},
"cargo": {
"type": "object",
"title": "Cargo dependencies",
"description": "A map of the exact cargo dependency versions. CLI ensures dependencies are installed each time you run commands that depend on Marine or Marine REPL",
"required": [],
"nullable": true
},
"version": {
"type": "number",
"const": 0
}
},
"required": [
"version"
]
}

View File

@ -1,272 +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"
},
"deploy": {
"type": "array",
"title": "Deployment list",
"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, distribution, 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)"
},
"distribution": {
"type": "string",
"enum": [
"even",
"random"
],
"nullable": true,
"description": "\"even\" distribution is used by default, means that the services will be deployed evenly across the listed peers. \"random\" distribution means that the services will be deployed randomly across the listed peers."
},
"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": {
"type": {
"type": "string",
"enum": [
"rust",
"compiled"
],
"nullable": true,
"default": "compiled",
"description": "Module type \"compiled\" is for the precompiled modules. Module type \"rust\" is for the source code written in rust which can be compiled into a Marine module"
},
"name": {
"type": "string",
"description": "\"name\" property from the Cargo.toml (for module type \"rust\") or name of the precompiled .wasm file (for module type \"compiled\")",
"nullable": true
},
"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. (This property replaces the legacy \"mapped_dirs\" property so there is no need to duplicate the same paths in \"preopenedFiles\" dir)"
},
"preopenedFiles": {
"type": "array",
"title": "Preopened files",
"description": "A list of files and directories that this module could access with WASI",
"items": {
"type": "string"
},
"nullable": true
},
"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"
},
"version": {
"type": "number",
"const": 0
},
"get": {
"type": "string",
"nullable": true,
"description": "Path to module directory or URL to the tar.gz archive with the module"
}
},
"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",
"deploy"
]
},
"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"
}
}
],
"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": "A map of dependency versions",
"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"
},
"aquaOutputTSPath": {
"type": "string",
"nullable": true,
"description": "Default compilation target dir from aqua to ts"
},
"aquaOutputJSPath": {
"type": "string",
"nullable": true,
"description": "Default compilation target dir from aqua to js. Overrides \"aquaOutputTSPath\" property"
},
"appTSPath": {
"type": "string",
"nullable": true,
"description": "Path to the directory where you want to generate app.ts after deployment. If you run registerApp() function in your typescript code after initializing FluenceJS client you will be able to access ids of the deployed services in aqua"
},
"appJSPath": {
"type": "string",
"nullable": true,
"description": "Path to the directory where you want to generate app.js after deployment. If you run registerApp() function in your javascript code after initializing FluenceJS client you will be able to access ids of the deployed services in aqua"
}
},
"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,50 +0,0 @@
{
"$id": "https://fluence.dev/schemas/project-secrets.yaml",
"title": "project-secrets.yaml",
"type": "object",
"description": "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",
"properties": {
"keyPairs": {
"title": "Key Pairs",
"description": "Key Pairs available for the particular project",
"type": "array",
"items": {
"title": "Key Pair",
"type": "object",
"properties": {
"peerId": {
"type": "string"
},
"secretKey": {
"type": "string"
},
"publicKey": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"peerId",
"secretKey",
"publicKey",
"name"
]
}
},
"defaultKeyPairName": {
"type": "string",
"nullable": true,
"description": "Key pair with this name will be used for the deployment by default. You can override it with flags or by using keyPair properties in fluence.yaml"
},
"version": {
"type": "number",
"const": 0
}
},
"required": [
"version",
"keyPairs"
]
}

View File

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

View File

@ -0,0 +1 @@
e72l3wuItcfCcQBP6Rn4L0uQRsKmyckZRbYXP1ms59Q=

View File

@ -0,0 +1 @@
rZxZGGCxECt1opnXjnxrSpV2g6Qt2Fl0KTDoJkox008=

View File

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

2
aqua-tests/.gitignore vendored Normal file
View File

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

View File

@ -1,7 +1,8 @@
module Test
aqua 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,15 +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": 0.9.2
"@fluencelabs/aqua-lib": 0.6.0
cargo:
marine: 0.14.1
mrepl: 0.21.3
aquaInputPath: aqua/test.aqua
npm:
'@fluencelabs/aqua-lib': 0.9.1
'@fluencelabs/spell': 0.6.9
'@fluencelabs/trust-graph': 0.4.11

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +1,5 @@
{
"name": "aqua-tests",
"version": "1.0.0",
"description": "Aqua Registry library",
"dependencies": {
"@fluencelabs/aqua-lib": "0.7.0",
"@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": "npx 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/cli": "0.4.16",
"@fluencelabs/fluence-network-environment": "1.0.14"
"@fluencelabs/fluence-network-environment": "1.1.2"
}
}

View File

@ -1,10 +1,13 @@
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 "../aqua/registry-service.aqua"
import "../aqua/registry-api.aqua"
import "@fluencelabs/aqua-lib/binary.aqua"
import "@fluencelabs/registry/registry-service.aqua"
import "@fluencelabs/registry/registry-api.aqua"
import "@fluencelabs/trust-graph/trust-graph.aqua"
data SpellConfig:
@ -57,16 +60,15 @@ func spell(config: SpellConfig):
check_and_run = (key: string, now:u32, interval: u32, job: u32 -> ()):
last_run <- Spell.get_u32(key)
need_to_run <- or(not(last_run.success), Compare.gte(now - last_run.num, interval))
need_to_run = !last_run.success || ((now - last_run.value) >= interval)
if need_to_run == true:
log(Op.concat_strings(Op.concat_strings("Running ", key), "job"))
job(now)
Spell.set_u32(key, now)
on HOST_PEER_ID:
now <- PeerTimeTrunc.timestamp_sec()
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)

View File

@ -5,7 +5,6 @@ import os
import inspect
from config import get_local
delegator.run("npx 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"npx 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()

View File

@ -2,6 +2,6 @@ import delegator
def test_fluence_cli_version():
c = delegator.run(f"npx fluence --version", block=True)
c = delegator.run(f"fluence --version", block=True)
print(f"Fluence CLI version: {c.out}")
assert True

View File

@ -1,3 +1,5 @@
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.

View File

@ -1,3 +1,5 @@
aqua Misc declares *
import "@fluencelabs/aqua-lib/builtin.aqua"
import "registry-service.aqua"
import "constants.aqua"
@ -37,7 +39,7 @@ func appendErrors(error1: *Error, error2: *Error):
func getResourceHelper(resource_id: ResourceId) -> ?Resource, *Error:
nodes <- getNeighbors(resource_id)
result: ?Resource
result: *Resource
error: *Error
resources: *Key

44368
aqua/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,17 @@
{
"name": "@fluencelabs/registry",
"version": "0.8.7",
"version": "0.9.4",
"description": "Aqua Registry library",
"files": [
"*.aqua"
],
"dependencies": {
"@fluencelabs/aqua-lib": "0.7.0",
"@fluencelabs/trust-graph": "0.4.1"
"@fluencelabs/aqua-lib": "0.9.1",
"@fluencelabs/trust-graph": "0.4.11"
},
"scripts": {
"compile-aqua": "aqua -i . -o ./target/typescript",
"generate-aqua": "../service/build.sh",
"build": "npm run compile-aqua"
"build": "fluence aqua -i . --dry"
},
"repository": {
"type": "git",
@ -28,9 +27,5 @@
"bugs": {
"url": "https://github.com/fluencelabs/registry/issues"
},
"homepage": "https://github.com/fluencelabs/registry",
"devDependencies": {
"@fluencelabs/cli": "0.4.16",
"@fluencelabs/aqua": "^0.10.3"
}
"homepage": "https://github.com/fluencelabs/registry"
}

View File

@ -1,3 +1,10 @@
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"
@ -15,7 +22,7 @@ func getRecordMetadata(key_id: string, value: string, peer_id: string, relay_id:
on INIT_PEER_ID via HOST_PEER_ID:
sig_result <- Sig.sign(bytes)
result: ?RecordMetadata
result: *RecordMetadata
error: *string
if sig_result.success == true:
result <- Registry.create_record_metadata(key_id, INIT_PEER_ID, t, value, peer_id, relay_id, service_id, solution, sig_result.signature!)

View File

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

View File

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

View File

@ -1,4 +1,4 @@
module Registry.ResourcesAPI declares *
aqua Registry.ResourcesAPI declares *
import "registry-service.aqua"
import "registry-api.aqua"
@ -6,10 +6,6 @@ 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)
@ -24,7 +20,7 @@ func getResourceId(label: string, peer_id: string) -> ResourceId:
func createResource(label: string) -> ?ResourceId, *Error:
t <- Peer.timestamp_sec()
resource_id: ?ResourceId
resource_id: *ResourceId
error: *Error
on HOST_PEER_ID:
sig_result <- getKeySignature(label, t)
@ -57,7 +53,7 @@ func createResource(label: string) -> ?ResourceId, *Error:
-- Note: resource must be already created
func registerService(resource_id: ResourceId, value: string, peer_id: PeerId, service_id: ?string) -> bool, *Error:
relay_id: ?string
relay_id: *string
if peer_id == INIT_PEER_ID:
relay_id <<- HOST_PEER_ID
@ -116,7 +112,7 @@ func registerService(resource_id: ResourceId, value: string, peer_id: PeerId, se
func unregisterService(resource_id: ResourceId, peer_id: PeerId) -> bool, *Error:
success: ?bool
success: *bool
error: *Error
on HOST_PEER_ID:
@ -168,7 +164,7 @@ func unregisterService(resource_id: ResourceId, peer_id: PeerId) -> bool, *Error
func resolveResource(resource_id: ResourceId, ack: i16) -> ?[]Record, *Error:
on HOST_PEER_ID:
nodes <- getNeighbors(resource_id)
result: ?[]Record
result: *[]Record
records: *[]Record
error: *Error
successful: *bool
@ -197,7 +193,7 @@ func resolveResource(resource_id: ResourceId, ack: i16) -> ?[]Record, *Error:
-- Execute the given call on providers
-- Note that you can provide another Aqua function as an argument to this one
func executeOnResource(resource_id: ResourceId, ack: i16, call: Record -> ()) -> bool, *Error:
success: ?bool
success: *bool
result, error <- resolveResource(resource_id, ack)
if result == nil:

View File

@ -1,180 +0,0 @@
module Registry.Subnetwork declares *
import "registry-service.aqua"
import "registry-api.aqua"
import "misc.aqua"
import "constants.aqua"
import "@fluencelabs/aqua-lib/builtin.aqua"
import "@fluencelabs/trust-graph/trust-graph.aqua"
alias Error: string
const MIN_ACK = 2
func getInsecuredPeerId() -> PeerId:
Sig "insecure_sig"
peer_id <- Sig.get_peer_id()
<- peer_id
func getKeyInsecuredSignature(label: string, peer_id: PeerId, timestamp_created: u64) -> SignResult:
bytes <- Registry.get_key_bytes(label, ?[peer_id], timestamp_created, nil, "")
Sig "insecure_sig"
result <- Sig.sign(bytes)
<- result
-- peer_id comes from ("insecure_sig" "get_peer_id")
func registerSubnetworkKey(deal_id: string, peer_id: PeerId, timestamp_created: u64, signature: []u8) -> RegisterKeyResult:
t <- Peer.timestamp_sec()
weight <- TrustGraph.get_weight(peer_id, t)
result <- Registry.register_key(deal_id, ?[peer_id], timestamp_created, nil, "", signature, weight, t)
<- result
func createSubnetwork(deal_id: string) -> ?string, *Error:
t <- Peer.timestamp_sec()
subnetwork_id: ?string
error: *Error
on HOST_PEER_ID:
peer_id <- getInsecuredPeerId()
sig_result <- getKeyInsecuredSignature(deal_id, peer_id, t)
if sig_result.success == false:
error <<- sig_result.error!
else:
signature = sig_result.signature!
id <- Registry.get_key_id(deal_id, peer_id)
nodes <- getNeighbors(id)
successful: *bool
on HOST_PEER_ID:
for n <- nodes par:
on n:
try:
res <- registerSubnetworkKey(deal_id, peer_id, t, signature)
if res.success:
successful <<- true
else:
error <<- res.error
success <- wait(successful, INITIAL_REPLICATION_FACTOR, DEFAULT_TIMEOUT)
if success == false:
error <<- "key wasn't created: timeout exceeded"
else:
subnetwork_id <<- id
<- subnetwork_id, error
func getWorkerRecordMetadata(subnetwork_id: string) -> ?RecordMetadata, ?string:
t <- Peer.timestamp_sec()
relay_id = ?[HOST_PEER_ID]
bytes <- Registry.get_record_metadata_bytes(subnetwork_id, INIT_PEER_ID, t, "", INIT_PEER_ID, relay_id, nil, nil)
on INIT_PEER_ID:
Sig "sig"
sig_result <- Sig.sign(bytes)
result: ?RecordMetadata
error: *string
if sig_result.success == true:
result <- Registry.create_record_metadata(subnetwork_id, INIT_PEER_ID, t, "", INIT_PEER_ID, relay_id, nil, nil, sig_result.signature!)
else:
error <<- sig_result.error!
<- result, error
func getWorkerRecordSignature(metadata: RecordMetadata, timestamp_created: u64) -> SignResult:
signature: *SignResult
bytes <- Registry.get_record_bytes(metadata, timestamp_created)
on INIT_PEER_ID:
Sig "sig"
signature <- Sig.sign(bytes)
<- signature!
func registerWorker(subnetwork_id: string) -> bool, *Error:
success: *bool
error: *Error
metadata, err <- getWorkerRecordMetadata(subnetwork_id)
if metadata == nil:
success <<- false
error <<- err!
else:
t <- Peer.timestamp_sec()
sig_result = getWorkerRecordSignature(metadata!, t)
if sig_result.success == false:
error <<- sig_result.error!
success <<- false
else:
key, error_get <- getResourceHelper(subnetwork_id)
if key == nil:
appendErrors(error, error_get)
success <<- false
else:
republish_result <- republishKey(key!)
if republish_result.success == false:
error <<- republish_result.error
success <<- false
else:
p_res <- putRecord(metadata!, t, sig_result.signature!)
if p_res.success == false:
error <<- p_res.error
success <<- false
else:
nodes <- getNeighbors(subnetwork_id)
successful: *bool
for n <- nodes par:
on n:
try:
republish_res <- republishKey(key!)
if republish_res.success == false:
error <<- republish_res.error
else:
put_res <- putRecord(metadata!, t, sig_result.signature!)
if put_res.success:
successful <<- true
else:
error <<- put_res.error
success <- wait(successful, INITIAL_REPLICATION_FACTOR, DEFAULT_TIMEOUT)
succ = success!
if succ == false:
error <<- "worker hasn't registered: timeout exceeded"
<- succ, error
func resolveSubnetwork(deal_id: string) -> ?[]Record, *Error:
result: ?[]Record
error: *Error
on HOST_PEER_ID:
peer_id <- getInsecuredPeerId()
key_id <- Registry.get_key_id(deal_id, peer_id)
nodes <- getNeighbors(key_id)
records: *[]Record
successful: *bool
for n <- nodes par:
on n:
try:
t <- Peer.timestamp_sec()
get_result <- Registry.get_records(key_id, t)
if get_result.success:
records <<- get_result.result
successful <<- true
else:
error <<- get_result.error
success <- wait(successful, MIN_ACK, DEFAULT_TIMEOUT)
if success == false:
error <<- "timeout exceeded"
else:
merged <- Registry.merge(records)
if merged.success == false:
error <<- merged.error
else:
result <<- merged.result
<- result, error

View File

@ -0,0 +1,744 @@
/* 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

@ -0,0 +1,322 @@
/* 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,5 +1,7 @@
#!/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")"
@ -11,7 +13,16 @@ DISTRO_TARGET=distro/registry-service
mkdir -p "$DISTRO_TARGET"
cd ./aqua
npx 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 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"

View File

@ -1,43 +0,0 @@
#!/usr/bin/env bash
set -o pipefail -o nounset -o errexit
# set current working directory to script directory to run script from everywhere
cd "$(dirname "$0")"
PACKAGE_DIR="$(pwd)/../registry"
SCHEDULED="$PACKAGE_DIR/scheduled"
(
rm -rf $PACKAGE_DIR
mkdir -p $PACKAGE_DIR
)
(
echo "*** compile scheduled scripts ***"
cd ../aqua
npx fluence --version
npx fluence aqua --no-relay --air -i ./registry-scheduled-scripts.aqua -o "$SCHEDULED"
)
(
echo "*** copy wasm files ***"
cd ../service
cp artifacts/*.wasm "$PACKAGE_DIR"
)
REGISTRY_CID=$(ipfs add -q --only-hash --cid-version=1 --chunker=size-262144 $PACKAGE_DIR/registry.wasm)
SQLITE_CID=$(ipfs add -q --only-hash --cid-version=1 --chunker=size-262144 $PACKAGE_DIR/sqlite3.wasm)
mv $PACKAGE_DIR/registry.wasm "$PACKAGE_DIR"/"$REGISTRY_CID".wasm
mv $PACKAGE_DIR/sqlite3.wasm "$PACKAGE_DIR"/"$SQLITE_CID".wasm
cp registry_config.json "$PACKAGE_DIR"/"$REGISTRY_CID"_config.json
cp sqlite3_config.json "$PACKAGE_DIR"/"$SQLITE_CID"_config.json
# write blueprint.json
echo "{}" | jq --arg registry_cid "$REGISTRY_CID" --arg sqlite_cid "$SQLITE_CID" '{"name": "registry", "dependencies":[{"/":$sqlite_cid},{"/":$registry_cid}]}' > "$PACKAGE_DIR/blueprint.json"
(
echo "*** create builtin distribution package ***"
cd ..
tar -f registry.tar.gz -zcv ./registry
)
echo "*** done ***"

View File

@ -1,8 +0,0 @@
{
"name": "registry",
"max_heap_size": "8 MiB",
"preopened_files": ["/tmp"],
"mapped_dirs": {
"tmp": "./tmp"
}
}

View File

@ -1,4 +0,0 @@
{
"name": "sqlite3",
"max_heap_size": "64 MiB"
}

154
distro/Cargo.lock generated
View File

@ -4,43 +4,9 @@ version = 3
[[package]]
name = "built"
version = "0.5.2"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b9c056b9ed43aee5e064b683aa1ec783e19c6acec7559e3ae931b7490472fbe"
dependencies = [
"cargo-lock",
]
[[package]]
name = "cargo-lock"
version = "8.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "031718ddb8f78aa5def78a09e90defe30151d1f6c672f937af4dd916429ed996"
dependencies = [
"semver",
"serde",
"toml",
"url",
]
[[package]]
name = "form_urlencoded"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8"
dependencies = [
"percent-encoding",
]
[[package]]
name = "idna"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
]
checksum = "38d17f4d6e4dc36d1a02fbedc2753a096848e7c1b0772f7654eab8e2c927dd53"
[[package]]
name = "itoa"
@ -54,33 +20,9 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
[[package]]
name = "percent-encoding"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
[[package]]
name = "proc-macro2"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc"
dependencies = [
"proc-macro2",
]
[[package]]
name = "registry-distro"
version = "0.8.7"
version = "0.9.4"
dependencies = [
"built",
"maplit",
@ -93,34 +35,11 @@ version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
[[package]]
name = "semver"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
dependencies = [
"serde",
]
[[package]]
name = "serde"
version = "1.0.160"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.160"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"
@ -132,70 +51,3 @@ dependencies = [
"ryu",
"serde",
]
[[package]]
name = "syn"
version = "2.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tinyvec"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "toml"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
dependencies = [
"serde",
]
[[package]]
name = "unicode-bidi"
version = "0.3.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
name = "unicode-ident"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]]
name = "unicode-normalization"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
dependencies = [
"tinyvec",
]
[[package]]
name = "url"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643"
dependencies = [
"form_urlencoded",
"idna",
"percent-encoding",
]

View File

@ -1,6 +1,6 @@
[package]
name = "registry-distro"
version = "0.8.7"
version = "0.9.4"
edition = "2021"
build = "built.rs"
include = [ "/src", "built.rs", "Cargo.toml", "registry-service"]
@ -13,4 +13,4 @@ maplit = "1.0.2"
serde_json = "1.0.96"
[build-dependencies]
built = "0.5.2"
built = "0.7.1"

View File

@ -1,4 +1,6 @@
modules_dir = "."
total_memory_limit = "Infinity"
[[module]]
name = "sqlite3"
mem_pages_count = 100

8
example/.gitignore vendored
View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
{
"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.0.14",
"@fluencelabs/trust-graph": "3.0.4"
},
"prettier": {}
}

View File

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

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

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

View File

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

View File

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

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

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

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

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

12
examples/archived/1-registry/.gitignore vendored Normal file
View File

@ -0,0 +1,12 @@
.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

2847
examples/archived/1-registry/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -18,13 +18,10 @@ This example shows how to use Registry to discover and call fluence services wit
## Set up the environment
1. Install the latest version of Fluence CLI:
```sh
npm i -g @fluencelabs/cli
```
1. [Install the latest version of Fluence CLI](https://github.com/fluencelabs/cli#installation-and-usage)
2. Install Fluence project dependencies. It may take a while:
```sh
fluence dependency i
fluence dep i
```
3. Install JS dependencies:
```sh
@ -92,9 +89,7 @@ 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
@ -108,9 +103,8 @@ 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

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

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

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

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

@ -13,32 +13,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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";
import { Fluence, KeyPair } from '@fluencelabs/js-client';
import { registerEchoJSService } from './compiled-aqua/main.ts';
// 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 connectTo = stage[0];
assert(connectTo !== undefined);
const keyPair = await KeyPair.fromEd25519SK(Buffer.from(secretKey, "base64"));
// connect to the Fluence network
await Fluence.start({ connectTo, KeyPair: keypair });
setLogLevel("SILENT");
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();
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"
await registerEchoService(serviceId, {
registerEchoJSService(serviceId, {
echo(msg) {
console.log(`Received message: ${msg}`);
return `${peerId}: ${msg}`;
@ -50,19 +51,19 @@ async function main() {
// don't register if resource id isn't passed
if (resourceId === undefined) {
console.log(
`
`
Copy this code to call this service:
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");
@ -71,7 +72,7 @@ async function main() {
process.stdin.setRawMode(true);
process.stdin.resume();
process.stdin.on("data", async () => {
await Fluence.stop();
await Fluence.disconnect();
process.exit(0);
});
}

View File

@ -0,0 +1,14 @@
[
{
"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

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

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

View File

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

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

29472
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
{
"dependencies": {
"@fluencelabs/cli": "^0.4.16"
}
}

View File

@ -1,9 +1,5 @@
[toolchain]
channel = "nightly-2022-12-01"
components = ["rustfmt", "clippy"]
targets = [
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"wasm32-wasi"
]
channel = "nightly-2023-08-27"
components = [ "rustfmt", "clippy" ]
targets = [ "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "wasm32-wasi" ]
profile = "minimal"

2358
service/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[package]
name = "registry"
version = "0.8.7"
version = "0.9.4"
authors = ["Fluence Labs"]
edition = "2018"
publish = false
@ -10,21 +10,21 @@ name = "registry"
path = "src/main.rs"
[dependencies]
bs58 = "=0.4.0"
marine-rs-sdk = "=0.7.1"
marine-sqlite-connector = "=0.8.0"
bs58 = "=0.5.0"
marine-rs-sdk = "=0.10.3"
marine-sqlite-connector = "=0.9.3"
fstrings = "=0.2.3"
boolinator = "=2.4.0"
toml = "=0.7.3"
serde = { version = "=1.0.162", features = ["derive"] }
thiserror = "=1.0.40"
sha2 = "=0.10.6"
fluence-keypair = "=0.8.1"
libp2p-core = { version = "=0.36.0", default-features = false, features = [ "secp256k1" ] }
toml = "=0.8.8"
serde = { version = "1.0.188", features = ["derive"] }
thiserror = "=1.0.50"
sha2 = "=0.10.8"
fluence-keypair = "=0.10.4"
libp2p-identity = "=0.2.8"
[dev-dependencies]
marine-rs-sdk-test = "=0.10.0"
rusqlite = "=0.28.0"
marine-rs-sdk-test = "=0.12.1"
rusqlite = "=0.30.0"
[build-dependencies]
marine-rs-sdk-test = "=0.10.0"
marine-rs-sdk-test = "=0.12.1"

View File

@ -1,4 +1,6 @@
modules_dir = "artifacts"
total_memory_limit = "Infinity"
[[module]]
name = "sqlite3"
mem_pages_count = 100

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.1/sqlite3.wasm -o artifacts/sqlite3.wasm
curl -L https://github.com/fluencelabs/sqlite/releases/download/sqlite-wasm-v0.18.2/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,5 +0,0 @@
[toolchain]
channel = "nightly-2023-02-27"
components = [ "rustfmt", "clippy" ]
targets = [ "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "wasm32-wasi" ]
profile = "minimal"

View File

@ -18,7 +18,7 @@ use crate::error::ServiceError;
use crate::WeightResult;
use boolinator::Boolinator;
use fluence_keypair::PublicKey;
use libp2p_core::PeerId;
use libp2p_identity::PeerId;
use std::convert::TryFrom;
use std::str::FromStr;

View File

@ -194,7 +194,7 @@ pub fn republish_records(
pub fn merge_two(a: Vec<Record>, b: Vec<Record>) -> MergeResult {
merge_records(
a.into_iter()
.chain(b.into_iter())
.chain(b)
.map(|record| RecordInternal {
record,
..Default::default()

View File

@ -226,7 +226,7 @@ mod tests {
) -> EvictStaleResult {
let cp = CPWrapper::new("peer_id", "host_id").add_timestamp_tetraplets(0);
let evict_result = registry.evict_stale_cp(current_timestamp_sec, cp.get());
assert!(evict_result.success, evict_result.error);
assert!(evict_result.success, "{}", evict_result.error);
evict_result
}
@ -387,7 +387,7 @@ mod tests {
solution,
weight,
);
assert!(result.success, result.error);
assert!(result.success, "{}", result.error);
}
fn get_records(
@ -474,7 +474,7 @@ mod tests {
timestamp_issued,
solution,
);
assert!(result.success, result.error);
assert!(result.success, "{}", result.error);
}
#[test]
@ -846,7 +846,7 @@ mod tests {
let expired_timestamp = timestamp_created + DEFAULT_EXPIRED_AGE;
let cp = CPWrapper::new("peer_id", "host_id").add_timestamp_tetraplets(0);
let result = registry.clear_expired_cp(expired_timestamp, cp.get());
assert!(result.success, result.error);
assert!(result.success, "{}", result.error);
assert_eq!(result.count_keys, 1);
}