Skip to content

Commit

Permalink
Upgrade to polkadot v0.9.29 (#673)
Browse files Browse the repository at this point in the history
* Upgrade to polkadot v0.9.29
* fix: use all the pallet's try-runtime feature for try-runtime
* Added logprint in try_runtime
* Try-runtime give a warning not a panic in CI
* Added all weights from benchmarks
* Update spec version

Co-authored-by: Alex Sedighi <alex@nodle.com>
  • Loading branch information
simonsso and aliXsed committed Oct 19, 2022
1 parent 90f1f98 commit 863b8a2
Show file tree
Hide file tree
Showing 35 changed files with 2,733 additions and 993 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: run
args: --release --bin nodle-parachain --features=try-runtime try-runtime --execution native --chain ${{ env.try-runtime-chain }} on-runtime-upgrade live -u ${{ env.try-runtime-uri }}
args: --release --bin nodle-parachain --features=try-runtime try-runtime --execution native --chain ${{ env.try-runtime-chain }} --no-spec-name-check on-runtime-upgrade live -u ${{ env.try-runtime-uri }}
44 changes: 30 additions & 14 deletions .maintain/frame-weight-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -35,69 +35,85 @@ use sp_std::marker::PhantomData;

/// Weight functions needed for {{pallet}}.
pub trait WeightInfo {

{{~#each benchmarks as |benchmark|}}

fn {{benchmark.name~}}

(
{{~#each benchmark.components as |c| ~}}

{{c.name}}: u32, {{/each~}}

) -> Weight;

{{~/each}}
}

/// Weights for {{pallet}} using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);

impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {

{{~#each benchmarks as |benchmark|}}

fn {{benchmark.name~}}

(

{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
({{underscore benchmark.base_weight}} as Weight)
{{~#each benchmark.component_weight as |cw|}}
Weight::from_ref_time({{underscore benchmark.base_weight}} as u64)
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}} as u64))
{{~/each}}
{{~#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as u64))
{{~/if}}
{{~#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as u64).saturating_mul({{cr.name}} as u64)))
{{~/each}}
{{~#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as u64))
{{~/if}}
{{~#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as u64).saturating_mul({{cw.name}} as u64)))
{{~/each}}
}
{{~/each}}
}

// For backwards compatibility and tests
impl WeightInfo for () {

{{~#each benchmarks as |benchmark|}}

fn {{benchmark.name~}}
(

{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
({{underscore benchmark.base_weight}} as Weight)
{{~#each benchmark.component_weight as |cw|}}
Weight::from_ref_time({{underscore benchmark.base_weight}} as u64)

{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}} as u64))

{{~/each}}
{{~#if (ne benchmark.base_reads "0")}}
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as u64))
{{~/if}}
{{~#each benchmark.component_reads as |cr|}}
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as u64).saturating_mul({{cr.name}} as u64)))
{{~/each}}
{{~#if (ne benchmark.base_writes "0")}}
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as u64))
{{~/if}}
{{~#each benchmark.component_writes as |cw|}}
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as u64).saturating_mul({{cw.name}} as u64)))
{{~/each}}
}
{{~/each}}
Expand Down

0 comments on commit 863b8a2

Please sign in to comment.