Skip to content

Commit

Permalink
Merge pull request #214 from subspace/update-subspace
Browse files Browse the repository at this point in the history
Update Subspace to upcoming `gemini-3h-2024-jul-05` release
  • Loading branch information
nazar-pc authored Jul 5, 2024
2 parents 3db9689 + 6f0297a commit 51c0380
Show file tree
Hide file tree
Showing 8 changed files with 1,445 additions and 1,219 deletions.
2,504 changes: 1,354 additions & 1,150 deletions Cargo.lock

Large diffs are not rendered by default.

96 changes: 50 additions & 46 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "space-acres"
description = "Space Acres is an opinionated GUI application for farming on Subspace Network"
license = "0BSD"
version = "0.1.24"
version = "0.1.25"
authors = ["Nazar Mokrynskyi <nazar@mokrynskyi.com>"]
repository = "https://github.com/subspace/space-acres"
edition = "2021"
Expand Down Expand Up @@ -35,77 +35,76 @@ product-icon = "res/windows/space-acres.ico"
product-name = "Space Acres"

[dependencies]
anyhow = "1.0.83"
anyhow = "1.0.86"
arc-swap = "1.7.1"
async-lock = "3.3.0"
async-lock = "3.4.0"
async-oneshot = "0.5.9"
async-trait = "0.1.80"
backoff = { version = "0.4.0", features = ["futures", "tokio"] }
betrayer = { version = "0.2.0" }
bytesize = "1.3.0"
clap = { version = "4.5.4", features = ["derive"] }
clap = { version = "4.5.8", features = ["derive"] }
dark-light = "1.1.1"
dirs = "5.0.1"
duct = "0.13.7"
event-listener-primitives = "2.0.1"
file-rotate = "0.7.5"
frame-system = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
fs4 = "0.8.3"
file-rotate = "0.7.6"
frame-system = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
fs4 = "0.8.4"
futures = "0.3.30"
futures-timer = "3.0.3"
gtk = { version = "0.7.3", package = "gtk4" }
hex = "0.4.3"
image = { version = "0.25.1", default-features = false, features = ["png"] }
indoc = "2.0.5"
# Substrate uses old version of libp2p
libp2p-identity-substate = { version = "0.1.3", package = "libp2p-identity" }
mimalloc = "0.1.41"
names = "0.14.0"
open = "5.1.2"
pallet-balances = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
open = "5.2.0"
pallet-balances = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
parity-scale-codec = "3.6.12"
parking_lot = "0.12.2"
parking_lot = "0.12.3"
relm4 = "0.7.0-rc.1"
relm4-components = { version = "0.7.0-rc.1", default-features = false }
relm4-icons = { version = "0.7.0-alpha.2", features = ["checkmark", "cross", "grid-filled", "menu-large", "pause", "processor", "puzzle-piece", "size-horizontally", "ssd", "wallet2", "warning"] }
reqwest = { version = "0.12.4", default-features = false, features = ["json", "rustls-tls"] }
sc-client-api = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sc-client-db = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sc-consensus-slots = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
sc-informant = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sc-network = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sc-rpc = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sc-service = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sc-storage-monitor = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
sc-utils = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sc-client-api = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sc-client-db = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sc-consensus-slots = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
sc-informant = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sc-network = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sc-network-types = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sc-rpc = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sc-service = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sc-storage-monitor = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
sc-utils = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
schnellru = "0.2.3"
semver = "1.0.23"
serde = { version = "1.0.202", features = ["derive"] }
serde_json = "1.0.117"
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.120"
simple_moving_average = "1.0.2"
sp-api = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sp-blockchain = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sp-consensus = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sp-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
sp-core = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
sp-domains-fraud-proof = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
sp-objects = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
sp-runtime = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6", default-features = false }
subspace-archiving = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
subspace-fake-runtime-api = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155", default-features = false }
subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
subspace-networking = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
subspace-service = { git = "https://github.com/subspace/subspace", rev = "870bc43614db409cfa588ca57b1be9bbd3aa7155" }
sp-api = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sp-blockchain = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sp-consensus = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sp-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
sp-core = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
sp-domains-fraud-proof = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
sp-objects = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
sp-runtime = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false }
subspace-archiving = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
subspace-fake-runtime-api = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4", default-features = false }
subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
subspace-networking = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
subspace-service = { git = "https://github.com/subspace/subspace", rev = "95b4183fe1d5de7ac96a6961e42ac7053e3360f4" }
supports-color = "3.0.0"
thiserror = "1.0.60"
thiserror = "1.0.61"
thread-priority = "1.1.0"
tokio = { version = "1.38.0", features = ["fs", "time"] }
tracing = "0.1.40"
Expand Down Expand Up @@ -192,6 +191,11 @@ panic = "unwind"
inherits = "release"
lto = "fat"

# TODO: Remove fork when https://github.com/paritytech/polkadot-sdk/issues/4856 and/or https://github.com/paritytech/litep2p/issues/161
# are resolved (our fork removes WebRTC support by default in order to avoid OpenSSL dependency)
[patch.crates-io]
litep2p = { git = "https://github.com/subspace/litep2p", rev = "331240c0184e9e8939ef9b113963dc58b43e2f92" }

