mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 00:31:07 +00:00
Remove Polkadot & Kusama native runtime (#1304)
This pull request removes the Polkadot and Kusama native runtime from the polkadot node. This brings some implications with it: There are no more kusama/polkadot-dev chain specs available. We will need to write some tooling in the fellowship repo to provide them easily. The try-runtime job for polkadot & kusama is not available anymore as we don't have the dev chain specs anymore. Certain benchmarking commands will also not work until we migrate them to use a runtime api. Some crates in utils are still depending on the polkadot/kusama native runtime that will also need to be fixed. Port of: https://github.com/paritytech/polkadot/pull/7467
This commit is contained in:
@@ -34,36 +34,8 @@ macro_rules! identify_chain {
|
||||
$generic_code:expr $(,)*
|
||||
) => {
|
||||
match $chain {
|
||||
Chain::Polkadot => {
|
||||
#[cfg(feature = "polkadot-native")]
|
||||
{
|
||||
use polkadot_runtime as runtime;
|
||||
|
||||
let call = $generic_code;
|
||||
|
||||
Ok(polkadot_sign_call(call, $nonce, $current_block, $period, $genesis, $signer))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "polkadot-native"))]
|
||||
{
|
||||
Err("`polkadot-native` feature not enabled")
|
||||
}
|
||||
},
|
||||
Chain::Kusama => {
|
||||
#[cfg(feature = "kusama-native")]
|
||||
{
|
||||
use kusama_runtime as runtime;
|
||||
|
||||
let call = $generic_code;
|
||||
|
||||
Ok(kusama_sign_call(call, $nonce, $current_block, $period, $genesis, $signer))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "kusama-native"))]
|
||||
{
|
||||
Err("`kusama-native` feature not enabled")
|
||||
}
|
||||
},
|
||||
Chain::Polkadot => Err("Polkadot runtimes are currently not supported"),
|
||||
Chain::Kusama => Err("Kusama runtimes are currently not supported"),
|
||||
Chain::Rococo => {
|
||||
#[cfg(feature = "rococo-native")]
|
||||
{
|
||||
@@ -91,16 +63,18 @@ macro_rules! identify_chain {
|
||||
|
||||
#[cfg(not(feature = "westend-native"))]
|
||||
{
|
||||
let _ = $nonce;
|
||||
let _ = $current_block;
|
||||
let _ = $period;
|
||||
let _ = $genesis;
|
||||
let _ = $signer;
|
||||
|
||||
Err("`westend-native` feature not enabled")
|
||||
}
|
||||
},
|
||||
Chain::Unknown => Err("Unknown chain"),
|
||||
Chain::Unknown => {
|
||||
let _ = $nonce;
|
||||
let _ = $current_block;
|
||||
let _ = $period;
|
||||
let _ = $genesis;
|
||||
let _ = $signer;
|
||||
|
||||
Err("Unknown chain")
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -130,10 +104,8 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder {
|
||||
}
|
||||
|
||||
fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
|
||||
let period = polkadot_runtime_common::BlockHashCount::get()
|
||||
.checked_next_power_of_two()
|
||||
.map(|c| c / 2)
|
||||
.unwrap_or(2) as u64;
|
||||
// We apply the extrinsic directly, so let's take some random period.
|
||||
let period = 128;
|
||||
let genesis = self.client.usage_info().chain.best_hash;
|
||||
let signer = Sr25519Keyring::Bob.pair();
|
||||
let current_block = 0;
|
||||
@@ -181,10 +153,8 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
|
||||
|
||||
fn build(&self, nonce: u32) -> std::result::Result<OpaqueExtrinsic, &'static str> {
|
||||
let signer = Sr25519Keyring::Bob.pair();
|
||||
let period = polkadot_runtime_common::BlockHashCount::get()
|
||||
.checked_next_power_of_two()
|
||||
.map(|c| c / 2)
|
||||
.unwrap_or(2) as u64;
|
||||
// We apply the extrinsic directly, so let's take some random period.
|
||||
let period = 128;
|
||||
let genesis = self.client.usage_info().chain.best_hash;
|
||||
let current_block = 0;
|
||||
let _dest = self.dest.clone();
|
||||
@@ -206,60 +176,6 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "polkadot-native")]
|
||||
fn polkadot_sign_call(
|
||||
call: polkadot_runtime::RuntimeCall,
|
||||
nonce: u32,
|
||||
current_block: u64,
|
||||
period: u64,
|
||||
genesis: sp_core::H256,
|
||||
acc: sp_core::sr25519::Pair,
|
||||
) -> OpaqueExtrinsic {
|
||||
use codec::Encode;
|
||||
use polkadot_runtime as runtime;
|
||||
use sp_core::Pair;
|
||||
|
||||
let extra: runtime::SignedExtra = (
|
||||
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
|
||||
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
|
||||
frame_system::CheckTxVersion::<runtime::Runtime>::new(),
|
||||
frame_system::CheckGenesis::<runtime::Runtime>::new(),
|
||||
frame_system::CheckMortality::<runtime::Runtime>::from(sp_runtime::generic::Era::mortal(
|
||||
period,
|
||||
current_block,
|
||||
)),
|
||||
frame_system::CheckNonce::<runtime::Runtime>::from(nonce),
|
||||
frame_system::CheckWeight::<runtime::Runtime>::new(),
|
||||
pallet_transaction_payment::ChargeTransactionPayment::<runtime::Runtime>::from(0),
|
||||
polkadot_runtime_common::claims::PrevalidateAttests::<runtime::Runtime>::new(),
|
||||
);
|
||||
|
||||
let payload = runtime::SignedPayload::from_raw(
|
||||
call.clone(),
|
||||
extra.clone(),
|
||||
(
|
||||
(),
|
||||
runtime::VERSION.spec_version,
|
||||
runtime::VERSION.transaction_version,
|
||||
genesis,
|
||||
genesis,
|
||||
(),
|
||||
(),
|
||||
(),
|
||||
(),
|
||||
),
|
||||
);
|
||||
|
||||
let signature = payload.using_encoded(|p| acc.sign(p));
|
||||
runtime::UncheckedExtrinsic::new_signed(
|
||||
call,
|
||||
sp_runtime::AccountId32::from(acc.public()).into(),
|
||||
polkadot_core_primitives::Signature::Sr25519(signature.clone()),
|
||||
extra,
|
||||
)
|
||||
.into()
|
||||
}
|
||||
|
||||
#[cfg(feature = "westend-native")]
|
||||
fn westend_sign_call(
|
||||
call: westend_runtime::RuntimeCall,
|
||||
@@ -312,58 +228,6 @@ fn westend_sign_call(
|
||||
.into()
|
||||
}
|
||||
|
||||
#[cfg(feature = "kusama-native")]
|
||||
fn kusama_sign_call(
|
||||
call: kusama_runtime::RuntimeCall,
|
||||
nonce: u32,
|
||||
current_block: u64,
|
||||
period: u64,
|
||||
genesis: sp_core::H256,
|
||||
acc: sp_core::sr25519::Pair,
|
||||
) -> OpaqueExtrinsic {
|
||||
use codec::Encode;
|
||||
use kusama_runtime as runtime;
|
||||
use sp_core::Pair;
|
||||
|
||||
let extra: runtime::SignedExtra = (
|
||||
frame_system::CheckNonZeroSender::<runtime::Runtime>::new(),
|
||||
frame_system::CheckSpecVersion::<runtime::Runtime>::new(),
|
||||
frame_system::CheckTxVersion::<runtime::Runtime>::new(),
|
||||
frame_system::CheckGenesis::<runtime::Runtime>::new(),
|
||||
frame_system::CheckMortality::<runtime::Runtime>::from(sp_runtime::generic::Era::mortal(
|
||||
period,
|
||||
current_block,
|
||||
)),
|
||||
frame_system::CheckNonce::<runtime::Runtime>::from(nonce),
|
||||
frame_system::CheckWeight::<runtime::Runtime>::new(),
|
||||
pallet_transaction_payment::ChargeTransactionPayment::<runtime::Runtime>::from(0),
|
||||
);
|
||||
|
||||
let payload = runtime::SignedPayload::from_raw(
|
||||
call.clone(),
|
||||
extra.clone(),
|
||||
(
|
||||
(),
|
||||
runtime::VERSION.spec_version,
|
||||
runtime::VERSION.transaction_version,
|
||||
genesis,
|
||||
genesis,
|
||||
(),
|
||||
(),
|
||||
(),
|
||||
),
|
||||
);
|
||||
|
||||
let signature = payload.using_encoded(|p| acc.sign(p));
|
||||
runtime::UncheckedExtrinsic::new_signed(
|
||||
call,
|
||||
sp_runtime::AccountId32::from(acc.public()).into(),
|
||||
polkadot_core_primitives::Signature::Sr25519(signature.clone()),
|
||||
extra,
|
||||
)
|
||||
.into()
|
||||
}
|
||||
|
||||
#[cfg(feature = "rococo-native")]
|
||||
fn rococo_sign_call(
|
||||
call: rococo_runtime::RuntimeCall,
|
||||
|
||||
Reference in New Issue
Block a user