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

polkadot-stable2409-3 #82

Merged
merged 5 commits into from
Feb 5, 2025
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
1,346 changes: 679 additions & 667 deletions Cargo.lock

Large diffs are not rendered by default.

204 changes: 97 additions & 107 deletions Cargo.toml

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ use std::path::PathBuf;
#[allow(clippy::large_enum_variant)]
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Key management CLI utilities
#[command(subcommand)]
Key(sc_cli::KeySubcommand),

/// Build a chain specification.
BuildSpec(sc_cli::BuildSpecCmd),

Expand Down
29 changes: 12 additions & 17 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::info;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, Result, SharedParams, SubstrateCli,
NetworkParams, Result, RpcEndpoint, SharedParams, SubstrateCli,
};
use sc_service::config::{BasePath, PrometheusConfig};
use sp_runtime::traits::AccountIdConversion;
use std::net::SocketAddr;

const POLKADOT_PARA_ID: u32 = 2051;
const PASEO_PARA_ID: u32 = 2051;
Expand Down Expand Up @@ -75,8 +74,8 @@ impl SubstrateCli for Cli {
format!(
"Ajuna parachain\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relaychain node.\n\n\
{} [parachain-args] -- [relaychain-args]",
to the relay chain node.\n\n\
{} <parachain-args> -- <relay-chain-args>",
Self::executable_name()
)
}
Expand All @@ -100,7 +99,7 @@ impl SubstrateCli for Cli {

impl SubstrateCli for RelayChainCli {
fn impl_name() -> String {
"Polkadot parachain".into()
"Ajuna parachain".into()
}

fn impl_version() -> String {
Expand All @@ -112,7 +111,7 @@ impl SubstrateCli for RelayChainCli {
"Ajuna Parachain\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \
to the relay chain node.\n\n\
{} [parachain-args] -- [relay_chain-args]",
{} <parachain-args> -- <relay-chain-args>",
Self::executable_name()
)
}
Expand Down Expand Up @@ -250,7 +249,6 @@ pub fn run() -> Result<()> {
_ => Err("Benchmarking sub-command unsupported".into()),
}
},
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
None => {
let runner = cli.create_runner(&cli.run.normalize())?;
let collator_options = cli.run.collator_options();
Expand All @@ -259,7 +257,10 @@ pub fn run() -> 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 Down Expand Up @@ -341,7 +342,7 @@ impl CliConfiguration<Self> for RelayChainCli {
.or_else(|| self.base_path.clone().map(Into::into)))
}

fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<Vec<RpcEndpoint>>> {
self.base.base.rpc_addr(default_listen_port)
}

Expand All @@ -353,15 +354,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
7 changes: 2 additions & 5 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use std::sync::Arc;

use parachains_common::{AccountId, Balance, Block, Nonce};
pub use sc_rpc::DenyUnsafe;
use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder;
Expand All @@ -36,8 +35,6 @@ pub struct FullDeps<C, P> {
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
}

/// Instantiate all RPC extensions.
Expand All @@ -60,9 +57,9 @@ where
use substrate_frame_rpc_system::{System, SystemApiServer};

let mut module = RpcExtension::new(());
let FullDeps { client, pool, deny_unsafe } = deps;
let FullDeps { client, pool } = 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).into_rpc())?;
Ok(module)
}
23 changes: 11 additions & 12 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,16 @@ pub fn new_partial(config: &Configuration) -> Result<Service, sc_service::Error>
.transpose()?;

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

let executor = ParachainExecutor::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 @@ -231,11 +232,13 @@ pub async fn start_parachain_node(

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);
>::new(&parachain_config.network, prometheus_registry.clone());

let client = params.client.clone();
let backend = params.backend.clone();
Expand All @@ -253,7 +256,6 @@ pub async fn start_parachain_node(
.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;

let validator = parachain_config.role.is_authority();
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();

Expand Down Expand Up @@ -300,12 +302,9 @@ pub async fn start_parachain_node(
let client = client.clone();
let transaction_pool = transaction_pool.clone();

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

crate::rpc::create_full(deps).map_err(Into::into)
})
Expand All @@ -331,7 +330,7 @@ pub async fn start_parachain_node(
// Here you can check whether the hardware meets your chains' requirements. Putting a link
// in there and swapping out the requirements for your own are probably a good idea. The
// requirements for a para-chain are dictated by its relay-chain.
match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) {
match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench, false) {
Err(err) if validator => {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements {} for role 'Authority'.",
Expand Down
13 changes: 9 additions & 4 deletions runtime/ajuna/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use crate::{
tx_payment, weights, AccountId, AssetConversion, Assets, Balance, Balances, ExistentialDeposit,
PoolAssets, Runtime, RuntimeEvent, RuntimeOrigin, AJUN, MILLI_AJUN,
weights, AccountId, AssetConversion, Assets, Balance, Balances, ExistentialDeposit, PoolAssets,
Runtime, RuntimeEvent, RuntimeOrigin, TreasuryAccount, AJUN, MILLI_AJUN,
};
use frame_support::{
ord_parameter_types,
Expand Down Expand Up @@ -100,8 +100,13 @@ impl pallet_asset_registry::BenchmarkHelper<AssetIdForTrustBackedAssets>

impl pallet_asset_conversion_tx_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Fungibles = NativeAndAssets;
type OnChargeAssetTransaction = tx_payment::SwapCreditAdapter<Native, AssetConversion>;
type AssetId = NativeOrWithId<AssetIdForTrustBackedAssets>;
type OnChargeAssetTransaction = pallet_asset_conversion_tx_payment::SwapAssetAdapter<
Native,
NativeAndAssets,
AssetConversion,
ResolveAssetTo<TreasuryAccount, NativeAndAssets>,
>;
}

impl pallet_asset_registry::Config for Runtime {
Expand Down
Loading
Loading