Skip to content

Commit

Permalink
fix(system-services): Update to the new decider (#2253)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmd-fl authored Jun 5, 2024
1 parent b6e15d5 commit d8be027
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 41 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
- nox-snapshot
uses: fluencelabs/cli/.github/workflows/tests.yml@main
with:
ref: change-nox-config
nox-image: "${{ needs.nox-snapshot.outputs.nox-image }}"


Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/system-services/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"

[dependencies]
aqua-ipfs-distro = "=0.6.0"
decider-distro = "=0.6.12"
decider-distro = "=0.7.0"
registry-distro = "=0.9.4"
trust-graph-distro = "=0.4.11"

Expand Down
42 changes: 4 additions & 38 deletions crates/system-services/src/distro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use fluence_app_service::TomlMarineConfig;
use fluence_spell_dtos::trigger_config::TriggerConfig;
use serde_json::json;
use server_config::system_services_config::{
AquaIpfsConfig, ConnectorConfig, DeciderConfig, RegistryConfig, ServiceKey, ServiceKey::*,
SystemServicesConfig,
AquaIpfsConfig, DeciderConfig, RegistryConfig, ServiceKey, ServiceKey::*, SystemServicesConfig,
};
use std::collections::HashMap;
use std::sync::Arc;
Expand Down Expand Up @@ -64,7 +63,7 @@ impl SystemServiceDistros {
AquaIpfs => default_aqua_ipfs_distro(&config.aqua_ipfs),
TrustGraph => default_trust_graph_distro(),
Registry => default_registry_distro(&config.registry),
Decider => default_decider_distro(&config.decider, &config.connector),
Decider => default_decider_distro(&config.decider),
};
distro.map(move |d| (d.name.clone(), d))
})
Expand Down Expand Up @@ -292,44 +291,11 @@ pub fn default_registry_distro(config: &RegistryConfig) -> eyre::Result<PackageD
Ok(package)
}

pub fn default_decider_distro<'a>(
decider_config: &DeciderConfig,
connector_config: &ConnectorConfig,
) -> eyre::Result<PackageDistro> {
// prepare connector
let connector_service_distro = decider_distro::connector_service_modules();
let mut marine_config: TomlMarineConfig =
toml_edit::de::from_slice(connector_service_distro.config)?;
apply_binary_path_override(
&mut marine_config,
"curl_adapter",
"curl",
connector_config.curl_binary_path.clone(),
);

let service_distro = ServiceDistro {
modules: connector_service_distro.modules,
config: marine_config,
name: connector_service_distro.name.to_string(),
};

let wallet_key = match decider_config.wallet_key.clone() {
// TODO: set default wallet key somewhere in nox-distro, etc
//None => return Err(eyre!("Decider enabled, but wallet_key is not set. Please set it via env FLUENCE_ENV_CONNECTOR_WALLET_KEY or in Config.toml")),
None => "0xfdc4ba94809c7930fe4676b7d845cbf8fa5c1beae8744d959530e5073004cf3f".to_string(),
Some(key) => key,
};

pub fn default_decider_distro(decider_config: &DeciderConfig) -> eyre::Result<PackageDistro> {
// prepare decider
let decider_settings = decider_distro::DeciderConfig {
worker_period_sec: decider_config.worker_period_sec,
worker_ipfs_multiaddr: decider_config.worker_ipfs_multiaddr.clone(),
chain_api_endpoint: decider_config.network_api_endpoint.clone(),
chain_network_id: decider_config.network_id,
chain_contract_block_hex: decider_config.start_block.clone(),
chain_matcher_addr: decider_config.matcher_address.clone(),
chain_workers_gas: decider_config.worker_gas,
chain_wallet_key: wallet_key,
};
let decider_spell_distro = decider_distro::decider_spell(decider_settings);
let mut decider_trigger_config = TriggerConfig::default();
Expand All @@ -345,7 +311,7 @@ pub fn default_decider_distro<'a>(
let package = PackageDistro {
name: Decider.to_string(),
version: decider_distro::VERSION,
services: vec![service_distro],
services: vec![],
spells: vec![spell_distro],
init: None,
};
Expand Down

0 comments on commit d8be027

Please sign in to comment.