diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index a64991ff..caaf496f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -40,6 +40,7 @@ jobs: uses: fluencelabs/nox/.github/workflows/build.yml@master with: + ref: multi_cu cargo-dependencies: | [ { @@ -64,4 +65,5 @@ jobs: - nox-snapshot uses: fluencelabs/cli/.github/workflows/tests.yml@main with: + ref: up-clients nox-image: "${{ needs.nox-snapshot.outputs.nox-image }}" diff --git a/.gitignore b/.gitignore index 0b0e92e6..0ef86281 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ /src/air /src/distro/decider-spell /src/compiled-aqua/ - +shell.nix diff --git a/src/aqua/deal/install.aqua b/src/aqua/deal/install.aqua index 5a5ec6af..efd40fa5 100644 --- a/src/aqua/deal/install.aqua +++ b/src/aqua/deal/install.aqua @@ -72,7 +72,7 @@ func install_deal(settings: WorkerSettings, deal: Deal) -> ?WorkerId: log = (msg: ⊤): deal_log(deal.deal_id, msg) - worker_id <- WorkerHelper.get_or_create(deal.deal_id, deal.unit_ids) + worker_id <- WorkerHelper.get_or_create(deal.deal_id, deal.cu_ids) if worker_id != nil: -- If it's not active, the deal is installed if Worker.is_active(deal.deal_id): @@ -99,7 +99,7 @@ func install_deals(worker_settings: WorkerSettings, deals: []Deal): worker_id <- install_deal(worker_settings, deal) if worker_id != nil: deal_log(deal.deal_id, ["Worker installed", worker_id]) - tx_hash <- register_worker(deal.deal_id, worker_id!, deal.unit_ids) + tx_hash <- register_worker(deal.deal_id, worker_id!, deal.onchain_worker_id) if tx_hash != nil: DealStorage.store_deal(deal.deal_id, tx_hash!) else: diff --git a/src/aqua/fluence/connector.aqua b/src/aqua/fluence/connector.aqua index 3782a22f..c4c8d610 100644 --- a/src/aqua/fluence/connector.aqua +++ b/src/aqua/fluence/connector.aqua @@ -19,21 +19,23 @@ aqua Connector declares * import CUID from "@fluencelabs/aqua-lib/workers.aqua" -import DealId, TxHash, Deal from "../types.aqua" +import DealId, TxHash, Deal, OnChainWorkerId from "../types.aqua" data DealInfo: -- For comparison, use DEAL_STATUS_* from consts.aqua status: string - unit_ids: []CUID + cu_ids: []CUID app_cid: string + onchain_worker_id: OnChainWorkerId func info_to_deal(deal_id: DealId, deal_info: DealInfo) -> Deal: <- Deal( deal_id = deal_id, status = deal_info.status, app_cid = deal_info.app_cid, - unit_ids = deal_info.unit_ids + cu_ids = deal_info.cu_ids, + onchain_worker_id = deal_info.onchain_worker_id ) data DealResult: @@ -61,7 +63,7 @@ data TxResult: service ChainConnector("connector"): -- Register a worker on chain - register_worker(deal_id: string, worker_id: string, unit_ids: []CUID) -> TxHash + register_worker(deal_id: string, worker_id: string, onchain_worker_id: OnChainWorkerId) -> TxHash -- Get the list of current deals get_deals() -> []DealResult -- Get transaction receipts for the given transaction hashes diff --git a/src/aqua/types.aqua b/src/aqua/types.aqua index 71dfa689..63b6539e 100644 --- a/src/aqua/types.aqua +++ b/src/aqua/types.aqua @@ -25,10 +25,12 @@ alias SpellId: string alias WorkerId: string alias CID: string alias TxHash: string +alias OnChainWorkerId: []u8 data Deal: deal_id: DealId -- For comparision, use DEAL_STATUS_* from consts.aqua status: string - unit_ids: []CUID + cu_ids: []CUID app_cid: string + onchain_worker_id: OnChainWorkerId diff --git a/src/aqua/worker/register.aqua b/src/aqua/worker/register.aqua index f5846bc0..c5704050 100644 --- a/src/aqua/worker/register.aqua +++ b/src/aqua/worker/register.aqua @@ -24,7 +24,7 @@ import Spell, TriggerConfig from "@fluencelabs/spell/spell_service.aqua" import "@fluencelabs/spell/spell_service.aqua" import deal_log, spell_log from "../fluence/spell.aqua" -import DealId, WorkerId, TxHash from "../types.aqua" +import DealId, WorkerId, TxHash, OnChainWorkerId from "../types.aqua" import ChainConnector from "../fluence/connector.aqua" use "../storage/tx.aqua" as TxStorage @@ -33,7 +33,7 @@ import "../consts.aqua" import Json from "../fluence/peer.aqua" -func register_worker(deal_id: DealId, worker_id: WorkerId, cu_ids: []CUID) -> ?TxHash: +func register_worker(deal_id: DealId, worker_id: WorkerId, onchain_worker_id: OnChainWorkerId) -> ?TxHash: tx_hash: *TxHash try: exsiting_hash <- DealStorage.get_tx(deal_id) @@ -42,7 +42,7 @@ func register_worker(deal_id: DealId, worker_id: WorkerId, cu_ids: []CUID) -> ?T tx_hash <<- exsiting_hash! else: deal_log(deal_id, ["Registering worker"]) - tx <- ChainConnector.register_worker(deal_id, worker_id, cu_ids) + tx <- ChainConnector.register_worker(deal_id, worker_id, onchain_worker_id) TxStorage.store_tx(deal_id, tx) deal_log(deal_id, ["Worker registered, tx hash:", tx]) tx_hash <<- tx diff --git a/src/tests/decider-distro-tests-rs/Cargo.lock b/src/tests/decider-distro-tests-rs/Cargo.lock index a7a01393..1e7b200f 100644 --- a/src/tests/decider-distro-tests-rs/Cargo.lock +++ b/src/tests/decider-distro-tests-rs/Cargo.lock @@ -87,7 +87,7 @@ dependencies = [ [[package]] name = "air-interpreter-fs" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "air-interpreter-wasm", "eyre", @@ -327,7 +327,7 @@ dependencies = [ [[package]] name = "aquamarine" version = "0.2.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "anyhow", "async-trait", @@ -1331,7 +1331,7 @@ dependencies = [ [[package]] name = "chain-connector" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -1362,7 +1362,7 @@ dependencies = [ [[package]] name = "chain-data" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -1382,7 +1382,7 @@ dependencies = [ [[package]] name = "chain-listener" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -1448,7 +1448,7 @@ dependencies = [ [[package]] name = "cid-utils" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "bytes", "eyre", @@ -1595,7 +1595,7 @@ dependencies = [ [[package]] name = "config-utils" version = "0.2.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "libp2p-identity", ] @@ -1603,7 +1603,7 @@ dependencies = [ [[package]] name = "connected-client" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "derivative", "either", @@ -1630,7 +1630,7 @@ dependencies = [ [[package]] name = "connection-pool" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "fluence-libp2p", "futures", @@ -1673,7 +1673,7 @@ checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "control-macro" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" [[package]] name = "convert_case" @@ -1684,7 +1684,7 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "core-distributor" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "bimap", "ccp-shared", @@ -1888,7 +1888,7 @@ dependencies = [ [[package]] name = "created-swarm" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "air-interpreter-fs", "aquamarine", @@ -2110,7 +2110,7 @@ dependencies = [ [[package]] name = "decider-distro" -version = "0.7.0" +version = "0.7.1" dependencies = [ "built 0.7.2", "fluence-spell-dtos", @@ -2120,9 +2120,9 @@ dependencies = [ [[package]] name = "decider-distro" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafeb2d55c8843ac62a86ae40b229a834bc6a9b89da46e7ffbd551cec43bd159" +checksum = "1f87fc5b72d3931ea4017ee61d7c99a7f98ec6f337b877f4e78fe14a708cb1ec" dependencies = [ "built 0.7.2", "fluence-spell-dtos", @@ -2138,7 +2138,7 @@ dependencies = [ "clarity", "connected-client", "created-swarm", - "decider-distro 0.7.0", + "decider-distro 0.7.1", "eyre", "futures", "hex", @@ -2662,7 +2662,7 @@ dependencies = [ [[package]] name = "fluence-libp2p" version = "0.2.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "bs58", "futures", @@ -2747,7 +2747,7 @@ dependencies = [ [[package]] name = "fs-utils" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "cfg-if", "eyre", @@ -3130,7 +3130,7 @@ dependencies = [ [[package]] name = "health" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "eyre", ] @@ -3186,7 +3186,7 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hex-utils" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "hex", "serde_with 3.8.1", @@ -3875,7 +3875,7 @@ dependencies = [ [[package]] name = "ivalue-utils" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "fluence-it-types", "serde_json", @@ -3922,7 +3922,7 @@ dependencies = [ [[package]] name = "json-utils" version = "0.0.2" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "base64 0.21.7", "serde", @@ -4249,7 +4249,7 @@ dependencies = [ [[package]] name = "kademlia" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "bs58", "control-macro", @@ -4903,7 +4903,7 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "local-vm" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "air-interpreter-fs", "air-interpreter-wasm", @@ -4945,7 +4945,7 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "log-format" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "nu-ansi-term 0.50.0", "tracing", @@ -4956,7 +4956,7 @@ dependencies = [ [[package]] name = "log-utils" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "log", "log-format", @@ -5780,12 +5780,12 @@ checksum = "995defdca0a589acfdd1bd2e8e3b896b4d4f7675a31fd14c32611440c7f608e6" [[package]] name = "now-millis" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" [[package]] name = "nox" -version = "0.25.2" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +version = "0.26.0" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "air-interpreter-fs", "air-interpreter-wasm", @@ -6191,7 +6191,7 @@ dependencies = [ [[package]] name = "particle-args" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "avm-server", "bs58", @@ -6206,7 +6206,7 @@ dependencies = [ [[package]] name = "particle-builtins" version = "0.2.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "async-trait", "avm-server", @@ -6253,7 +6253,7 @@ dependencies = [ [[package]] name = "particle-execution" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "async-trait", "bs58", @@ -6275,7 +6275,7 @@ dependencies = [ [[package]] name = "particle-modules" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "base64 0.21.7", "bytesize", @@ -6302,7 +6302,7 @@ dependencies = [ [[package]] name = "particle-protocol" version = "0.3.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "air-interpreter-sede", "asynchronous-codec 0.7.0", @@ -6330,7 +6330,7 @@ dependencies = [ [[package]] name = "particle-services" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "bytesize", "cid-utils", @@ -6395,7 +6395,7 @@ dependencies = [ [[package]] name = "peer-metrics" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "bytesize", "fluence-app-service", @@ -7713,7 +7713,7 @@ dependencies = [ [[package]] name = "server-config" version = "0.2.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "air-interpreter-fs", "base64 0.21.7", @@ -7753,7 +7753,7 @@ dependencies = [ [[package]] name = "service-modules" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "cid-utils", "eyre", @@ -7956,7 +7956,7 @@ dependencies = [ [[package]] name = "sorcerer" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "aquamarine", "connection-pool", @@ -7995,7 +7995,7 @@ dependencies = [ [[package]] name = "spell-event-bus" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "connection-pool", "derivative", @@ -8021,7 +8021,7 @@ dependencies = [ [[package]] name = "spell-service-api" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "fluence-libp2p", "fluence-spell-dtos", @@ -8036,7 +8036,7 @@ dependencies = [ [[package]] name = "spell-storage" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "derivative", "eyre", @@ -8201,11 +8201,11 @@ dependencies = [ [[package]] name = "system-services" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "aqua-ipfs-distro", "async-trait", - "decider-distro 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "decider-distro 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "eyre", "fluence-app-service", "fluence-spell-dtos", @@ -8271,12 +8271,12 @@ dependencies = [ [[package]] name = "test-constants" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" [[package]] name = "test-utils" version = "0.3.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "base64 0.21.7", "clarity", @@ -8535,7 +8535,7 @@ dependencies = [ [[package]] name = "toml-utils" version = "0.0.1" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "marine-runtime", ] @@ -8649,7 +8649,7 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "toy-vms" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "aquamarine", "async-trait", @@ -8805,7 +8805,7 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "types" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "libp2p-identity", "serde", @@ -8956,7 +8956,7 @@ dependencies = [ [[package]] name = "uuid-utils" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "uuid", ] @@ -9019,7 +9019,7 @@ dependencies = [ [[package]] name = "vm-utils" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "ccp-shared", "mac_address", @@ -10065,7 +10065,7 @@ dependencies = [ [[package]] name = "workers" version = "0.1.0" -source = "git+https://github.com/fluencelabs/nox.git?branch=config_diamond#8e3b59841371113ec42091a2a5fb99802e3689d9" +source = "git+https://github.com/fluencelabs/nox.git?branch=multi_cu#84858fb0cc5356421bdbed572a51ed565e04b224" dependencies = [ "async-trait", "core-distributor", diff --git a/src/tests/decider-distro-tests-rs/Cargo.toml b/src/tests/decider-distro-tests-rs/Cargo.toml index ab7fd224..c5323217 100644 --- a/src/tests/decider-distro-tests-rs/Cargo.toml +++ b/src/tests/decider-distro-tests-rs/Cargo.toml @@ -8,9 +8,9 @@ edition = "2021" [dev-dependencies] decider-distro = { path = "../../distro" } -created-swarm = { git = "https://github.com/fluencelabs/nox.git", branch = "config_diamond" } -connected-client = { git = "https://github.com/fluencelabs/nox.git", branch = "config_diamond" } -log-utils = { git = "https://github.com/fluencelabs/nox.git", branch = "config_diamond" } +created-swarm = { git = "https://github.com/fluencelabs/nox.git", branch = "multi_cu" } +connected-client = { git = "https://github.com/fluencelabs/nox.git", branch = "multi_cu" } +log-utils = { git = "https://github.com/fluencelabs/nox.git", branch = "multi_cu" } tempfile = "3.9.0" tracing = { version = "0.1.37", default-features = false, features = ["log"] } diff --git a/src/tests/decider-distro-tests-rs/tests/utils/chain.rs b/src/tests/decider-distro-tests-rs/tests/utils/chain.rs index b3ebdbd8..d8816cab 100644 --- a/src/tests/decider-distro-tests-rs/tests/utils/chain.rs +++ b/src/tests/decider-distro-tests-rs/tests/utils/chain.rs @@ -37,6 +37,7 @@ pub struct Deal { pub deal_id: String, pub app: Option, pub status: Option, + pub cus_num: u32, } impl Deal { @@ -45,6 +46,7 @@ impl Deal { deal_id: deal_id.to_string(), app: Some(app), status: Some(status.to_string()), + cus_num: 3, } } @@ -53,18 +55,26 @@ impl Deal { deal_id: deal_id.to_string(), app: None, status: None, + cus_num: 3 } } } -fn get_compute_units(ids: &Vec<&String>) -> String { - let cu_prefix = "aa3046a12a1aac6e840625e6"; - let mut result = format!("0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000{}", ids.len()); - for id in ids { +fn get_compute_units(deals: &Vec) -> String { + let mut entries = 0; + let mut result = String::new(); + for deal in deals { // a unique cid is formed by appending the deal id to some prefix of existing cuid - result.push_str(&format!("{cu_prefix}{id}000000000000000000000000{id}00000000000000000000000000000000000000000000000000000000000fffbc")); + + let id = &deal.deal_id; + for cu_i in 0..deal.cus_num { + result.push_str(&format!("{cu_i:0>24x}{id}000000000000000000000000{id}00000000000000000000000000000000000000000000000000000000000fffbc{id:1>64}")); + entries += 1; + } } - result + let mut prefix = format!("000000000000000000000000000000000000000000000000000000000000002{entries:0>65x}"); + prefix.push_str(&result); + prefix } #[derive(Clone)] @@ -116,7 +126,6 @@ pub async fn play_chain(server: &mut ServerHandle, chain_replies: ChainReplies) } pub async fn play_get_deals(server: &mut ServerHandle, deals: &Vec) { - let ids = deals.iter().map(|d| &d.deal_id).collect::>(); { // get compute units let (method, params) = server.receive_request().await.unwrap(); @@ -126,7 +135,7 @@ pub async fn play_get_deals(server: &mut ServerHandle, deals: &Vec) { Some("diamond_contract") ); - server.send_response(Ok(json!(get_compute_units(&ids)))); + server.send_response(Ok(json!(get_compute_units(&deals)))); } for _ in 0..deals.len() { @@ -172,41 +181,6 @@ pub async fn play_get_deals(server: &mut ServerHandle, deals: &Vec) { }; server.send_response(reply); } - - /* - - // get app cid - for _ in 0..deals.len() { - let (method, params) = server.receive_request().await.unwrap(); - assert_eq!(method, "eth_call"); - - let requested_deal = params[0].get("to").unwrap().as_str().unwrap(); - let deal = deals - .iter() - .find(|deal| requested_deal.ends_with(&deal.deal_id)); - assert!( - deal.is_some(), - "nox requested non-existent deal {requested_deal}, deals: {deals:?}" - ); - let deal = deal.unwrap(); - - let reply = if let Some(ref app_cid) = deal.app { - Ok(json!(app_cid.encoded_cid())) - } else { - Err(json!("no app cid provided")) - }; - server.send_response(reply); - } - - let are_apps_broken = deals.iter().any(|d| d.app.is_none()); - if are_apps_broken { - log::debug!("do not expect status calls since app cids are broken"); - return; - } - // get deal status - for _ in 0..deals.len() { - } - */ } pub async fn play_register_worker_gen(server: &mut ServerHandle, tx_hash: &Option) {