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

chore: upgrade to polkadot 2409 #675

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
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
4,118 changes: 1,961 additions & 2,157 deletions Cargo.lock

Large diffs are not rendered by default.

1,032 changes: 515 additions & 517 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runtime-integration-tests"
version = "1.0.6"
version = "1.0.7"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
32 changes: 28 additions & 4 deletions integration-tests/src/kusama_test_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use frame_support::assert_ok;
use frame_support::traits::OnInitialize;
use pallet_transaction_multi_payment::Price;
pub use pallet_xyk::types::AssetPair;
use polkadot_primitives::v7::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE};
use polkadot_primitives::v8::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE};
use polkadot_runtime_parachains::configuration::HostConfiguration;
use pretty_assertions::assert_eq;
use primitives::{constants::time::SLOT_DURATION, AssetId, Balance};
Expand Down Expand Up @@ -167,13 +167,12 @@ pub mod rococo {
}

use polkadot_primitives::{AssignmentId, ValidatorId};
use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy;
use polkadot_service::chain_spec::get_account_id_from_seed;
use sc_consensus_grandpa::AuthorityId as GrandpaId;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId;

use sp_core::{Pair, Public};
use sp_core::{sr25519, Pair, Public};

/// Helper function to generate a crypto pair from seed
fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand All @@ -200,6 +199,28 @@ pub mod rococo {
}
}

pub fn get_authority_keys_from_seed_no_beefy(
seed: &str,
) -> (
AccountId,
AccountId,
BabeId,
GrandpaId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
) {
(
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", seed)),
get_account_id_from_seed::<sr25519::Public>(seed),
get_from_seed::<BabeId>(seed),
get_from_seed::<GrandpaId>(seed),
get_from_seed::<ValidatorId>(seed),
get_from_seed::<AssignmentId>(seed),
get_from_seed::<AuthorityDiscoveryId>(seed),
)
}

