Skip to content

Commit

Permalink
Merge pull request #336 from autonomys/update-subspace
Browse files Browse the repository at this point in the history
Update Subspace to `mainnet-2024-nov-27` release
  • Loading branch information
nazar-pc authored Nov 27, 2024
2 parents 27c4bc5 + 4a3aafb commit 013e56a
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 86 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,5 +269,5 @@ jobs:
with:
tool: cargo-nextest

- name: cargo nextest run --locked
run: cargo -Zgitoxide -Zgit nextest run --locked
- name: cargo nextest run --locked --no-tests pass
run: cargo -Zgitoxide -Zgit nextest run --locked --no-tests pass
94 changes: 41 additions & 53 deletions Cargo.lock

Large diffs are not rendered by default.

36 changes: 18 additions & 18 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 Autonomys Network"
license = "0BSD"
version = "0.2.4"
version = "0.2.5"
authors = ["Nazar Mokrynskyi <[email protected]>"]
repository = "https://github.com/autonomys/space-acres"
edition = "2021"
Expand Down Expand Up @@ -71,13 +71,13 @@ reqwest = { version = "0.12.8", default-features = false, features = ["json", "r
sc-client-api = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sc-client-db = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sc-consensus-slots = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
sc-network = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sc-network-types = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sc-rpc = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sc-service = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sc-storage-monitor = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
sc-utils = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
schnellru = "0.2.3"
semver = "1.0.23"
Expand All @@ -86,23 +86,23 @@ serde_json = "1.0.132"
simple_moving_average = "1.0.2"
sp-api = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sp-consensus = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sp-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
sp-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
sp-core = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
sp-objects = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
sp-objects = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
sp-runtime = { git = "https://github.com/subspace/polkadot-sdk", rev = "94a1a8143a89bbe9f938c1939ff68abc1519a305", default-features = false }
subspace-archiving = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-fake-runtime-api = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e", default-features = false }
subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-kzg = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-networking = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-proof-of-space-gpu = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e", optional = true }
subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-service = { git = "https://github.com/subspace/subspace", rev = "8fe58495741b547af5da8d3b5349b42d3145286e" }
subspace-archiving = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-fake-runtime-api = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c", default-features = false }
subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-kzg = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-networking = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-proof-of-space-gpu = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c", optional = true }
subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
subspace-service = { git = "https://github.com/subspace/subspace", rev = "f4a19dd5bc59c4e2480bd13ce86c73fdc4cc8c2c" }
supports-color = "3.0.1"
sys-locale = "0.3.1"
tempfile = "3.13.0"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ installations from 3g.

Current features:

* Configuration (reward address, node location, multiple farms, P2P ports)
* Configuration (reward address, node location, multiple farms, P2P ports and some advanced options)
* Node sync with displayed progress, speed and ETA
* Farmer plotting/farming piece cache/plotting/replotting progress display and speed calculation
* Farmer auditing/proving performance indicators
* Farmer sector state visualization
* Desktop notifications with rewards and other notable events
* Very easy to use

Upcoming features/capabilities: see open issues, also consider contributing if something is missing!

Expand Down
33 changes: 23 additions & 10 deletions src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::backend::node::{
dsn_bootstrap_nodes, BlockImportedNotification, ChainInfo, ChainSpec, ConsensusNode,
ConsensusNodeCreationError, SyncState, GENESIS_HASH,
};
use async_lock::RwLock as AsyncRwLock;
use async_lock::{RwLock as AsyncRwLock, Semaphore};
use backoff::ExponentialBackoff;
use future::FutureExt;
use futures::channel::mpsc;
Expand Down Expand Up @@ -63,6 +63,8 @@ const PIECE_GETTER_MAX_RETRIES: u16 = 7;
const GET_PIECE_INITIAL_INTERVAL: Duration = Duration::from_secs(5);
/// Defines max duration between get_piece calls.
const GET_PIECE_MAX_INTERVAL: Duration = Duration::from_secs(40);
/// Multiplier on top of outgoing connections number for piece downloading purposes
const PIECE_PROVIDER_MULTIPLIER: usize = 10;

#[derive(Debug, Clone)]
struct PieceGetterWrapper(
Expand Down Expand Up @@ -417,20 +419,28 @@ async fn load(

let plotted_pieces = Arc::new(AsyncRwLock::new(PlottedPieces::default()));

let (maybe_node_client, node, node_runner, network_keypair, farmer_cache, farmer_cache_worker) =
create_networking_stack(
&config,
GENESIS_HASH.to_string(),
&chain_spec,
Arc::downgrade(&plotted_pieces),
notifications_sender,
)
.await?;
let (
maybe_node_client,
node,
node_runner,
network_keypair,
farmer_cache,
farmer_cache_worker,
out_connections,
) = create_networking_stack(
&config,
GENESIS_HASH.to_string(),
&chain_spec,
Arc::downgrade(&plotted_pieces),
notifications_sender,
)
.await?;

let kzg = Kzg::new();
let piece_provider = PieceProvider::new(
node.clone(),
SegmentCommitmentPieceValidator::new(node.clone(), maybe_node_client.clone(), kzg.clone()),
Semaphore::new(out_connections as usize * PIECE_PROVIDER_MULTIPLIER),
);

let piece_getter = PieceGetterWrapper::new(FarmerPieceGetter::new(
Expand Down Expand Up @@ -776,6 +786,7 @@ async fn create_networking_stack(
Keypair,
FarmerCache,
FarmerCacheWorker<MaybeNodeClient>,
u32,
)> {
notifications_sender
.send(BackendNotification::Loading(
Expand Down Expand Up @@ -881,6 +892,7 @@ async fn create_networking_stack(
network_options.pending_in_connections = 500;
network_options.pending_out_connections = 500;
}
let out_connections = network_options.out_connections;
let maybe_node_client = MaybeNodeClient::default();

let (farmer_cache, farmer_cache_worker) = FarmerCache::new(
Expand Down Expand Up @@ -912,6 +924,7 @@ async fn create_networking_stack(
network_keypair,
farmer_cache,
farmer_cache_worker,
out_connections,
))
}

Expand Down
4 changes: 2 additions & 2 deletions src/backend/farmer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::backend::utils::{Handler, HandlerFn};
use crate::backend::PieceGetterWrapper;
use crate::PosTable;
use anyhow::anyhow;
use async_lock::{Mutex as AsyncMutex, RwLock as AsyncRwLock};
use async_lock::{Mutex as AsyncMutex, RwLock as AsyncRwLock, Semaphore};
use bytesize::ByteSize;
use event_listener_primitives::HandlerId;
use futures::channel::{mpsc, oneshot};
Expand Down Expand Up @@ -45,7 +45,7 @@ use subspace_farmer::utils::{
use subspace_farmer_components::plotting::PlottedSector;
use subspace_kzg::Kzg;
use thread_priority::ThreadPriority;
use tokio::sync::{watch, Barrier, Semaphore};
use tokio::sync::{watch, Barrier};
use tracing::{debug, error, info, info_span, Instrument};

/// Minimal cache percentage, there is no need in setting it higher
Expand Down
2 changes: 2 additions & 0 deletions src/backend/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ pub(super) async fn create_consensus_node(
subspace_networking: SubspaceNetworking::Reuse {
node,
bootstrap_nodes: dsn_bootstrap_nodes,
// This will not be used since we provide piece getter explicitly below
max_connections: 0,
},
dsn_piece_getter: Some(piece_getter),
is_timekeeper: false,
Expand Down

0 comments on commit 013e56a

Please sign in to comment.