diff --git a/Cargo.lock b/Cargo.lock index 3962d83..2e5e0bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2204,7 +2204,7 @@ checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" [[package]] name = "cross-domain-message-gossip" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "domain-block-preprocessor", "fp-account", @@ -2691,7 +2691,7 @@ dependencies = [ [[package]] name = "domain-block-preprocessor" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-trait", "domain-runtime-primitives", @@ -2724,7 +2724,7 @@ dependencies = [ [[package]] name = "domain-runtime-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "fixed-hash", "fp-account", @@ -9425,7 +9425,7 @@ dependencies = [ [[package]] name = "sc-consensus-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-trait", "futures", @@ -9465,7 +9465,7 @@ dependencies = [ [[package]] name = "sc-consensus-subspace-rpc" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-oneshot", "futures", @@ -9498,7 +9498,7 @@ dependencies = [ [[package]] name = "sc-domains" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "sc-client-api", "sc-executor", @@ -9861,7 +9861,7 @@ dependencies = [ [[package]] name = "sc-proof-of-time" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "atomic", "core_affinity", @@ -10093,7 +10093,7 @@ dependencies = [ [[package]] name = "sc-subspace-block-relay" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-channel 1.9.0", "async-trait", @@ -10118,7 +10118,7 @@ dependencies = [ [[package]] name = "sc-subspace-chain-specs" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" [[package]] name = "sc-sysinfo" @@ -10869,7 +10869,7 @@ dependencies = [ [[package]] name = "sp-auto-id" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "parity-scale-codec", "scale-info", @@ -10893,7 +10893,7 @@ dependencies = [ [[package]] name = "sp-block-fees" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-trait", "domain-runtime-primitives", @@ -10987,7 +10987,7 @@ dependencies = [ [[package]] name = "sp-consensus-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-trait", "log", @@ -11123,7 +11123,7 @@ dependencies = [ [[package]] name = "sp-domain-digests" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "parity-scale-codec", "sp-runtime", @@ -11132,7 +11132,7 @@ dependencies = [ [[package]] name = "sp-domain-sudo" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-trait", "parity-scale-codec", @@ -11143,7 +11143,7 @@ dependencies = [ [[package]] name = "sp-domains" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "blake2 0.10.6", "domain-runtime-primitives", @@ -11175,7 +11175,7 @@ dependencies = [ [[package]] name = "sp-domains-fraud-proof" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "domain-block-preprocessor", "domain-runtime-primitives", @@ -11210,7 +11210,7 @@ dependencies = [ [[package]] name = "sp-executive" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-trait", "parity-scale-codec", @@ -11301,7 +11301,7 @@ dependencies = [ [[package]] name = "sp-messenger" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-trait", "frame-support", @@ -11323,7 +11323,7 @@ dependencies = [ [[package]] name = "sp-messenger-host-functions" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "domain-block-preprocessor", "parity-scale-codec", @@ -11380,7 +11380,7 @@ dependencies = [ [[package]] name = "sp-objects" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "sp-api", "subspace-core-primitives", @@ -11565,7 +11565,7 @@ dependencies = [ [[package]] name = "sp-subspace-mmr" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "parity-scale-codec", "scale-info", @@ -11916,7 +11916,7 @@ dependencies = [ [[package]] name = "subspace-archiving" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "parity-scale-codec", "rayon", @@ -11929,7 +11929,7 @@ dependencies = [ [[package]] name = "subspace-core-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "blake3", "bytes", @@ -11953,7 +11953,7 @@ dependencies = [ [[package]] name = "subspace-erasure-coding" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "kzg", "rust-kzg-blst", @@ -11963,7 +11963,7 @@ dependencies = [ [[package]] name = "subspace-fake-runtime-api" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "domain-runtime-primitives", "frame-support", @@ -11995,7 +11995,7 @@ dependencies = [ [[package]] name = "subspace-farmer" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "anyhow", "async-lock", @@ -12056,7 +12056,7 @@ dependencies = [ [[package]] name = "subspace-farmer-components" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-lock", "async-trait", @@ -12087,7 +12087,7 @@ dependencies = [ [[package]] name = "subspace-metrics" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "actix-web", "prometheus", @@ -12098,7 +12098,7 @@ dependencies = [ [[package]] name = "subspace-networking" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "async-mutex", "async-trait", @@ -12136,7 +12136,7 @@ dependencies = [ [[package]] name = "subspace-proof-of-space" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "chacha20", "derive_more", @@ -12151,7 +12151,7 @@ dependencies = [ [[package]] name = "subspace-proof-of-time" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "aes 0.9.0-pre.1", "subspace-core-primitives", @@ -12161,7 +12161,7 @@ dependencies = [ [[package]] name = "subspace-rpc-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "hex", "parity-scale-codec", @@ -12174,7 +12174,7 @@ dependencies = [ [[package]] name = "subspace-runtime-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "frame-support", "frame-system", @@ -12189,7 +12189,7 @@ dependencies = [ [[package]] name = "subspace-service" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "array-bytes", "async-channel 1.9.0", @@ -12273,7 +12273,7 @@ dependencies = [ [[package]] name = "subspace-verification" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=55066638508daa4e323ce01e567ec8be1417ea07#55066638508daa4e323ce01e567ec8be1417ea07" +source = "git+https://github.com/subspace/subspace?rev=96c296154a483743881d68ee0f5d4543ee0f5032#96c296154a483743881d68ee0f5d4543ee0f5032" dependencies = [ "parity-scale-codec", "schnorrkel", diff --git a/Cargo.toml b/Cargo.toml index 6c847ce..0105657 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,14 +68,14 @@ reqwest = { version = "0.12.4", default-features = false, features = ["json", "r 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 = "55066638508daa4e323ce01e567ec8be1417ea07" } +sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } 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 = "55066638508daa4e323ce01e567ec8be1417ea07" } +sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } sc-utils = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false } schnellru = "0.2.3" semver = "1.0.23" @@ -85,22 +85,22 @@ simple_moving_average = "1.0.2" 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 = "55066638508daa4e323ce01e567ec8be1417ea07" } +sp-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } 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 = "55066638508daa4e323ce01e567ec8be1417ea07" } -sp-objects = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } +sp-domains-fraud-proof = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +sp-objects = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } sp-runtime = { git = "https://github.com/subspace/polkadot-sdk", rev = "0cbfcb0232bbf71ac5b14cc8c99bf043cec420ef", default-features = false } -subspace-archiving = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } -subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } -subspace-fake-runtime-api = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07", default-features = false } -subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } -subspace-networking = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } -subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } -subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } -subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } -subspace-service = { git = "https://github.com/subspace/subspace", rev = "55066638508daa4e323ce01e567ec8be1417ea07" } +subspace-archiving = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +subspace-fake-runtime-api = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032", default-features = false } +subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +subspace-networking = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } +subspace-service = { git = "https://github.com/subspace/subspace", rev = "96c296154a483743881d68ee0f5d4543ee0f5032" } supports-color = "3.0.0" sys-locale = "0.3.1" tempfile = "3.10.1" diff --git a/res/translations/en/messages.ftl b/res/translations/en/messages.ftl index a96dc99..99d0763 100644 --- a/res/translations/en/messages.ftl +++ b/res/translations/en/messages.ftl @@ -37,7 +37,7 @@ loading_networking_stack_step_generating_keypair = Generating network keypair... loading_networking_stack_step_writing_keypair_to_disk = Writing network keypair to disk... loading_networking_stack_step_instantiating = Instantiating networking stack... loading_networking_stack_step_created_successfully = Networking stack created successfully -loading_consensus_node_title = Initializing networking stack +loading_consensus_node_title = Initializing consensus node loading_consensus_node_step_creating = Creating consensus node... loading_consensus_node_step_created_successfully = Consensus node created successfully loading_farmer_title = Instantiating farmer @@ -67,8 +67,12 @@ configuration_farm_path_placeholder = Example: {$path} configuration_farm_path_tooltip = Absolute path where farm files will be stored, any SSD works, high endurance not necessary configuration_farm_path_button_select = Select configuration_farm_path_error_doesnt_exist_or_write_permissions = Folder doesn't exist or user is lacking write permissions -configuration_farm_size_placeholder = Example: 4T, 2.5TB, 500GiB, etc. -configuration_farm_size_tooltip = Size of the farm in whichever units you prefer, any amount of space above 2 GB works +configuration_farm_size_kind_fixed = Fixed size +configuration_farm_size_kind_free_percentage = % of free disk space +configuration_farm_fixed_size_placeholder = Example: 4T, 2.5TB, 500GiB, etc. +configuration_farm_fixed_size_tooltip = Size of the farm in whichever units you prefer, any amount of space above 2 GB works +configuration_farm_free_percentage_size_placeholder = Example: 100%, 1.1%, etc. +configuration_farm_free_percentage_size_tooltip = Percentage of free disk space to occupy by this farm, anything above 0% works, but at least 2 GB of free space should remain on disk to avoid errors configuration_farm_delete = Delete this farm configuration_advanced = Advanced configuration configuration_advanced_network = Network configuration diff --git a/res/translations/rs/messages.ftl b/res/translations/rs/messages.ftl index ded90cb..a0f7164 100644 --- a/res/translations/rs/messages.ftl +++ b/res/translations/rs/messages.ftl @@ -37,7 +37,8 @@ loading_networking_stack_step_generating_keypair = Generisanje mrežnog para klj loading_networking_stack_step_writing_keypair_to_disk = Pisanje mrežnog para ključeva na disk... loading_networking_stack_step_instantiating = Stvaranje mrežnog steka... loading_networking_stack_step_created_successfully = Mrežni stek je uspešno kreiran -loading_consensus_node_title = Inicijalizacija mrežnog steka +# TODO: Translate +loading_consensus_node_title = Initializing consensus node loading_consensus_node_step_creating = Kreiranje konsenzus čvora... loading_consensus_node_step_created_successfully = Konsenzus čvor uspešno kreiran loading_farmer_title = Inicijalizacija farmera @@ -67,8 +68,15 @@ configuration_farm_path_placeholder = Primer: {$path} configuration_farm_path_tooltip = Apsolutna putanja gde će se čuvati datoteke farme, bilo koji SSD funkcioniše, visoka izdržljivost nije neophodna configuration_farm_path_button_select = Izaberi configuration_farm_path_error_doesnt_exist_or_write_permissions = Folder ne postoji ili korisnik nema dozvolu za pisanje -configuration_farm_size_placeholder = Primer: 4T, 2.5TB, 500GiB itd. -configuration_farm_size_tooltip = Veličina farme u jedinicama koje preferirate, bilo koja količina prostora iznad 2 GB funkcioniše +# TODO: Translate +configuration_farm_size_kind_fixed = Fixed size +# TODO: Translate +configuration_farm_size_kind_free_percentage = % of free disk space +configuration_farm_fixed_size_placeholder = Primer: 4T, 2.5TB, 500GiB itd. +configuration_farm_fixed_size_tooltip = Veličina farme u jedinicama koje preferirate, bilo koja količina prostora iznad 2 GB funkcioniše +configuration_farm_free_percentage_size_placeholder = Primer: 100%, 1.1%, itd. +# TODO: Translate +configuration_farm_free_percentage_size_tooltip = Percentage of free disk space to occupy by this farm, anything above 0% works, but at least 2 GB of free space should remain on disk to avoid errors configuration_farm_delete = Obriši ovu farmu configuration_advanced = Napredna konfiguracija configuration_advanced_network = Konfiguracija mreže diff --git a/res/translations/zh-CN/messages.ftl b/res/translations/zh-CN/messages.ftl index 9e9ac77..fe2399f 100644 --- a/res/translations/zh-CN/messages.ftl +++ b/res/translations/zh-CN/messages.ftl @@ -37,7 +37,8 @@ loading_networking_stack_step_generating_keypair = 生成网络密钥对... loading_networking_stack_step_writing_keypair_to_disk = 写入网络密钥对到磁盘... loading_networking_stack_step_instantiating = 实例化网络工作栈... loading_networking_stack_step_created_successfully = 网络工作栈创建成功 -loading_consensus_node_title = 初始化网络工作栈 +# TODO: Translate +loading_consensus_node_title = Initializing consensus node loading_consensus_node_step_creating = 创建共识节点... loading_consensus_node_step_created_successfully = 共识节点创建成功 loading_farmer_title = 实例化农民 @@ -67,8 +68,15 @@ configuration_farm_path_placeholder = 示例: {$path} configuration_farm_path_tooltip = 存储农场数据文件的绝对路径,可使用任何类型的 SSD configuration_farm_path_button_select = 选择 configuration_farm_path_error_doesnt_exist_or_write_permissions = 文件目录不存在或当前用户无写入权限 -configuration_farm_size_placeholder = 示例: 4T, 2.5TB, 500GiB, 等. -configuration_farm_size_tooltip = 农场单元的大小,可以使用任何大于 2GB 的值 +# TODO: Translate +configuration_farm_size_kind_fixed = Fixed size +# TODO: Translate +configuration_farm_size_kind_free_percentage = % of free disk space +configuration_farm_fixed_size_placeholder = 示例: 4T, 2.5TB, 500GiB, 等. +configuration_farm_fixed_size_tooltip = 农场单元的大小,可以使用任何大于 2GB 的值 +configuration_farm_free_percentage_size_placeholder = 示例: 100%, 1.1%, 等. +# TODO: Translate +configuration_farm_free_percentage_size_tooltip = Percentage of free disk space to occupy by this farm, anything above 0% works, but at least 2 GB of free space should remain on disk to avoid errors configuration_farm_delete = 删除这个农场 configuration_advanced = 高级配置 configuration_advanced_network = 网络配置 diff --git a/src/backend/config.rs b/src/backend/config.rs index 851452f..ddd2336 100644 --- a/src/backend/config.rs +++ b/src/backend/config.rs @@ -1,22 +1,29 @@ -use crate::backend::farmer::DiskFarm; +use crate::backend::farmer::{DiskFarm, CACHE_PERCENTAGE}; use bytesize::ByteSize; use serde::{Deserialize, Serialize}; use std::io; use std::path::{Path, PathBuf}; use std::str::FromStr; use subspace_core_primitives::PublicKey; +use subspace_farmer::single_disk_farm::SingleDiskFarm; use subspace_farmer::utils::ss58::{parse_ss58_reward_address, Ss58ParsingError}; use tokio::io::AsyncWriteExt; use tokio::task; +use tracing::warn; const DEFAULT_SUBSTRATE_PORT: u16 = 30333; const DEFAULT_SUBSPACE_PORT: u16 = 30433; +pub const MIN_FARM_SIZE: u64 = ByteSize::gb(2).as_u64(); +/// Marginal difference in farm size that will not trigger resizing +const FARM_SIZE_DIFF_MARGIN: u64 = ByteSize::gib(5).as_u64(); +/// Margin for farm size allocation relatively to available space +const FARM_SIZE_ALLOCATION_MARGIN: u64 = ByteSize::gib(2).as_u64(); -// TODO: Replace with `DiskFarm` #[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Farm { pub path: PathBuf, + /// Could be absolute value or percentage of free disk space (when ends with `%`) pub size: String, } @@ -202,20 +209,99 @@ impl Config { let mut farms = Vec::with_capacity(raw_config.farms().len()); for farm in raw_config.farms() { - let path = PathBuf::from(&farm.path); + check_path(farm.path.clone()).await?; + + let farm_details_fut = task::spawn_blocking({ + let farm = farm.clone(); + + move || { + let fs_stats = fs4::statvfs(&farm.path)?; + let effective_disk_usage = + SingleDiskFarm::effective_disk_usage(&farm.path, CACHE_PERCENTAGE.get()) + .map_err(|error| { + io::Error::new( + io::ErrorKind::Other, + format!("Failed to check effective disk usage: {error}"), + ) + })?; + + Ok((fs_stats, effective_disk_usage)) + } + }); + let farm_details_result = farm_details_fut + .await + .map_err(|error| { + io::Error::new( + io::ErrorKind::Other, + format!("Failed to spawn tokio task: {error}"), + ) + }) + .flatten(); + + let (fs_stats, effective_disk_usage) = match farm_details_result { + Ok(result) => result, + Err(error) => { + return Err(ConfigError::PathError { + path: farm.path.display().to_string(), + error, + }); + } + }; + // Includes "virtual" free space that corresponds to the space farm already occupies, + // which simplifies logic below when checking amount of space farm is able to occupy + let available_space = fs_stats.available_space() + effective_disk_usage; + + let target_size = if farm.size.ends_with("%") { + let size_percentage = + f64::from_str(farm.size.trim_end_matches('%')).map_err(|error| { + ConfigError::InvalidSizeFormat { + size: farm.size.clone(), + error: error.to_string(), + } + })?; + if size_percentage <= 0.0 || size_percentage > 100.0 { + return Err(ConfigError::InvalidSizeFormat { + size: farm.size.clone(), + error: "Size percentage should be above 0% and not exceed 100%".to_string(), + }); + } - check_path(path.clone()).await?; + let target_size = (available_space - FARM_SIZE_ALLOCATION_MARGIN) as f64 + * size_percentage + / 100.0; + let target_size = MIN_FARM_SIZE.max(target_size.round() as u64); - let size = ByteSize::from_str(&farm.size) - .map_err(|error| ConfigError::InvalidSizeFormat { - size: farm.size.clone(), - error, - })? - .as_u64(); + if target_size.abs_diff(effective_disk_usage) <= FARM_SIZE_DIFF_MARGIN { + effective_disk_usage + } else { + target_size + } + } else { + ByteSize::from_str(&farm.size) + .map_err(|error| ConfigError::InvalidSizeFormat { + size: farm.size.clone(), + error, + })? + .as_u64() + }; + + let size = if target_size > available_space { + let new_size = available_space - FARM_SIZE_ALLOCATION_MARGIN; + warn!( + target_size, + available_space, + new_size, + "Overriding farm size due to not enough available space" + ); + + new_size + } else { + target_size + }; farms.push(DiskFarm { - directory: path, - allocated_plotting_space: size, + directory: farm.path.clone(), + allocated_space: size, }); } diff --git a/src/backend/farmer.rs b/src/backend/farmer.rs index 47817cb..c07eeb8 100644 --- a/src/backend/farmer.rs +++ b/src/backend/farmer.rs @@ -7,6 +7,7 @@ use crate::backend::PieceGetterWrapper; use crate::{PosTable, PosTableLegacy}; use anyhow::anyhow; use async_lock::{Mutex as AsyncMutex, RwLock as AsyncRwLock}; +use bytesize::ByteSize; use event_listener_primitives::HandlerId; use futures::channel::{mpsc, oneshot}; use futures::future::BoxFuture; @@ -46,7 +47,7 @@ use tracing::{debug, error, info, info_span, Instrument}; pub(super) const CACHE_PERCENTAGE: NonZeroU8 = NonZeroU8::MIN; /// NOTE: for large gaps between the plotted part and the end of the file plot cache will result in /// very long period of writing zeroes on Windows, see https://stackoverflow.com/q/78058306/3806795 -const MAX_SPACE_PLEDGED_FOR_PLOT_CACHE_ON_WINDOWS: u64 = 7 * 1024 * 1024 * 1024 * 1024; +const MAX_SPACE_PLEDGED_FOR_PLOT_CACHE_ON_WINDOWS: u64 = ByteSize::tib(7).as_u64(); const FARM_ERROR_PRINT_INTERVAL: Duration = Duration::from_secs(30); #[derive(Debug, Default, Copy, Clone, PartialEq)] @@ -173,7 +174,7 @@ impl fmt::Debug for Farmer { #[derive(Debug, Clone)] pub struct DiskFarm { pub directory: PathBuf, - pub allocated_plotting_space: u64, + pub allocated_space: u64, } /// Arguments for farmer @@ -236,7 +237,7 @@ where let plot_cache = !cfg!(windows) || disk_farms .iter() - .map(|farm| farm.allocated_plotting_space) + .map(|farm| farm.allocated_space) .sum::() <= MAX_SPACE_PLEDGED_FOR_PLOT_CACHE_ON_WINDOWS; @@ -356,7 +357,7 @@ where SingleDiskFarmOptions { directory: disk_farm.directory.clone(), farmer_app_info, - allocated_space: disk_farm.allocated_plotting_space, + allocated_space: disk_farm.allocated_space, max_pieces_in_sector, node_client, reward_address, diff --git a/src/frontend/configuration/farm.rs b/src/frontend/configuration/farm.rs index 6825e8c..aebabd0 100644 --- a/src/frontend/configuration/farm.rs +++ b/src/frontend/configuration/farm.rs @@ -1,7 +1,8 @@ -use crate::backend::config::Farm; +use crate::backend::config::{Farm, MIN_FARM_SIZE}; use crate::frontend::configuration::MaybeValid; use bytesize::ByteSize; use gtk::prelude::*; +use std::fmt; // TODO: Remove import once in prelude: https://github.com/Relm4/Relm4/issues/662 use relm4::factory::AsyncFactoryComponent; use relm4::prelude::*; @@ -9,20 +10,47 @@ use relm4::prelude::*; use crate::frontend::configuration::utils::is_directory_writable; use crate::frontend::translations::{AsDefaultStr, T}; use relm4::AsyncFactorySender; +use relm4_components::simple_combo_box::SimpleComboBox; use relm4_icons::icon_name; use std::path::PathBuf; use std::str::FromStr; use tracing::warn; -// 2 GB -const MIN_FARM_SIZE: u64 = 1000 * 1000 * 1000 * 2; - -fn is_size_valid(size: &str) -> bool { +fn is_fixed_size_valid(size: &str) -> bool { ByteSize::from_str(size) .map(|size| size.as_u64() >= MIN_FARM_SIZE) .unwrap_or_default() } +fn is_free_percentage_size_valid(size: &str) -> bool { + size.ends_with("%") + && f32::from_str(size.trim_end_matches('%')) + .ok() + .map(|size| size > 0.0 && size <= 100.0) + .unwrap_or_default() +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +enum SizeKind { + Fixed, + FreePercentage, +} + +impl fmt::Display for SizeKind { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&match self { + Self::Fixed => T.configuration_farm_size_kind_fixed(), + Self::FreePercentage => T.configuration_farm_size_kind_free_percentage(), + }) + } +} + +impl SizeKind { + fn all() -> [SizeKind; std::mem::variant_count::()] { + [Self::Fixed, Self::FreePercentage] + } +} + #[derive(Debug)] pub(super) struct FarmWidgetInit { pub(super) path: PathBuf, @@ -41,7 +69,9 @@ impl Default for FarmWidgetInit { #[derive(Debug)] pub(super) enum FarmWidgetInput { DirectorySelected(PathBuf), - FarmSizeChanged(String), + SizeKindChanged(usize), + FarmFixedSizeChanged(String), + FarmFreePercentageSizeChanged(String), } #[derive(Debug)] @@ -51,12 +81,22 @@ pub(super) enum FarmWidgetOutput { Delete(DynamicIndex), } +#[tracker::track] #[derive(Debug)] pub(super) struct FarmWidget { // TODO: Track changes for dynamic index + #[do_not_track] index: DynamicIndex, + #[do_not_track] path: MaybeValid, - size: MaybeValid, + size_kind: SizeKind, + #[do_not_track] + size_kind_selector: Controller>, + #[do_not_track] + fixed_size: MaybeValid, + /// 0.0%..=100.0% + #[do_not_track] + free_percentage_size: MaybeValid, } #[relm4::factory(pub(super) async)] @@ -138,34 +178,74 @@ impl AsyncFactoryComponent for FarmWidget { }, }, - gtk::Entry { - connect_activate[sender] => move |entry| { - sender.input(FarmWidgetInput::FarmSizeChanged(entry.text().into())); - }, - connect_changed[sender] => move |entry| { - sender.input(FarmWidgetInput::FarmSizeChanged(entry.text().into())); + gtk::Box { + add_css_class: "linked", + + self.size_kind_selector.widget().clone(), + + gtk::Entry { + connect_activate[sender] => move |entry| { + sender.input(FarmWidgetInput::FarmFixedSizeChanged(entry.text().into())); + }, + connect_changed[sender] => move |entry| { + sender.input(FarmWidgetInput::FarmFixedSizeChanged(entry.text().into())); + }, + #[track = "self.fixed_size.changed_is_valid()"] + set_css_classes: if self.fixed_size.is_valid { + &["valid-input"] + } else { + &["invalid-input"] + }, + set_placeholder_text: Some( + &T.configuration_farm_fixed_size_placeholder(), + ), + set_primary_icon_name: Some(icon_name::SIZE_HORIZONTALLY), + set_primary_icon_activatable: false, + set_primary_icon_sensitive: false, + #[track = "self.fixed_size.changed_is_valid()"] + set_secondary_icon_name: self.fixed_size.icon(), + set_secondary_icon_activatable: false, + set_secondary_icon_sensitive: false, + #[track = "self.fixed_size.changed_value()"] + set_text: self.fixed_size.as_str(), + set_tooltip_markup: Some( + &T.configuration_farm_fixed_size_tooltip() + ), + #[track = "self.changed_size_kind()"] + set_visible: self.size_kind == SizeKind::Fixed, }, - #[track = "self.size.changed_is_valid()"] - set_css_classes: if self.size.is_valid { - &["valid-input"] - } else { - &["invalid-input"] + + gtk::Entry { + connect_activate[sender] => move |entry| { + sender.input(FarmWidgetInput::FarmFreePercentageSizeChanged(entry.text().into())); + }, + connect_changed[sender] => move |entry| { + sender.input(FarmWidgetInput::FarmFreePercentageSizeChanged(entry.text().into())); + }, + #[track = "self.free_percentage_size.changed_is_valid()"] + set_css_classes: if self.free_percentage_size.is_valid { + &["valid-input"] + } else { + &["invalid-input"] + }, + set_placeholder_text: Some( + &T.configuration_farm_free_percentage_size_placeholder(), + ), + set_primary_icon_name: Some(icon_name::SIZE_HORIZONTALLY), + set_primary_icon_activatable: false, + set_primary_icon_sensitive: false, + #[track = "self.free_percentage_size.changed_is_valid()"] + set_secondary_icon_name: self.free_percentage_size.icon(), + set_secondary_icon_activatable: false, + set_secondary_icon_sensitive: false, + #[track = "self.free_percentage_size.changed_value()"] + set_text: self.free_percentage_size.as_str(), + set_tooltip_markup: Some( + &T.configuration_farm_free_percentage_size_tooltip() + ), + #[track = "self.changed_size_kind()"] + set_visible: self.size_kind == SizeKind::FreePercentage, }, - set_placeholder_text: Some( - &T.configuration_farm_size_placeholder(), - ), - set_primary_icon_name: Some(icon_name::SIZE_HORIZONTALLY), - set_primary_icon_activatable: false, - set_primary_icon_sensitive: false, - #[track = "self.size.changed_is_valid()"] - set_secondary_icon_name: self.size.icon(), - set_secondary_icon_activatable: false, - set_secondary_icon_sensitive: false, - #[track = "self.size.changed_value()"] - set_text: self.size.as_str(), - set_tooltip_markup: Some( - &T.configuration_farm_size_tooltip() - ), }, gtk::Button { @@ -195,6 +275,42 @@ impl AsyncFactoryComponent for FarmWidget { index: &DynamicIndex, sender: AsyncFactorySender, ) -> Self { + let (size_kind, fixed_size, free_percentage_size) = if value.size.ends_with('%') { + ( + SizeKind::FreePercentage, + MaybeValid::no(String::new()), + if is_free_percentage_size_valid(&value.size) { + MaybeValid::yes(value.size) + } else { + MaybeValid::no(value.size) + }, + ) + } else { + ( + SizeKind::Fixed, + if is_fixed_size_valid(&value.size) { + MaybeValid::yes(value.size) + } else { + MaybeValid::no(value.size) + }, + MaybeValid::no(String::new()), + ) + }; + + let size_kind_selector = SimpleComboBox::builder() + .launch({ + let variants = SizeKind::all().to_vec(); + let active_index = variants + .iter() + .position(|candidate| *candidate == size_kind); + + SimpleComboBox { + variants, + active_index, + } + }) + .forward(sender.input_sender(), FarmWidgetInput::SizeKindChanged); + let instance = Self { index: index.clone(), path: if is_directory_writable(value.path.clone()).await { @@ -202,11 +318,11 @@ impl AsyncFactoryComponent for FarmWidget { } else { MaybeValid::no(value.path) }, - size: if is_size_valid(&value.size) { - MaybeValid::yes(value.size) - } else { - MaybeValid::no(value.size) - }, + size_kind, + size_kind_selector, + fixed_size, + free_percentage_size, + tracker: u8::MAX, }; // Send notification up that validity was updated, such that parent view can re-render @@ -220,8 +336,10 @@ impl AsyncFactoryComponent for FarmWidget { async fn update(&mut self, input: Self::Input, sender: AsyncFactorySender) { // Reset changes + self.reset(); self.path.reset(); - self.size.reset(); + self.fixed_size.reset(); + self.free_percentage_size.reset(); let was_valid = self.valid(); @@ -233,9 +351,15 @@ impl AsyncFactoryComponent for FarmWidget { MaybeValid::no(path) }; } - FarmWidgetInput::FarmSizeChanged(size) => { - self.size.set_is_valid(is_size_valid(&size)); - self.size.value = size; + FarmWidgetInput::SizeKindChanged(index) => self.set_size_kind(SizeKind::all()[index]), + FarmWidgetInput::FarmFixedSizeChanged(size) => { + self.fixed_size.set_is_valid(is_fixed_size_valid(&size)); + self.fixed_size.value = size; + } + FarmWidgetInput::FarmFreePercentageSizeChanged(size) => { + self.free_percentage_size + .set_is_valid(is_free_percentage_size_valid(&size)); + self.free_percentage_size.value = size; } } @@ -252,13 +376,23 @@ impl AsyncFactoryComponent for FarmWidget { impl FarmWidget { pub(super) fn valid(&self) -> bool { - self.path.is_valid && self.size.is_valid + if !self.path.is_valid { + return false; + } + + match self.size_kind { + SizeKind::Fixed => self.fixed_size.is_valid, + SizeKind::FreePercentage => self.free_percentage_size.is_valid, + } } pub(super) fn farm(&self) -> Farm { Farm { path: PathBuf::clone(&self.path), - size: String::clone(&self.size), + size: String::clone(match self.size_kind { + SizeKind::Fixed => &self.fixed_size, + SizeKind::FreePercentage => &self.free_percentage_size, + }), } } } diff --git a/src/frontend/running.rs b/src/frontend/running.rs index e187bd3..cb32c36 100644 --- a/src/frontend/running.rs +++ b/src/frontend/running.rs @@ -305,7 +305,7 @@ impl RunningView { for (farm_index, (initial_farm_state, farm)) in initial_farm_states .iter() .copied() - .zip(raw_config.farms().iter().cloned()) + .zip(config.farms.iter().cloned()) .enumerate() { self.farms.insert( @@ -342,11 +342,8 @@ impl RunningView { self.farmer_state .get_mut_token_symbol() .clone_from(&chain_info.token_symbol); - self.farmer_state.local_space_pledged = config - .farms - .iter() - .map(|farm| farm.allocated_plotting_space) - .sum(); + self.farmer_state.local_space_pledged = + config.farms.iter().map(|farm| farm.allocated_space).sum(); let (total_sectors_count, plotted_sectors_count) = initial_farm_states.iter().fold( (0, 0), |(total_sectors_count, plotted_sectors_count), initial_farm_state| { diff --git a/src/frontend/running/farm.rs b/src/frontend/running/farm.rs index 30b24b0..a412313 100644 --- a/src/frontend/running/farm.rs +++ b/src/frontend/running/farm.rs @@ -1,5 +1,6 @@ -use crate::backend::config::Farm; +use crate::backend::farmer::DiskFarm; use crate::frontend::translations::{AsDefaultStr, T}; +use bytesize::ByteSize; use gtk::prelude::*; use relm4::prelude::*; use relm4_icons::icon_name; @@ -29,6 +30,10 @@ const EXCELLENT_PROVING_TIME: Duration = Duration::from_millis(1800); /// Number of samples over which to track sector plotting time const SECTOR_PLOTTING_TIME_TRACKING_WINDOW: usize = 10; +fn format_size(bytes: u64) -> String { + ByteSize::b(bytes).to_string_as(bytes % ByteSize::mb(1).as_u64() != 0) +} + #[derive(Debug, Copy, Clone, Eq, PartialEq)] enum PlottingKind { Initial, @@ -70,7 +75,7 @@ impl SectorState { #[derive(Debug)] pub(super) struct FarmWidgetInit { - pub(super) farm: Farm, + pub(super) farm: DiskFarm, pub(super) total_sectors: SectorIndex, pub(super) plotted_total_sectors: SectorIndex, pub(super) plotting_paused: bool, @@ -406,8 +411,8 @@ impl FactoryComponent for FarmWidget { }); Self { - path: init.farm.path, - size: init.farm.size, + path: init.farm.directory, + size: format_size(init.farm.allocated_space), auditing_time: SingleSumSMA::from_zero(Duration::ZERO), auditing_time_average: Duration::ZERO, auditing_time_score: INVALID_SCORE_VALUE, diff --git a/src/frontend/running/node.rs b/src/frontend/running/node.rs index 9805568..dd1fcaa 100644 --- a/src/frontend/running/node.rs +++ b/src/frontend/running/node.rs @@ -20,7 +20,7 @@ const MAX_IMPORTING_BLOCKS: BlockNumber = 2048; /// How frequently to check for free disk space const FREE_DISK_SPACE_CHECK_INTERVAL: Duration = Duration::from_secs(5); /// Free disk space below which warning must be shown -const FREE_DISK_SPACE_CHECK_WARNING_THRESHOLD: u64 = 10 * 1024 * 1024 * 1024; +const FREE_DISK_SPACE_CHECK_WARNING_THRESHOLD: u64 = ByteSize::gib(10).as_u64(); /// Number of samples over which to track block import time, 1 minute in slots const BLOCK_IMPORT_TIME_TRACKING_WINDOW: usize = 1000; diff --git a/src/main.rs b/src/main.rs index 3fc4a97..9c3cddd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,18 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] -#![feature(const_option, let_chains, trait_alias, try_blocks)] +#![feature( + const_option, + let_chains, + result_flattening, + trait_alias, + try_blocks, + variant_count +)] mod backend; mod frontend; use crate::frontend::{App, AppInit, RunBackendResult, GLOBAL_CSS}; +use bytesize::ByteSize; use clap::Parser; use duct::{cmd, Expression}; use file_rotate::compression::Compression; @@ -34,8 +42,8 @@ static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; /// Number of log files to keep const LOG_FILE_LIMIT_COUNT: usize = 5; /// Size of one log file -const LOG_FILE_LIMIT_SIZE: usize = 1024 * 1024 * 10; -const LOG_READ_BUFFER: usize = 1024 * 1024; +const LOG_FILE_LIMIT_SIZE: usize = ByteSize::mib(10).as_u64() as usize; +const LOG_READ_BUFFER: usize = ByteSize::mib(1).as_u64() as usize; /// If `true`, this means supervisor will not be able to capture logs from child application and logger needs to be in /// the child process itself, while supervisor will not attempt to read stdout/stderr at all const WINDOWS_SUBSYSTEM_WINDOWS: bool = cfg!(all(windows, not(debug_assertions)));