Skip to content
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
24 changes: 19 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ panic = 'unwind'
members = [
'math',
'node',
'pallets/parameters',
'runtime/basilisk',
'pallets/marketplace',
'pallets/asset-registry',
Expand Down Expand Up @@ -56,6 +57,7 @@ pallet-marketplace = { path = "pallets/marketplace", default-features = false}
pallet-asset-registry = { path = "pallets/asset-registry", default-features = false}
pallet-ema-oracle = { path = "pallets/ema-oracle", default-features = false}
pallet-lbp = { path = "pallets/lbp", default-features = false }
pallet-parameters = { path = "pallets/parameters", default-features = false }
pallet-route-executor = { path = "pallets/route-executor", default-features = false }
pallet-transaction-multi-payment = { path = "pallets/transaction-multi-payment", default-features = false }
pallet-xyk = { path = "pallets/xyk", default-features = false }
Expand Down Expand Up @@ -596,4 +598,3 @@ westend-runtime = { git = "https://github.com/galacticcouncil/polkadot-sdk", bra
cumulus-client-pov-recovery = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "polkadot-stable2506-7-patch" }
cumulus-pallet-parachain-system-proc-macro = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "polkadot-stable2506-7-patch" }
cumulus-relay-chain-rpc-interface = { git = "https://github.com/galacticcouncil/polkadot-sdk", branch = "polkadot-stable2506-7-patch" }

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.2.0"
version = "1.2.1"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
8 changes: 8 additions & 0 deletions integration-tests/src/kusama_test_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ pub mod basilisk {
safe_xcm_version: Some(5),
..Default::default()
},
parameters: basilisk_runtime::ParametersConfig {
relay_parent_offset_override: true,
..Default::default()
},
multi_transaction_payment: basilisk_runtime::MultiTransactionPaymentConfig {
currencies: vec![(AUSD, Price::from_inner(462_962_963_000_u128))], //0.000_000_462_962_963
account_currencies: vec![],
Expand Down Expand Up @@ -516,6 +520,10 @@ pub mod other_parachain {
safe_xcm_version: Some(5),
..Default::default()
},
parameters: basilisk_runtime::ParametersConfig {
relay_parent_offset_override: true,
..Default::default()
},
multi_transaction_payment: basilisk_runtime::MultiTransactionPaymentConfig {
currencies: vec![(AUSD, Price::from_inner(462_962_963_000_u128))], //0.000_000_462_962_963
account_currencies: vec![],
Expand Down
10 changes: 10 additions & 0 deletions launch-configs/zombienet/local.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@
"name": "bob",
"ws_port": 9955,
"validator": true
},
{
"name": "charlie",
"ws_port": 9966,
"validator": true
},
{
"name": "dave",
"ws_port": 9977,
"validator": true
}
]
},
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 = "19.1.0"
version = "20.0.0"
description = "Basilisk node"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
7 changes: 6 additions & 1 deletion node/src/chain_spec/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
),
// endowed_accounts
vec![
(get_account_id_from_seed::<sr25519::Public>("Alice"), INITIAL_BALANCE),
(
get_account_id_from_seed::<sr25519::Public>("Alice"),
INITIAL_BALANCE * 20,
),
(get_account_id_from_seed::<sr25519::Public>("Bob"), INITIAL_BALANCE),
(get_account_id_from_seed::<sr25519::Public>("Charlie"), INITIAL_BALANCE),
(get_account_id_from_seed::<sr25519::Public>("Dave"), INITIAL_BALANCE),
Expand Down Expand Up @@ -102,6 +105,8 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
],
// parachain ID
PARA_ID.into(),
// is_testnet
true,
);

