BlockId removal refactor: Backend::state_at (#6149)

* BlockId removal refactor: Backend::state_at

* formatting

* update lockfile for {"substrate"}

Co-authored-by: parity-processbot <>
This commit is contained in:
Michal Kucharczyk
2022-10-14 12:37:17 +02:00
committed by GitHub
parent 1d7d87856c
commit a8b79a3b48
2 changed files with 228 additions and 243 deletions
+179 -179
View File
File diff suppressed because it is too large Load Diff
@@ -23,7 +23,7 @@ use polkadot_test_client::{
};
use polkadot_test_runtime::pallet_test_notifier;
use polkadot_test_service::construct_extrinsic;
use sp_runtime::{generic::BlockId, traits::Block};
use sp_runtime::traits::Block;
use sp_state_machine::InspectState;
use xcm::{latest::prelude::*, VersionedResponse, VersionedXcm};
@@ -60,10 +60,7 @@ fn basic_buy_fees_message_executes() {
futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block))
.expect("imports the block");
client
.state_at(&BlockId::Hash(block_hash))
.expect("state should exist")
.inspect_state(|| {
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
r.event,
polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::Attempted(
@@ -104,10 +101,7 @@ fn query_response_fires() {
.expect("imports the block");
let mut query_id = None;
client
.state_at(&BlockId::Hash(block_hash))
.expect("state should exist")
.inspect_state(|| {
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
for r in polkadot_test_runtime::System::events().iter() {
match r.event {
TestNotifier(QueryPrepared(q)) => query_id = Some(q),
@@ -142,10 +136,7 @@ fn query_response_fires() {
futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block))
.expect("imports the block");
client
.state_at(&BlockId::Hash(block_hash))
.expect("state should exist")
.inspect_state(|| {
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
r.event,
polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::ResponseReady(
@@ -193,10 +184,7 @@ fn query_response_elicits_handler() {
.expect("imports the block");
let mut query_id = None;
client
.state_at(&BlockId::Hash(block_hash))
.expect("state should exist")
.inspect_state(|| {
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
for r in polkadot_test_runtime::System::events().iter() {
match r.event {
TestNotifier(NotifyQueryPrepared(q)) => query_id = Some(q),
@@ -230,10 +218,7 @@ fn query_response_elicits_handler() {
futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block))
.expect("imports the block");
client
.state_at(&BlockId::Hash(block_hash))
.expect("state should exist")
.inspect_state(|| {
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
r.event,
TestNotifier(ResponseReceived(