Skip to content

Commit

Permalink
Merge branch 'develop' into v0.9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ark930 committed Nov 3, 2021
2 parents 67084e0 + b434578 commit 9acbcb0
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 34 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,26 @@ jobs:
fields: repo,author,eventName,workflow,ref,commit
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PULLREQUEST_WEBHOOK_URL }}
bench:
if: "!contains(github.event.commits[0].message, '[skip ci]')"
runs-on: [self-hosted, bench]
steps:
- name: Check to latest commit
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2021-09-12
components: rustfmt
target: wasm32-unknown-unknown
default: true
- name: Generate WeightInfo Files
run: make generate-all-weights
- name: Commit Automatically
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 🤖 ($WEIGHT) Generate weightInfo files automatically
# file_pattern: runtime/**/*.rs
# bench:
# if: "!contains(github.event.commits[0].message, '[skip ci]')"
# runs-on: [self-hosted, bench]
# steps:
# - name: Check to latest commit
# uses: actions/checkout@v2
# with:
# submodules: recursive
# - name: Install toolchain
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# toolchain: nightly-2021-09-12
# components: rustfmt
# target: wasm32-unknown-unknown
# default: true
# - name: Generate WeightInfo Files
# run: make generate-all-weights
# - name: Commit Automatically
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: 🤖 ($WEIGHT) Generate weightInfo files automatically
# # file_pattern: runtime/**/*.rs
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ build-bifrost-wasm:
build-asgard-wasm:
.maintain/build-wasm.sh asgard

.PHONY: check-try-runtime
check-try-runtime:
SKIP_WASM_BUILD= cargo check --features try-runtime --features with-bifrost-runtime

.PHONY: try-bifrost-runtime-upgrade
try-bifrost-runtime-upgrade:
./scripts/try-runtime.sh bifrost
Expand All @@ -168,4 +172,4 @@ keystore:

.PHONY: production-release
production-release:
.maintain/publish-release.sh
.maintain/publish-release.sh
12 changes: 8 additions & 4 deletions runtime/asgard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1981,9 +1981,12 @@ impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade() -> Result<(Weight, Weight), sp_runtime::RuntimeString> {
let weight = Executive::try_runtime_upgrade()?;
Ok((weight, RuntimeBlockWeights::get().max_block))
fn on_runtime_upgrade() -> (Weight, Weight) {
let weight = Executive::try_runtime_upgrade().unwrap();
(weight, RuntimeBlockWeights::get().max_block)
}
fn execute_block_no_check(block: Block) -> Weight {
Executive::execute_block_no_check(block)
}
}
}
Expand All @@ -2006,7 +2009,8 @@ impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> Weight {
log::info!("Asgard `on_runtime_upgrade`...");
let _ = PolkadotXcm::force_default_xcm_version(Origin::root(), Some(2));
RocksDbWeight::get().writes(1);
log::info!("Asgard `on_runtime_upgrade finished`");
RocksDbWeight::get().writes(1)
}
}

Expand Down
10 changes: 7 additions & 3 deletions runtime/bifrost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1859,10 +1859,13 @@ impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade() -> Result<(Weight, Weight), sp_runtime::RuntimeString> {
fn on_runtime_upgrade() -> (Weight, Weight) {
log::info!("try-runtime::on_runtime_upgrade bifrost.");
let weight = Executive::try_runtime_upgrade()?;
Ok((weight, RuntimeBlockWeights::get().max_block))
let weight = Executive::try_runtime_upgrade().unwrap();
(weight, RuntimeBlockWeights::get().max_block)
}
fn execute_block_no_check(block: Block) -> Weight {
Executive::execute_block_no_check(block)
}
}
}
Expand All @@ -1883,6 +1886,7 @@ impl OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> Weight {
log::info!("Bifrost `on_runtime_upgrade`...");
let _ = PolkadotXcm::force_default_xcm_version(Origin::root(), Some(2));
log::info!("Bifrost `on_runtime_upgrade finished`");
RocksDbWeight::get().writes(1)
}
}
Expand Down
8 changes: 5 additions & 3 deletions scripts/try-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

chain_type=$1
chain_type="${chain_type:-bifrost}"
echo $chain_type

chain_url=$2
chain_url="${chain_url:-ws://localhost:9944}"
chain_url="${chain_url:-ws://localhost:18848}"
echo $chain_url

block_hash=$3
block_hash="${block_hash:-0xd854e0d78b2bcd9cc56b6b4897f13d937d8ee166f1cda3b6c748ce775c56a87d}"
block_hash="${block_hash:-0x588bc30598fddd228f234b387cf68daa551262a2a17a5dda1199e770aeaffd77}"

cargo run -p node-cli --locked --features with-$chain_type-runtime --features try-runtime -- try-runtime --chain="$chain_type-genesis" --wasm-execution=compiled --url="$chain_url" --block-at="$block_hash" on-runtime-upgrade live -s snapshot.bin
cargo run -p node-cli --locked --features with-$chain_type-runtime --features try-runtime -- try-runtime --chain="$chain_type-local" --wasm-execution=compiled on-runtime-upgrade live --uri=$chain_url --at=$block_hash

0 comments on commit 9acbcb0

Please sign in to comment.