Skip to content
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
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