let chain_spec = ChainSpec::builder(
Expand Down
4 changes: 4 additions & 0 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub fn parachain_genesis(
accepted_assets: Vec<(AssetId, Price)>, // (Asset id, Fallback price) - asset which fee can be paid with
token_balances: Vec<(AccountId, Vec<(AssetId, Balance)>)>,
parachain_id: ParaId,
is_testnet: bool,
) -> serde_json::Value {
serde_json::json!({
"system": {},
Expand Down Expand Up @@ -135,6 +136,9 @@ pub fn parachain_genesis(
"currencies": accepted_assets,
"accountCurrencies": Vec::<(AccountId, AssetId)>::new(),
},
"parameters": {
"isTestnet": is_testnet,
},
"parachainInfo": {
"parachainId": parachain_id,
},
Expand Down
2 changes: 2 additions & 0 deletions node/src/chain_spec/paseo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ pub fn _parachain_config_paseo() -> Result<ChainSpec, String> {
vec![],
// parachain ID
PARA_ID.into(),
// is_testnet
false,
);

let chain_spec = ChainSpec::builder(
Expand Down
2 changes: 2 additions & 0 deletions node/src/chain_spec/rococo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ pub fn _parachain_config_rococo() -> Result<ChainSpec, String> {
vec![],
// parachain ID
PARA_ID.into(),
// is_testnet
false,
);

let chain_spec = ChainSpec::builder(
Expand Down
51 changes: 32 additions & 19 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use basilisk_runtime::{

// Cumulus Imports
use cumulus_client_collator::service::CollatorService;
use cumulus_client_consensus_aura::collators::slot_based::{SlotBasedBlockImport, SlotBasedBlockImportHandle};
use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;
use cumulus_client_consensus_proposer::Proposer;
use cumulus_client_service::{
Expand All @@ -41,7 +42,7 @@ use cumulus_primitives_core::{
relay_chain::{CollatorPair, ValidationCode},
ParaId,
};
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
use cumulus_relay_chain_interface::RelayChainInterface;

// Substrate Imports
use sc_client_api::Backend;
Expand All @@ -65,7 +66,8 @@ type ParachainClient = TFullClient<

type ParachainBackend = TFullBackend<Block>;

type ParachainBlockImport = TParachainBlockImport<Block, Arc<ParachainClient>, ParachainBackend>;
type ParachainBlockImport =
TParachainBlockImport<Block, SlotBasedBlockImport<Block, Arc<ParachainClient>, ParachainClient>, ParachainBackend>;

/// Starts a `ServiceBuilder` for a full service.
///
Expand All @@ -80,7 +82,12 @@ pub fn new_partial(
(),
sc_consensus::DefaultImportQueue<Block>,
sc_transaction_pool::TransactionPoolHandle<Block, ParachainClient>,
(ParachainBlockImport, Option<Telemetry>, Option<TelemetryWorkerHandle>),
(
ParachainBlockImport,
SlotBasedBlockImportHandle<Block>,
Option<Telemetry>,
Option<TelemetryWorkerHandle>,
),
>,
sc_service::Error,
> {
Expand Down Expand Up @@ -138,7 +145,8 @@ pub fn new_partial(
.build(),
);

let block_import = ParachainBlockImport::new(client.clone(), backend.clone());
let (slot_based_block_import, block_import_handle) = SlotBasedBlockImport::new(client.clone(), client.clone());
let block_import = ParachainBlockImport::new(slot_based_block_import, backend.clone());

let import_queue = build_import_queue(
client.clone(),
Expand All @@ -156,7 +164,7 @@ pub fn new_partial(
task_manager,
transaction_pool,
select_chain: (),
other: (block_import, telemetry, telemetry_worker_handle),
other: (block_import, block_import_handle, telemetry, telemetry_worker_handle),
})
}

Expand All @@ -174,7 +182,7 @@ async fn start_node_impl(
let parachain_config = prepare_node_config(parachain_config);

let params = new_partial(&parachain_config)?;
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;
let (block_import, block_import_handle, 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(
Expand Down Expand Up @@ -329,6 +337,7 @@ async fn start_node_impl(
client.clone(),
backend.clone(),
block_import,
block_import_handle,
prometheus_registry.as_ref(),
telemetry.as_ref().map(|t| t.handle()),
&task_manager,
Expand All @@ -338,7 +347,6 @@ async fn start_node_impl(
relay_chain_slot_duration,
para_id,
collator_key.expect("Command line arguments do not allow this. qed"),
overseer_handle,
announce_block,
)?;
}
Expand Down Expand Up @@ -379,6 +387,7 @@ fn start_consensus(
client: Arc<ParachainClient>,
backend: Arc<ParachainBackend>,
block_import: ParachainBlockImport,
block_import_handle: SlotBasedBlockImportHandle<Block>,
prometheus_registry: Option<&Registry>,
telemetry: Option<TelemetryHandle>,
task_manager: &TaskManager,
Expand All @@ -388,13 +397,9 @@ fn start_consensus(
relay_chain_slot_duration: Duration,
para_id: ParaId,
collator_key: CollatorPair,
overseer_handle: OverseerHandle,
announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
) -> Result<(), sc_service::Error> {
use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params as AuraParams};

// NOTE: because we use Aura here explicitly, we can use `CollatorSybilResistance::Resistant`
// when starting the network.
use cumulus_client_consensus_aura::collators::slot_based::{self as slot_based, Params as SlotBasedParams};

let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
task_manager.spawn_handle(),
Expand All @@ -413,27 +418,35 @@ fn start_consensus(
client.clone(),
);

let params = AuraParams {
let client_for_aura = client.clone();
let params = SlotBasedParams {
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
block_import,
para_client: client.clone(),
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()),
code_hash_provider: move |block_hash| {
client_for_aura
.code_at(block_hash)
.ok()
.map(|c| ValidationCode::from(c).hash())
},
keystore,
collator_key,
para_id,
overseer_handle,
relay_chain_slot_duration,
proposer,
collator_service,
authoring_duration: Duration::from_millis(1500),
reinitialize: false,
max_pov_percentage: None, // Defaults to 85% of max PoV size (safe default)
slot_offset: Duration::from_secs(1),
block_import_handle,
spawner: task_manager.spawn_handle(),
relay_chain_slot_duration,
export_pov: None,
max_pov_percentage: None,
};

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

Ok(())
}
Expand Down
33 changes: 33 additions & 0 deletions pallets/parameters/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[package]
name = "pallet-parameters"
version = "1.0.0"
authors = ["GalacticCouncil"]
edition = "2021"
license = "Apache-2.0"
homepage = "https://github.com/galacticcouncil/Basilisk-node"
repository = "https://github.com/galacticcouncil/Basilisk-node"
description = "Pallet for storing runtime parameters"

[dependencies]
codec = { workspace = true, features = ["derive", "max-encoded-len"] }
scale-info = { workspace = true }
frame-support = { workspace = true }
frame-system = { workspace = true }

[dev-dependencies]
sp-core = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }

[features]
default = ["std"]
std = [
"codec/std",
"scale-info/std",
"frame-support/std",
"frame-system/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
]
try-runtime = ["frame-support/try-runtime"]
Loading
Loading