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 Release v1.5.0 migration #330

Merged
merged 13 commits into from
Jan 12, 2024
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
4,853 changes: 2,215 additions & 2,638 deletions Cargo.lock

Large diffs are not rendered by default.

242 changes: 119 additions & 123 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
bs58 = { version = "0.5.0", default-features = false }
wasm-bindgen = { version = "0.2.87", optional = true }
sp-io = { workspace = true }

[features]
alloc = []
js = ["alloc", "wasm-bindgen"]

1 change: 1 addition & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#[cfg(feature = "alloc")]
extern crate alloc;
extern crate sp_io;

mod payment_id;
pub use payment_id::PaymentId;
5 changes: 1 addition & 4 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ serde = { workspace = true }
serde_json = { workspace = true }

# Local
virto-runtime = { workspace = true, optional = true }
kreivo-runtime = { workspace = true, optional = true }
jsonrpsee = { workspace = true, features = ["server"] }

Expand Down Expand Up @@ -101,13 +100,11 @@ wait-timeout = { workspace = true }
polkadot-cli = { workspace = true }

[features]
default = ["virto-runtime", "kreivo-runtime"]
default = ["kreivo-runtime"]
runtime-benchmarks = [
"virto-runtime?/runtime-benchmarks",
"kreivo-runtime?/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks"
]
try-runtime = [
"virto-runtime?/try-runtime",
"kreivo-runtime?/try-runtime"
]
62 changes: 1 addition & 61 deletions node/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,67 +85,6 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder<kreivo_runtime::
}
}

#[cfg(feature = "virto-runtime")]
impl frame_benchmarking_cli::ExtrinsicBuilder for RemarkBuilder<virto_runtime::RuntimeApi> {
fn pallet(&self) -> &str {
"system"
}

fn extrinsic(&self) -> &str {
"remark"
}

fn build(&self, nonce: u32) -> Result<OpaqueExtrinsic, &'static str> {
use virto_runtime as runtime;

let call: runtime::RuntimeCall = runtime::SystemCall::remark { remark: vec![] }.into();
let period = runtime::BlockHashCount::get()
.checked_next_power_of_two()
.map(|c| c / 2)
.unwrap_or(2) as u64;
let best_block = self.client.chain_info().best_number;
let tip = 0;
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::CheckEra::<runtime::Runtime>::from(generic::Era::mortal(period, best_block.saturated_into())),
frame_system::CheckNonce::<runtime::Runtime>::from(nonce),
frame_system::CheckWeight::<runtime::Runtime>::new(),
pallet_asset_tx_payment::ChargeAssetTxPayment::<runtime::Runtime>::from(tip, None),
);

let genesis_hash = self.client.block_hash(0).ok().flatten().expect("Genesis block exists");
let best_hash = self.client.chain_info().best_hash;
let payload = runtime::SignedPayload::from_raw(
call.clone(),
extra.clone(),
(
(),
runtime::VERSION.spec_version,
runtime::VERSION.transaction_version,
genesis_hash,
best_hash,
(),
(),
(),
),
);

let sender = Sr25519Keyring::Bob.pair();
let signature = payload.using_encoded(|x| sender.sign(x));
let extrinsic = runtime::UncheckedExtrinsic::new_signed(
call,
sp_runtime::AccountId32::from(sender.public()).into(),
runtime::Signature::Sr25519(signature),
extra,
);

Ok(extrinsic.into())
}
}

/// Generates inherent data for the `benchmark overhead` command.
pub fn inherent_benchmark_data() -> sc_cli::Result<InherentData> {
let mut inherent_data = InherentData::new();
Expand All @@ -163,6 +102,7 @@ pub fn inherent_benchmark_data() -> sc_cli::Result<InherentData> {
xcm_config: Default::default(),
raw_downward_messages: Default::default(),
raw_horizontal_messages: Default::default(),
additional_key_values: Default::default(),
};

futures::executor::block_on(parachain_inherent.provide_inherent_data(&mut inherent_data))
Expand Down
Loading
Loading