Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substrate upgrade cleanups #2426

Merged
merged 4 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
351 changes: 115 additions & 236 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ panic = "unwind"
inherits = "release"
lto = "fat"

[patch.crates-io]
# TODO: Switch to stable release once https://github.com/paritytech/substrate-bip39/pull/20 is published
substrate-bip39 = { git = "https://github.com/paritytech/substrate-bip39", rev = "03f02a7225d9bc5add92b7657790ee1ac8ab90a4" }

# Reason: We need to patch substrate dependency of frontier to our fork
# TODO: Remove if/when we are using upstream substrate instead of fork
[patch."https://github.com/paritytech/polkadot-sdk.git"]
Expand Down
2 changes: 1 addition & 1 deletion crates/pallet-offences-subspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sp-std = { version = "8.0.0", default-features = false, git = "https://github.co
[dev-dependencies]
sp-io = { version = "23.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-core = { version = "21.0.0", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
schnorrkel = "0.9.1"
schnorrkel = "0.11.4"

[features]
default = ["std"]
Expand Down
2 changes: 1 addition & 1 deletion crates/pallet-subspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ frame-support = { version = "4.0.0-dev", default-features = false, git = "https:
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
log = { version = "0.4.20", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
schnorrkel = { version = "0.9.1", default-features = false, features = ["u64_backend"] }
schnorrkel = { version = "0.11.4", default-features = false }
serde = { version = "1.0.195", optional = true, default-features = false, features = ["derive"] }
sp-consensus-subspace = { version = "0.1.0", default-features = false, path = "../sp-consensus-subspace" }
sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
Expand Down
2 changes: 1 addition & 1 deletion crates/sc-consensus-subspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ parking_lot = "0.12.1"
rand = "0.8.5"
rand_chacha = "0.3.1"
rayon = "1.8.0"
schnorrkel = "0.9.1"
schnorrkel = "0.11.4"
sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
Expand Down
2 changes: 1 addition & 1 deletion crates/sc-consensus-subspace/src/slot_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ where
// Ensure proof of time is valid according to parent block
if !self.pot_verifier.is_output_valid(
pot_input,
Slot::from(u64::from(slot) - u64::from(parent_slot)),
slot - parent_slot,
proof_of_time,
parent_pot_parameters.next_parameters_change(),
) {
Expand Down
2 changes: 1 addition & 1 deletion crates/sc-proof-of-time/src/source/gossip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ where
match GossipProof::decode(&mut data) {
Ok(proof) => {
let next_slot_input = self.state.next_slot_input(atomic::Ordering::Relaxed);
let current_slot = Slot::from(u64::from(next_slot_input.slot) - 1);
let current_slot = next_slot_input.slot - Slot::from(1);

if proof.slot < current_slot {
trace!(
Expand Down
2 changes: 1 addition & 1 deletion crates/sp-consensus-subspace/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async-trait = { version = "0.1.73", optional = true }
codec = { package = "parity-scale-codec", version = "3.6.5", default-features = false }
log = { version = "0.4.20", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
schnorrkel = { version = "0.9.1", default-features = false, features = ["u64_backend"] }
schnorrkel = { version = "0.11.4", default-features = false }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-application-crypto = { version = "23.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
Expand Down
2 changes: 1 addition & 1 deletion crates/sp-lightclient/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include = [
[dependencies]
codec = { package = "parity-scale-codec", version = "3.1.2", default-features = false }
scale-info = { version = "2.7.0", default-features = false, features = ["derive"] }
schnorrkel = { version = "0.9.1", default-features = false, features = ["u64_backend"] }
schnorrkel = { version = "0.11.4", default-features = false }
sp-arithmetic = { version = "16.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-consensus-subspace = { version = "0.1.0", path = "../sp-consensus-subspace", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-farmer-components/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ libc = "0.2.146"
parity-scale-codec = "3.6.5"
rand = "0.8.5"
rayon = "1.8.0"
schnorrkel = "0.9.1"
schnorrkel = "0.11.4"
serde = { version = "1.0.195", features = ["derive"] }
static_assertions = "1.1.0"
subspace-archiving = { version = "0.1.0", path = "../subspace-archiving" }
Expand Down
4 changes: 2 additions & 2 deletions crates/subspace-farmer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ parking_lot = "0.12.1"
prometheus-client = "0.22.0"
rand = "0.8.5"
rayon = "1.8.0"
schnorrkel = "0.9.1"
schnorrkel = "0.11.4"
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
static_assertions = "1.1.0"
Expand All @@ -52,7 +52,7 @@ subspace-metrics = { version = "0.1.0", path = "../../shared/subspace-metrics" }
subspace-networking = { version = "0.1.0", path = "../subspace-networking" }
subspace-proof-of-space = { version = "0.1.0", path = "../subspace-proof-of-space" }
subspace-rpc-primitives = { version = "0.1.0", path = "../subspace-rpc-primitives" }
substrate-bip39 = "0.4.4"
substrate-bip39 = "0.4.5"
supports-color = "2.0.0"
tempfile = "3.8.0"
thiserror = "1.0.48"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ fn main() -> Result<(), Error> {
let cross_domain_message_gossip_worker = xdm_gossip_worker_builder
.build::<Block, _, _>(
consensus_chain_node.network_service,
consensus_chain_node.cdm_gossip_notification_service,
consensus_chain_node.xdm_gossip_notification_service,
consensus_chain_node.sync_service,
);

Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-node/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ pub async fn run(run_options: RunOptions) -> Result<(), Error> {
let cross_domain_message_gossip_worker = xdm_gossip_worker_builder
.build::<Block, _, _>(
consensus_chain_node.network_service.clone(),
consensus_chain_node.cdm_gossip_notification_service,
consensus_chain_node.xdm_gossip_notification_service,
consensus_chain_node.sync_service.clone(),
);

Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ impl pallet_sudo::Config for Runtime {

parameter_types! {
pub const RelayConfirmationDepth: BlockNumber = 18;
pub SelfChainId: ChainId = ChainId::Consensus;
pub const SelfChainId: ChainId = ChainId::Consensus;
}

pub struct DomainInfo;
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/polka
sc-tracing = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
schnorrkel = "0.9.1"
schnorrkel = "0.11.4"
sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
Expand Down
16 changes: 8 additions & 8 deletions crates/subspace-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use crate::dsn::{create_dsn_instance, DsnConfigurationError};
use crate::metrics::NodeMetrics;
use crate::transaction_pool::FullPool;
use core::sync::atomic::{AtomicU32, Ordering};
use cross_domain_message_gossip::cdm_gossip_peers_set_config;
use cross_domain_message_gossip::xdm_gossip_peers_set_config;
use domain_runtime_primitives::opaque::{Block as DomainBlock, Header as DomainHeader};
use frame_system_rpc_runtime_api::AccountNonceApi;
use futures::channel::oneshot;
Expand Down Expand Up @@ -341,14 +341,14 @@ where
if quick_verification {
pot_verifier.try_is_output_valid(
pot_input,
Slot::from(slot - u64::from(parent_slot)),
Slot::from(slot) - parent_slot,
proof_of_time,
pot_parameters.next_parameters_change(),
)
} else {
pot_verifier.is_output_valid(
pot_input,
Slot::from(slot - u64::from(parent_slot)),
Slot::from(slot) - parent_slot,
proof_of_time,
pot_parameters.next_parameters_change(),
)
Expand Down Expand Up @@ -587,7 +587,7 @@ where
/// Network service.
pub network_service: Arc<NetworkService<Block, <Block as BlockT>::Hash>>,
/// Cross-domain gossip notification service.
pub cdm_gossip_notification_service: Box<dyn NotificationService>,
pub xdm_gossip_notification_service: Box<dyn NotificationService>,
/// Sync service.
pub sync_service: Arc<sc_network_sync::SyncingService<Block>>,
/// RPC handlers.
Expand Down Expand Up @@ -761,9 +761,9 @@ where
.map_err(Error::BlockRelay)?,
);
let mut net_config = sc_network::config::FullNetworkConfiguration::new(&config.base.network);
let (cdm_gossip_notification_config, cdm_gossip_notification_service) =
cdm_gossip_peers_set_config();
net_config.add_notification_protocol(cdm_gossip_notification_config);
let (xdm_gossip_notification_config, xdm_gossip_notification_service) =
xdm_gossip_peers_set_config();
net_config.add_notification_protocol(xdm_gossip_notification_config);
let (pot_gossip_notification_config, pot_gossip_notification_service) =
pot_gossip_peers_set_config();
net_config.add_notification_protocol(pot_gossip_notification_config);
Expand Down Expand Up @@ -1068,7 +1068,7 @@ where
client,
select_chain,
network_service,
cdm_gossip_notification_service,
xdm_gossip_notification_service,
sync_service,
rpc_handlers,
backend,
Expand Down
2 changes: 1 addition & 1 deletion crates/subspace-verification/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include = [

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.5", default-features = false }
schnorrkel = { version = "0.9.1", default-features = false, features = ["u64_backend"] }
schnorrkel = { version = "0.11.4", default-features = false }
sp-arithmetic = { version = "16.0.0", default-features = false, git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
subspace-archiving = { version = "0.1.0", path = "../subspace-archiving", default-features = false }
subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub struct GossipWorker<Block: BlockT, Network> {
}

/// Returns the network configuration for cross chain message gossip.
pub fn cdm_gossip_peers_set_config() -> (NonDefaultSetConfig, Box<dyn NotificationService>) {
pub fn xdm_gossip_peers_set_config() -> (NonDefaultSetConfig, Box<dyn NotificationService>) {
let (mut cfg, notification_service) = NonDefaultSetConfig::new(
PROTOCOL_NAME.into(),
Vec::new(),
Expand Down
2 changes: 1 addition & 1 deletion domains/client/cross-domain-message-gossip/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod gossip_worker;
mod message_listener;

pub use gossip_worker::{
cdm_gossip_peers_set_config, ChainTxPoolMsg, ChainTxPoolSink, GossipWorker,
xdm_gossip_peers_set_config, ChainTxPoolMsg, ChainTxPoolSink, GossipWorker,
GossipWorkerBuilder, Message,
};
pub use message_listener::start_cross_chain_message_listener;
2 changes: 1 addition & 1 deletion test/subspace-test-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ codec = { package = "parity-scale-codec", version = "3.6.5", features = ["derive
evm-domain-test-runtime = { version = "0.1.0", path = "../../domains/test/runtime/evm" }
fp-evm = { version = "3.0.0-dev", git = "https://github.com/subspace/frontier", rev = "7627e61d80275a4cf24d06f27491f6c31eadb7b7" }
futures = "0.3.29"
schnorrkel = "0.9.1"
schnorrkel = "0.11.4"
sc-chain-spec = { git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sc-client-api = { git = "https://github.com/subspace/polkadot-sdk", rev = "d6b500960579d73c43fc4ef550b703acfa61c4c8" }
sc-consensus-subspace = { version = "0.1.0", path = "../../crates/sc-consensus-subspace" }
Expand Down
16 changes: 8 additions & 8 deletions test/subspace-test-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#![warn(missing_docs, unused_crate_dependencies)]

use codec::{Decode, Encode};
use cross_domain_message_gossip::{cdm_gossip_peers_set_config, GossipWorkerBuilder};
use cross_domain_message_gossip::{xdm_gossip_peers_set_config, GossipWorkerBuilder};
use domain_runtime_primitives::opaque::{Block as DomainBlock, Header as DomainHeader};
use futures::channel::mpsc;
use futures::{select, Future, FutureExt, StreamExt};
Expand Down Expand Up @@ -233,7 +233,7 @@ pub struct MockConsensusNode {
/// Network service.
pub network_service: Arc<sc_network::NetworkService<Block, <Block as BlockT>::Hash>>,
/// Cross-domain gossip notification service.
pub cdm_gossip_notification_service: Option<Box<dyn NotificationService>>,
pub xdm_gossip_notification_service: Option<Box<dyn NotificationService>>,
/// Sync service.
pub sync_service: Arc<sc_network_sync::SyncingService<Block>>,
/// RPC handlers.
Expand Down Expand Up @@ -309,9 +309,9 @@ impl MockConsensusNode {
let block_import = MockBlockImport::<_, _>::new(client.clone());

let mut net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);
let (cdm_gossip_notification_config, cdm_gossip_notification_service) =
cdm_gossip_peers_set_config();
net_config.add_notification_protocol(cdm_gossip_notification_config);
let (xdm_gossip_notification_config, xdm_gossip_notification_service) =
xdm_gossip_peers_set_config();
net_config.add_notification_protocol(xdm_gossip_notification_config);

let (network_service, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =
sc_service::build_network(sc_service::BuildNetworkParams {
Expand Down Expand Up @@ -359,7 +359,7 @@ impl MockConsensusNode {
transaction_pool,
select_chain,
network_service,
cdm_gossip_notification_service: Some(cdm_gossip_notification_service),
xdm_gossip_notification_service: Some(xdm_gossip_notification_service),
sync_service,
rpc_handlers,
network_starter: Some(network_starter),
Expand Down Expand Up @@ -396,9 +396,9 @@ impl MockConsensusNode {
.expect("gossip message worker have not started yet");
let cross_domain_message_gossip_worker = xdm_gossip_worker_builder.build::<Block, _, _>(
self.network_service.clone(),
self.cdm_gossip_notification_service
self.xdm_gossip_notification_service
.take()
.expect("CDM gossip notification service must be used only once"),
.expect("XDM gossip notification service must be used only once"),
self.sync_service.clone(),
);
self.task_manager
Expand Down
Loading