Skip to content

Commit

Permalink
chore: upgrade to 1.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chungquantin committed Aug 15, 2024
1 parent a2025a1 commit c0ec099
Show file tree
Hide file tree
Showing 11 changed files with 2,579 additions and 2,488 deletions.
4,762 changes: 2,406 additions & 2,356 deletions Cargo.lock

Large diffs are not rendered by default.

203 changes: 101 additions & 102 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ scale-info = { version = "2.10.0", default-features = false, features = [
smallvec = "1.11.0"
serde = "1.0.195"
clap = { version = "4.4.18", features = ["derive"] }
jsonrpsee = { version = "0.22.0", features = ["server"] }
jsonrpsee = { version = "0.22.5", features = ["server"] }
futures = "0.3.28"
serde_json = "1.0.111"
tracing-subscriber = { version = "0.3", default-features = false }
Expand All @@ -48,7 +48,7 @@ tokio = { version = "1.36", features = ["macros", "time", "rt-multi-thread"] }

# Build
substrate-build-script-utils = "11.0.0"
substrate-wasm-builder = "22.0.0"
substrate-wasm-builder = "23.0.0"

# Local
pop-runtime-devnet = { path = "runtime/devnet", default-features = true, features = [
Expand All @@ -61,113 +61,112 @@ pop-runtime-common = { path = "runtime/common", default-features = false }
pop-primitives = { path = "./primitives", default-features = false }

# Substrate
sc-basic-authorship = "0.40.0"
sc-chain-spec = "33.0.0"
sc-cli = "0.42.0"
sc-client-api = "34.0.0"
sc-offchain = "35.0.0"
sc-consensus = "0.39.1"
sc-executor = "0.38.0"
sc-network = "0.40.0"
sc-network-sync = "0.39.0"
sc-rpc = "35.0.0"
sc-service = "0.41.0"
sc-sysinfo = "33.0.0"
sc-telemetry = "20.0.0"
sc-tracing = "34.0.0"
sc-transaction-pool = "34.0.0"
sc-transaction-pool-api = "34.0.0"
frame-benchmarking = { version = "34.0.0", default-features = false }
frame-benchmarking-cli = "38.0.0"
frame-executive = { version = "34.0.0", default-features = false }
frame-support = { version = "34.0.0", default-features = false }
frame-system = { version = "34.0.1", default-features = false }
frame-system-benchmarking = { version = "34.0.0", default-features = false }
frame-system-rpc-runtime-api = { version = "32.0.0", default-features = false }
frame-try-runtime = { version = "0.40.0", default-features = false }
pallet-aura = { version = "33.0.0", default-features = false }
pallet-authorship = { version = "34.0.0", default-features = false }
pallet-assets = { version = "35.0.0", default-features = false }
pallet-balances = { version = "35.0.0", default-features = false }
pallet-contracts = { version = "33.0.0", default-features = false }
pallet-message-queue = { version = "37.0.0", default-features = false }
pallet-multisig = { version = "34.0.0", default-features = false }
pallet-nft-fractionalization = { version = "16.0.0", default-features = false }
pallet-nfts = { version = "28.0.0", default-features = false }
pallet-nfts-runtime-api = { version = "20.0.0", default-features = false }
pallet-preimage = { version = "34.0.0", default-features = false }
pallet-proxy = { version = "34.0.0", default-features = false }
pallet-scheduler = { version = "35.0.0", default-features = false }
pallet-session = { version = "34.0.0", default-features = false }
pallet-sudo = { version = "34.0.0", default-features = false }
pallet-timestamp = { version = "33.0.0", default-features = false }
pallet-transaction-payment = { version = "34.0.0", default-features = false }
pallet-transaction-payment-rpc = "36.0.0"
pallet-transaction-payment-rpc-runtime-api = { version = "34.0.0", default-features = false }
pallet-utility = { version = "34.0.0", default-features = false }
sp-api = { version = "32.0.0", default-features = false }
sp-authority-discovery = { version = "32.0.0", default-features = false }
sp-block-builder = { version = "32.0.0", default-features = false }
sp-blockchain = "34.0.0"
sp-consensus-aura = { version = "0.38.0", default-features = false }
sp-consensus-babe = { version = "0.38.0", default-features = false }
sp-consensus-beefy = { version = "19.0.0", default-features = false }
sp-consensus-grandpa = { version = "19.0.0", default-features = false }
sp-core = { version = "33.0.1", default-features = false }
sp-keystore = "0.39.0"
sp-io = { version = "36.0.0", default-features = false }
sp-genesis-builder = { version = "0.13.0", default-features = false }
sp-inherents = { version = "32.0.0", default-features = false }
sp-offchain = { version = "32.0.0", default-features = false }
sp-runtime = { version = "37.0.0", default-features = false }
sp-timestamp = "32.0.0"
substrate-frame-rpc-system = "34.0.0"
sc-basic-authorship = "0.41.0"
sc-chain-spec = "34.0.0"
sc-cli = "0.43.0"
sc-client-api = "=35.0.0"
sc-offchain = "36.0.0"
sc-consensus = "0.40.0"
sc-executor = "0.39.0"
sc-network = "0.41.0"
sc-network-sync = "0.40.0"
sc-rpc = "36.0.0"
sc-service = "0.42.0"
sc-sysinfo = "34.0.0"
sc-telemetry = "21.0.0"
sc-tracing = "35.0.0"
sc-transaction-pool = "35.0.0"
sc-transaction-pool-api = "35.0.0"
frame-benchmarking = { version = "35.0.0", default-features = false }
frame-benchmarking-cli = "39.0.0"
frame-executive = { version = "35.0.0", default-features = false }
frame-support = { version = "35.0.0", default-features = false }
frame-system = { version = "35.0.0", default-features = false }
frame-system-benchmarking = { version = "35.0.0", default-features = false }
frame-system-rpc-runtime-api = { version = "33.0.0", default-features = false }
frame-try-runtime = { version = "0.41.0", default-features = false }
frame-metadata-hash-extension = { version = "0.3.0", default-features = false }
pallet-aura = { version = "34.0.0", default-features = false }
pallet-authorship = { version = "35.0.0", default-features = false }
pallet-assets = { version = "36.0.0", default-features = false }
pallet-balances = { version = "36.0.0", default-features = false }
pallet-contracts = { version = "34.0.0", default-features = false }
pallet-message-queue = { version = "38.0.0", default-features = false }
pallet-multisig = { version = "35.0.0", default-features = false }
pallet-nft-fractionalization = { version = "17.0.0", default-features = false }
pallet-nfts = { version = "29.0.0", default-features = false }
pallet-nfts-runtime-api = { version = "21.0.0", default-features = false }
pallet-preimage = { version = "35.0.0", default-features = false }
pallet-proxy = { version = "35.0.0", default-features = false }
pallet-scheduler = { version = "36.0.0", default-features = false }
pallet-session = { version = "35.0.0", default-features = false }
pallet-sudo = { version = "35.0.0", default-features = false }
pallet-timestamp = { version = "34.0.0", default-features = false }
pallet-transaction-payment = { version = "35.0.0", default-features = false }
pallet-transaction-payment-rpc = "37.0.0"
pallet-transaction-payment-rpc-runtime-api = { version = "35.0.0", default-features = false }
pallet-utility = { version = "35.0.0", default-features = false }
sp-api = { version = "33.0.0", default-features = false }
sp-authority-discovery = { version = "33.0.0", default-features = false }
sp-block-builder = { version = "33.0.0", default-features = false }
sp-blockchain = "35.0.0"
sp-consensus-aura = { version = "0.39.0", default-features = false }
sp-consensus-babe = { version = "0.39.0", default-features = false }
sp-consensus-beefy = { version = "20.0.0", default-features = false }
sp-consensus-grandpa = { version = "20.0.0", default-features = false }
sp-core = { version = "34.0.0", default-features = false }
sp-keystore = "0.40.0"
sp-io = { version = "37.0.0", default-features = false }
sp-genesis-builder = { version = "0.14.0", default-features = false }
sp-inherents = { version = "33.0.0", default-features = false }
sp-offchain = { version = "33.0.0", default-features = false }
sp-runtime = { version = "=38.0.0", default-features = false }
sp-timestamp = "33.0.0"
substrate-frame-rpc-system = "35.0.0"
substrate-prometheus-endpoint = "0.17.0"
sp-session = { version = "33.0.0", default-features = false }
sp-session = { version = "34.0.0", default-features = false }
sp-std = { version = "14.0.0", default-features = false }
sp-transaction-pool = { version = "32.0.0", default-features = false }
sp-version = { version = "35.0.0", default-features = false }
sp-transaction-pool = { version = "33.0.0", default-features = false }
sp-version = { version = "36.0.0", default-features = false }

# Polkadot
pallet-xcm = { version = "13.0.0", default-features = false }
polkadot-cli = "13.0.0"
polkadot-parachain-primitives = { version = "12.0.0", default-features = false }
polkadot-runtime-parachains = { version = "13.0.0", default-features = false }
polkadot-primitives = { version = "13.0.0", default-features = false }
polkadot-runtime-common = { version = "13.0.0", default-features = false }
rococo-runtime-constants = { version = "13.0.0", default-features = false }
rococo-runtime = { version = "13.0.0", default-features = false }
xcm = { version = "13.0.1", package = "staging-xcm", default-features = false }
xcm-builder = { version = "13.0.0", package = "staging-xcm-builder", default-features = false }
xcm-executor = { version = "13.0.0", package = "staging-xcm-executor", default-features = false }
pallet-xcm = { version = "14.0.0", default-features = false }
polkadot-cli = "14.0.0"
polkadot-parachain-primitives = { version = "13.0.0", default-features = false }
polkadot-runtime-parachains = { version = "14.0.0", default-features = false }
polkadot-primitives = { version = "14.0.0", default-features = false }
polkadot-runtime-common = { version = "14.0.0", default-features = false }
rococo-runtime-constants = { version = "14.0.0", default-features = false }
rococo-runtime = { version = "14.0.0", default-features = false }
xcm = { version = "14.0.0", package = "staging-xcm", default-features = false }
xcm-builder = { version = "14.0.0", package = "staging-xcm-builder", default-features = false }
xcm-executor = { version = "14.0.0", package = "staging-xcm-executor", default-features = false }

# Cumulus
asset-hub-rococo-runtime = { version = "0.17.0", default-features = false }
asset-test-utils = { version = "13.0.0", default-features = false }
cumulus-pallet-aura-ext = { version = "0.13.0", default-features = false }
cumulus-pallet-parachain-system = { version = "0.13.0", default-features = false, features = [
"parameterized-consensus-hook",
] }
cumulus-pallet-session-benchmarking = { version = "15.0.0", default-features = false }
cumulus-pallet-xcm = { version = "0.13.0", default-features = false }
cumulus-pallet-xcmp-queue = { version = "0.13.0", default-features = false }
cumulus-primitives-aura = { version = "0.13.0", default-features = false }
cumulus-primitives-core = { version = "0.13.0", default-features = false }
cumulus-primitives-storage-weight-reclaim = { version = "4.0.0", default-features = false }
cumulus-primitives-utility = { version = "0.13.0", default-features = false }
emulated-integration-tests-common = { version = "9.0.0", default-features = false }
pallet-collator-selection = { version = "15.0.0", default-features = false }
parachains-common = { version = "13.0.0", default-features = false }
parachain-info = { version = "0.13.0", package = "staging-parachain-info", default-features = false }
cumulus-primitives-parachain-inherent = "0.13.0"
cumulus-relay-chain-interface = "0.13.0"
asset-hub-rococo-runtime = { version = "0.18.0", default-features = false }
asset-test-utils = { version = "14.0.0", default-features = false }
cumulus-pallet-aura-ext = { version = "0.14.0", default-features = false }
cumulus-pallet-parachain-system = { version = "0.14.0", default-features = false }
cumulus-pallet-session-benchmarking = { version = "16.0.0", default-features = false }
cumulus-pallet-xcm = { version = "0.14.0", default-features = false }
cumulus-pallet-xcmp-queue = { version = "0.14.0", default-features = false }
cumulus-primitives-aura = { version = "0.14.0", default-features = false }
cumulus-primitives-core = { version = "0.14.0", default-features = false }
cumulus-primitives-storage-weight-reclaim = { version = "5.0.0", default-features = false }
cumulus-primitives-utility = { version = "0.14.0", default-features = false }
emulated-integration-tests-common = { version = "10.0.0", default-features = false }
pallet-collator-selection = { version = "16.0.0", default-features = false }
parachains-common = { version = "14.0.0", default-features = false }
parachain-info = { version = "0.14.0", package = "staging-parachain-info", default-features = false }
cumulus-primitives-parachain-inherent = "0.14.0"
cumulus-relay-chain-interface = "0.14.0"
color-print = "0.3.4"
cumulus-client-cli = "0.13.0"
cumulus-client-collator = "0.13.0"
cumulus-client-consensus-aura = "0.13.0"
cumulus-client-consensus-common = "0.13.0"
cumulus-client-consensus-proposer = "0.13.0"
cumulus-client-service = "0.13.0"
cumulus-client-cli = "0.14.0"
cumulus-client-collator = "0.14.0"
cumulus-client-consensus-aura = "0.14.0"
cumulus-client-consensus-common = "0.14.0"
cumulus-client-consensus-proposer = "0.14.0"
cumulus-client-service = "0.14.0"

# Paseo
asset-hub-paseo-runtime = { git = "https://github.com/paseo-network/runtimes/", tag = "v1.2.5-system-chains", default-features = false }
Expand Down
6 changes: 2 additions & 4 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ use sp_core::{crypto::Ss58Codec, sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};

/// Specialized `ChainSpec` for the development parachain runtime.
pub type DevnetChainSpec =
sc_service::GenericChainSpec<pop_runtime_devnet::RuntimeGenesisConfig, Extensions>;
pub type DevnetChainSpec = sc_service::GenericChainSpec<Extensions>;

/// Specialized `ChainSpec` for the testnet parachain runtime.
pub type TestnetChainSpec =
sc_service::GenericChainSpec<pop_runtime_testnet::RuntimeGenesisConfig, Extensions>;
pub type TestnetChainSpec = sc_service::GenericChainSpec<Extensions>;

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
Expand Down
14 changes: 14 additions & 0 deletions runtime/devnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pop-runtime-common = { workspace = true, default-features = false }
# Substrate
frame-benchmarking.workspace = true
frame-executive.workspace = true
frame-metadata-hash-extension.workspace = true
frame-support.workspace = true
frame-system.workspace = true
frame-system-benchmarking.workspace = true
Expand Down Expand Up @@ -226,3 +227,16 @@ try-runtime = [
]

experimental = []

# Enable the metadata hash generation.
#
# This is hidden behind a feature because it increases the compile time.
# The wasm binary needs to be compiled twice, once to fetch the metadata,
# generate the metadata hash and then a second time with the
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
# extension.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# A convenience feature for enabling things when doing a build
# for an on-chain release.
on-chain-release-build = ["metadata-hash"]
12 changes: 11 additions & 1 deletion runtime/devnet/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
#[cfg(feature = "std")]
#[cfg(all(feature = "std", feature = "metadata-hash"))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
.export_heap_base()
.import_memory()
.enable_metadata_hash("UNIT", 12)
.build()
}

#[cfg(all(feature = "std", not(feature = "metadata-hash")))]
fn main() {
substrate_wasm_builder::WasmBuilder::new()
.with_current_project()
Expand Down
18 changes: 6 additions & 12 deletions runtime/devnet/src/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use frame_support::{
use pallet_contracts::chain_extension::{
BufInBufOutState, ChainExtension, ChargedAmount, Environment, Ext, InitState, RetVal,
};
use pallet_contracts::WeightInfo;
use pop_primitives::storage_keys::RuntimeStateKeys;
use sp_core::crypto::UncheckedFrom;
use sp_runtime::{traits::Dispatchable, DispatchError};
Expand All @@ -15,8 +16,6 @@ use crate::{AccountId, AllowedApiCalls, RuntimeCall, RuntimeOrigin};

const LOG_TARGET: &str = "pop-api::extension";

type ContractSchedule<T> = <T as pallet_contracts::Config>::Schedule;

#[derive(Default)]
pub struct PopApiExtension;

Expand Down Expand Up @@ -124,16 +123,14 @@ where
T: pallet_contracts::Config,
E: Ext<T = T>,
{
let contract_host_weight = ContractSchedule::<T>::get().host_fn_weights;

// calculate weight for reading bytes of `len`
// reference: https://github.com/paritytech/polkadot-sdk/blob/117a9433dac88d5ac00c058c9b39c511d47749d2/substrate/frame/contracts/src/wasm/runtime.rs#L267
let base_weight: Weight = contract_host_weight.return_per_byte.saturating_mul(len.into());
// reference: https://github.com/paritytech/polkadot-sdk/pull/4233/files#:~:text=CopyToContract(len)%20%3D%3E%20T%3A%3AWeightInfo%3A%3Aseal_input(len)%2C
let base_weight: Weight = T::WeightInfo::seal_return(len);

// debug_message weight is a good approximation of the additional overhead of going
// from contract layer to substrate layer.
// reference: https://github.com/paritytech/ink-examples/blob/b8d2caa52cf4691e0ddd7c919e4462311deb5ad0/psp22-extension/runtime/psp22-extension-example.rs#L236
let overhead = contract_host_weight.debug_message;
// reference: https://github.com/paritytech/polkadot-sdk/pull/4233/files#:~:text=DebugMessage(len)%20%3D%3E%20T%3A%3AWeightInfo%3A%3Aseal_debug_message(len)%2C
let overhead = T::WeightInfo::seal_debug_message(len);

let charged_weight = env.charge_weight(base_weight.saturating_add(overhead))?;
log::debug!(target: LOG_TARGET, "{} charged weight: {:?}", log_prefix, charged_weight);
Expand Down Expand Up @@ -173,10 +170,7 @@ where
let mut env = env.buf_in_buf_out();

// To be conservative, we charge the weight for reading the input bytes of a fixed-size type.
let base_weight: Weight = ContractSchedule::<T>::get()
.host_fn_weights
.return_per_byte
.saturating_mul(env.in_len().into());
let base_weight: Weight = T::WeightInfo::seal_return(env.in_len());
let charged_weight = env.charge_weight(base_weight)?;

log::debug!(target:LOG_TARGET, "{} charged weight: {:?}", LOG_PREFIX, charged_weight);
Expand Down
8 changes: 6 additions & 2 deletions runtime/devnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = ();
type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>;
// Limit the number of messages and signals a HRML channel can have at most
type MaxActiveOutboundChannels = ConstU32<128>;
// Limit the number of HRML channels
type MaxPageSize = ConstU32<{ 1 << 16 }>;
}

parameter_types! {
Expand Down Expand Up @@ -656,7 +660,7 @@ impl_runtime_apis! {
Runtime::metadata_at_version(version)
}

fn metadata_versions() -> sp_std::vec::Vec<u32> {
fn metadata_versions() -> Vec<u32> {
Runtime::metadata_versions()
}
}
Expand Down Expand Up @@ -930,7 +934,7 @@ impl_runtime_apis! {

use frame_system_benchmarking::Pallet as SystemBench;
impl frame_system_benchmarking::Config for Runtime {
fn setup_set_code_requirements(code: &sp_std::vec::Vec<u8>) -> Result<(), BenchmarkError> {
fn setup_set_code_requirements(code: &Vec<u8>) -> Result<(), BenchmarkError> {
ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32);
Ok(())
}
Expand Down
14 changes: 14 additions & 0 deletions runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pop-runtime-common = { workspace = true, default-features = false }
# Substrate
frame-benchmarking.workspace = true
frame-executive.workspace = true
frame-metadata-hash-extension.workspace = true
frame-support.workspace = true
frame-system.workspace = true
frame-system-benchmarking.workspace = true
Expand Down Expand Up @@ -224,3 +225,16 @@ try-runtime = [
]

experimental = []

# Enable the metadata hash generation.
#
# This is hidden behind a feature because it increases the compile time.
# The wasm binary needs to be compiled twice, once to fetch the metadata,
# generate the metadata hash and then a second time with the
# `RUNTIME_METADATA_HASH` environment variable set for the `CheckMetadataHash`
# extension.
metadata-hash = ["substrate-wasm-builder/metadata-hash"]

# A convenience feature for enabling things when doing a build
# for an on-chain release.
on-chain-release-build = ["metadata-hash"]
Loading

0 comments on commit c0ec099

Please sign in to comment.