Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Try-runtime Revamp and Facelift #12537

Merged
merged 74 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
8959a88
fix online/offline confusion
kianenigma Oct 18, 2022
e38582d
unified cache file
kianenigma Oct 18, 2022
c0f7958
multi-threaded babyyy
kianenigma Oct 18, 2022
0e4a63e
checkpoint for niklas
kianenigma Oct 19, 2022
d3173b3
compiles
kianenigma Oct 19, 2022
7240722
all tests pass with --test-threads 1
kianenigma Oct 19, 2022
35b1854
child-tree scrape is also multi-threaded now.
kianenigma Oct 19, 2022
dc69425
better thread splitting
kianenigma Oct 20, 2022
0f0de64
some suggestions (#12532)
niklasad1 Oct 20, 2022
72395ec
merged, remote-ext is all good
kianenigma Oct 20, 2022
e426c7d
snapshot command
kianenigma Oct 20, 2022
0efdfdb
holy master merge
kianenigma Oct 20, 2022
bc7160d
fix rem
kianenigma Oct 20, 2022
3443039
a bit of cleanup
kianenigma Oct 20, 2022
20d100b
support optional checks
kianenigma Oct 21, 2022
fab3854
fix
kianenigma Oct 21, 2022
91e3fde
OCW command migrated to wasm-only, as an example
kianenigma Oct 21, 2022
bbae216
state-version management fully in remote-ext
kianenigma Oct 22, 2022
174f1ea
almost everything move to wasm executor, some CLI flags reduced
kianenigma Oct 22, 2022
96838b1
Merge branch 'master' of github.com:paritytech/substrate into kiz-rev…
kianenigma Oct 22, 2022
88b9b4a
follow-chain works as well
kianenigma Oct 23, 2022
dd8a347
Master.into()
kianenigma Nov 13, 2022
067a084
Master.into()
kianenigma Nov 13, 2022
ee0130c
everything builds now
kianenigma Nov 13, 2022
43fdf11
concurrent insertion and download for remote builds
kianenigma Nov 13, 2022
a37609c
minor fix
kianenigma Nov 14, 2022
542e57e
fix a bug
kianenigma Nov 14, 2022
287193b
checkpoint
kianenigma Nov 14, 2022
79b72bb
some updates
kianenigma Nov 14, 2022
0b38d96
fmt
kianenigma Nov 14, 2022
52a8c8d
review comments
kianenigma Nov 16, 2022
acd019a
Master.into()
kianenigma Nov 16, 2022
05f0da3
fmt
kianenigma Nov 16, 2022
341083c
fix
kianenigma Nov 16, 2022
c38245d
fmt
kianenigma Nov 16, 2022
66a870f
update
kianenigma Nov 24, 2022
5cd0247
fmt
kianenigma Nov 24, 2022
7441452
Master.into()
kianenigma Nov 30, 2022
c58f9f8
Merge branch 'master' of github.com:paritytech/substrate into kiz-rev…
kianenigma Dec 4, 2022
83b164c
rename
kianenigma Dec 4, 2022
d54d27c
fix the damn UI tests
kianenigma Dec 7, 2022
b456f96
master.into()
kianenigma Dec 7, 2022
f4a40ef
fmt
kianenigma Dec 7, 2022
1b42bbd
remoe the thread abstraction for the time being
kianenigma Dec 7, 2022
ee7e293
cleanup
kianenigma Dec 7, 2022
c80dcae
fix CI
kianenigma Dec 7, 2022
2ae812a
fmt
kianenigma Dec 7, 2022
942d6eb
Merge branch 'master' of github.com:paritytech/substrate into kiz-rev…
kianenigma Dec 7, 2022
be7cfdd
fix
kianenigma Dec 7, 2022
e700fc9
fix a few more things
kianenigma Dec 7, 2022
1c416b1
tweak log levels
kianenigma Dec 7, 2022
d43c877
better error handling
kianenigma Dec 8, 2022
076a5e9
address grumbles: use futures::mpsc
niklasad1 Dec 8, 2022
ae38f10
review comments
kianenigma Dec 8, 2022
83d2297
Merge branch 'kiz-revamp-try-runtime-stuff' of github.com:paritytech/…
kianenigma Dec 8, 2022
78cb145
Merge branch 'master' of github.com:paritytech/substrate into kiz-rev…
kianenigma Dec 8, 2022
259622b
fmt
kianenigma Dec 8, 2022
b32d375
Apply suggestions from code review
kianenigma Dec 12, 2022
45d13fa
Update utils/frame/try-runtime/cli/src/lib.rs
kianenigma Dec 12, 2022
8db7fca
better api version stuff
kianenigma Dec 12, 2022
5f3266d
Merge branch 'kiz-revamp-try-runtime-stuff' of github.com:paritytech/…
kianenigma Dec 12, 2022
369f819
some doc update
kianenigma Dec 13, 2022
f4b00d1
a whole lot of docs
kianenigma Dec 13, 2022
4eb028e
fmt
kianenigma Dec 13, 2022
a35bca9
fix all docs
kianenigma Dec 13, 2022
59a11d6
fmt
kianenigma Dec 13, 2022
4ce770a
rpc rebase: Try-runtime Revamp and Facelift (#12921)
lexnv Dec 14, 2022
215f5b1
Revert "rpc rebase: Try-runtime Revamp and Facelift (#12921)"
kianenigma Dec 14, 2022
378cfb2
Lexnv/kiz revamp try runtime stuff (#12932)
kianenigma Dec 14, 2022
4cd8565
Revert "Lexnv/kiz revamp try runtime stuff (#12932)"
kianenigma Dec 14, 2022
6b44fa3
merged??
kianenigma Dec 14, 2022
042c7ea
fmt
kianenigma Dec 14, 2022
a41b669
update
kianenigma Dec 14, 2022
f204995
fix publish
kianenigma Dec 14, 2022
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
78 changes: 64 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/node-template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ sc-finality-grandpa = { version = "0.10.0-dev", path = "../../../client/finality
sp-finality-grandpa = { version = "4.0.0-dev", path = "../../../primitives/finality-grandpa" }
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api" }
sp-runtime = { version = "7.0.0", path = "../../../primitives/runtime" }
sp-io = { version = "7.0.0", path = "../../../primitives/io" }
sp-timestamp = { version = "4.0.0-dev", path = "../../../primitives/timestamp" }
sp-inherents = { version = "4.0.0-dev", path = "../../../primitives/inherents" }
sp-keyring = { version = "7.0.0", path = "../../../primitives/keyring" }
Expand Down
10 changes: 9 additions & 1 deletion bin/node-template/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ pub fn run() -> sc_cli::Result<()> {
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use crate::service::ExecutorDispatch;
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
// we don't need any of the components of new_partial, just a runtime, or a task
Expand All @@ -182,7 +184,13 @@ pub fn run() -> sc_cli::Result<()> {
let task_manager =
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;
Ok((cmd.run::<Block, service::ExecutorDispatch>(config), task_manager))
Ok((
cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<ExecutorDispatch as NativeExecutionDispatch>::ExtendHostFunctions,
>>(),
task_manager,
))
})
},
#[cfg(not(feature = "try-runtime"))]
Expand Down
8 changes: 5 additions & 3 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,11 @@ impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade() -> (Weight, Weight) {
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here. If any of the pre/post migration checks fail, we shall stop
// right here and right now.
let weight = Executive::try_runtime_upgrade().unwrap();
let weight = Executive::try_runtime_upgrade(checks).unwrap();
(weight, BlockWeights::get().max_block)
}

Expand All @@ -552,8 +552,10 @@ impl_runtime_apis! {
) -> Weight {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
Executive::try_execute_block(block, state_root_check, select).expect("execute-block failed")
Executive::try_execute_block(block, state_root_check, true, select).expect("execute-block failed")
}

fn ping() {}
}
}

Expand Down
1 change: 1 addition & 0 deletions bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ sp-keystore = { version = "0.13.0", path = "../../../primitives/keystore" }
sp-consensus = { version = "0.10.0-dev", path = "../../../primitives/consensus/common" }
sp-transaction-pool = { version = "4.0.0-dev", path = "../../../primitives/transaction-pool" }
sp-transaction-storage-proof = { version = "4.0.0-dev", path = "../../../primitives/transaction-storage-proof" }
sp-io = { path = "../../../primitives/io" }
kianenigma marked this conversation as resolved.
Show resolved Hide resolved

# client dependencies
sc-client-api = { version = "4.0.0-dev", path = "../../../client/api" }
Expand Down
9 changes: 8 additions & 1 deletion bin/node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ pub fn run() -> Result<()> {
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
// we don't need any of the components of new_partial, just a runtime, or a task
Expand All @@ -236,7 +237,13 @@ pub fn run() -> Result<()> {
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;

Ok((cmd.run::<Block, ExecutorDispatch>(config), task_manager))
Ok((
cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<ExecutorDispatch as NativeExecutionDispatch>::ExtendHostFunctions,
>>(),
task_manager,
))
})
},
#[cfg(not(feature = "try-runtime"))]
Expand Down
11 changes: 7 additions & 4 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2133,11 +2133,11 @@ impl_runtime_apis! {

#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime<Block> for Runtime {
fn on_runtime_upgrade() -> (Weight, Weight) {
fn on_runtime_upgrade(checks: bool) -> (Weight, Weight) {
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here. If any of the pre/post migration checks fail, we shall stop
// right here and right now.
let weight = Executive::try_runtime_upgrade().unwrap();
let weight = Executive::try_runtime_upgrade(checks).unwrap();
(weight, RuntimeBlockWeights::get().max_block)
}

Expand All @@ -2148,15 +2148,18 @@ impl_runtime_apis! {
) -> Weight {
log::info!(
target: "node-runtime",
"try-runtime: executing block {:?} / root checks: {:?} / try-state-select: {:?}",
"try-runtime: executing block {:?} / state root check: {:?} / signature check: {:?} / try-state-select: {:?}",
block.header.hash(),
state_root_check,
false,
select,
);
kianenigma marked this conversation as resolved.
Show resolved Hide resolved
// NOTE: intentional unwrap: we don't want to propagate the error backwards, and want to
// have a backtrace here.
Executive::try_execute_block(block, state_root_check, select).unwrap()
Executive::try_execute_block(block, state_root_check, false, select).unwrap()
}

fn ping() {}
}

#[cfg(feature = "runtime-benchmarks")]
Expand Down
2 changes: 1 addition & 1 deletion frame/bags-list/remote-tests/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub async fn execute<Runtime, Block>(
ws_url: String,
) where
Runtime: RuntimeT<pallet_bags_list::Instance1>,
Block: BlockT,
Block: BlockT + DeserializeOwned,
Block::Header: DeserializeOwned,
{
let mut ext = Builder::<Block>::new()
Expand Down
18 changes: 11 additions & 7 deletions frame/bags-list/remote-tests/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sp_runtime::{traits::Block as BlockT, DeserializeOwned};
pub async fn execute<Runtime, Block>(voter_limit: Option<usize>, currency_unit: u64, ws_url: String)
where
Runtime: crate::RuntimeT<pallet_bags_list::Instance1>,
Block: BlockT,
Block: BlockT + DeserializeOwned,
Block::Header: DeserializeOwned,
{
use frame_support::storage::generator::StorageMap;
Expand All @@ -38,14 +38,18 @@ where
pallets: vec![pallet_bags_list::Pallet::<Runtime, pallet_bags_list::Instance1>::name()
.to_string()],
at: None,
hashed_prefixes: vec![
<pallet_staking::Bonded<Runtime>>::prefix_hash(),
<pallet_staking::Ledger<Runtime>>::prefix_hash(),
<pallet_staking::Validators<Runtime>>::map_storage_final_prefix(),
<pallet_staking::Nominators<Runtime>>::map_storage_final_prefix(),
],
hashed_keys: vec![
<pallet_staking::Validators<Runtime>>::counter_storage_final_key().to_vec(),
<pallet_staking::Nominators<Runtime>>::counter_storage_final_key().to_vec(),
],
..Default::default()
}))
.inject_hashed_prefix(&<pallet_staking::Bonded<Runtime>>::prefix_hash())
.inject_hashed_prefix(&<pallet_staking::Ledger<Runtime>>::prefix_hash())
.inject_hashed_prefix(&<pallet_staking::Validators<Runtime>>::map_storage_final_prefix())
.inject_hashed_prefix(&<pallet_staking::Nominators<Runtime>>::map_storage_final_prefix())
.inject_hashed_key(&<pallet_staking::Validators<Runtime>>::counter_storage_final_key())
.inject_hashed_key(&<pallet_staking::Nominators<Runtime>>::counter_storage_final_key())
.build()
.await
.unwrap();
Expand Down
Loading