mirror of
https://github.com/fluencelabs/registry.git
synced 2025-04-25 02:02:14 +00:00
Compare commits
74 Commits
registry-v
...
main
Author | SHA1 | Date | |
---|---|---|---|
|
41e9b5ac87 | ||
|
be6ca2e4b4 | ||
|
4efd6b2645 | ||
|
586249873f | ||
|
f4829267d0 | ||
|
2181b22142 | ||
|
fed52dcd06 | ||
|
aaf7f68ce8 | ||
|
e9ba1ad248 | ||
|
a100d2f5d2 | ||
|
5c9af8bd3a | ||
|
e000e46128 | ||
|
f78212d49b | ||
|
b71b85ca1e | ||
|
7d9327bcfd | ||
|
b9bce2e764 | ||
|
c6c579479e | ||
|
3092907e5e | ||
|
01d8cb4052 | ||
|
633d8e6648 | ||
|
7ba20dcabd | ||
|
ddce821a57 | ||
|
c207f7fa54 | ||
|
863ae55f35 | ||
|
a6aeeea3f5 | ||
|
66a42f7b93 | ||
|
7b892678b1 | ||
|
64b3b4b9c9 | ||
|
c160475157 | ||
|
d77fd12b4d | ||
|
2405f41702 | ||
|
2a440a8b1f | ||
|
19f064519d | ||
|
9e5dc63fb2 | ||
|
5ea6ff36ed | ||
|
517872aa84 | ||
|
a6514ffce9 | ||
|
d9a8a20d58 | ||
|
0985109026 | ||
|
acfa42850b | ||
|
0394560c06 | ||
|
3d378b92fb | ||
|
394b5b8395 | ||
|
81f15d4eb7 | ||
|
d5c2c7c6c1 | ||
|
19f5d47add | ||
|
2259425976 | ||
|
8ff086a206 | ||
|
a7051d748b | ||
|
1f44cdc3b1 | ||
|
9b7c2807dc | ||
|
4cb1b90a95 | ||
|
0ac1b76fe1 | ||
|
d63183a7d7 | ||
|
2c29fea098 | ||
|
9b4142dc95 | ||
|
19128039df | ||
|
8901137546 | ||
|
5269c1ebf6 | ||
|
1a12a56f3e | ||
|
be441e86cb | ||
|
bb33b8cc22 | ||
|
6b47a7c423 | ||
|
0b603e7ff3 | ||
|
14d63141cb | ||
|
257516e74f | ||
|
3c0e44488f | ||
|
851dae2aa5 | ||
|
c6bdf2d55a | ||
|
ba3e66b496 | ||
|
990b588b75 | ||
|
083b16c776 | ||
|
a08ee16ff9 | ||
|
5acf1d230b |
19
.github/check-registry.sh
vendored
19
.github/check-registry.sh
vendored
@ -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
|
|
86
.github/e2e/docker-compose.yml
vendored
86
.github/e2e/docker-compose.yml
vendored
@ -1,13 +1,13 @@
|
|||||||
networks:
|
networks:
|
||||||
fluence:
|
nox:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
ipam:
|
ipam:
|
||||||
config:
|
config:
|
||||||
- subnet: 10.50.10.0/24
|
- subnet: 10.50.10.0/24
|
||||||
|
|
||||||
services:
|
services:
|
||||||
fluence-1:
|
nox-1:
|
||||||
image: ${RUST_PEER_IMAGE}
|
image: ${NOX_IMAGE}
|
||||||
ports:
|
ports:
|
||||||
- 7771:7771
|
- 7771:7771
|
||||||
- 9991:9991
|
- 9991:9991
|
||||||
@ -17,21 +17,19 @@ services:
|
|||||||
- -w=9991
|
- -w=9991
|
||||||
- -x=10.50.10.10
|
- -x=10.50.10.10
|
||||||
- --external-maddrs
|
- --external-maddrs
|
||||||
- /dns4/fluence-1/tcp/7771
|
- /dns4/nox-1/tcp/7771
|
||||||
- /dns4/fluence-1/tcp/9991/ws
|
- /dns4/nox-1/tcp/9991/ws
|
||||||
- --allow-private-ips
|
- --allow-private-ips
|
||||||
- --local
|
- --local
|
||||||
# - --bootstraps=/dns/fluence-1/tcp/7771
|
# - --bootstraps=/dns/nox-1/tcp/7771
|
||||||
# 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
|
# 12D3KooWBM3SdXWqGaawQDGQ6JprtwswEg3FWGvGhmgmMez1vRbR
|
||||||
- -k=hK62afickoeP2uZbmSkAYXxxqP8ozq16VRN7qfTP719EHC5V5tjrtW57BSjUr8GvsEXmJRbtejUWyPZ2rZMyQdq
|
- -k=hK62afickoeP2uZbmSkAYXxxqP8ozq16VRN7qfTP719EHC5V5tjrtW57BSjUr8GvsEXmJRbtejUWyPZ2rZMyQdq
|
||||||
volumes:
|
|
||||||
- ../../registry:/builtins/registry
|
|
||||||
networks:
|
networks:
|
||||||
fluence:
|
nox:
|
||||||
ipv4_address: 10.50.10.10
|
ipv4_address: 10.50.10.10
|
||||||
|
|
||||||
fluence-2:
|
nox-2:
|
||||||
image: ${RUST_PEER_IMAGE}
|
image: ${NOX_IMAGE}
|
||||||
ports:
|
ports:
|
||||||
- 7772:7772
|
- 7772:7772
|
||||||
- 9992:9992
|
- 9992:9992
|
||||||
@ -41,20 +39,18 @@ services:
|
|||||||
- -w=9992
|
- -w=9992
|
||||||
- -x=10.50.10.20
|
- -x=10.50.10.20
|
||||||
- --external-maddrs
|
- --external-maddrs
|
||||||
- /dns4/fluence-2/tcp/7772
|
- /dns4/nox-2/tcp/7772
|
||||||
- /dns4/fluence-2/tcp/9992/ws
|
- /dns4/nox-2/tcp/9992/ws
|
||||||
- --allow-private-ips
|
- --allow-private-ips
|
||||||
- --bootstraps=/dns/fluence-1/tcp/7771
|
- --bootstraps=/dns/nox-1/tcp/7771
|
||||||
# 12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK
|
# 12D3KooWQdpukY3p2DhDfUfDgphAqsGu5ZUrmQ4mcHSGrRag6gQK
|
||||||
- -k=2WijTVdhVRzyZamWjqPx4V4iNMrajegNMwNa2PmvPSZV6RRpo5M2fsPWdQr22HVRubuJhhSw8BrWiGt6FPhFAuXy
|
- -k=2WijTVdhVRzyZamWjqPx4V4iNMrajegNMwNa2PmvPSZV6RRpo5M2fsPWdQr22HVRubuJhhSw8BrWiGt6FPhFAuXy
|
||||||
volumes:
|
|
||||||
- ../../registry:/builtins/registry
|
|
||||||
networks:
|
networks:
|
||||||
fluence:
|
nox:
|
||||||
ipv4_address: 10.50.10.20
|
ipv4_address: 10.50.10.20
|
||||||
|
|
||||||
fluence-3:
|
nox-3:
|
||||||
image: ${RUST_PEER_IMAGE}
|
image: ${NOX_IMAGE}
|
||||||
ports:
|
ports:
|
||||||
- 7773:7773
|
- 7773:7773
|
||||||
- 9993:9993
|
- 9993:9993
|
||||||
@ -64,20 +60,18 @@ services:
|
|||||||
- -w=9993
|
- -w=9993
|
||||||
- -x=10.50.10.30
|
- -x=10.50.10.30
|
||||||
- --external-maddrs
|
- --external-maddrs
|
||||||
- /dns4/fluence-3/tcp/7773
|
- /dns4/nox-3/tcp/7773
|
||||||
- /dns4/fluence-3/tcp/9993/ws
|
- /dns4/nox-3/tcp/9993/ws
|
||||||
- --allow-private-ips
|
- --allow-private-ips
|
||||||
- --bootstraps=/dns/fluence-1/tcp/7771
|
- --bootstraps=/dns/nox-1/tcp/7771
|
||||||
# 12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ
|
# 12D3KooWRT8V5awYdEZm6aAV9HWweCEbhWd7df4wehqHZXAB7yMZ
|
||||||
- -k=2n2wBVanBeu2GWtvKBdrYK9DJAocgG3PrTUXMharq6TTfxqTL4sLdXL9BF23n6rsnkAY5pR9vBtx2uWYDQAiZdrX
|
- -k=2n2wBVanBeu2GWtvKBdrYK9DJAocgG3PrTUXMharq6TTfxqTL4sLdXL9BF23n6rsnkAY5pR9vBtx2uWYDQAiZdrX
|
||||||
volumes:
|
|
||||||
- ../../registry:/builtins/registry
|
|
||||||
networks:
|
networks:
|
||||||
fluence:
|
nox:
|
||||||
ipv4_address: 10.50.10.30
|
ipv4_address: 10.50.10.30
|
||||||
|
|
||||||
fluence-4:
|
nox-4:
|
||||||
image: ${RUST_PEER_IMAGE}
|
image: ${NOX_IMAGE}
|
||||||
ports:
|
ports:
|
||||||
- 7774:7774
|
- 7774:7774
|
||||||
- 9994:9994
|
- 9994:9994
|
||||||
@ -87,20 +81,18 @@ services:
|
|||||||
- -w=9994
|
- -w=9994
|
||||||
- -x=10.50.10.40
|
- -x=10.50.10.40
|
||||||
- --external-maddrs
|
- --external-maddrs
|
||||||
- /dns4/fluence-4/tcp/7774
|
- /dns4/nox-4/tcp/7774
|
||||||
- /dns4/fluence-4/tcp/9994/ws
|
- /dns4/nox-4/tcp/9994/ws
|
||||||
- --allow-private-ips
|
- --allow-private-ips
|
||||||
- --bootstraps=/dns/fluence-1/tcp/7771
|
- --bootstraps=/dns/nox-1/tcp/7771
|
||||||
# 12D3KooWBzLSu9RL7wLP6oUowzCbkCj2AGBSXkHSJKuq4wwTfwof
|
# 12D3KooWBzLSu9RL7wLP6oUowzCbkCj2AGBSXkHSJKuq4wwTfwof
|
||||||
- -k=4zp8ucAikkjB8CmkufYiFBW4QCDUCbQG7yMjviX7W8bMyN5rfChQ2Pi5QCWThrCTbAm9uq5nbFbxtFcNZq3De4dX
|
- -k=4zp8ucAikkjB8CmkufYiFBW4QCDUCbQG7yMjviX7W8bMyN5rfChQ2Pi5QCWThrCTbAm9uq5nbFbxtFcNZq3De4dX
|
||||||
volumes:
|
|
||||||
- ../../registry:/builtins/registry
|
|
||||||
networks:
|
networks:
|
||||||
fluence:
|
nox:
|
||||||
ipv4_address: 10.50.10.40
|
ipv4_address: 10.50.10.40
|
||||||
|
|
||||||
fluence-5:
|
nox-5:
|
||||||
image: ${RUST_PEER_IMAGE}
|
image: ${NOX_IMAGE}
|
||||||
ports:
|
ports:
|
||||||
- 7775:7775
|
- 7775:7775
|
||||||
- 9995:9995
|
- 9995:9995
|
||||||
@ -110,20 +102,18 @@ services:
|
|||||||
- -w=9995
|
- -w=9995
|
||||||
- -x=10.50.10.50
|
- -x=10.50.10.50
|
||||||
- --external-maddrs
|
- --external-maddrs
|
||||||
- /dns4/fluence-5/tcp/7775
|
- /dns4/nox-5/tcp/7775
|
||||||
- /dns4/fluence-5/tcp/9995/ws
|
- /dns4/nox-5/tcp/9995/ws
|
||||||
- --allow-private-ips
|
- --allow-private-ips
|
||||||
- --bootstraps=/dns/fluence-1/tcp/7771
|
- --bootstraps=/dns/nox-1/tcp/7771
|
||||||
# 12D3KooWBf6hFgrnXwHkBnwPGMysP3b1NJe5HGtAWPYfwmQ2MBiU
|
# 12D3KooWBf6hFgrnXwHkBnwPGMysP3b1NJe5HGtAWPYfwmQ2MBiU
|
||||||
- -k=3ry26rm5gkJXvdqRH4FoM3ezWq4xVVsBQF7wtKq4E4pbuaa6p1F84tNqifUS7DdfJL9hs2gcdW64Wc342vHZHMUp
|
- -k=3ry26rm5gkJXvdqRH4FoM3ezWq4xVVsBQF7wtKq4E4pbuaa6p1F84tNqifUS7DdfJL9hs2gcdW64Wc342vHZHMUp
|
||||||
volumes:
|
|
||||||
- ../../registry:/builtins/registry
|
|
||||||
networks:
|
networks:
|
||||||
fluence:
|
nox:
|
||||||
ipv4_address: 10.50.10.50
|
ipv4_address: 10.50.10.50
|
||||||
|
|
||||||
fluence-6:
|
nox-6:
|
||||||
image: ${RUST_PEER_IMAGE}
|
image: ${NOX_IMAGE}
|
||||||
ports:
|
ports:
|
||||||
- 7776:7776
|
- 7776:7776
|
||||||
- 9996:9996
|
- 9996:9996
|
||||||
@ -131,16 +121,14 @@ services:
|
|||||||
- --aqua-pool-size=2
|
- --aqua-pool-size=2
|
||||||
- -t=7776
|
- -t=7776
|
||||||
- -w=9996
|
- -w=9996
|
||||||
- --bootstraps=/dns/fluence-1/tcp/7771
|
- --bootstraps=/dns/nox-1/tcp/7771
|
||||||
- -x=10.50.10.60
|
- -x=10.50.10.60
|
||||||
- --external-maddrs
|
- --external-maddrs
|
||||||
- /dns4/fluence-6/tcp/7776
|
- /dns4/nox-6/tcp/7776
|
||||||
- /dns4/fluence-6/tcp/9996/ws
|
- /dns4/nox-6/tcp/9996/ws
|
||||||
- --allow-private-ips
|
- --allow-private-ips
|
||||||
# 12D3KooWPisGn7JhooWhggndz25WM7vQ2JmA121EV8jUDQ5xMovJ
|
# 12D3KooWPisGn7JhooWhggndz25WM7vQ2JmA121EV8jUDQ5xMovJ
|
||||||
- -k=5Qh8bB1sF28uLPwr3HTvEksCeC6mAWQvebCfcgv9y6j4qKwSzNKm2tzLUg4nACUEo2KZpBw11gNCnwaAdM7o1pEn
|
- -k=5Qh8bB1sF28uLPwr3HTvEksCeC6mAWQvebCfcgv9y6j4qKwSzNKm2tzLUg4nACUEo2KZpBw11gNCnwaAdM7o1pEn
|
||||||
volumes:
|
|
||||||
- ../../registry:/builtins/registry
|
|
||||||
networks:
|
networks:
|
||||||
fluence:
|
nox:
|
||||||
ipv4_address: 10.50.10.60
|
ipv4_address: 10.50.10.60
|
||||||
|
2
.github/release-please/manifest.json
vendored
2
.github/release-please/manifest.json
vendored
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
".": "0.8.6"
|
".": "0.9.4"
|
||||||
}
|
}
|
||||||
|
10
.github/renovate.json
vendored
10
.github/renovate.json
vendored
@ -7,6 +7,7 @@
|
|||||||
"enabledManagers": ["cargo", "npm", "github-actions", "pip_requirements"],
|
"enabledManagers": ["cargo", "npm", "github-actions", "pip_requirements"],
|
||||||
"rangeStrategy": "pin",
|
"rangeStrategy": "pin",
|
||||||
"schedule": "every weekend",
|
"schedule": "every weekend",
|
||||||
|
"respectLatest": false,
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
{
|
{
|
||||||
"matchManagers": ["cargo", "npm"],
|
"matchManagers": ["cargo", "npm"],
|
||||||
@ -19,6 +20,15 @@
|
|||||||
"semanticCommitScope": "deps",
|
"semanticCommitScope": "deps",
|
||||||
"schedule": "at any time"
|
"schedule": "at any time"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"matchManagers": ["cargo"],
|
||||||
|
"groupName": "marine things",
|
||||||
|
"matchPackagePatterns": [
|
||||||
|
"marine-rs-sdk",
|
||||||
|
"marine-rs-sdk-test",
|
||||||
|
"marine-sqlite-connector"
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"matchDepTypes": ["devDependencies"],
|
"matchDepTypes": ["devDependencies"],
|
||||||
"prPriority": -1,
|
"prPriority": -1,
|
||||||
|
72
.github/workflows/e2e.yml
vendored
Normal file
72
.github/workflows/e2e.yml
vendored
Normal 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
21
.github/workflows/lint-pr.yml
vendored
Normal 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 }}
|
28
.github/workflows/lint.yml
vendored
28
.github/workflows/lint.yml
vendored
@ -2,29 +2,20 @@ name: lint
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
paths:
|
||||||
- opened
|
- ".github/workflows/**"
|
||||||
- edited
|
- ".github/renovate.json"
|
||||||
- synchronize
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "${{ github.workflow }}-${{ github.ref }}"
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
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:
|
reviewdog:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Lint actions
|
- name: Lint actions
|
||||||
uses: reviewdog/action-actionlint@v1
|
uses: reviewdog/action-actionlint@v1
|
||||||
@ -33,3 +24,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
reporter: github-pr-check
|
reporter: github-pr-check
|
||||||
fail_on_error: true
|
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
|
||||||
|
90
.github/workflows/release.yml
vendored
90
.github/workflows/release.yml
vendored
@ -45,15 +45,15 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
|
ref: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
|
||||||
|
|
||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: dsherret/rust-toolchain-file@v1
|
||||||
|
|
||||||
- name: Install cargo-edit
|
- name: Install cargo-edit
|
||||||
uses: baptiste0928/cargo-install@v2.0.0
|
uses: baptiste0928/cargo-install@v2.2.0
|
||||||
with:
|
with:
|
||||||
crate: cargo-edit
|
crate: cargo-edit
|
||||||
|
|
||||||
@ -67,10 +67,14 @@ jobs:
|
|||||||
working-directory: service
|
working-directory: service
|
||||||
run: cargo set-version ${{ steps.version.outputs.version }}
|
run: cargo set-version ${{ steps.version.outputs.version }}
|
||||||
|
|
||||||
|
- name: Set version in distro
|
||||||
|
working-directory: distro
|
||||||
|
run: cargo set-version ${{ steps.version.outputs.version }}
|
||||||
|
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "16"
|
node-version: "18"
|
||||||
|
|
||||||
- name: Set version in aqua
|
- name: Set version in aqua
|
||||||
working-directory: aqua
|
working-directory: aqua
|
||||||
@ -97,10 +101,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Import secrets
|
- name: Import secrets
|
||||||
uses: hashicorp/vault-action@v2.5.0
|
uses: hashicorp/vault-action@v2.7.3
|
||||||
with:
|
with:
|
||||||
url: https://vault.fluence.dev
|
url: https://vault.fluence.dev
|
||||||
path: jwt/github
|
path: jwt/github
|
||||||
@ -113,11 +117,16 @@ jobs:
|
|||||||
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
|
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN
|
||||||
|
|
||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: dsherret/rust-toolchain-file@v1
|
||||||
|
|
||||||
- name: Setup marine
|
- name: Setup marine
|
||||||
uses: fluencelabs/setup-marine@v1
|
uses: fluencelabs/setup-marine@v1
|
||||||
|
|
||||||
|
- name: Setup fcli
|
||||||
|
uses: fluencelabs/setup-fluence@v1
|
||||||
|
with:
|
||||||
|
version: main
|
||||||
|
|
||||||
- name: Build service
|
- name: Build service
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
working-directory: service
|
working-directory: service
|
||||||
@ -125,7 +134,7 @@ jobs:
|
|||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "16"
|
node-version: "18"
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
cache-dependency-path: "aqua/package-lock.json"
|
cache-dependency-path: "aqua/package-lock.json"
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
@ -140,42 +149,39 @@ jobs:
|
|||||||
run: npm publish --access public
|
run: npm publish --access public
|
||||||
working-directory: aqua
|
working-directory: aqua
|
||||||
|
|
||||||
- name: Install ipfs
|
- name: Import secrets
|
||||||
uses: nahsi/setup-ipfs@v1
|
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/crates.io/fluencebot token | CARGO_REGISTRY_TOKEN
|
||||||
|
|
||||||
- name: Create builtin distribution package
|
- name: Setup Rust toolchain
|
||||||
run: ./builtin-package/package.sh
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
|
||||||
- name: Calculate SHA256
|
- name: Install cargo-workspaces
|
||||||
id: sha
|
uses: baptiste0928/cargo-install@v2.2.0
|
||||||
|
with:
|
||||||
|
crate: cargo-workspaces
|
||||||
|
|
||||||
|
- name: Build distro
|
||||||
|
run: ./build.sh
|
||||||
|
|
||||||
|
- name: Publish to crates.io
|
||||||
|
working-directory: ./distro
|
||||||
run: |
|
run: |
|
||||||
# Calculate sha256
|
cargo ws publish \
|
||||||
du -hs registry.tar.gz
|
--no-git-commit \
|
||||||
sha256sum registry.tar.gz
|
--allow-dirty \
|
||||||
sha=($(sha256sum registry.tar.gz))
|
--from-git \
|
||||||
echo "sha256=${sha}" >> $GITHUB_OUTPUT
|
--skip-published \
|
||||||
|
--yes
|
||||||
- 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 }}"
|
|
||||||
}'
|
|
||||||
|
|
||||||
slack:
|
slack:
|
||||||
if: always()
|
if: always()
|
||||||
@ -204,7 +210,7 @@ jobs:
|
|||||||
echo "found any?:" "${{ steps.status.outputs.found }}"
|
echo "found any?:" "${{ steps.status.outputs.found }}"
|
||||||
|
|
||||||
- name: Import secrets
|
- name: Import secrets
|
||||||
uses: hashicorp/vault-action@v2.5.0
|
uses: hashicorp/vault-action@v2.7.3
|
||||||
with:
|
with:
|
||||||
url: https://vault.fluence.dev
|
url: https://vault.fluence.dev
|
||||||
path: jwt/github
|
path: jwt/github
|
||||||
|
34
.github/workflows/run-tests.yml
vendored
34
.github/workflows/run-tests.yml
vendored
@ -7,6 +7,7 @@ on:
|
|||||||
- ".github/**"
|
- ".github/**"
|
||||||
- "!.github/workflows/run-tests.yml"
|
- "!.github/workflows/run-tests.yml"
|
||||||
- "!.github/workflows/tests.yml"
|
- "!.github/workflows/tests.yml"
|
||||||
|
- "!.github/workflows/e2e.yml"
|
||||||
types:
|
types:
|
||||||
- "labeled"
|
- "labeled"
|
||||||
- "synchronize"
|
- "synchronize"
|
||||||
@ -20,17 +21,13 @@ on:
|
|||||||
- ".github/**"
|
- ".github/**"
|
||||||
- "!.github/workflows/run-tests.yml"
|
- "!.github/workflows/run-tests.yml"
|
||||||
- "!.github/workflows/tests.yml"
|
- "!.github/workflows/tests.yml"
|
||||||
|
- "!.github/workflows/e2e.yml"
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: "${{ github.workflow }}-${{ github.ref }}"
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
registry:
|
|
||||||
uses: ./.github/workflows/tests.yml
|
|
||||||
with:
|
|
||||||
ref: ${{ github.ref }}
|
|
||||||
|
|
||||||
cargo:
|
cargo:
|
||||||
name: "registry / Run cargo tests"
|
name: "registry / Run cargo tests"
|
||||||
runs-on: builder
|
runs-on: builder
|
||||||
@ -41,10 +38,12 @@ jobs:
|
|||||||
working-directory: service
|
working-directory: service
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup rust toolchain
|
- name: Setup rust toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
cache: false
|
||||||
|
|
||||||
- name: Setup marine
|
- name: Setup marine
|
||||||
uses: fluencelabs/setup-marine@v1
|
uses: fluencelabs/setup-marine@v1
|
||||||
@ -56,18 +55,33 @@ jobs:
|
|||||||
run: cargo fmt --all -- --check
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
- name: Run cargo clippy
|
- name: Run cargo clippy
|
||||||
env:
|
|
||||||
RUSTFLAGS: ""
|
|
||||||
run: cargo clippy -Z unstable-options --all -- -D warnings
|
run: cargo clippy -Z unstable-options --all -- -D warnings
|
||||||
|
|
||||||
- name: Install cargo-nextest
|
- name: Install cargo-nextest
|
||||||
uses: baptiste0928/cargo-install@v2.0.0
|
uses: baptiste0928/cargo-install@v2.2.0
|
||||||
with:
|
with:
|
||||||
crate: cargo-nextest
|
crate: cargo-nextest
|
||||||
|
version: 0.9.22
|
||||||
|
|
||||||
- name: Run cargo nextest
|
- name: Run cargo nextest
|
||||||
env:
|
env:
|
||||||
RUSTFLAGS: ""
|
|
||||||
NEXTEST_RETRIES: 2
|
NEXTEST_RETRIES: 2
|
||||||
NEXTEST_TEST_THREADS: 1
|
NEXTEST_TEST_THREADS: 1
|
||||||
run: cargo nextest run --release --all-features --no-fail-fast
|
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
104
.github/workflows/snapshot.yml
vendored
Normal 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
|
131
.github/workflows/tests.yml
vendored
131
.github/workflows/tests.yml
vendored
@ -7,18 +7,18 @@ on:
|
|||||||
description: "Fluence enviroment to run tests agains"
|
description: "Fluence enviroment to run tests agains"
|
||||||
type: string
|
type: string
|
||||||
default: "local"
|
default: "local"
|
||||||
rust-peer-image:
|
nox-image:
|
||||||
description: "rust-peer image tag"
|
description: "nox image tag"
|
||||||
type: string
|
type: string
|
||||||
default: "fluencelabs/rust-peer:minimal"
|
default: "fluencelabs/nox:unstable"
|
||||||
aqua-version:
|
fcli-version:
|
||||||
description: "@fluencelabs/aqua version"
|
|
||||||
type: string
|
|
||||||
default: "null"
|
|
||||||
fluence-cli-version:
|
|
||||||
description: "@fluencelabs/cli version"
|
description: "@fluencelabs/cli version"
|
||||||
type: string
|
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:
|
cargo-dependencies:
|
||||||
description: "Cargo dependencies map"
|
description: "Cargo dependencies map"
|
||||||
type: string
|
type: string
|
||||||
@ -30,7 +30,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
FORCE_COLOR: true
|
FORCE_COLOR: true
|
||||||
RUST_PEER_IMAGE: "${{ inputs.rust-peer-image }}"
|
NOX_IMAGE: "${{ inputs.nox-image }}"
|
||||||
FLUENCE_ENV: "${{ inputs.fluence-env }}"
|
FLUENCE_ENV: "${{ inputs.fluence-env }}"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -45,7 +45,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Import secrets
|
- name: Import secrets
|
||||||
uses: hashicorp/vault-action@v2.5.0
|
uses: hashicorp/vault-action@v2.7.3
|
||||||
with:
|
with:
|
||||||
url: https://vault.fluence.dev
|
url: https://vault.fluence.dev
|
||||||
path: jwt/github
|
path: jwt/github
|
||||||
@ -59,7 +59,7 @@ jobs:
|
|||||||
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
|
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN;
|
||||||
|
|
||||||
- name: Checkout registry
|
- name: Checkout registry
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: fluencelabs/registry
|
repository: fluencelabs/registry
|
||||||
ref: ${{ inputs.ref }}
|
ref: ${{ inputs.ref }}
|
||||||
@ -67,7 +67,7 @@ jobs:
|
|||||||
- name: Setup node with self-hosted registry
|
- name: Setup node with self-hosted registry
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: "16"
|
node-version: "18"
|
||||||
registry-url: "https://npm.fluence.dev"
|
registry-url: "https://npm.fluence.dev"
|
||||||
cache: "npm"
|
cache: "npm"
|
||||||
cache-dependency-path: "**/package-lock.json"
|
cache-dependency-path: "**/package-lock.json"
|
||||||
@ -80,55 +80,20 @@ jobs:
|
|||||||
run: npm install
|
run: npm install
|
||||||
working-directory: aqua-tests
|
working-directory: aqua-tests
|
||||||
|
|
||||||
- name: Set fluence-cli version
|
- name: Setup fcli
|
||||||
if: inputs.fluence-cli-version != 'null'
|
uses: fluencelabs/setup-fluence@v1
|
||||||
uses: fluencelabs/github-actions/npm-set-dependency@main
|
|
||||||
with:
|
with:
|
||||||
package: "@fluencelabs/cli"
|
artifact: fcli
|
||||||
version: ${{ inputs.fluence-cli-version }}
|
version: ${{ inputs.fcli-version }}
|
||||||
working-directory: aqua-tests
|
if-no-artifact-found: ${{ inputs.if-no-artifacts-found }}
|
||||||
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 }}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- name: Setup Rust toolchain
|
- name: Setup Rust toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: dsherret/rust-toolchain-file@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
|
|
||||||
|
|
||||||
- name: Setup marine
|
- name: Setup marine
|
||||||
if: steps.marine.outcome == 'failure'
|
|
||||||
uses: fluencelabs/setup-marine@v1
|
uses: fluencelabs/setup-marine@v1
|
||||||
|
with:
|
||||||
|
artifact-name: marine
|
||||||
|
|
||||||
- name: Set dependencies
|
- name: Set dependencies
|
||||||
if: inputs.cargo-dependencies != ''
|
if: inputs.cargo-dependencies != ''
|
||||||
@ -138,29 +103,27 @@ jobs:
|
|||||||
path: service/
|
path: service/
|
||||||
|
|
||||||
- name: Build service
|
- name: Build service
|
||||||
|
env:
|
||||||
|
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
|
||||||
run: ./build.sh
|
run: ./build.sh
|
||||||
working-directory: service
|
working-directory: service
|
||||||
|
|
||||||
- name: Install ipfs
|
- name: Build distro
|
||||||
uses: nahsi/setup-ipfs@v1
|
env:
|
||||||
|
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
|
||||||
- name: Create builtin distribution package
|
run: ./build.sh
|
||||||
run: ./builtin-package/package.sh
|
|
||||||
|
|
||||||
- name: Unpack registry package
|
|
||||||
run: tar xvf registry.tar.gz
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: docker.fluence.dev
|
registry: docker.fluence.dev
|
||||||
username: ${{ env.DOCKER_USERNAME }}
|
username: ${{ env.DOCKER_USERNAME }}
|
||||||
password: ${{ env.DOCKER_PASSWORD }}
|
password: ${{ env.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Pull rust-peer image
|
- name: Pull nox image
|
||||||
run: docker pull $RUST_PEER_IMAGE
|
run: docker pull $NOX_IMAGE
|
||||||
|
|
||||||
- name: Run rust-peer
|
- name: Run nox network
|
||||||
uses: isbang/compose-action@v1.4.1
|
uses: isbang/compose-action@v1.4.1
|
||||||
with:
|
with:
|
||||||
compose-file: ".github/e2e/docker-compose.yml"
|
compose-file: ".github/e2e/docker-compose.yml"
|
||||||
@ -177,30 +140,20 @@ jobs:
|
|||||||
run: pip install -r requirements.txt
|
run: pip install -r requirements.txt
|
||||||
working-directory: aqua-tests
|
working-directory: aqua-tests
|
||||||
|
|
||||||
# - name: Wait for registry to be deployed
|
- name: Install fcli dependencies
|
||||||
# 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
|
|
||||||
env:
|
env:
|
||||||
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
|
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
|
||||||
run: npx fluence dep i --no-input
|
run: fluence dep i --no-input
|
||||||
working-directory: aqua-tests
|
working-directory: aqua-tests
|
||||||
|
|
||||||
- name: Print Fluence CLI version
|
- name: Print fcli version
|
||||||
run: pytest -s test_fluence_cli_version.py
|
run: pytest -s test_fluence_cli_version.py
|
||||||
working-directory: aqua-tests
|
working-directory: aqua-tests
|
||||||
|
|
||||||
- name: Run aqua tests
|
- name: Run aqua tests
|
||||||
env:
|
env:
|
||||||
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
|
FLUENCE_USER_DIR: "${{ github.workspace }}/tmp/.fluence"
|
||||||
|
NPM_CONFIG_REGISTRY: "https://npm.fluence.dev"
|
||||||
run: pytest test_aqua.py
|
run: pytest test_aqua.py
|
||||||
working-directory: aqua-tests
|
working-directory: aqua-tests
|
||||||
|
|
||||||
@ -211,18 +164,16 @@ jobs:
|
|||||||
cat <<SNAPSHOT >> $GITHUB_STEP_SUMMARY
|
cat <<SNAPSHOT >> $GITHUB_STEP_SUMMARY
|
||||||
## Used versions
|
## Used versions
|
||||||
\`\`\`
|
\`\`\`
|
||||||
$(npx fluence dep v)
|
$(fluence dep v)
|
||||||
\`\`\`
|
\`\`\`
|
||||||
SNAPSHOT
|
SNAPSHOT
|
||||||
|
|
||||||
- name: Dump rust-peer logs on failure
|
- name: Dump container logs
|
||||||
if: always()
|
if: always()
|
||||||
uses: jwalton/gh-docker-logs@v2
|
uses: jwalton/gh-docker-logs@v2
|
||||||
|
|
||||||
- name: Remove registry directory
|
- name: Cleanup
|
||||||
if: always()
|
if: always()
|
||||||
run: sudo rm -rf registry
|
run: |
|
||||||
|
rm -rf tmp ~/.fluence
|
||||||
- name: Remove tmp directory
|
sudo rm -rf registry
|
||||||
if: always()
|
|
||||||
run: sudo rm -rf tmp
|
|
||||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@ -3,6 +3,8 @@ builtin-package/*.wasm
|
|||||||
builtin-package/scheduled/*.air
|
builtin-package/scheduled/*.air
|
||||||
registry.tar.gz
|
registry.tar.gz
|
||||||
registry
|
registry
|
||||||
|
distro/target/
|
||||||
|
distro/registry-service/
|
||||||
|
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
**/.idea
|
**/.idea
|
||||||
@ -12,9 +14,8 @@ registry
|
|||||||
**/dist
|
**/dist
|
||||||
*.drawio
|
*.drawio
|
||||||
|
|
||||||
# Remove after https://github.com/fluencelabs/aqua/issues/287
|
aqua/*.tgz
|
||||||
aqua/target/typescript/**
|
examples/src/generated/**
|
||||||
example/src/generated/**
|
|
||||||
|
|
||||||
**/__pycache__
|
**/__pycache__
|
||||||
tmp
|
tmp
|
||||||
|
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
.github
|
98
CHANGELOG.md
98
CHANGELOG.md
@ -1,5 +1,103 @@
|
|||||||
# Changelog
|
# 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)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add distro crate [fixes NET-462] ([#233](https://github.com/fluencelabs/registry/issues/233)) ([5acf1d2](https://github.com/fluencelabs/registry/commit/5acf1d230b92f6b0784314b0926b6f6c2e195307))
|
||||||
|
* Migrate Registry to spell ([#247](https://github.com/fluencelabs/registry/issues/247)) ([990b588](https://github.com/fluencelabs/registry/commit/990b588b75857d2f61b76d89999a2c1f09f861f8))
|
||||||
|
* update to node 18 ([a08ee16](https://github.com/fluencelabs/registry/commit/a08ee16ff9dc402e1388e22c57324ca975c1a94d))
|
||||||
|
|
||||||
## [0.8.6](https://github.com/fluencelabs/registry/compare/registry-v0.8.5...registry-v0.8.6) (2023-05-19)
|
## [0.8.6](https://github.com/fluencelabs/registry/compare/registry-v0.8.5...registry-v0.8.6) (2023-05-19)
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ dependencies:
|
|||||||
npm:
|
npm:
|
||||||
"@fluencelabs/registry": 0.6.2
|
"@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:
|
If you are developing from scratch without Fluence CLI, you should install it via npm:
|
||||||
|
|
||||||
|
67
aqua-tests/.fluence/aqua-dependencies/package-lock.json
generated
Normal file
67
aqua-tests/.fluence/aqua-dependencies/package-lock.json
generated
Normal 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=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
aqua-tests/.fluence/env.yaml
Normal file
9
aqua-tests/.fluence/env.yaml
Normal 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
|
@ -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
|
|
||||||
}
|
|
||||||
]
|
|
@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
@ -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"
|
|
||||||
}
|
|
@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
1
aqua-tests/.fluence/secrets/test_create_resource.txt
Normal file
1
aqua-tests/.fluence/secrets/test_create_resource.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
BNidntUryx+hxr7NK2z9nci23sMn3fURB6bTH1K2Ll4=
|
1
aqua-tests/.fluence/secrets/test_get_resource.txt
Normal file
1
aqua-tests/.fluence/secrets/test_get_resource.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
e72l3wuItcfCcQBP6Rn4L0uQRsKmyckZRbYXP1ms59Q=
|
@ -0,0 +1 @@
|
|||||||
|
rZxZGGCxECt1opnXjnxrSpV2g6Qt2Fl0KTDoJkox008=
|
@ -0,0 +1 @@
|
|||||||
|
I/ZUMsjlt47e9LxYxbk/LamZJUzNxoBikPA+Qqy8yYA=
|
2
aqua-tests/.gitignore
vendored
Normal file
2
aqua-tests/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/.fluence/schemas
|
||||||
|
/.fluence/aqua-dependencies/package.json
|
@ -1,7 +1,8 @@
|
|||||||
module Test
|
aqua Test
|
||||||
|
|
||||||
import "@fluencelabs/aqua-lib/builtin.aqua"
|
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||||
import "@fluencelabs/registry/resources-api.aqua"
|
import "@fluencelabs/registry/resources-api.aqua"
|
||||||
|
|
||||||
export getResource, createResource, getResourceId, get_peer_id, registerService, resolveResource, unregisterService
|
export getResource, createResource, getResourceId, get_peer_id, registerService, resolveResource, unregisterService
|
||||||
|
|
||||||
func get_peer_id() -> PeerId:
|
func get_peer_id() -> PeerId:
|
||||||
|
@ -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
|
# 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
|
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/fluence.md
|
||||||
|
|
||||||
version: 2
|
version: 5
|
||||||
|
|
||||||
|
aquaInputPath: aqua/test.aqua
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
npm:
|
|
||||||
"@fluencelabs/aqua": 0.9.2
|
|
||||||
"@fluencelabs/aqua-lib": 0.6.0
|
|
||||||
cargo:
|
cargo:
|
||||||
marine: 0.14.1
|
marine: 0.14.1
|
||||||
mrepl: 0.21.3
|
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
|
||||||
|
39944
aqua-tests/package-lock.json
generated
39944
aqua-tests/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,35 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "aqua-tests",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "Aqua Registry library",
|
|
||||||
"dependencies": {
|
|
||||||
"@fluencelabs/aqua-lib": "0.6.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": {
|
"devDependencies": {
|
||||||
"@fluencelabs/cli": "0.4.8",
|
"@fluencelabs/fluence-network-environment": "1.1.2"
|
||||||
"@fluencelabs/fluence-network-environment": "1.0.14"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
74
aqua-tests/spell/spell.aqua
Normal file
74
aqua-tests/spell/spell.aqua
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
aqua TestSpell
|
||||||
|
|
||||||
|
export spell
|
||||||
|
|
||||||
|
import Op, Debug, Peer, Kademlia from "@fluencelabs/aqua-lib/builtin.aqua"
|
||||||
|
import Spell from "@fluencelabs/spell/spell_service.aqua"
|
||||||
|
import Compare from "@fluencelabs/aqua-lib/math.aqua"
|
||||||
|
|
||||||
|
import "@fluencelabs/registry/registry-service.aqua"
|
||||||
|
import "@fluencelabs/registry/registry-api.aqua"
|
||||||
|
import "@fluencelabs/trust-graph/trust-graph.aqua"
|
||||||
|
|
||||||
|
data SpellConfig:
|
||||||
|
expired_interval: u32
|
||||||
|
renew_interval: u32
|
||||||
|
replicate_interval:u32
|
||||||
|
|
||||||
|
-- A hack to allow using timestamp as u32 values
|
||||||
|
-- Aqua doesn't allow truncating values
|
||||||
|
service PeerTimeTrunc("peer"):
|
||||||
|
timestamp_sec() -> u32
|
||||||
|
|
||||||
|
func log_info(spell_id: string, msg: string):
|
||||||
|
Spell spell_id
|
||||||
|
Spell.list_push_string("logs", msg)
|
||||||
|
|
||||||
|
|
||||||
|
-- clears expired records
|
||||||
|
func clear_expired(now:u32):
|
||||||
|
Registry.clear_expired(now)
|
||||||
|
|
||||||
|
-- update stale local records
|
||||||
|
func renew(now:u32):
|
||||||
|
res <- Registry.get_stale_local_records(now)
|
||||||
|
for r <- res.result par:
|
||||||
|
signature <- getRecordSignature(r.metadata, now)
|
||||||
|
putRecord(r.metadata, now, signature.signature!)
|
||||||
|
|
||||||
|
-- get all old records and replicate it by routes
|
||||||
|
func replicate(now:u32):
|
||||||
|
res <- Registry.evict_stale(now)
|
||||||
|
for r <- res.results par:
|
||||||
|
k <- Op.string_to_b58(r.key.id)
|
||||||
|
nodes <- Kademlia.neighborhood(k, nil, nil)
|
||||||
|
for n <- nodes par:
|
||||||
|
on n:
|
||||||
|
tt <- Peer.timestamp_sec()
|
||||||
|
key_weight <- TrustGraph.get_weight(r.key.owner_peer_id, tt)
|
||||||
|
Registry.republish_key(r.key, key_weight, tt)
|
||||||
|
|
||||||
|
records_weights: *WeightResult
|
||||||
|
for record <- r.records:
|
||||||
|
records_weights <- TrustGraph.get_weight(record.metadata.issued_by, tt)
|
||||||
|
Registry.republish_records(r.records, records_weights, tt)
|
||||||
|
|
||||||
|
func spell(config: SpellConfig):
|
||||||
|
Spell "registry-spell"
|
||||||
|
log = (msg: string):
|
||||||
|
log_info("registry-spell", msg)
|
||||||
|
|
||||||
|
check_and_run = (key: string, now:u32, interval: u32, job: u32 -> ()):
|
||||||
|
last_run <- Spell.get_u32(key)
|
||||||
|
need_to_run = !last_run.success || ((now - last_run.value) >= interval)
|
||||||
|
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)
|
11
aqua-tests/spell/spell.yaml
Normal file
11
aqua-tests/spell/spell.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# yaml-language-server: $schema=../.fluence/schemas/spell.yaml.json
|
||||||
|
|
||||||
|
# Defines a spell. You can use `fluence spell new` command to generate a template for new spell
|
||||||
|
|
||||||
|
# Documentation: https://github.com/fluencelabs/fluence-cli/tree/main/docs/configs/spell.md
|
||||||
|
|
||||||
|
version: 0
|
||||||
|
aquaFilePath: ./spell.aqua
|
||||||
|
function: spell
|
||||||
|
clock:
|
||||||
|
periodSec: 6000
|
@ -5,7 +5,6 @@ import os
|
|||||||
import inspect
|
import inspect
|
||||||
from config import get_local
|
from config import get_local
|
||||||
|
|
||||||
delegator.run("npx fluence dep npm i", block=True)
|
|
||||||
default_peers = json.loads(delegator.run(
|
default_peers = json.loads(delegator.run(
|
||||||
f"node ./getDefaultPeers.js", block=True).out)
|
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
|
# 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]
|
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)
|
print(command)
|
||||||
c = delegator.run(command, block=True)
|
c = delegator.run(command, block=True)
|
||||||
lines = c.out.splitlines()
|
lines = c.out.splitlines()
|
||||||
|
@ -2,6 +2,6 @@ import delegator
|
|||||||
|
|
||||||
|
|
||||||
def test_fluence_cli_version():
|
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}")
|
print(f"Fluence CLI version: {c.out}")
|
||||||
assert True
|
assert True
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
aqua Constants declares *
|
||||||
|
|
||||||
-- the number of peers to which data will be replicated during the API call
|
-- the number of peers to which data will be replicated during the API call
|
||||||
const INITIAL_REPLICATION_FACTOR = 1
|
const INITIAL_REPLICATION_FACTOR = 1
|
||||||
-- the minimal number of peers requested to obtain the data.
|
-- the minimal number of peers requested to obtain the data.
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
aqua Misc declares *
|
||||||
|
|
||||||
import "@fluencelabs/aqua-lib/builtin.aqua"
|
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||||
import "registry-service.aqua"
|
import "registry-service.aqua"
|
||||||
import "constants.aqua"
|
import "constants.aqua"
|
||||||
@ -37,7 +39,7 @@ func appendErrors(error1: *Error, error2: *Error):
|
|||||||
|
|
||||||
func getResourceHelper(resource_id: ResourceId) -> ?Resource, *Error:
|
func getResourceHelper(resource_id: ResourceId) -> ?Resource, *Error:
|
||||||
nodes <- getNeighbors(resource_id)
|
nodes <- getNeighbors(resource_id)
|
||||||
result: ?Resource
|
result: *Resource
|
||||||
error: *Error
|
error: *Error
|
||||||
|
|
||||||
resources: *Key
|
resources: *Key
|
||||||
|
14604
aqua/package-lock.json
generated
14604
aqua/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,18 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "@fluencelabs/registry",
|
"name": "@fluencelabs/registry",
|
||||||
"version": "0.8.6",
|
"version": "0.9.4",
|
||||||
"description": "Aqua Registry library",
|
"description": "Aqua Registry library",
|
||||||
"files": [
|
"files": [
|
||||||
"*.aqua"
|
"*.aqua"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fluencelabs/aqua-lib": "0.7.0",
|
"@fluencelabs/aqua-lib": "0.9.1",
|
||||||
"@fluencelabs/trust-graph": "0.4.1"
|
"@fluencelabs/trust-graph": "0.4.11"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile-aqua": "aqua -i . -o ./target/typescript",
|
|
||||||
"generate-aqua": "../service/build.sh",
|
"generate-aqua": "../service/build.sh",
|
||||||
"build": "npm run compile-aqua"
|
"build": "fluence aqua -i . --dry"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -28,8 +27,5 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/fluencelabs/registry/issues"
|
"url": "https://github.com/fluencelabs/registry/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/fluencelabs/registry",
|
"homepage": "https://github.com/fluencelabs/registry"
|
||||||
"devDependencies": {
|
|
||||||
"@fluencelabs/aqua": "0.10.3"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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 "registry-service.aqua"
|
||||||
import PeerId, Peer, Sig, SignResult from "@fluencelabs/aqua-lib/builtin.aqua"
|
import PeerId, Peer, Sig, SignResult from "@fluencelabs/aqua-lib/builtin.aqua"
|
||||||
import "@fluencelabs/trust-graph/trust-graph.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:
|
on INIT_PEER_ID via HOST_PEER_ID:
|
||||||
sig_result <- Sig.sign(bytes)
|
sig_result <- Sig.sign(bytes)
|
||||||
|
|
||||||
result: ?RecordMetadata
|
result: *RecordMetadata
|
||||||
error: *string
|
error: *string
|
||||||
if sig_result.success == true:
|
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!)
|
result <- Registry.create_record_metadata(key_id, INIT_PEER_ID, t, value, peer_id, relay_id, service_id, solution, sig_result.signature!)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Registry.Scheduled declares *
|
aqua Registry.Scheduled declares *
|
||||||
|
|
||||||
export clearExpired_86400, replicate_3600, renew_43200
|
export clearExpired_86400, replicate_3600, renew_43200
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Registry declares *
|
aqua Registry declares *
|
||||||
|
|
||||||
data ClearExpiredResult:
|
data ClearExpiredResult:
|
||||||
success: bool
|
success: bool
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Registry.ResourcesAPI declares *
|
aqua Registry.ResourcesAPI declares *
|
||||||
|
|
||||||
import "registry-service.aqua"
|
import "registry-service.aqua"
|
||||||
import "registry-api.aqua"
|
import "registry-api.aqua"
|
||||||
@ -6,10 +6,6 @@ import "misc.aqua"
|
|||||||
import "constants.aqua"
|
import "constants.aqua"
|
||||||
import "@fluencelabs/aqua-lib/builtin.aqua"
|
import "@fluencelabs/aqua-lib/builtin.aqua"
|
||||||
|
|
||||||
alias ResourceId: string
|
|
||||||
alias Resource: Key
|
|
||||||
alias Error: string
|
|
||||||
|
|
||||||
func getResource(resource_id: ResourceId) -> ?Resource, *Error:
|
func getResource(resource_id: ResourceId) -> ?Resource, *Error:
|
||||||
on HOST_PEER_ID:
|
on HOST_PEER_ID:
|
||||||
result, error <- getResourceHelper(resource_id)
|
result, error <- getResourceHelper(resource_id)
|
||||||
@ -24,7 +20,7 @@ func getResourceId(label: string, peer_id: string) -> ResourceId:
|
|||||||
func createResource(label: string) -> ?ResourceId, *Error:
|
func createResource(label: string) -> ?ResourceId, *Error:
|
||||||
t <- Peer.timestamp_sec()
|
t <- Peer.timestamp_sec()
|
||||||
|
|
||||||
resource_id: ?ResourceId
|
resource_id: *ResourceId
|
||||||
error: *Error
|
error: *Error
|
||||||
on HOST_PEER_ID:
|
on HOST_PEER_ID:
|
||||||
sig_result <- getKeySignature(label, t)
|
sig_result <- getKeySignature(label, t)
|
||||||
@ -57,7 +53,7 @@ func createResource(label: string) -> ?ResourceId, *Error:
|
|||||||
|
|
||||||
-- Note: resource must be already created
|
-- Note: resource must be already created
|
||||||
func registerService(resource_id: ResourceId, value: string, peer_id: PeerId, service_id: ?string) -> bool, *Error:
|
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:
|
if peer_id == INIT_PEER_ID:
|
||||||
relay_id <<- HOST_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:
|
func unregisterService(resource_id: ResourceId, peer_id: PeerId) -> bool, *Error:
|
||||||
success: ?bool
|
success: *bool
|
||||||
error: *Error
|
error: *Error
|
||||||
|
|
||||||
on HOST_PEER_ID:
|
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:
|
func resolveResource(resource_id: ResourceId, ack: i16) -> ?[]Record, *Error:
|
||||||
on HOST_PEER_ID:
|
on HOST_PEER_ID:
|
||||||
nodes <- getNeighbors(resource_id)
|
nodes <- getNeighbors(resource_id)
|
||||||
result: ?[]Record
|
result: *[]Record
|
||||||
records: *[]Record
|
records: *[]Record
|
||||||
error: *Error
|
error: *Error
|
||||||
successful: *bool
|
successful: *bool
|
||||||
@ -197,7 +193,7 @@ func resolveResource(resource_id: ResourceId, ack: i16) -> ?[]Record, *Error:
|
|||||||
-- Execute the given call on providers
|
-- Execute the given call on providers
|
||||||
-- Note that you can provide another Aqua function as an argument to this one
|
-- 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:
|
func executeOnResource(resource_id: ResourceId, ack: i16, call: Record -> ()) -> bool, *Error:
|
||||||
success: ?bool
|
success: *bool
|
||||||
result, error <- resolveResource(resource_id, ack)
|
result, error <- resolveResource(resource_id, ack)
|
||||||
|
|
||||||
if result == nil:
|
if result == nil:
|
||||||
|
@ -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
|
|
744
aqua/target/typescript/misc.ts
Normal file
744
aqua/target/typescript/misc.ts
Normal 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 */
|
1341
aqua/target/typescript/registry-api.ts
Normal file
1341
aqua/target/typescript/registry-api.ts
Normal file
File diff suppressed because it is too large
Load Diff
322
aqua/target/typescript/registry-scheduled-scripts.ts
Normal file
322
aqua/target/typescript/registry-scheduled-scripts.ts
Normal 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 */
|
31
build.sh
Executable file
31
build.sh
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#!/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")"
|
||||||
|
|
||||||
|
# Build the service
|
||||||
|
./service/build.sh
|
||||||
|
|
||||||
|
DISTRO_TARGET=distro/registry-service
|
||||||
|
mkdir -p "$DISTRO_TARGET"
|
||||||
|
|
||||||
|
cd ./aqua
|
||||||
|
npm pack
|
||||||
|
cd -
|
||||||
|
|
||||||
|
packed_archive_file_name_pattern="fluencelabs-registry-"
|
||||||
|
packed_archive_file_name=$(find "./aqua" -type f -name "${packed_archive_file_name_pattern}*")
|
||||||
|
|
||||||
|
cd ./aqua-tests
|
||||||
|
echo " '@fluencelabs/registry': file:.$packed_archive_file_name" >> "./fluence.yaml"
|
||||||
|
fluence dep i
|
||||||
|
fluence aqua -i ./spell/spell.aqua --no-relay --air -o "../$DISTRO_TARGET/air"
|
||||||
|
cd -
|
||||||
|
|
||||||
|
cp service/artifacts/registry.wasm service/artifacts/sqlite3.wasm distro/Config.toml "$DISTRO_TARGET"
|
||||||
|
|
||||||
|
cd distro
|
||||||
|
cargo build
|
@ -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 aqua --version
|
|
||||||
npx 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 ***"
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "registry",
|
|
||||||
"max_heap_size": "8 MiB",
|
|
||||||
"preopened_files": ["/tmp"],
|
|
||||||
"mapped_dirs": {
|
|
||||||
"tmp": "./tmp"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "sqlite3",
|
|
||||||
"max_heap_size": "64 MiB"
|
|
||||||
}
|
|
53
distro/Cargo.lock
generated
Normal file
53
distro/Cargo.lock
generated
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "built"
|
||||||
|
version = "0.7.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "38d17f4d6e4dc36d1a02fbedc2753a096848e7c1b0772f7654eab8e2c927dd53"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "maplit"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "registry-distro"
|
||||||
|
version = "0.9.4"
|
||||||
|
dependencies = [
|
||||||
|
"built",
|
||||||
|
"maplit",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ryu"
|
||||||
|
version = "1.0.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.160"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.96"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
16
distro/Cargo.toml
Normal file
16
distro/Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[package]
|
||||||
|
name = "registry-distro"
|
||||||
|
version = "0.9.4"
|
||||||
|
edition = "2021"
|
||||||
|
build = "built.rs"
|
||||||
|
include = [ "/src", "built.rs", "Cargo.toml", "registry-service"]
|
||||||
|
description = "Distribution package for the registry service including scheduled scripts"
|
||||||
|
license = "Apache-2.0"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
[dependencies]
|
||||||
|
maplit = "1.0.2"
|
||||||
|
serde_json = "1.0.96"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
built = "0.7.1"
|
16
distro/Config.toml
Normal file
16
distro/Config.toml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
modules_dir = "."
|
||||||
|
total_memory_limit = "Infinity"
|
||||||
|
|
||||||
|
[[module]]
|
||||||
|
name = "sqlite3"
|
||||||
|
mem_pages_count = 100
|
||||||
|
logger_enabled = false
|
||||||
|
|
||||||
|
[module.wasi]
|
||||||
|
preopened_files = ["./tmp"]
|
||||||
|
mapped_dirs = { "tmp" = "./tmp" }
|
||||||
|
|
||||||
|
[[module]]
|
||||||
|
name = "registry"
|
||||||
|
mem_pages_count = 1
|
||||||
|
logger_enabled = false
|
3
distro/built.rs
Normal file
3
distro/built.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fn main() {
|
||||||
|
built::write_built_file().expect("Failed to acquire build-time information")
|
||||||
|
}
|
51
distro/src/lib.rs
Normal file
51
distro/src/lib.rs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
use maplit::hashmap;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use serde_json::{json, Value as JValue};
|
||||||
|
|
||||||
|
pub const REGISTRY_WASM: &'static [u8] = include_bytes!("../registry-service/registry.wasm");
|
||||||
|
pub const SQLITE_WASM: &'static [u8] = include_bytes!("../registry-service/sqlite3.wasm");
|
||||||
|
pub const CONFIG: &'static [u8] = include_bytes!("../registry-service/Config.toml");
|
||||||
|
|
||||||
|
pub const REGISTRY_SPELL: &'static str =
|
||||||
|
include_str!("../registry-service/air/spell.spell.air");
|
||||||
|
|
||||||
|
pub mod build_info {
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
||||||
|
}
|
||||||
|
|
||||||
|
pub use build_info::PKG_VERSION as VERSION;
|
||||||
|
|
||||||
|
pub fn modules() -> std::collections::HashMap<&'static str, &'static [u8]> {
|
||||||
|
maplit::hashmap! {
|
||||||
|
"sqlite3" => SQLITE_WASM,
|
||||||
|
"registry" => REGISTRY_WASM,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct DistrSpell {
|
||||||
|
/// AIR script of the spell
|
||||||
|
pub air: &'static str,
|
||||||
|
/// Initial key-value records for spells KV storage
|
||||||
|
pub init_data: HashMap<&'static str, JValue>,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct RegistryConfig {
|
||||||
|
pub expired_interval: u32,
|
||||||
|
pub renew_interval: u32,
|
||||||
|
pub replicate_interval: u32
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn registry_spell(config: RegistryConfig) -> DistrSpell {
|
||||||
|
DistrSpell {
|
||||||
|
air: REGISTRY_SPELL,
|
||||||
|
init_data: hashmap!{
|
||||||
|
"config" => json!( {
|
||||||
|
"expired_interval": config.expired_interval,
|
||||||
|
"renew_interval": config.renew_interval,
|
||||||
|
"replicate_interval": config.replicate_interval,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
8
example/.gitignore
vendored
8
example/.gitignore
vendored
@ -1,8 +0,0 @@
|
|||||||
.idea
|
|
||||||
.DS_Store
|
|
||||||
.fluence
|
|
||||||
**/node_modules
|
|
||||||
**/target/
|
|
||||||
.repl_history
|
|
||||||
generated
|
|
||||||
.vscode/settings.json
|
|
1820
example/echo_service/modules/echo_service/Cargo.lock
generated
1820
example/echo_service/modules/echo_service/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
|||||||
# yaml-language-server: $schema=../../../.fluence/schemas/module.yaml.json
|
|
||||||
|
|
||||||
version: 0
|
|
||||||
type: rust
|
|
||||||
name: echo_service
|
|
@ -1,7 +0,0 @@
|
|||||||
# yaml-language-server: $schema=../.fluence/schemas/service.yaml.json
|
|
||||||
|
|
||||||
version: 0
|
|
||||||
name: echo_service
|
|
||||||
modules:
|
|
||||||
facade:
|
|
||||||
get: modules/echo_service
|
|
@ -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.6.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
11841
example/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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": {}
|
|
||||||
}
|
|
@ -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!
|
|
24
examples/archived/1-registry/.fluence/aqua/deals.aqua
Normal file
24
examples/archived/1-registry/.fluence/aqua/deals.aqua
Normal 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
|
||||||
|
)]
|
||||||
|
)
|
4
examples/archived/1-registry/.fluence/aqua/hosts.aqua
Normal file
4
examples/archived/1-registry/.fluence/aqua/hosts.aqua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
aqua Hosts declares *
|
||||||
|
|
||||||
|
func get() -> ?u8:
|
||||||
|
<- nil
|
2
examples/archived/1-registry/.fluence/aqua/services.aqua
Normal file
2
examples/archived/1-registry/.fluence/aqua/services.aqua
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
service EchoService("echo_service"):
|
||||||
|
echo(msg: string) -> string
|
@ -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"
|
@ -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"
|
@ -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"
|
102
examples/archived/1-registry/.fluence/docker-compose.yaml
Normal file
102
examples/archived/1-registry/.fluence/docker-compose.yaml
Normal 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
|
17
examples/archived/1-registry/.fluence/workers.yaml
Normal file
17
examples/archived/1-registry/.fluence/workers.yaml
Normal 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
12
examples/archived/1-registry/.gitignore
vendored
Normal 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
2847
examples/archived/1-registry/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
2
examples/archived/1-registry/Cargo.toml
Normal file
2
examples/archived/1-registry/Cargo.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[workspace]
|
||||||
|
members = [ "src/services/echo_service/modules/echo_service" ]
|
@ -18,13 +18,10 @@ This example shows how to use Registry to discover and call fluence services wit
|
|||||||
|
|
||||||
## Set up the environment
|
## Set up the environment
|
||||||
|
|
||||||
1. Install the latest version of Fluence CLI:
|
1. [Install the latest version of Fluence CLI](https://github.com/fluencelabs/cli#installation-and-usage)
|
||||||
```sh
|
|
||||||
npm i -g @fluencelabs/cli
|
|
||||||
```
|
|
||||||
2. Install Fluence project dependencies. It may take a while:
|
2. Install Fluence project dependencies. It may take a while:
|
||||||
```sh
|
```sh
|
||||||
fluence dependency i
|
fluence dep i
|
||||||
```
|
```
|
||||||
3. Install JS dependencies:
|
3. Install JS dependencies:
|
||||||
```sh
|
```sh
|
||||||
@ -92,9 +89,7 @@ It uses `createResource` function from Resources API to register the Resource wi
|
|||||||
You should see output similar to this:
|
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
|
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:
|
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.
|
It means the service is registered in Registry and should be accessible by anyone who only has the `resourceId` of this service.
|
24
examples/archived/1-registry/fluence.yaml
Normal file
24
examples/archived/1-registry/fluence.yaml
Normal 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
|
32
examples/archived/1-registry/provider.yaml
Normal file
32
examples/archived/1-registry/provider.yaml
Normal 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
|
73
examples/archived/1-registry/src/aqua/main.aqua
Normal file
73
examples/archived/1-registry/src/aqua/main.aqua
Normal 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
|
||||||
|
|
||||||
|
|
||||||
|
|
3547
examples/archived/1-registry/src/frontend/package-lock.json
generated
Normal file
3547
examples/archived/1-registry/src/frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
examples/archived/1-registry/src/frontend/package.json
Normal file
24
examples/archived/1-registry/src/frontend/package.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
@ -13,32 +13,33 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { Fluence, KeyPair, setLogLevel } from "@fluencelabs/fluence";
|
import { Fluence, KeyPair } from '@fluencelabs/js-client';
|
||||||
import { stage } from "@fluencelabs/fluence-network-environment";
|
import { registerEchoJSService } from './compiled-aqua/main.ts';
|
||||||
import { registerEchoService, registerService } from "./generated/export";
|
|
||||||
import assert from "node:assert";
|
|
||||||
|
|
||||||
// don't store your secret key in the code. This is just for the example
|
// don't store your secret key in the code. This is just for the example
|
||||||
const secretKey = "Iz3HUmNIB78lkNNVmMkDKrju0nCivtkJNyObrFAr774=";
|
const secretKey = "Iz3HUmNIB78lkNNVmMkDKrju0nCivtkJNyObrFAr774=";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const keypair = await KeyPair.fromEd25519SK(Buffer.from(secretKey, "base64"));
|
const keyPair = await KeyPair.fromEd25519SK(Buffer.from(secretKey, "base64"));
|
||||||
const connectTo = stage[0];
|
|
||||||
assert(connectTo !== undefined);
|
|
||||||
|
|
||||||
// connect to the Fluence network
|
await Fluence.connect({
|
||||||
await Fluence.start({ connectTo, KeyPair: keypair });
|
multiaddr:
|
||||||
setLogLevel("SILENT");
|
"/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}`);
|
console.log(`📗 created a fluence peer ${peerId} with relay ${relayId}`);
|
||||||
|
|
||||||
const serviceId = "echo";
|
const serviceId = "echo";
|
||||||
|
|
||||||
// register local service with serviceId "echo"
|
// register local service with serviceId "echo"
|
||||||
await registerEchoService(serviceId, {
|
registerEchoJSService(serviceId, {
|
||||||
echo(msg) {
|
echo(msg) {
|
||||||
console.log(`Received message: ${msg}`);
|
console.log(`Received message: ${msg}`);
|
||||||
return `${peerId}: ${msg}`;
|
return `${peerId}: ${msg}`;
|
||||||
@ -50,19 +51,19 @@ async function main() {
|
|||||||
// don't register if resource id isn't passed
|
// don't register if resource id isn't passed
|
||||||
if (resourceId === undefined) {
|
if (resourceId === undefined) {
|
||||||
console.log(
|
console.log(
|
||||||
`
|
`
|
||||||
Copy this code to call this service:
|
Copy this code to call this service:
|
||||||
|
|
||||||
fluence run -f 'echoJS("${peerId}", "${relayId}", "${serviceId}", "hi")'`
|
fluence run -f 'echoJS("${peerId}", "${relayId}", "${serviceId}", "hi")'`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const [success, error] = await registerService(
|
// const [success, error] = await registerService(
|
||||||
resourceId,
|
// resourceId,
|
||||||
"echo",
|
// "echo",
|
||||||
peerId,
|
// peerId,
|
||||||
serviceId
|
// serviceId
|
||||||
);
|
// );
|
||||||
console.log(`Registration result: ${success || error}`);
|
// console.log(`Registration result: ${success || error}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("\nPress any key to stop fluence js peer");
|
console.log("\nPress any key to stop fluence js peer");
|
||||||
@ -71,7 +72,7 @@ async function main() {
|
|||||||
process.stdin.setRawMode(true);
|
process.stdin.setRawMode(true);
|
||||||
process.stdin.resume();
|
process.stdin.resume();
|
||||||
process.stdin.on("data", async () => {
|
process.stdin.on("data", async () => {
|
||||||
await Fluence.stop();
|
await Fluence.disconnect();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
14
examples/archived/1-registry/src/frontend/src/relays.json
Normal file
14
examples/archived/1-registry/src/frontend/src/relays.json
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
23
examples/archived/1-registry/src/frontend/tsconfig.json
Normal file
23
examples/archived/1-registry/src/frontend/tsconfig.json
Normal 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"]
|
||||||
|
}
|
@ -8,7 +8,7 @@ name = "echo_service"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
marine-rs-sdk = "=0.7.1"
|
marine-rs-sdk = "0.10.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
marine-rs-sdk-test = "=0.8.1"
|
marine-rs-sdk-test = "=0.12.0"
|
@ -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
|
@ -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
|
@ -1,9 +1,5 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2022-12-01"
|
channel = "nightly-2023-08-27"
|
||||||
components = ["rustfmt", "clippy"]
|
components = [ "rustfmt", "clippy" ]
|
||||||
targets = [
|
targets = [ "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "wasm32-wasi" ]
|
||||||
"x86_64-unknown-linux-gnu",
|
|
||||||
"x86_64-apple-darwin",
|
|
||||||
"wasm32-wasi"
|
|
||||||
]
|
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
|
3304
service/Cargo.lock
generated
3304
service/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "registry"
|
name = "registry"
|
||||||
version = "0.8.6"
|
version = "0.9.4"
|
||||||
authors = ["Fluence Labs"]
|
authors = ["Fluence Labs"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
@ -10,21 +10,21 @@ name = "registry"
|
|||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bs58 = "=0.4.0"
|
bs58 = "=0.5.0"
|
||||||
marine-rs-sdk = "=0.7.1"
|
marine-rs-sdk = "=0.10.3"
|
||||||
marine-sqlite-connector = "=0.8.0"
|
marine-sqlite-connector = "=0.9.3"
|
||||||
fstrings = "=0.2.3"
|
fstrings = "=0.2.3"
|
||||||
boolinator = "=2.4.0"
|
boolinator = "=2.4.0"
|
||||||
toml = "=0.7.3"
|
toml = "=0.8.8"
|
||||||
serde = { version = "=1.0.152", features = ["derive"] }
|
serde = { version = "1.0.188", features = ["derive"] }
|
||||||
thiserror = "=1.0.38"
|
thiserror = "=1.0.50"
|
||||||
sha2 = "=0.10.6"
|
sha2 = "=0.10.8"
|
||||||
fluence-keypair = "=0.8.1"
|
fluence-keypair = "=0.10.4"
|
||||||
libp2p-core = { version = "=0.36.0", default-features = false, features = [ "secp256k1" ] }
|
libp2p-identity = "=0.2.8"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
marine-rs-sdk-test = "=0.8.1"
|
marine-rs-sdk-test = "=0.12.1"
|
||||||
rusqlite = "=0.28.0"
|
rusqlite = "=0.30.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
marine-rs-sdk-test = "=0.8.1"
|
marine-rs-sdk-test = "=0.12.1"
|
||||||
|
@ -1,19 +1,12 @@
|
|||||||
modules_dir = "artifacts/"
|
modules_dir = "artifacts"
|
||||||
|
total_memory_limit = "Infinity"
|
||||||
|
|
||||||
[[module]]
|
[[module]]
|
||||||
name = "sqlite3"
|
name = "sqlite3"
|
||||||
mem_pages_count = 100
|
mem_pages_count = 100
|
||||||
logger_enabled = false
|
logger_enabled = false
|
||||||
|
|
||||||
[module.wasi]
|
|
||||||
preopened_files = ["/tmp"]
|
|
||||||
mapped_dirs = { "tmp" = "/tmp" }
|
|
||||||
|
|
||||||
[[module]]
|
[[module]]
|
||||||
name = "registry"
|
name = "registry"
|
||||||
mem_pages_count = 1
|
mem_pages_count = 1
|
||||||
logger_enabled = false
|
logger_enabled = false
|
||||||
|
|
||||||
[module.wasi]
|
|
||||||
preopened_files = ["/tmp"]
|
|
||||||
mapped_dirs = { "tmp" = "/tmp" }
|
|
||||||
|
@ -20,7 +20,7 @@ fn main() {
|
|||||||
"registry".to_string(),
|
"registry".to_string(),
|
||||||
ServiceDescription {
|
ServiceDescription {
|
||||||
config_path: "Config.toml".to_string(),
|
config_path: "Config.toml".to_string(),
|
||||||
modules_dir: Some("artifacts".to_string()),
|
modules_dir: None,
|
||||||
},
|
},
|
||||||
)];
|
)];
|
||||||
|
|
||||||
|
@ -13,7 +13,10 @@ mkdir -p artifacts
|
|||||||
cp target/wasm32-wasi/release/registry.wasm artifacts/
|
cp target/wasm32-wasi/release/registry.wasm artifacts/
|
||||||
|
|
||||||
# download SQLite 3 to use in tests
|
# 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
|
# generate Aqua bindings
|
||||||
marine aqua artifacts/registry.wasm -s Registry -i registry >../aqua/registry-service.aqua
|
marine aqua artifacts/registry.wasm -s Registry -i registry >../aqua/registry-service.aqua
|
||||||
|
|
||||||
|
mkdir -p ../distro/registry-service
|
||||||
|
cp artifacts/registry.wasm artifacts/sqlite3.wasm ../distro/registry-service
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
[toolchain]
|
|
||||||
channel = "nightly-2022-10-05"
|
|
||||||
components = [ "rustfmt", "clippy" ]
|
|
||||||
targets = [ "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "wasm32-wasi" ]
|
|
||||||
profile = "minimal"
|
|
@ -18,7 +18,7 @@ use crate::error::ServiceError;
|
|||||||
use crate::WeightResult;
|
use crate::WeightResult;
|
||||||
use boolinator::Boolinator;
|
use boolinator::Boolinator;
|
||||||
use fluence_keypair::PublicKey;
|
use fluence_keypair::PublicKey;
|
||||||
use libp2p_core::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ pub fn republish_records(
|
|||||||
pub fn merge_two(a: Vec<Record>, b: Vec<Record>) -> MergeResult {
|
pub fn merge_two(a: Vec<Record>, b: Vec<Record>) -> MergeResult {
|
||||||
merge_records(
|
merge_records(
|
||||||
a.into_iter()
|
a.into_iter()
|
||||||
.chain(b.into_iter())
|
.chain(b)
|
||||||
.map(|record| RecordInternal {
|
.map(|record| RecordInternal {
|
||||||
record,
|
record,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -226,7 +226,7 @@ mod tests {
|
|||||||
) -> EvictStaleResult {
|
) -> EvictStaleResult {
|
||||||
let cp = CPWrapper::new("peer_id", "host_id").add_timestamp_tetraplets(0);
|
let cp = CPWrapper::new("peer_id", "host_id").add_timestamp_tetraplets(0);
|
||||||
let evict_result = registry.evict_stale_cp(current_timestamp_sec, cp.get());
|
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
|
evict_result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ mod tests {
|
|||||||
solution,
|
solution,
|
||||||
weight,
|
weight,
|
||||||
);
|
);
|
||||||
assert!(result.success, result.error);
|
assert!(result.success, "{}", result.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_records(
|
fn get_records(
|
||||||
@ -474,7 +474,7 @@ mod tests {
|
|||||||
timestamp_issued,
|
timestamp_issued,
|
||||||
solution,
|
solution,
|
||||||
);
|
);
|
||||||
assert!(result.success, result.error);
|
assert!(result.success, "{}", result.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -846,7 +846,7 @@ mod tests {
|
|||||||
let expired_timestamp = timestamp_created + DEFAULT_EXPIRED_AGE;
|
let expired_timestamp = timestamp_created + DEFAULT_EXPIRED_AGE;
|
||||||
let cp = CPWrapper::new("peer_id", "host_id").add_timestamp_tetraplets(0);
|
let cp = CPWrapper::new("peer_id", "host_id").add_timestamp_tetraplets(0);
|
||||||
let result = registry.clear_expired_cp(expired_timestamp, cp.get());
|
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);
|
assert_eq!(result.count_keys, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user