pub fn initial_authorities() -> Vec<(
AccountId,
AccountId,
Expand Down Expand Up @@ -250,6 +271,7 @@ pub mod rococo {
)
})
.collect::<Vec<_>>(),
non_authority_keys: Default::default(),
},
babe: rococo_runtime::BabeConfig {
authorities: Default::default(),
Expand Down Expand Up @@ -373,6 +395,7 @@ pub mod basilisk {
)
})
.collect(),
non_authority_keys: Default::default(),
},
asset_registry: basilisk_runtime::AssetRegistryConfig {
registered_assets: vec![
Expand Down Expand Up @@ -460,6 +483,7 @@ pub mod other_parachain {
)
})
.collect(),
non_authority_keys: Default::default(),
},
asset_registry: basilisk_runtime::AssetRegistryConfig {
registered_assets: vec![(b"AUSD".to_vec(), 1_000_000u128, Some(AUSD))],
Expand Down
4 changes: 0 additions & 4 deletions integration-tests/src/sessions.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#![cfg(test)]
use crate::kusama_test_net::*;
use basilisk_runtime::CollatorRewards;
use basilisk_runtime::Runtime;
use frame_support::traits::Contains;
use pallet_session::SessionManager;
use polkadot_xcm::v3::prelude::*;
use polkadot_xcm::VersionedXcm;
use pretty_assertions::assert_eq;
use xcm_emulator::TestExt;
#[test]
Expand Down
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "basilisk"
version = "17.0.0"
version = "18.0.0"
description = "Basilisk node"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
5 changes: 2 additions & 3 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const TOKEN_DECIMALS: u8 = 12;
const TOKEN_SYMBOL: &str = "BSX";
const PROTOCOL_ID: &str = "bsx";

use basilisk_runtime::{AccountId, AuraId, Balance, RuntimeGenesisConfig, Signature, WASM_BINARY};
use basilisk_runtime::{AccountId, AuraId, Balance, Signature, WASM_BINARY};
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use primitives::{
Expand All @@ -45,7 +45,6 @@ use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};
/// The extensions for the [`ChainSpec`].
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
#[serde(deny_unknown_fields)]
pub struct Extensions {
/// The relay chain of the Parachain.
pub relay_chain: String,
Expand All @@ -61,7 +60,7 @@ impl Extensions {
}

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<Extensions>;

/// Generate a crypto pair from seed.
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down
17 changes: 7 additions & 10 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ pub fn run() -> sc_cli::Result<()> {
let hwbench = (!cli.no_hardware_benchmarks)
.then_some(config.database.path().map(|database_path| {
let _ = std::fs::create_dir_all(database_path);
sc_sysinfo::gather_hwbench(Some(database_path))
sc_sysinfo::gather_hwbench(
Some(database_path),
&SUBSTRATE_REFERENCE_HARDWARE,
)
}))
.flatten();

Expand All @@ -296,7 +299,7 @@ pub fn run() -> sc_cli::Result<()> {
let id = ParaId::from(para_id);

let parachain_account =
AccountIdConversion::<polkadot_primitives::v7::AccountId>::into_account_truncating(&id);
AccountIdConversion::<polkadot_primitives::v8::AccountId>::into_account_truncating(&id);

let state_version = Cli::runtime_version().state_version();

Expand Down Expand Up @@ -373,15 +376,9 @@ impl CliConfiguration<Self> for RelayChainCli {
self.base.base.prometheus_config(default_listen_port, chain_spec)
}

fn init<F>(
&self,
_support_url: &String,
_impl_version: &String,
_logger_hook: F,
_config: &sc_service::Configuration,
) -> Result<()>
fn init<F>(&self, _support_url: &String, _impl_version: &String, _logger_hook: F) -> Result<()>
where
F: FnOnce(&mut sc_cli::LoggerBuilder, &sc_service::Configuration),
F: FnOnce(&mut sc_cli::LoggerBuilder),
{
unreachable!("PolkadotCli is never initialized; qed");
}
Expand Down
14 changes: 3 additions & 11 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use std::sync::Arc;

use basilisk_runtime::{opaque::Block, AccountId, Balance, Index};
pub use sc_rpc_api::DenyUnsafe;
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
Expand All @@ -20,8 +19,6 @@ pub struct FullDeps<C, P, B> {
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
/// Backend used by the node.
pub backend: Arc<B>,
}
Expand All @@ -47,16 +44,11 @@ where
use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer};

let mut module = RpcExtension::new(());
let FullDeps {
client,
pool,
deny_unsafe,
backend,
} = deps;
let FullDeps { client, pool, backend } = deps;

module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(System::new(client.clone(), pool).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(StateMigration::new(client, backend, deny_unsafe).into_rpc())?;
module.merge(StateMigration::new(client, backend).into_rpc())?;

// Extend this RPC with a custom API by using the following syntax.
// `YourRpcStruct` should have a reference to a client, which is needed
Expand Down
19 changes: 9 additions & 10 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ use sc_client_api::Backend;
use sc_consensus::ImportQueue;
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_network::NetworkBlock;
use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
Expand Down Expand Up @@ -97,17 +96,18 @@ pub fn new_partial(
.transpose()?;

let heap_pages = config
.executor
.default_heap_pages
.map_or(DEFAULT_HEAP_ALLOC_STRATEGY, |h| HeapAllocStrategy::Static {
extra_pages: h as _,
});

let executor = WasmExecutor::builder()
.with_execution_method(config.wasm_method)
.with_execution_method(config.executor.wasm_method)
.with_onchain_heap_alloc_strategy(heap_pages)
.with_offchain_heap_alloc_strategy(heap_pages)
.with_max_runtime_instances(config.max_runtime_instances)
.with_runtime_cache_size(config.runtime_cache_size)
.with_max_runtime_instances(config.executor.max_runtime_instances)
.with_runtime_cache_size(config.executor.runtime_cache_size)
.build();

let (client, backend, keystore_container, task_manager) =
Expand Down Expand Up @@ -171,8 +171,11 @@ async fn start_node_impl(

let params = new_partial(&parachain_config)?;
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;

let prometheus_registry = parachain_config.prometheus_registry().cloned();
let net_config = sc_network::config::FullNetworkConfiguration::<_, _, sc_network::NetworkWorker<Block, Hash>>::new(
&parachain_config.network,
prometheus_registry.clone(),
);

let client = params.client.clone();
Expand Down Expand Up @@ -235,11 +238,10 @@ async fn start_node_impl(
let transaction_pool = transaction_pool.clone();
let backend = backend.clone();

Box::new(move |deny_unsafe, _| {
Box::new(move |_| {
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: transaction_pool.clone(),
deny_unsafe,
backend: backend.clone(),
};

Expand Down Expand Up @@ -326,7 +328,6 @@ async fn start_node_impl(
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
sync_service.clone(),
params.keystore_container.keystore(),
relay_chain_slot_duration,
para_id,
Expand Down Expand Up @@ -379,7 +380,6 @@ fn start_consensus(
task_manager: &TaskManager,
relay_chain_interface: Arc<dyn RelayChainInterface>,
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
sync_oracle: Arc<SyncingService<Block>>,
keystore: KeystorePtr,
relay_chain_slot_duration: Duration,
para_id: ParaId,
Expand Down Expand Up @@ -416,7 +416,6 @@ fn start_consensus(
para_backend: backend.clone(),
relay_client: relay_chain_interface,
code_hash_provider: move |block_hash| client.code_at(block_hash).ok().map(|c| ValidationCode::from(c).hash()),
sync_oracle,
keystore,
collator_key,
para_id,
Expand All @@ -428,7 +427,7 @@ fn start_consensus(
reinitialize: false,
};

let fut = aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _, _, _>(params);
let fut = aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _, _>(params);
task_manager.spawn_essential_handle().spawn("aura", None, fut);

Ok(())
Expand Down
7 changes: 4 additions & 3 deletions pallets/asset-registry/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-asset-registry"
version = "2.3.5"
version = "2.3.6"
description = "Pallet for asset registry management"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down Expand Up @@ -51,8 +51,10 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
]
std = [
"serde/std",
"codec/std",
"scale-info/std",
"serde/std",
"orml-traits/std",
"frame-support/std",
"frame-system/std",
"sp-runtime/std",
Expand All @@ -61,7 +63,6 @@ std = [
"hydradx-traits/std",
"sp-api/std",
"frame-benchmarking/std",
"scale-info/std",
"polkadot-xcm/std",
]
try-runtime = ["frame-support/try-runtime"]
Expand Down
1 change: 1 addition & 0 deletions pallets/asset-registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::manual_inspect)]

use frame_support::pallet_prelude::*;
use frame_support::sp_runtime::traits::CheckedAdd;
Expand Down
3 changes: 3 additions & 0 deletions pallets/asset-registry/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub enum AssetType<AssetId> {
StableSwap,
Bond,
External,
Erc20,
}

impl<AssetId> From<AssetKind> for AssetType<AssetId> {
Expand All @@ -45,6 +46,7 @@ impl<AssetId> From<AssetKind> for AssetType<AssetId> {
AssetKind::StableSwap => Self::StableSwap,
AssetKind::Bond => Self::Bond,
AssetKind::External => Self::External,
AssetKind::Erc20 => Self::Erc20,
}
}
}
Expand All @@ -58,6 +60,7 @@ impl<AssetId> From<AssetType<AssetId>> for AssetKind {
AssetType::StableSwap => Self::StableSwap,
AssetType::Bond => Self::Bond,
AssetType::External => Self::External,
AssetType::Erc20 => Self::Erc20,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/marketplace/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-marketplace"
version = "5.0.19"
version = "5.0.20"
authors = ["GalacticCoucil"]
description = "The marketplace for trading NFTs"
edition = "2018"
Expand Down
1 change: 1 addition & 0 deletions pallets/marketplace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::unused_unit)]
#![allow(clippy::upper_case_acronyms)]
#![allow(clippy::manual_inspect)]

use frame_support::{
dispatch::DispatchResult,
Expand Down
2 changes: 1 addition & 1 deletion pallets/xyk-liquidity-mining/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-xyk-liquidity-mining"
version = "1.1.12"
version = "1.1.13"
description = "Liquidity mining"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
1 change: 1 addition & 0 deletions pallets/xyk-liquidity-mining/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
//! pair of assets.

#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::manual_inspect)]

#[cfg(test)]
mod tests;
Expand Down
Loading
Loading