From 56d268209cea1d650a692cfe469986b908b357ca Mon Sep 17 00:00:00 2001 From: Parth Desai Date: Sat, 5 Aug 2023 07:54:42 +0400 Subject: [PATCH] import subspace/subspace#1698 subspace/subspace#1699 subspace/subspace#1690 subspace/subspace#1697 subspace/subspace#1701 subspace/subspace#1707 subspace/subspace#1705 --- Cargo.lock | 86 ++++++++++++++++++++++------------------ Cargo.toml | 4 +- dsn/Cargo.toml | 10 ++--- dsn/src/builder.rs | 99 ++++++---------------------------------------- dsn/src/lib.rs | 15 ++----- farmer/Cargo.toml | 14 +++---- farmer/src/lib.rs | 24 ++--------- node/Cargo.toml | 28 ++++++------- node/src/lib.rs | 2 +- traits/Cargo.toml | 6 +-- utils/Cargo.toml | 12 +++--- 11 files changed, 105 insertions(+), 195 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ef551d6..dc400cc9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -606,6 +606,15 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-mutex" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479db852db25d9dbf6204e6cb6253698f175c15726470f78af0d918e99d6156e" +dependencies = [ + "event-listener", +] + [[package]] name = "async-oneshot" version = "0.5.0" @@ -1563,7 +1572,7 @@ checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" [[package]] name = "cross-domain-message-gossip" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "futures", "parity-scale-codec", @@ -2118,7 +2127,7 @@ dependencies = [ [[package]] name = "domain-block-preprocessor" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "domain-runtime-primitives", "parity-scale-codec", @@ -2142,7 +2151,7 @@ dependencies = [ [[package]] name = "domain-runtime-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "parity-scale-codec", "scale-info", @@ -5152,7 +5161,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "orml-vesting" version = "0.4.1-dev" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-support", "frame-system", @@ -5243,7 +5252,7 @@ dependencies = [ [[package]] name = "pallet-domains" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-benchmarking", "frame-support", @@ -5263,7 +5272,7 @@ dependencies = [ [[package]] name = "pallet-feeds" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-support", "frame-system", @@ -5279,7 +5288,7 @@ dependencies = [ [[package]] name = "pallet-grandpa-finality-verifier" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "finality-grandpa", "frame-support", @@ -5299,7 +5308,7 @@ dependencies = [ [[package]] name = "pallet-object-store" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-support", "frame-system", @@ -5314,7 +5323,7 @@ dependencies = [ [[package]] name = "pallet-offences-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-support", "frame-system", @@ -5329,7 +5338,7 @@ dependencies = [ [[package]] name = "pallet-rewards" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-support", "frame-system", @@ -5342,7 +5351,7 @@ dependencies = [ [[package]] name = "pallet-runtime-configs" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-support", "frame-system", @@ -5354,7 +5363,7 @@ dependencies = [ [[package]] name = "pallet-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-benchmarking", "frame-support", @@ -5413,7 +5422,7 @@ dependencies = [ [[package]] name = "pallet-transaction-fees" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-support", "frame-system", @@ -6718,7 +6727,7 @@ dependencies = [ [[package]] name = "sc-consensus-fraud-proof" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "async-trait", "parity-scale-codec", @@ -6756,7 +6765,7 @@ dependencies = [ [[package]] name = "sc-consensus-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "async-trait", "fork-tree", @@ -6799,7 +6808,7 @@ dependencies = [ [[package]] name = "sc-consensus-subspace-rpc" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "async-oneshot", "futures", @@ -7322,7 +7331,7 @@ dependencies = [ [[package]] name = "sc-subspace-block-relay" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "async-channel", "async-trait", @@ -7344,7 +7353,7 @@ dependencies = [ [[package]] name = "sc-subspace-chain-specs" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "sc-chain-spec", "sc-service", @@ -8325,7 +8334,7 @@ dependencies = [ [[package]] name = "sp-consensus-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "async-trait", "log", @@ -8442,7 +8451,7 @@ dependencies = [ [[package]] name = "sp-domain-digests" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "parity-scale-codec", "sp-api", @@ -8454,7 +8463,7 @@ dependencies = [ [[package]] name = "sp-domains" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "blake2", "parity-scale-codec", @@ -8557,7 +8566,7 @@ dependencies = [ [[package]] name = "sp-messenger" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "frame-support", "hash-db", @@ -8585,7 +8594,7 @@ dependencies = [ [[package]] name = "sp-objects" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "sp-api", "sp-std", @@ -9035,7 +9044,7 @@ dependencies = [ [[package]] name = "subspace-archiving" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "parity-scale-codec", "rayon", @@ -9048,7 +9057,7 @@ dependencies = [ [[package]] name = "subspace-core-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "blake2", "blst_rust", @@ -9072,7 +9081,7 @@ dependencies = [ [[package]] name = "subspace-erasure-coding" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "blst_rust", "kzg", @@ -9082,7 +9091,7 @@ dependencies = [ [[package]] name = "subspace-farmer" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "anyhow", "async-trait", @@ -9135,7 +9144,7 @@ dependencies = [ [[package]] name = "subspace-farmer-components" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "async-trait", "backoff", @@ -9164,7 +9173,7 @@ dependencies = [ [[package]] name = "subspace-fraud-proof" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "domain-block-preprocessor", "domain-runtime-primitives", @@ -9188,10 +9197,11 @@ dependencies = [ [[package]] name = "subspace-networking" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "actix-web", "anyhow", + "async-mutex", "async-trait", "backoff", "bytes", @@ -9228,7 +9238,7 @@ dependencies = [ [[package]] name = "subspace-proof-of-space" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "blake3", "chacha20 0.9.1", @@ -9242,7 +9252,7 @@ dependencies = [ [[package]] name = "subspace-rpc-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "hex", "serde", @@ -9254,7 +9264,7 @@ dependencies = [ [[package]] name = "subspace-runtime" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "domain-runtime-primitives", "frame-benchmarking", @@ -9305,7 +9315,7 @@ dependencies = [ [[package]] name = "subspace-runtime-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "parity-scale-codec", "serde", @@ -9346,7 +9356,7 @@ dependencies = [ [[package]] name = "subspace-service" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "async-trait", "atomic", @@ -9418,12 +9428,12 @@ dependencies = [ [[package]] name = "subspace-solving" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" [[package]] name = "subspace-transaction-pool" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "async-trait", "domain-runtime-primitives", @@ -9451,7 +9461,7 @@ dependencies = [ [[package]] name = "subspace-verification" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=1e12a6e258e4562c7411c8dec40c155cf112ade4#1e12a6e258e4562c7411c8dec40c155cf112ade4" +source = "git+https://github.com/subspace/subspace?rev=ecd8c8fc4da522a36eb667c702e9cf6e25862051#ecd8c8fc4da522a36eb667c702e9cf6e25862051" dependencies = [ "parity-scale-codec", "scale-info", diff --git a/Cargo.toml b/Cargo.toml index d430393e..cc3c6537 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 = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } +subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } # 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 = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } +subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } # 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 56ccfc31..e8c99027 100644 --- a/dsn/Cargo.toml +++ b/dsn/Cargo.toml @@ -24,8 +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 = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-service = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } +subspace-networking = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-service = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } diff --git a/dsn/src/builder.rs b/dsn/src/builder.rs index b3a72ec1..7bcc104f 100644 --- a/dsn/src/builder.rs +++ b/dsn/src/builder.rs @@ -1,4 +1,3 @@ -use std::num::NonZeroUsize; use std::path::PathBuf; use std::sync::{Arc, Weak}; @@ -6,7 +5,6 @@ use anyhow::Context; use derivative::Derivative; use derive_builder::Builder; use derive_more::{Deref, DerefMut, Display, From}; -use either::*; use futures::prelude::*; use sc_consensus_subspace::SegmentHeadersStore; use sdk_utils::{self, DropCollection, Multiaddr, MultiaddrWithPeerId}; @@ -15,16 +13,14 @@ 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::{ - PeerInfo, PeerInfoProvider, PieceAnnouncementRequestHandler, PieceAnnouncementResponse, - PieceByHashRequest, PieceByHashRequestHandler, PieceByHashResponse, ProviderStorage as _, + PeerInfo, PeerInfoProvider, PieceByHashRequest, PieceByHashRequestHandler, PieceByHashResponse, SegmentHeaderBySegmentIndexesRequestHandler, SegmentHeaderRequest, SegmentHeaderResponse, KADEMLIA_PROVIDER_TTL_IN_SECS, }; use super::provider_storage_utils::MaybeProviderStorage; -use super::{FarmerProviderStorage, NodePieceCache, NodeProviderStorage, ProviderStorage}; +use super::{FarmerProviderStorage, NodePieceCache, ProviderStorage}; /// Wrapper with default value for listen address #[derive( @@ -155,10 +151,6 @@ impl DsnBuilder { } } -const MAX_PROVIDER_RECORDS_LIMIT: NonZeroUsize = NonZeroUsize::new(100000).expect("100000 > 0"); // ~ 10 MB -const MAX_CONCURRENT_ANNOUNCEMENTS_QUEUE: NonZeroUsize = - NonZeroUsize::new(2000).expect("Not zero; qed"); - /// Options for DSN pub struct DsnOptions { /// Client to aux storage for node piece cache @@ -180,7 +172,7 @@ pub struct DsnOptions { /// Farmer total allocated space across all plots pub farmer_total_space_pledged: usize, /// Segment header store - pub segment_header_store: SegmentHeadersStore + pub segment_header_store: SegmentHeadersStore, } /// Farmer piece store @@ -200,9 +192,6 @@ pub struct DsnShared { /// Farmer piece store #[derivative(Debug = "ignore")] pub farmer_piece_store: Arc>>, - /// Provider records receiver - pub provider_records_receiver: - parking_lot::Mutex>>, /// Farmer provider storage pub farmer_provider_storage: MaybeProviderStorage, /// Farmer archival storage pieces @@ -253,7 +242,7 @@ impl Dsn { get_piece_by_hash, get_segment_header_by_segment_indexes, farmer_total_space_pledged, - segment_header_store + segment_header_store, } = options; let farmer_readers_and_pieces = Arc::new(parking_lot::Mutex::new(None)); let farmer_piece_store = Arc::new(tokio::sync::Mutex::new(None)); @@ -303,7 +292,7 @@ impl Dsn { listen_addresses, reserved_nodes, allow_non_global_addresses_in_dht, - provider_storage_path, + provider_storage_path: _, in_connections: InConnections(max_established_incoming_connections), out_connections: OutConnections(max_established_outgoing_connections), target_connections: TargetConnections(target_connections), @@ -312,96 +301,32 @@ impl Dsn { boot_nodes, } = self; - let peer_id = subspace_networking::peer_id(&keypair); let bootstrap_nodes = boot_nodes.into_iter().map(Into::into).collect::>(); let listen_on = listen_addresses.0.into_iter().map(Into::into).collect(); let networking_parameters_registry = subspace_networking::NetworkingParametersManager::new( &base_path.join("known_addresses_db"), - bootstrap_nodes, ) .context("Failed to open known addresses database for DSN")? .boxed(); - let external_provider_storage = match provider_storage_path { - Some(path) => Either::Left(subspace_networking::ParityDbProviderStorage::new( - &path, - MAX_PROVIDER_RECORDS_LIMIT, - peer_id, - )?), - None => Either::Right(subspace_networking::MemoryProviderStorage::new(peer_id)), - }; - - let node_provider_storage = - NodeProviderStorage::new(peer_id, piece_cache.clone(), external_provider_storage); let provider_storage = - ProviderStorage::new(farmer_provider_storage.clone(), node_provider_storage); - - let (provider_records_sender, provider_records_receiver) = - futures::channel::mpsc::channel(MAX_CONCURRENT_ANNOUNCEMENTS_QUEUE.get()); + ProviderStorage::new(farmer_provider_storage.clone(), piece_cache.clone()); let mut default_networking_config = subspace_networking::Config::new( protocol_version, keypair, provider_storage.clone(), - PeerInfoProvider::new_farmer(Box::new(farmer_archival_storage_pieces.clone())), + Some(PeerInfoProvider::new_farmer(Box::new(farmer_archival_storage_pieces.clone()))), ); default_networking_config.kademlia.set_provider_record_ttl(KADEMLIA_PROVIDER_TTL_IN_SECS); let config = subspace_networking::Config { listen_on, allow_non_global_addresses_in_dht, - networking_parameters_registry, + networking_parameters_registry: Some(networking_parameters_registry), request_response_protocols: vec![ - PieceAnnouncementRequestHandler::create({ - move |peer_id, req| { - tracing::trace!(?req, %peer_id, "Piece announcement request received."); - - let mut provider_records_sender = provider_records_sender.clone(); - let provider_record = ProviderRecord { - provider: peer_id, - key: req.piece_index_hash.into(), - addresses: req.addresses.clone(), - expires: KADEMLIA_PROVIDER_TTL_IN_SECS - .map(|ttl| std::time::Instant::now() + ttl), - }; - - let result = match provider_storage.add_provider(provider_record.clone()) { - Ok(()) => { - if let Err(error) = - provider_records_sender.try_send(provider_record) - { - if !error.is_disconnected() { - let record = error.into_inner(); - // TODO: This should be made a warning, but due to - // https://github.com/libp2p/rust-libp2p/discussions/3411 it'll - // take us some time to resolve - tracing::debug!( - ?record.key, - ?record.provider, - "Failed to add provider record to the channel." - ); - } - }; - - Some(PieceAnnouncementResponse::Success) - } - Err(error) => { - tracing::error!( - %error, - %peer_id, - ?req, - "Failed to add provider for received key." - ); - - None - } - }; - - futures::future::ready(result) - } - }), PieceByHashRequestHandler::create({ let weak_readers_and_pieces = Arc::downgrade(&farmer_readers_and_pieces); let farmer_piece_store = Arc::clone(&farmer_piece_store); @@ -434,11 +359,14 @@ impl Dsn { max_established_outgoing_connections, general_target_connections: target_connections, // maintain permanent connections between farmers - special_connected_peers_handler: Arc::new(PeerInfo::is_farmer), + special_connected_peers_handler: Some(Arc::new(PeerInfo::is_farmer)), // other (non-farmer) connections - general_connected_peers_handler: Arc::new(|peer_info| !PeerInfo::is_farmer(peer_info)), + general_connected_peers_handler: Some(Arc::new(|peer_info| { + !PeerInfo::is_farmer(peer_info) + })), max_pending_incoming_connections, max_pending_outgoing_connections, + bootstrap_addresses: bootstrap_nodes, ..default_networking_config }; @@ -490,7 +418,6 @@ impl Dsn { DsnShared { node, farmer_piece_store, - provider_records_receiver: parking_lot::Mutex::new(Some(provider_records_receiver)), farmer_provider_storage, farmer_readers_and_pieces, piece_cache, diff --git a/dsn/src/lib.rs b/dsn/src/lib.rs index 18cacfef..2959aa21 100644 --- a/dsn/src/lib.rs +++ b/dsn/src/lib.rs @@ -14,27 +14,18 @@ mod builder; mod provider_storage_utils; pub use builder::*; -use either::*; /// Farmer piece cache pub use subspace_farmer::utils::farmer_piece_cache::FarmerPieceCache; -use subspace_networking::ParityDbProviderStorage; use tracing::warn; /// Node piece cache pub type NodePieceCache = subspace_service::piece_cache::PieceCache; /// Farmer provider storage pub type FarmerProviderStorage = - subspace_farmer::utils::farmer_provider_storage::FarmerProviderStorage< - ParityDbProviderStorage, - FarmerPieceCache, - >; -/// Node provider storage -pub type NodeProviderStorage = subspace_service::dsn::node_provider_storage::NodeProviderStorage< - NodePieceCache, - Either, ->; + subspace_farmer::utils::farmer_provider_storage::FarmerProviderStorage; + /// General provider storage pub type ProviderStorage = provider_storage_utils::AndProviderStorage< provider_storage_utils::MaybeProviderStorage, - NodeProviderStorage, + NodePieceCache, >; diff --git a/farmer/Cargo.toml b/farmer/Cargo.toml index 10eaa5e0..0b0ec7eb 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 = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-networking = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4", features = ["parallel", "chia"] } -subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-erasure-coding = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-networking = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051", features = ["parallel", "chia"] } +subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } diff --git a/farmer/src/lib.rs b/farmer/src/lib.rs index 35e357e0..cda16aca 100644 --- a/farmer/src/lib.rs +++ b/farmer/src/lib.rs @@ -44,13 +44,12 @@ 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}; use tracing::{debug, error, trace, warn}; use tracing_futures::Instrument; -use self::builder::{PieceCacheSize, ProvidedKeysLimit}; +use self::builder::PieceCacheSize; /// Description of the cache #[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)] @@ -370,7 +369,7 @@ impl Config { let Self { max_concurrent_plots: _, piece_cache_size: PieceCacheSize(piece_cache_size), - provided_keys_limit: ProvidedKeysLimit(provided_keys_limit), + provided_keys_limit: _, max_pieces_in_sector, } = self; @@ -390,20 +389,8 @@ impl Config { let piece_cache_db_path = base_path.join("piece_cache_db"); let (piece_store, piece_cache, farmer_provider_storage) = { - let provider_db_path = base_path.join("providers_db"); - - tracing::info!( - db_path = ?provider_db_path, - keys_limit = ?provided_keys_limit, - "Initializing provider storage..." - ); - let peer_id = node.dsn().node.id(); - let db_provider_storage = - ParityDbProviderStorage::new(&provider_db_path, provided_keys_limit, peer_id) - .context("Failed to create parity db provider storage")?; - tracing::info!( db_path = ?piece_cache_db_path, size = ?piece_cache_size, @@ -419,12 +406,7 @@ impl Config { current_size = ?piece_cache.size(), "Piece cache initialized successfully" ); - let farmer_provider_storage = FarmerProviderStorage::new( - peer_id, - Arc::clone(&readers_and_pieces), - db_provider_storage, - piece_cache.clone(), - ); + let farmer_provider_storage = FarmerProviderStorage::new(peer_id, piece_cache.clone()); (piece_store, Arc::new(Mutex::new(piece_cache)), farmer_provider_storage) }; diff --git a/node/Cargo.toml b/node/Cargo.toml index 00ffa580..45dabc93 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 = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -pallet-subspace = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -sp-domains = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -sp-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-networking = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-service = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-transaction-pool = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } +pallet-rewards = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +pallet-subspace = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +sc-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +sp-domains = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +sp-consensus-subspace = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-farmer-components = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-networking = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-service = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-transaction-pool = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } diff --git a/node/src/lib.rs b/node/src/lib.rs index f42580f7..0bc92df0 100644 --- a/node/src/lib.rs +++ b/node/src/lib.rs @@ -124,7 +124,7 @@ impl Config { get_piece_by_hash: get_piece_by_hash::, get_segment_header_by_segment_indexes, farmer_total_space_pledged, - segment_header_store + segment_header_store, })?; tracing::debug!("Subspace networking initialized: Node ID is {}", dsn.node.id()); diff --git a/traits/Cargo.toml b/traits/Cargo.toml index 7088ef43..57b082b9 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 = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-proof-of-space = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } 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 5343b925..0028875e 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 = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } -subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } +sc-consensus-subspace-rpc = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-rpc-primitives = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } +subspace-runtime-primitives = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" } # Unused for now. TODO: add `serde` feature to `subspace-core-primitives` in `subspace-archiver` -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "1e12a6e258e4562c7411c8dec40c155cf112ade4" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "ecd8c8fc4da522a36eb667c702e9cf6e25862051" }