Update the solochain template to stable2503 (#24)

This synchronizes the template to the stable2503 branch.

Co-authored-by: iulianbarbu <14218860+iulianbarbu@users.noreply.github.com>
This commit is contained in:
paritytech-polkadotsdk-templatebot[bot]
2025-04-17 13:12:16 +03:00
committed by GitHub
parent 1af6d764d3
commit 7582c5ea84
14 changed files with 1366 additions and 1576 deletions
+9 -2
View File
@@ -75,6 +75,12 @@ impl_runtime_apis! {
}
}
impl frame_support::view_functions::runtime_api::RuntimeViewFunction<Block> for Runtime {
fn execute_view_function(id: frame_support::view_functions::ViewFunctionId, input: Vec<u8>) -> Result<Vec<u8>, frame_support::view_functions::ViewFunctionDispatchError> {
Runtime::execute_view_function(id, input)
}
}
impl sp_block_builder::BlockBuilder<Block> for Runtime {
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
Executive::apply_extrinsic(extrinsic)
@@ -220,7 +226,7 @@ impl_runtime_apis! {
Vec<frame_benchmarking::BenchmarkList>,
Vec<frame_support::traits::StorageInfo>,
) {
use frame_benchmarking::{baseline, Benchmarking, BenchmarkList};
use frame_benchmarking::{baseline, BenchmarkList};
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
@@ -235,10 +241,11 @@ impl_runtime_apis! {
(list, storage_info)
}
#[allow(non_local_definitions)]
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, alloc::string::String> {
use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch};
use frame_benchmarking::{baseline, BenchmarkBatch};
use sp_storage::TrackedStorageKey;
use frame_system_benchmarking::Pallet as SystemBench;
use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench;
+12 -15
View File
@@ -17,11 +17,12 @@
use crate::{AccountId, BalancesConfig, RuntimeGenesisConfig, SudoConfig};
use alloc::{vec, vec::Vec};
use frame_support::build_struct_json_patch;
use serde_json::Value;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_consensus_grandpa::AuthorityId as GrandpaId;
use sp_genesis_builder::{self, PresetId};
use sp_keyring::AccountKeyring;
use sp_keyring::Sr25519Keyring;
// Returns the genesis config presets populated with given parameters.
fn testnet_genesis(
@@ -29,7 +30,7 @@ fn testnet_genesis(
endowed_accounts: Vec<AccountId>,
root: AccountId,
) -> Value {
let config = RuntimeGenesisConfig {
build_struct_json_patch!(RuntimeGenesisConfig {
balances: BalancesConfig {
balances: endowed_accounts
.iter()
@@ -42,13 +43,9 @@ fn testnet_genesis(
},
grandpa: pallet_grandpa::GenesisConfig {
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect::<Vec<_>>(),
..Default::default()
},
sudo: SudoConfig { key: Some(root) },
..Default::default()
};
serde_json::to_value(config).expect("Could not build genesis config.")
})
}
/// Return the development genesis config.
@@ -59,12 +56,12 @@ pub fn development_config_genesis() -> Value {
sp_keyring::Ed25519Keyring::Alice.public().into(),
)],
vec![
AccountKeyring::Alice.to_account_id(),
AccountKeyring::Bob.to_account_id(),
AccountKeyring::AliceStash.to_account_id(),
AccountKeyring::BobStash.to_account_id(),
Sr25519Keyring::Alice.to_account_id(),
Sr25519Keyring::Bob.to_account_id(),
Sr25519Keyring::AliceStash.to_account_id(),
Sr25519Keyring::BobStash.to_account_id(),
],
sp_keyring::AccountKeyring::Alice.to_account_id(),
sp_keyring::Sr25519Keyring::Alice.to_account_id(),
)
}
@@ -81,11 +78,11 @@ pub fn local_config_genesis() -> Value {
sp_keyring::Ed25519Keyring::Bob.public().into(),
),
],
AccountKeyring::iter()
.filter(|v| v != &AccountKeyring::One && v != &AccountKeyring::Two)
Sr25519Keyring::iter()
.filter(|v| v != &Sr25519Keyring::One && v != &Sr25519Keyring::Two)
.map(|v| v.to_account_id())
.collect::<Vec<_>>(),
AccountKeyring::Alice.to_account_id(),
Sr25519Keyring::Alice.to_account_id(),
)
}
+3 -1
View File
@@ -157,6 +157,7 @@ pub type TxExtension = (
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
frame_metadata_hash_extension::CheckMetadataHash<Runtime>,
frame_system::WeightReclaim<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
@@ -195,7 +196,8 @@ mod runtime {
RuntimeHoldReason,
RuntimeSlashReason,
RuntimeLockId,
RuntimeTask
RuntimeTask,
RuntimeViewFunction
)]
pub struct Runtime;