Skip to content

Commit

Permalink
Polkadot v1.1.0 (#489)
Browse files Browse the repository at this point in the history
* replacing dependencies

* dependencies upgrades

* restructure imports for update, relevant modifications of chain extensions

* reorder dependencies and types for pallets staking, tokens and allowance

* update fixes for asset registry, runtime common

* amplitude 1.1.0 changes

* updating foucoco, pendulum runtimes

* benchmark fixes for common

* fixes for runtimes with runtime benchmarks

* node modifications for upgrade

* WIP fixing integration tests

* fixed missing default features

* WIP fixing std issue

* modification toml pendulum, orml-currencies, amplitude

* use serde, log with default features = false

* remove std conditionals on pallets

* fix foucoco default features declaration

* add trait to sibling currency id

* remove unnecessary trait ConvertMultilocation

* remove unnecessary trait ConvertMultilocation in integration tests sibling chain

* use start_relay_chain_tasks in node

* modifications .toml integration tests

* WIP testing comprehensive patch

* fix for integration tests dependencies

* remove deps of polkadot fellows runtime, solve integration test parachain to parachian issue

* adding pallets to sibling chain

* compile sibling tests with emulator macros, fixing tests

* fix all pen tests

* fixing amplitude test

* integration tests stable

* cleanup, solving features issue with pallet parachain system

* remove .txt files

* define storage version bump for bounties, staking

* fix pallets mock runtimes

* add patch to solve missing vrfs dependency and compile with newer nightly

* temporary remove flag

* allow deprecated flag

* warnings and comment requests

* more unused imports removal

* clippy fixes

* set inherent data provider closure to default

* add missing flag for eventual try-runtime command

* format nightly for latest changes

* Revert "format nightly for latest changes"

This reverts commit e03041e.

* generate weights for dia-oracle pallet

* use temporary spacewalk version with dia-oracle fix

* re-introduce non local definition flag for clippy

* use previous spacewalk revision

* remove temporary dia-oracle fix branch

* remove temp stellar sdk patch

* Readme modification, nightly version used

* clean comments and address review improvements

* remove unused dependencies and imports

* run fmt nightly

* move const outside macro definition

* fix bandersnatch parch url

* add benchmarkings (those not failed), modify config to use default weight

* Revert "add benchmarkings (those not failed), modify config to use default weight"

This reverts commit 79012a1.

* fix benchmark for orml-tokens-management, add benchmark helper script, run benchmarks

* fix definition of weights in runtimes

* run redeem benchmark after fix for ED

* replace spacewalk rev latest

* use default values for pallet contracts

* Update pallets/vesting-manager/Cargo.toml

Co-authored-by: Marcel Ebert <mail@marcel-ebert.de>

---------

Co-authored-by: Marcel Ebert <mail@marcel-ebert.de>
  • Loading branch information
gianfra-t and ebma authored Sep 19, 2024
1 parent c653789 commit d21c351
Show file tree
Hide file tree
Showing 107 changed files with 10,312 additions and 8,780 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
- name: Setup nightly Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-04-18
toolchain: nightly-2024-05-30
components: rustfmt, clippy
target: wasm32-unknown-unknown

- name: Setup nightly Rust as default
run: rustup default nightly-2024-04-18
run: rustup default nightly-2024-05-30

- name: Install Protoc
uses: arduino/setup-protoc@v1
Expand All @@ -42,28 +42,28 @@ jobs:
- name: Test
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-04-18
toolchain: nightly-2024-05-30
command: test

- name: Clippy -- Main
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-04-18
toolchain: nightly-2024-05-30
command: clippy
args: --all-features -- -W clippy::all -A clippy::style -A forgetting_copy_types -A forgetting_references

- name: Clippy -- All Targets (except integration)
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-04-18
toolchain: nightly-2024-05-30
command: clippy
# We are a bit more forgiving when it comes to the code in tests and only check for correctness
args: --workspace --all-features --all-targets --exclude runtime-integration-tests -- -A clippy::all -W clippy::correctness -A forgetting_copy_types -A forgetting_references

- name: Clippy -- Integration
uses: actions-rs/cargo@v1
with:
toolchain: nightly-2024-04-18
toolchain: nightly-2024-05-30
command: clippy
# We are a bit more forgiving when it comes to the code in tests and only check for correctness
args: --package runtime-integration-tests --all-features --all-targets -- -A clippy::all -W clippy::correctness -A forgetting_copy_types -A forgetting_references
Expand Down
55 changes: 1 addition & 54 deletions .maintain/frame-weight-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,12 @@
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use core::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>);
{{#if (eq pallet "frame_system")}}
impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
{{else}}
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
impl<T: frame_system::Config> {{pallet}}::WeightInfo for SubstrateWeight<T> {
{{/if}}
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
Expand Down Expand Up @@ -76,46 +65,4 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{/each}}
}
{{/each}}
}

// For backwards compatibility and tests
impl WeightInfo for () {
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
/// {{comment}}
{{/each}}
{{#each benchmark.component_ranges as |range|}}
/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.
{{/each}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
// Proof Size summary in bytes:
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
{{/each}}
{{#each benchmark.component_calculated_proof_size as |cp|}}
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
{{/each}}
}
{{/each}}
}
52 changes: 52 additions & 0 deletions .maintain/run_all_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

script_dir=$(dirname "$(realpath "$0")")


runtimes=("pendulum" "amplitude" "foucoco")


for runtime_name in "${runtimes[@]}"; do
cd $script_dir
cd ../runtime/$runtime_name/src/weights
weight_dir=`pwd`

cd $script_dir

if [ ! -d "$weight_dir" ]; then
echo "Directory $weight_dir does not exist for runtime $runtime_name!"
echo "Weights directory should exist and contain previously calculated weights"
continue
fi

echo "Processing runtime: $runtime_name"

for file in "$weight_dir"/*; do

filename=$(basename -- "$file")
filename_without_ext="${filename%.*}"


if [[ "$filename_without_ext" == "parachain_staking" ]]; then
echo "Skipping file: $filename_without_ext"
continue
fi

echo "Running benchmark for pallet: $filename_without_ext in runtime $runtime_name"

# Run the benchmark command for each file, ignore errors from files
# not corresponding to any pallets.
# Failed benchmarks will not be detected.
../target/production/pendulum-node benchmark pallet \
--chain $runtime_name \
--wasm-execution=compiled \
--pallet "$filename_without_ext" \
--extrinsic "*" \
--steps 50 \
--repeat 20 \
--output "../runtime/$runtime_name/src/weights/$filename" \
--template "frame-weight-template.hbs" \
|| true

done
done
Loading

0 comments on commit d21c351

Please sign in to comment.