From ee91f00bc7bb6e77d082665c147f54e345363291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCn=20=C3=96zerk?= Date: Sat, 11 Jun 2022 11:57:29 +0300 Subject: [PATCH] update dependencies (#254) update dependencies --- package.json | 2 +- src-tauri/Cargo.lock | 84 +++++++++++++++++++++++++---------------- src-tauri/Cargo.toml | 18 +++++---- src-tauri/src/farmer.rs | 8 ++-- src-tauri/src/node.rs | 42 ++++++++++++++++++--- 5 files changed, 105 insertions(+), 49 deletions(-) diff --git a/package.json b/package.json index ac3ca43f..edfb25d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "subspace-desktop", - "version": "0.6.5", + "version": "0.6.6", "private": true, "description": "Subspace desktop", "author": "Subspace Labs ", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 15eb319a..3288920a 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -929,7 +929,7 @@ dependencies = [ [[package]] name = "cirrus-pallet-executive" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "frame-executive", "frame-support", @@ -946,7 +946,7 @@ dependencies = [ [[package]] name = "cirrus-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "parity-scale-codec", "sp-api", @@ -958,7 +958,7 @@ dependencies = [ [[package]] name = "cirrus-runtime" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "cirrus-pallet-executive", "cirrus-primitives", @@ -5049,7 +5049,7 @@ dependencies = [ [[package]] name = "orml-vesting" version = "0.4.1-dev" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "frame-support", "frame-system", @@ -5115,7 +5115,7 @@ dependencies = [ [[package]] name = "pallet-executor" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "frame-support", "frame-system", @@ -5131,7 +5131,7 @@ dependencies = [ [[package]] name = "pallet-feeds" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "frame-support", "frame-system", @@ -5147,7 +5147,7 @@ dependencies = [ [[package]] name = "pallet-grandpa-finality-verifier" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "finality-grandpa", "frame-support", @@ -5167,7 +5167,7 @@ dependencies = [ [[package]] name = "pallet-object-store" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "frame-support", "frame-system", @@ -5182,7 +5182,7 @@ dependencies = [ [[package]] name = "pallet-offences-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "frame-support", "frame-system", @@ -5197,7 +5197,7 @@ dependencies = [ [[package]] name = "pallet-rewards" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "frame-support", "frame-system", @@ -5210,7 +5210,7 @@ dependencies = [ [[package]] name = "pallet-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "frame-support", "frame-system", @@ -5263,7 +5263,7 @@ dependencies = [ [[package]] name = "pallet-transaction-fees" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "frame-support", "frame-system", @@ -6667,6 +6667,21 @@ dependencies = [ "thiserror", ] +[[package]] +name = "sc-consensus-fraud-proof" +version = "0.1.0" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" +dependencies = [ + "async-trait", + "parity-scale-codec", + "sc-consensus", + "sp-api", + "sp-consensus", + "sp-executor", + "sp-runtime", + "subspace-fraud-proof", +] + [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" @@ -6695,7 +6710,7 @@ dependencies = [ [[package]] name = "sc-consensus-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "async-trait", "fork-tree", @@ -6735,7 +6750,7 @@ dependencies = [ [[package]] name = "sc-consensus-subspace-rpc" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "async-oneshot", "futures", @@ -7180,7 +7195,7 @@ dependencies = [ [[package]] name = "sc-subspace-chain-specs" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "sc-chain-spec", "sc-service", @@ -8023,7 +8038,7 @@ dependencies = [ [[package]] name = "sp-consensus-subspace" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "async-trait", "parity-scale-codec", @@ -8138,7 +8153,7 @@ dependencies = [ [[package]] name = "sp-executor" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "parity-scale-codec", "scale-info", @@ -8146,7 +8161,6 @@ dependencies = [ "sp-application-crypto", "sp-consensus-slots", "sp-core", - "sp-externalities", "sp-runtime", "sp-runtime-interface", "sp-state-machine", @@ -8154,6 +8168,7 @@ dependencies = [ "sp-trie", "subspace-core-primitives", "subspace-runtime-primitives", + "thiserror", ] [[package]] @@ -8253,7 +8268,7 @@ dependencies = [ [[package]] name = "sp-objects" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "sp-api", "sp-std", @@ -8698,7 +8713,7 @@ dependencies = [ [[package]] name = "subspace-archiving" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "merkle_light", "parity-scale-codec", @@ -8712,7 +8727,7 @@ dependencies = [ [[package]] name = "subspace-core-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "hmac 0.12.1", "num-traits", @@ -8725,7 +8740,7 @@ dependencies = [ [[package]] name = "subspace-desktop" -version = "0.6.5" +version = "0.6.6" dependencies = [ "anyhow", "cirrus-runtime", @@ -8738,6 +8753,7 @@ dependencies = [ "libp2p", "log", "sc-chain-spec", + "sc-client-api", "sc-executor", "sc-network", "sc-service", @@ -8748,6 +8764,7 @@ dependencies = [ "sp-panic-handler", "subspace-core-primitives", "subspace-farmer", + "subspace-fraud-proof", "subspace-runtime", "subspace-service", "subspace-solving", @@ -8763,7 +8780,7 @@ dependencies = [ [[package]] name = "subspace-farmer" version = "0.3.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "anyhow", "arc-swap", @@ -8807,7 +8824,7 @@ dependencies = [ [[package]] name = "subspace-fraud-proof" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "hash-db", "parity-scale-codec", @@ -8816,7 +8833,6 @@ dependencies = [ "sp-blockchain", "sp-core", "sp-executor", - "sp-externalities", "sp-runtime", "sp-state-machine", "sp-trie", @@ -8826,7 +8842,7 @@ dependencies = [ [[package]] name = "subspace-networking" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "bytes", "event-listener-primitives", @@ -8844,7 +8860,7 @@ dependencies = [ [[package]] name = "subspace-rpc-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "hex-buffer-serde", "serde", @@ -8854,7 +8870,7 @@ dependencies = [ [[package]] name = "subspace-runtime" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "cirrus-primitives", "cirrus-runtime", @@ -8902,7 +8918,7 @@ dependencies = [ [[package]] name = "subspace-runtime-primitives" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "parity-scale-codec", "parity-util-mem", @@ -8916,18 +8932,21 @@ dependencies = [ [[package]] name = "subspace-service" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "cirrus-primitives", "derive_more", "frame-support", "frame-system-rpc-runtime-api", + "futures", "jsonrpsee", "pallet-transaction-payment-rpc", "pallet-transaction-payment-rpc-runtime-api", + "parity-util-mem", "sc-basic-authorship", "sc-client-api", "sc-consensus", + "sc-consensus-fraud-proof", "sc-consensus-slots", "sc-consensus-subspace", "sc-consensus-subspace-rpc", @@ -8960,12 +8979,13 @@ dependencies = [ "substrate-frame-rpc-system", "substrate-prometheus-endpoint", "thiserror", + "tracing", ] [[package]] name = "subspace-solving" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" dependencies = [ "merlin", "num-traits", @@ -8982,7 +9002,7 @@ dependencies = [ [[package]] name = "subspace-wasm-tools" version = "0.1.0" -source = "git+https://github.com/subspace/subspace?rev=eaff7053cb36fbf93fa43c1b19900a5b26037916#eaff7053cb36fbf93fa43c1b19900a5b26037916" +source = "git+https://github.com/subspace/subspace?rev=00670c9714949ec8f776e7f0467110945866457b#00670c9714949ec8f776e7f0467110945866457b" [[package]] name = "substrate-bip39" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index d14e29ce..c07d9e41 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subspace-desktop" -version = "0.6.5" +version = "0.6.6" description = "Subspace desktop" authors = ["Subspace Labs "] license = "Apache-2.0" @@ -13,7 +13,7 @@ tauri-build = { version = "1.0.0-rc.9", features = [] } [dependencies] anyhow = "1.0.44" -cirrus-runtime = { git = "https://github.com/subspace/subspace", rev = "eaff7053cb36fbf93fa43c1b19900a5b26037916" } +cirrus-runtime = { git = "https://github.com/subspace/subspace", rev = "00670c9714949ec8f776e7f0467110945866457b" } dirs = "4.0.0" dotenv = "0.15.0" event-listener-primitives = "2.0.1" @@ -22,19 +22,21 @@ fs2 = "0.4.3" hex = "0.4.3" log = "0.4.14" sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "5f0aa1feb7250ac7b8c1b9928f87b2420b530e22" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "5f0aa1feb7250ac7b8c1b9928f87b2420b530e22" } sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "5f0aa1feb7250ac7b8c1b9928f87b2420b530e22", features = ["wasmtime"] } sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "5f0aa1feb7250ac7b8c1b9928f87b2420b530e22" } sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "5f0aa1feb7250ac7b8c1b9928f87b2420b530e22", features = ["wasmtime"] } -sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "eaff7053cb36fbf93fa43c1b19900a5b26037916" } +sc-subspace-chain-specs = { git = "https://github.com/subspace/subspace", rev = "00670c9714949ec8f776e7f0467110945866457b" } serde_json = "1.0.81" serde = { version = "1.0.137", features = [ "derive" ] } sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "5f0aa1feb7250ac7b8c1b9928f87b2420b530e22" } sp-panic-handler = { version = "4.0.0", git = "https://github.com/subspace/substrate", rev = "5f0aa1feb7250ac7b8c1b9928f87b2420b530e22" } -subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "eaff7053cb36fbf93fa43c1b19900a5b26037916" } -subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "eaff7053cb36fbf93fa43c1b19900a5b26037916" } -subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "eaff7053cb36fbf93fa43c1b19900a5b26037916" } -subspace-service = { git = "https://github.com/subspace/subspace", rev = "eaff7053cb36fbf93fa43c1b19900a5b26037916" } -subspace-solving = { git = "https://github.com/subspace/subspace", rev = "eaff7053cb36fbf93fa43c1b19900a5b26037916" } +subspace-core-primitives = { git = "https://github.com/subspace/subspace", rev = "00670c9714949ec8f776e7f0467110945866457b" } +subspace-farmer = { git = "https://github.com/subspace/subspace", rev = "00670c9714949ec8f776e7f0467110945866457b" } +subspace-fraud-proof = { git = "https://github.com/subspace/subspace", rev = "00670c9714949ec8f776e7f0467110945866457b" } +subspace-runtime = { git = "https://github.com/subspace/subspace", rev = "00670c9714949ec8f776e7f0467110945866457b" } +subspace-service = { git = "https://github.com/subspace/subspace", rev = "00670c9714949ec8f776e7f0467110945866457b" } +subspace-solving = { git = "https://github.com/subspace/subspace", rev = "00670c9714949ec8f776e7f0467110945866457b" } tokio = { version = "1.11.0", features = ["macros", "rt-multi-thread"] } tracing = "0.1.31" tracing-subscriber = "0.3.11" diff --git a/src-tauri/src/farmer.rs b/src-tauri/src/farmer.rs index 57f5aff7..74aeb562 100644 --- a/src-tauri/src/farmer.rs +++ b/src-tauri/src/farmer.rs @@ -70,9 +70,10 @@ async fn farm( }; info!("Connecting to node at {}", node_rpc_url); - let client = NodeRpcClient::new(node_rpc_url).await?; + let archiving_client = NodeRpcClient::new(node_rpc_url).await?; + let farming_client = NodeRpcClient::new(node_rpc_url).await?; - let metadata = client + let metadata = farming_client .farmer_metadata() .await .map_err(|error| anyhow!(error))?; @@ -90,7 +91,8 @@ async fn farm( let multi_farming = MultiFarming::new( MultiFarmingOptions { base_directory: base_directory.clone(), - client, + archiving_client, + farming_client, object_mappings: object_mappings.clone(), reward_address, bootstrap_nodes: vec![], diff --git a/src-tauri/src/node.rs b/src-tauri/src/node.rs index e0afcfba..c80bc593 100644 --- a/src-tauri/src/node.rs +++ b/src-tauri/src/node.rs @@ -1,7 +1,8 @@ -use anyhow::Result; +use anyhow::{anyhow, Result}; use cirrus_runtime::GenesisConfig as ExecutionGenesisConfig; use log::{error, warn}; use sc_chain_spec::ChainSpec; +use sc_client_api::HeaderBackend; use sc_executor::{NativeExecutionDispatch, WasmExecutionMethod, WasmtimeInstantiationStrategy}; use sc_network::config::{NodeKeyConfig, Secret}; use sc_service::config::{ @@ -17,7 +18,8 @@ use sp_core::crypto::Ss58AddressFormat; use std::env; use std::path::PathBuf; use std::sync::Once; -use subspace_runtime::GenesisConfig as ConsensusGenesisConfig; +use subspace_fraud_proof::VerifyFraudProof; +use subspace_runtime::{GenesisConfig as ConsensusGenesisConfig, RuntimeApi}; use subspace_service::{FullClient, NewFull, SubspaceConfiguration}; use tokio::runtime::Handle; @@ -83,7 +85,12 @@ async fn create_full_client( chain_spec: CS, base_path: PathBuf, node_name: String, -) -> Result>> { +) -> Result< + NewFull< + FullClient, + impl VerifyFraudProof + Clone + Send + Sync + 'static, + >, +> { // This must only be initialized once INITIALIZE_SUBSTRATE.call_once(|| { dotenv::dotenv().ok(); @@ -113,8 +120,33 @@ async fn create_full_client( node_name, )?; - subspace_service::new_full::(config, true) - .map_err(Into::into) + let config_dir = config + .base_path + .as_ref() + .map(|base_path| base_path.config_dir("subspace_gemini_1b")); + + let primary_chain_node = subspace_service::new_full::( + config, true, + ) + .map_err(|error| { + sc_service::Error::Other(format!("Failed to build a full subspace node: {error:?}")) + })?; + + if primary_chain_node.client.info().best_number == 33670 { + if let Some(config_dir) = config_dir { + let workaround_file = config_dir.join("network").join("gemini_1b_workaround"); + if !workaround_file.exists() { + let _ = std::fs::write(workaround_file, &[]); + let _ = std::fs::remove_file(config_dir.join("network").join("secret_ed25519")); + return Err(anyhow!( + "Applied workaround for upgrade from gemini-1b-2022-jun-08, \ + please restart this node" + )); + } + } + } + + Ok(primary_chain_node) } fn set_default_ss58_version(chain_spec: &CS) {