From 8a3c0a4f144f0f8dfb13255a5226ac641e870a06 Mon Sep 17 00:00:00 2001 From: Parth Desai Date: Fri, 4 Aug 2023 18:56:37 +0400 Subject: [PATCH] import subspace/subspace#1689 subspace/subspace#1665 subspace/subspace#1686 subspace/subspace#1688 --- Cargo.lock | 79 ++++++++++++++++++----------------- Cargo.toml | 4 +- dsn/Cargo.toml | 12 +++--- dsn/src/builder.rs | 39 +++++++++++++++++- dsn/src/lib.rs | 38 ----------------- farmer/Cargo.toml | 14 +++---- farmer/src/lib.rs | 91 ++++++----------------------------------- node/Cargo.toml | 28 ++++++------- node/src/lib.rs | 3 +- substrate/src/lib.rs | 7 +++- traits/Cargo.toml | 6 +-- utils/Cargo.toml | 12 +++--- utils/src/lib.rs | 2 + utils/src/rpc_client.rs | 13 +++++- 14 files changed, 147 insertions(+), 201 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d03a8075..45fb8181 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1563,7 +1563,7 @@ checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" [[package]] name = "cross-domain-message-gossip" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "futures", "parity-scale-codec", @@ -2118,7 +2118,7 @@ dependencies = [ [[package]] name = "domain-block-preprocessor" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "domain-runtime-primitives", "parity-scale-codec", @@ -2142,7 +2142,7 @@ dependencies = [ [[package]] name = "domain-runtime-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "parity-scale-codec", "scale-info", @@ -5152,7 +5152,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "orml-vesting" version = "0.4.1-dev" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-support", "frame-system", @@ -5243,7 +5243,7 @@ dependencies = [ [[package]] name = "pallet-domains" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5263,7 +5263,7 @@ dependencies = [ [[package]] name = "pallet-feeds" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-support", "frame-system", @@ -5279,7 +5279,7 @@ dependencies = [ [[package]] name = "pallet-grandpa-finality-verifier" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "finality-grandpa", "frame-support", @@ -5299,7 +5299,7 @@ dependencies = [ [[package]] name = "pallet-object-store" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-support", "frame-system", @@ -5314,7 +5314,7 @@ dependencies = [ [[package]] name = "pallet-offences-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-support", "frame-system", @@ -5329,7 +5329,7 @@ dependencies = [ [[package]] name = "pallet-rewards" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-support", "frame-system", @@ -5342,7 +5342,7 @@ dependencies = [ [[package]] name = "pallet-runtime-configs" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-support", "frame-system", @@ -5354,7 +5354,7 @@ dependencies = [ [[package]] name = "pallet-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-benchmarking", "frame-support", @@ -5413,7 +5413,7 @@ dependencies = [ [[package]] name = "pallet-transaction-fees" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-support", "frame-system", @@ -6718,7 +6718,7 @@ dependencies = [ [[package]] name = "sc-consensus-fraud-proof" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "async-trait", "parity-scale-codec", @@ -6756,7 +6756,7 @@ dependencies = [ [[package]] name = "sc-consensus-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "async-trait", "fork-tree", @@ -6799,7 +6799,7 @@ dependencies = [ [[package]] name = "sc-consensus-subspace-rpc" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "async-oneshot", "futures", @@ -6813,6 +6813,7 @@ dependencies = [ "sc-utils", "sp-api", "sp-blockchain", + "sp-consensus", "sp-consensus-slots", "sp-consensus-subspace", "sp-core", @@ -7321,7 +7322,7 @@ dependencies = [ [[package]] name = "sc-subspace-block-relay" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "async-channel", "async-trait", @@ -7343,7 +7344,7 @@ dependencies = [ [[package]] name = "sc-subspace-chain-specs" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "sc-chain-spec", "sc-service", @@ -7591,7 +7592,6 @@ name = "sdk-dsn" version = "0.1.0" dependencies = [ "anyhow", - "async-trait", "derivative", "derive_builder 0.12.0", "derive_more", @@ -7608,7 +7608,6 @@ dependencies = [ "sp-runtime", "subspace-core-primitives", "subspace-farmer", - "subspace-farmer-components", "subspace-networking", "subspace-service", "tokio", @@ -8326,7 +8325,7 @@ dependencies = [ [[package]] name = "sp-consensus-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "async-trait", "log", @@ -8443,7 +8442,7 @@ dependencies = [ [[package]] name = "sp-domain-digests" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "parity-scale-codec", "sp-api", @@ -8455,7 +8454,7 @@ dependencies = [ [[package]] name = "sp-domains" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "blake2", "parity-scale-codec", @@ -8558,7 +8557,7 @@ dependencies = [ [[package]] name = "sp-messenger" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "frame-support", "hash-db", @@ -8586,7 +8585,7 @@ dependencies = [ [[package]] name = "sp-objects" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "sp-api", "sp-std", @@ -9036,7 +9035,7 @@ dependencies = [ [[package]] name = "subspace-archiving" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "parity-scale-codec", "rayon", @@ -9049,7 +9048,7 @@ dependencies = [ [[package]] name = "subspace-core-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "blake2", "blst_rust", @@ -9073,7 +9072,7 @@ dependencies = [ [[package]] name = "subspace-erasure-coding" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "blst_rust", "kzg", @@ -9083,7 +9082,7 @@ dependencies = [ [[package]] name = "subspace-farmer" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "anyhow", "async-trait", @@ -9136,7 +9135,7 @@ dependencies = [ [[package]] name = "subspace-farmer-components" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "async-trait", "backoff", @@ -9165,7 +9164,7 @@ dependencies = [ [[package]] name = "subspace-fraud-proof" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "domain-block-preprocessor", "domain-runtime-primitives", @@ -9189,7 +9188,7 @@ dependencies = [ [[package]] name = "subspace-networking" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "actix-web", "anyhow", @@ -9229,7 +9228,7 @@ dependencies = [ [[package]] name = "subspace-proof-of-space" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "blake3", "chacha20 0.9.1", @@ -9243,7 +9242,7 @@ dependencies = [ [[package]] name = "subspace-rpc-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "hex", "serde", @@ -9255,7 +9254,7 @@ dependencies = [ [[package]] name = "subspace-runtime" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "domain-runtime-primitives", "frame-benchmarking", @@ -9306,7 +9305,7 @@ dependencies = [ [[package]] name = "subspace-runtime-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "parity-scale-codec", "serde", @@ -9347,7 +9346,7 @@ dependencies = [ [[package]] name = "subspace-service" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "async-trait", "atomic", @@ -9419,12 +9418,12 @@ dependencies = [ [[package]] name = "subspace-solving" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" [[package]] name = "subspace-transaction-pool" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "async-trait", "domain-runtime-primitives", @@ -9452,7 +9451,7 @@ dependencies = [ [[package]] name = "subspace-verification" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=561f0e5b2e22e88af18402ca82e784bb9f97c552#561f0e5b2e22e88af18402ca82e784bb9f97c552" +source = "git+https://github.com/subspace/subspace?rev=3640edde1832bd5db94677b542c336c65cef564b#3640edde1832bd5db94677b542c336c65cef564b" dependencies = [ "parity-scale-codec", "scale-info", diff --git a/Cargo.toml b/Cargo.toml index 5e3167b0..fb7216f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ sdk-dsn = { path = "dsn" } sdk-substrate = { path = "substrate" } sdk-farmer = { path = "farmer" } -subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } +subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } # The only triple tested and confirmed as working in `jemallocator` crate is `x86_64-unknown-linux-gnu` [target.'cfg(all(target_arch = "x86_64", target_vendor = "unknown", target_os = "linux", target_env = "gnu"))'.dev-dependencies] @@ -35,7 +35,7 @@ tracing = "0.1" tracing-futures = "0.2" tracing-subscriber = "0.3" -subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } +subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } # The list of dependencies below (which can be both direct and indirect dependencies) are crates # that are suspected to be CPU-intensive, and that are unlikely to require debugging (as some of diff --git a/dsn/Cargo.toml b/dsn/Cargo.toml index 94c3287b..316c5d43 100644 --- a/dsn/Cargo.toml +++ b/dsn/Cargo.toml @@ -7,7 +7,6 @@ edition = "2021" [dependencies] anyhow = "1" -async-trait = "0.1" derivative = "2.2.0" derive_builder = "0.12" derive_more = "0.99" @@ -25,9 +24,8 @@ sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/subs sp-runtime = { version = "24.0.0", git = "https://github.com/subspace/substrate", rev = "55c157cff49b638a59d81a9f971f0f9a66829c71" } sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "55c157cff49b638a59d81a9f971f0f9a66829c71" } -subspace-networking = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-service = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } +subspace-networking = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-service = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } diff --git a/dsn/src/builder.rs b/dsn/src/builder.rs index 5769b53b..e69ecb32 100644 --- a/dsn/src/builder.rs +++ b/dsn/src/builder.rs @@ -11,10 +11,16 @@ use futures::prelude::*; use sdk_utils::{self, DropCollection, Multiaddr, MultiaddrWithPeerId}; use serde::{Deserialize, Serialize}; use subspace_core_primitives::Piece; +use subspace_farmer::utils::archival_storage_info::ArchivalStorageInfo; use subspace_farmer::utils::archival_storage_pieces::ArchivalStoragePieces; use subspace_farmer::utils::readers_and_pieces::ReadersAndPieces; use subspace_networking::libp2p::kad::ProviderRecord; -use subspace_networking::{PeerInfoProvider, PieceAnnouncementRequestHandler, PieceAnnouncementResponse, PieceByHashRequest, PieceByHashRequestHandler, PieceByHashResponse, ProviderStorage as _, SegmentHeaderBySegmentIndexesRequestHandler, SegmentHeaderRequest, SegmentHeaderResponse, KADEMLIA_PROVIDER_TTL_IN_SECS, PeerInfo}; +use subspace_networking::{ + PeerInfo, PeerInfoProvider, PieceAnnouncementRequestHandler, PieceAnnouncementResponse, + PieceByHashRequest, PieceByHashRequestHandler, PieceByHashResponse, ProviderStorage as _, + SegmentHeaderBySegmentIndexesRequestHandler, SegmentHeaderRequest, SegmentHeaderResponse, + KADEMLIA_PROVIDER_TTL_IN_SECS, +}; use subspace_service::segment_headers::SegmentHeaderCache; use subspace_service::Error; @@ -200,6 +206,8 @@ pub struct DsnShared { pub farmer_provider_storage: MaybeProviderStorage, /// Farmer archival storage pieces pub farmer_archival_storage_pieces: ArchivalStoragePieces, + /// Farmer archival storage info + pub farmer_archival_storage_info: ArchivalStorageInfo, /// Farmer piece cache #[derivative(Debug = "ignore")] pub piece_cache: NodePieceCache, @@ -252,6 +260,7 @@ impl Dsn { let cuckoo_filter_size = farmer_total_space_pledged / Piece::SIZE + 1usize; let farmer_archival_storage_pieces = ArchivalStoragePieces::new(cuckoo_filter_size); + let farmer_archival_storage_info = ArchivalStorageInfo::default(); tracing::debug!(genesis_hash = protocol_version, "Setting DSN protocol version..."); @@ -454,6 +463,33 @@ impl Dsn { })); drop_collection.push(on_new_listener); + let on_peer_info = node.on_peer_info(Arc::new({ + let archival_storage_info = farmer_archival_storage_info.clone(); + + move |new_peer_info| { + let peer_id = new_peer_info.peer_id; + let peer_info = &new_peer_info.peer_info; + + if let PeerInfo::Farmer { cuckoo_filter } = peer_info { + archival_storage_info.update_cuckoo_filter(peer_id, cuckoo_filter.clone()); + + tracing::debug!(%peer_id, ?peer_info, "Peer info cached",); + } + } + })); + drop_collection.push(on_peer_info); + + let on_disconnected_peer = node.on_disconnected_peer(Arc::new({ + let archival_storage_info = farmer_archival_storage_info.clone(); + + move |peer_id| { + if archival_storage_info.remove_peer_filter(peer_id) { + tracing::debug!(%peer_id, "Peer filter removed.",); + } + } + })); + drop_collection.push(on_disconnected_peer); + Ok(( DsnShared { node, @@ -464,6 +500,7 @@ impl Dsn { piece_cache, _drop: drop_collection, farmer_archival_storage_pieces, + farmer_archival_storage_info, }, runner, )) diff --git a/dsn/src/lib.rs b/dsn/src/lib.rs index 7d6fb605..18cacfef 100644 --- a/dsn/src/lib.rs +++ b/dsn/src/lib.rs @@ -15,11 +15,8 @@ mod provider_storage_utils; pub use builder::*; use either::*; -use sc_client_api::AuxStore; /// Farmer piece cache pub use subspace_farmer::utils::farmer_piece_cache::FarmerPieceCache; -use subspace_farmer_components::plotting::{PieceGetter, PieceGetterRetryPolicy}; -use subspace_networking::utils::piece_provider::PieceValidator; use subspace_networking::ParityDbProviderStorage; use tracing::warn; @@ -41,38 +38,3 @@ pub type ProviderStorage = provider_storage_utils::AndProviderStorage< provider_storage_utils::MaybeProviderStorage, NodeProviderStorage, >; - -/// Node piece getter (combines DSN and Farmer getters) -pub struct NodePieceGetter { - piece_getter: subspace_farmer::utils::node_piece_getter::NodePieceGetter, - node_cache: NodePieceCache, -} - -impl NodePieceGetter { - /// Constructor - pub fn new( - dsn_piece_getter: subspace_farmer::utils::node_piece_getter::NodePieceGetter, - node_cache: NodePieceCache, - ) -> Self { - Self { piece_getter: dsn_piece_getter, node_cache } - } -} - -#[async_trait::async_trait()] -impl PieceGetter for NodePieceGetter { - async fn get_piece( - &self, - piece_index: subspace_core_primitives::PieceIndex, - retry_policy: PieceGetterRetryPolicy, - ) -> Result< - Option, - Box, - > { - let piece = self.node_cache.get_piece(piece_index.hash()).map_err(|x| x.to_string())?; - if piece.is_some() { - return Ok(piece); - } - - self.piece_getter.get_piece(piece_index, retry_policy).await - } -} diff --git a/farmer/Cargo.toml b/farmer/Cargo.toml index 2c0f049e..651d41f6 100644 --- a/farmer/Cargo.toml +++ b/farmer/Cargo.toml @@ -25,10 +25,10 @@ sdk-utils = { path = "../utils" } sdk-dsn = { path = "../dsn" } sdk-traits = { path = "../traits" } -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-networking = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552", features = ["parallel", "chia"] } -subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-networking = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b", features = ["parallel", "chia"] } +subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } diff --git a/farmer/src/lib.rs b/farmer/src/lib.rs index 7192f154..35e357e0 100644 --- a/farmer/src/lib.rs +++ b/farmer/src/lib.rs @@ -22,7 +22,7 @@ pub use builder::{Builder, Config}; use derivative::Derivative; use futures::prelude::*; use futures::stream::FuturesUnordered; -use sdk_dsn::{FarmerPieceCache, FarmerProviderStorage, NodePieceGetter}; +use sdk_dsn::{FarmerPieceCache, FarmerProviderStorage}; use sdk_traits::Node; use sdk_utils::{AsyncDropFutures, ByteSize, DropCollection, PublicKey}; use serde::{Deserialize, Serialize}; @@ -37,13 +37,13 @@ use subspace_farmer::single_disk_plot::{ }; use subspace_farmer::utils::archival_storage_pieces::ArchivalStoragePieces; use subspace_farmer::utils::farmer_piece_getter::FarmerPieceGetter; -use subspace_farmer::utils::node_piece_getter::NodePieceGetter as DsnPieceGetter; use subspace_farmer::utils::parity_db_store::ParityDbStore; use subspace_farmer::utils::piece_cache::PieceCache; use subspace_farmer::utils::piece_validator::SegmentCommitmentPieceValidator; use subspace_farmer::utils::readers_and_pieces::ReadersAndPieces; use subspace_farmer_components::plotting::{PieceGetter, PieceGetterRetryPolicy, PlottedSector}; use subspace_networking::utils::multihash::ToMultihash; +use subspace_networking::utils::piece_provider::PieceValidator; use subspace_networking::ParityDbProviderStorage; use subspace_rpc_primitives::{FarmerAppInfo, SolutionResponse}; use tokio::sync::{oneshot, watch, Mutex}; @@ -335,15 +335,9 @@ fn create_readers_and_pieces( fn handler_on_sector_plotted( plotted_sector: &PlottedSector, maybe_old_plotted_sector: &Option, - plotting_permit: Arc, disk_farm_index: usize, - node: &subspace_networking::Node, readers_and_pieces: Arc>>, - mut dropped_receiver: tokio::sync::broadcast::Receiver<()>, - node_name: &str, ) { - let sector_index = plotted_sector.sector_index; - let disk_farm_index = disk_farm_index .try_into() .expect("More than 256 plots are not supported, this is checked above already; qed"); @@ -358,44 +352,6 @@ fn handler_on_sector_plotted( } readers_and_pieces.add_sector(disk_farm_index, plotted_sector); } - - let piece_indexes = plotted_sector.piece_indexes.clone(); - - let node = node.clone(); - - // TODO: Skip those that were already announced (because they cached) - let publish_fut = async move { - piece_indexes - .into_iter() - .map(|piece_index| { - subspace_networking::utils::piece_announcement::announce_single_piece_index_hash_with_backoff( - piece_index.hash(), - &node, - ) - }) - .collect::>() - .map(drop) - .collect::>() - .await; - - tracing::info!(sector_index, "Sector publishing was successful."); - - // Release only after publishing is finished - drop(plotting_permit); - } - .in_current_span(); - - drop(sdk_utils::task_spawn( - format!("subspace-sdk-farmer-{node_name}-piece-publishing"), - async move { - use futures::future::{select, Either}; - - let result = select(Box::pin(publish_fut), Box::pin(dropped_receiver.recv())).await; - if matches!(result, Either::Right(_)) { - tracing::debug!("Piece publishing was cancelled due to shutdown."); - } - }, - )); } impl Config { @@ -412,7 +368,7 @@ impl Config { } let Self { - max_concurrent_plots, + max_concurrent_plots: _, piece_cache_size: PieceCacheSize(piece_cache_size), provided_keys_limit: ProvidedKeysLimit(provided_keys_limit), max_pieces_in_sector, @@ -426,9 +382,6 @@ impl Config { let mut single_disk_plots = Vec::with_capacity(plots.len()); let mut plot_info = HashMap::with_capacity(plots.len()); - let concurrent_plotting_semaphore = - Arc::new(tokio::sync::Semaphore::new(max_concurrent_plots.get())); - let base_path = cache.directory; let readers_and_pieces = Arc::clone(&node.dsn().farmer_readers_and_pieces); @@ -496,11 +449,10 @@ impl Config { )), ); let piece_getter = Arc::new(FarmerPieceGetter::new( - NodePieceGetter::new( - DsnPieceGetter::new(piece_provider), - node.dsn().piece_cache.clone(), - ), - Arc::clone(&piece_cache), + node.dsn().node.clone(), + piece_provider, + piece_cache.clone(), + node.dsn().farmer_archival_storage_info.clone(), )); let farmer_app_info = subspace_farmer::NodeClient::farmer_app_info(node.rpc()) @@ -543,7 +495,6 @@ impl Config { node, max_pieces_in_sector, piece_getter: Arc::clone(&piece_getter), - concurrent_plotting_semaphore: Arc::clone(&concurrent_plotting_semaphore), description, kzg: kzg.clone(), erasure_coding: erasure_coding.clone(), @@ -562,30 +513,16 @@ impl Config { let readers_and_pieces = Arc::clone(&readers_and_pieces); let span = tracing::info_span!("farm", %disk_farm_index); - // We are not going to send anything here, but dropping of sender on dropping of - // corresponding `SingleDiskPlot` will allow us to stop background tasks. - let (dropped_sender, _dropped_receiver) = tokio::sync::broadcast::channel::<()>(1); - drop_at_exit.defer({ - let dropped_sender = dropped_sender.clone(); - move || drop(dropped_sender.send(())) - }); - - let node = node.dsn().node.clone(); - let node_name = node_name.clone(); // Collect newly plotted pieces // TODO: Once we have replotting, this will have to be updated let handler_id = single_disk_plot.on_sector_plotted(Arc::new( - move |(plotted_sector, maybe_old_plotted_sector, plotting_permit)| { + move |(plotted_sector, maybe_old_plotted_sector)| { let _span_guard = span.enter(); handler_on_sector_plotted( plotted_sector, maybe_old_plotted_sector, - Arc::clone(plotting_permit), disk_farm_index, - &node, readers_and_pieces.clone(), - dropped_sender.subscribe(), - &node_name, ) }, )); @@ -752,8 +689,7 @@ pub struct InitialPlottingProgress { } /// Progress data received from sender, used to monitor plotting progress -pub type ProgressData = - Option<(PlottedSector, Option, Arc)>; +pub type ProgressData = Option<(PlottedSector, Option)>; /// Plot structure #[derive(Debug)] @@ -829,7 +765,6 @@ struct PlotOptions<'a, PG, N: sdk_traits::Node> { pub reward_address: PublicKey, pub node: &'a N, pub piece_getter: PG, - pub concurrent_plotting_semaphore: Arc, pub description: &'a PlotDescription, pub kzg: kzg::Kzg, pub erasure_coding: ErasureCoding, @@ -843,7 +778,6 @@ impl Plot { reward_address, node, piece_getter, - concurrent_plotting_semaphore, description, kzg, erasure_coding, @@ -869,7 +803,6 @@ impl Plot { kzg, erasure_coding, piece_getter, - concurrent_plotting_semaphore, }; let single_disk_plot = SingleDiskPlot::new::<_, _, T>(description, disk_farm_idx).await?; let mut drop_at_exit = DropCollection::new(); @@ -1023,13 +956,13 @@ const POPULATE_PIECE_DELAY: Duration = Duration::from_secs(10); /// Populates piece cache on startup. It waits for the new segment index and /// check all pieces from previous segments to see if they are already in the /// cache. If they are not, they are added from DSN. -async fn populate_pieces_cache( +async fn populate_pieces_cache( dsn_node: subspace_networking::Node, segment_index: SegmentIndex, - piece_getter: Arc>, + piece_getter: Arc>, piece_cache: Arc>, ) where - PG: PieceGetter + Send + Sync, + PV: PieceValidator + Send + Sync + 'static, PC: PieceCache + Send + 'static, { let _ = dsn_node.wait_for_connected_peers(POPULATE_PIECE_DELAY).await; diff --git a/node/Cargo.toml b/node/Cargo.toml index f2055eda..51b2ee74 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -42,17 +42,17 @@ sp-core = { version = "21.0.0", git = "https://github.com/subspace/substrate", r sp-runtime = { version = "24.0.0", git = "https://github.com/subspace/substrate", rev = "55c157cff49b638a59d81a9f971f0f9a66829c71" } sp-version = { version = "22.0.0", git = "https://github.com/subspace/substrate", rev = "55c157cff49b638a59d81a9f971f0f9a66829c71" } -pallet-rewards = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -pallet-subspace = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -sc-consensus-subspace-rpc = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -sp-domains = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -sp-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-networking = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-service = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-transaction-pool = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } +pallet-rewards = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +pallet-subspace = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +sc-consensus-subspace-rpc = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +sp-domains = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +sp-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-networking = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-service = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-transaction-pool = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } diff --git a/node/src/lib.rs b/node/src/lib.rs index f7933d1f..130a8e8b 100644 --- a/node/src/lib.rs +++ b/node/src/lib.rs @@ -260,7 +260,8 @@ impl sc_executor::NativeExecutionDispatch for ExecutorDispatch { // ) // /// Otherwise we only use the default Substrate host functions. // #[cfg(not(feature = "runtime-benchmarks"))] - type ExtendHostFunctions = (sp_consensus_subspace::consensus::HostFunctions, sp_domains::domain::HostFunctions); + type ExtendHostFunctions = + (sp_consensus_subspace::consensus::HostFunctions, sp_domains::domain::HostFunctions); fn dispatch(method: &str, data: &[u8]) -> Option> { subspace_runtime::api::dispatch(method, data) diff --git a/substrate/src/lib.rs b/substrate/src/lib.rs index 16928e6c..35bf8d8c 100644 --- a/substrate/src/lib.rs +++ b/substrate/src/lib.rs @@ -233,10 +233,13 @@ impl Base { // endpoints let telemetry_endpoints = match chain_spec.telemetry_endpoints() { Some(endpoints) => { - let Ok(serde_json::Value::Array(extra_telemetry)) = serde_json::to_value(&telemetry) else { + let Ok(serde_json::Value::Array(extra_telemetry)) = + serde_json::to_value(&telemetry) + else { unreachable!("Will always return an array") }; - let Ok(serde_json::Value::Array(telemetry)) = serde_json::to_value(endpoints) else { + let Ok(serde_json::Value::Array(telemetry)) = serde_json::to_value(endpoints) + else { unreachable!("Will always return an array") }; diff --git a/traits/Cargo.toml b/traits/Cargo.toml index 07e29beb..4191a104 100644 --- a/traits/Cargo.toml +++ b/traits/Cargo.toml @@ -10,8 +10,8 @@ async-trait = "0.1" parking_lot = "0.12" sdk-dsn = { path = "../dsn" } -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "55c157cff49b638a59d81a9f971f0f9a66829c71" } diff --git a/utils/Cargo.toml b/utils/Cargo.toml index 1fc9d236..02c3568b 100644 --- a/utils/Cargo.toml +++ b/utils/Cargo.toml @@ -34,11 +34,11 @@ sp-core-hashing = { version = "9.0.0", git = "https://github.com/subspace/substr sp-runtime = { version = "24.0.0", git = "https://github.com/subspace/substrate", rev = "55c157cff49b638a59d81a9f971f0f9a66829c71" } sp-storage = { version = "13.0.0", git = "https://github.com/subspace/substrate", rev = "55c157cff49b638a59d81a9f971f0f9a66829c71" } -sc-consensus-subspace-rpc = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } -subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } +sc-consensus-subspace-rpc = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } +subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } # Unused for now. TODO: add `serde` feature to `subspace-core-primitives` in `subspace-archiver` -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "561f0e5b2e22e88af18402ca82e784bb9f97c552" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "3640edde1832bd5db94677b542c336c65cef564b" } diff --git a/utils/src/lib.rs b/utils/src/lib.rs index 45ceeeb1..b438c509 100644 --- a/utils/src/lib.rs +++ b/utils/src/lib.rs @@ -128,6 +128,7 @@ impl ClientT for Rpc { self.inner.call(method, params).await } + #[allow(clippy::diverging_sub_expression)] async fn batch_request<'a, R>( &self, _batch: BatchRequestBuilder<'a>, @@ -167,6 +168,7 @@ impl SubscriptionClientT for Rpc { Ok(Subscription::new(to_back, notifs_rx, SubscriptionKind::Subscription(kind))) } + #[allow(clippy::diverging_sub_expression)] async fn subscribe_to_method<'a, Notif>( &self, _method: &'a str, diff --git a/utils/src/rpc_client.rs b/utils/src/rpc_client.rs index 18fa57fc..ae8aa872 100644 --- a/utils/src/rpc_client.rs +++ b/utils/src/rpc_client.rs @@ -5,7 +5,8 @@ use sc_consensus_subspace_rpc::SubspaceRpcApiClient; use subspace_core_primitives::{Piece, PieceIndex, SegmentCommitment, SegmentHeader, SegmentIndex}; use subspace_farmer::node_client::{Error, NodeClient}; use subspace_rpc_primitives::{ - FarmerAppInfo, RewardSignatureResponse, RewardSigningInfo, SlotInfo, SolutionResponse, + FarmerAppInfo, NodeSyncStatus, RewardSignatureResponse, RewardSigningInfo, SlotInfo, + SolutionResponse, }; #[async_trait::async_trait] @@ -58,6 +59,16 @@ impl NodeClient for crate::Rpc { )) } + async fn subscribe_node_sync_status_change( + &self, + ) -> Result + Send + 'static>>, Error> { + Ok(Box::pin( + SubspaceRpcApiClient::subscribe_node_sync_status_change(self) + .await? + .filter_map(|result| futures::future::ready(result.ok())), + )) + } + async fn segment_commitments( &self, segment_indexes: Vec,