[patch."https://github.com/paritytech/polkadot-sdk.git"]
# TODO: https://github.com/paritytech/arkworks-substrate depends on Substrate's git commit and requires override
sp-crypto-ec-utils = { git = "https://github.com/subspace/polkadot-sdk", rev = "6da3c45e1d5b3c1f09b5e54152b8848149f9d5e6" }
sp-crypto-ec-utils = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef" }
8 changes: 4 additions & 4 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ use std::sync::{Arc, Weak};
use std::time::Duration;
use subspace_core_primitives::crypto::kzg::{embedded_kzg_settings, Kzg};
use subspace_core_primitives::{BlockNumber, Piece, PieceIndex, PublicKey};
use subspace_farmer::farm::plotted_pieces::PlottedPieces;
use subspace_farmer::farmer_cache::{FarmerCache, FarmerCacheWorker};
use subspace_farmer::single_disk_farm::SingleDiskFarm;
use subspace_farmer::utils::farmer_piece_getter::{
use subspace_farmer::farmer_piece_getter::piece_validator::SegmentCommitmentPieceValidator;
use subspace_farmer::farmer_piece_getter::{
DsnCacheRetryPolicy, FarmerPieceGetter, WeakFarmerPieceGetter,
};
use subspace_farmer::utils::piece_validator::SegmentCommitmentPieceValidator;
use subspace_farmer::utils::plotted_pieces::PlottedPieces;
use subspace_farmer::single_disk_farm::SingleDiskFarm;
use subspace_farmer::utils::run_future_in_dedicated_thread;
use subspace_farmer_components::PieceGetter;
use subspace_networking::libp2p::identity::ed25519::{Keypair, SecretKey};
Expand Down
25 changes: 18 additions & 7 deletions src/backend/farmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub(super) mod maybe_node_client;
use crate::backend::farmer::maybe_node_client::MaybeNodeClient;
use crate::backend::utils::{Handler, HandlerFn};
use crate::backend::PieceGetterWrapper;
use crate::PosTable;
use crate::{PosTable, PosTableLegacy};
use anyhow::anyhow;
use async_lock::{Mutex as AsyncMutex, RwLock as AsyncRwLock};
use event_listener_primitives::HandlerId;
Expand All @@ -23,6 +23,7 @@ use std::{fmt, fs};
use subspace_core_primitives::crypto::kzg::Kzg;
use subspace_core_primitives::{PublicKey, Record, SectorIndex};
use subspace_erasure_coding::ErasureCoding;
use subspace_farmer::farm::plotted_pieces::PlottedPieces;
use subspace_farmer::farm::{
FarmingNotification, PlottedSectors, SectorPlottingDetails, SectorUpdate,
};
Expand All @@ -32,7 +33,6 @@ use subspace_farmer::plotter::cpu::CpuPlotter;
use subspace_farmer::single_disk_farm::{
SingleDiskFarm, SingleDiskFarmError, SingleDiskFarmOptions,
};
use subspace_farmer::utils::plotted_pieces::PlottedPieces;
use subspace_farmer::utils::{
create_plotting_thread_pool_manager, recommended_number_of_farming_threads,
run_future_in_dedicated_thread, thread_pool_core_indices, AsyncJoinOnDrop,
Expand Down Expand Up @@ -295,8 +295,17 @@ where
)?;

let global_mutex = Arc::default();
let plotter = Arc::new(CpuPlotter::<_, PosTable>::new(
piece_getter,
let legacy_cpu_plotter = Arc::new(CpuPlotter::<_, PosTableLegacy>::new(
piece_getter.clone(),
Arc::clone(&downloading_semaphore),
plotting_thread_pool_manager.clone(),
record_encoding_concurrency,
Arc::clone(&global_mutex),
kzg.clone(),
erasure_coding.clone(),
));
let modern_cpu_plotter = Arc::new(CpuPlotter::<_, PosTable>::new(
piece_getter.clone(),
downloading_semaphore,
plotting_thread_pool_manager.clone(),
record_encoding_concurrency,
Expand Down Expand Up @@ -325,22 +334,25 @@ where
let max_pieces_in_sector = farmer_app_info.protocol_info.max_pieces_in_sector;
let kzg = kzg.clone();
let erasure_coding = erasure_coding.clone();
let plotter = Arc::clone(&plotter);
let plotter_legacy = Arc::clone(&legacy_cpu_plotter);
let plotter = Arc::clone(&modern_cpu_plotter);
let global_mutex = Arc::clone(&global_mutex);
let faster_read_sector_record_chunks_mode_barrier =
Arc::clone(&faster_read_sector_record_chunks_mode_barrier);
let faster_read_sector_record_chunks_mode_concurrency =
Arc::clone(&faster_read_sector_record_chunks_mode_concurrency);

async move {
let farm_fut = SingleDiskFarm::new::<_, _, PosTable>(
let farm_fut = SingleDiskFarm::new::<_, PosTableLegacy, PosTable>(
SingleDiskFarmOptions {
directory: disk_farm.directory.clone(),
farmer_app_info,
allocated_space: disk_farm.allocated_plotting_space,
max_pieces_in_sector,
node_client,
reward_address,
plotter_legacy,
plotter,
kzg,
erasure_coding,
cache_percentage: CACHE_PERCENTAGE.get(),
Expand All @@ -351,7 +363,6 @@ where
read_sector_record_chunks_mode: None,
faster_read_sector_record_chunks_mode_barrier,
faster_read_sector_record_chunks_mode_concurrency,
plotter,
create: true,
},
farm_index,
Expand Down
2 changes: 1 addition & 1 deletion src/backend/networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::fmt;
use std::hash::Hash;
use std::path::Path;
use std::sync::{Arc, Weak};
use subspace_farmer::farm::plotted_pieces::PlottedPieces;
use subspace_farmer::farmer_cache::FarmerCache;
use subspace_farmer::node_client::NodeClientExt;
use subspace_farmer::utils::plotted_pieces::PlottedPieces;
use subspace_farmer::KNOWN_PEERS_CACHE_SIZE;
use subspace_networking::libp2p::identity::ed25519::Keypair;
use subspace_networking::libp2p::kad::RecordKey;
Expand Down
Loading

0 comments on commit 51c0380

Please sign in to comment.