mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
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:
committed by
GitHub
parent
1d7d87856c
commit
a8b79a3b48
Generated
+179
-179
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_runtime::pallet_test_notifier;
|
||||||
use polkadot_test_service::construct_extrinsic;
|
use polkadot_test_service::construct_extrinsic;
|
||||||
use sp_runtime::{generic::BlockId, traits::Block};
|
use sp_runtime::traits::Block;
|
||||||
use sp_state_machine::InspectState;
|
use sp_state_machine::InspectState;
|
||||||
use xcm::{latest::prelude::*, VersionedResponse, VersionedXcm};
|
use xcm::{latest::prelude::*, VersionedResponse, VersionedXcm};
|
||||||
|
|
||||||
@@ -60,17 +60,14 @@ fn basic_buy_fees_message_executes() {
|
|||||||
futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block))
|
futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block))
|
||||||
.expect("imports the block");
|
.expect("imports the block");
|
||||||
|
|
||||||
client
|
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
|
||||||
.state_at(&BlockId::Hash(block_hash))
|
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
|
||||||
.expect("state should exist")
|
r.event,
|
||||||
.inspect_state(|| {
|
polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::Attempted(
|
||||||
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
|
Outcome::Complete(_)
|
||||||
r.event,
|
)),
|
||||||
polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::Attempted(
|
)));
|
||||||
Outcome::Complete(_)
|
});
|
||||||
)),
|
|
||||||
)));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -104,17 +101,14 @@ fn query_response_fires() {
|
|||||||
.expect("imports the block");
|
.expect("imports the block");
|
||||||
|
|
||||||
let mut query_id = None;
|
let mut query_id = None;
|
||||||
client
|
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
|
||||||
.state_at(&BlockId::Hash(block_hash))
|
for r in polkadot_test_runtime::System::events().iter() {
|
||||||
.expect("state should exist")
|
match r.event {
|
||||||
.inspect_state(|| {
|
TestNotifier(QueryPrepared(q)) => query_id = Some(q),
|
||||||
for r in polkadot_test_runtime::System::events().iter() {
|
_ => (),
|
||||||
match r.event {
|
|
||||||
TestNotifier(QueryPrepared(q)) => query_id = Some(q),
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
let query_id = query_id.unwrap();
|
let query_id = query_id.unwrap();
|
||||||
|
|
||||||
let mut block_builder = client.init_polkadot_block_builder();
|
let mut block_builder = client.init_polkadot_block_builder();
|
||||||
@@ -142,25 +136,22 @@ fn query_response_fires() {
|
|||||||
futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block))
|
futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block))
|
||||||
.expect("imports the block");
|
.expect("imports the block");
|
||||||
|
|
||||||
client
|
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
|
||||||
.state_at(&BlockId::Hash(block_hash))
|
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
|
||||||
.expect("state should exist")
|
r.event,
|
||||||
.inspect_state(|| {
|
polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::ResponseReady(
|
||||||
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
|
q,
|
||||||
r.event,
|
Response::ExecutionResult(None),
|
||||||
polkadot_test_runtime::RuntimeEvent::Xcm(pallet_xcm::Event::ResponseReady(
|
)) if q == query_id,
|
||||||
q,
|
)));
|
||||||
Response::ExecutionResult(None),
|
assert_eq!(
|
||||||
)) if q == query_id,
|
polkadot_test_runtime::Xcm::query(query_id),
|
||||||
)));
|
Some(QueryStatus::Ready {
|
||||||
assert_eq!(
|
response: VersionedResponse::V2(Response::ExecutionResult(None)),
|
||||||
polkadot_test_runtime::Xcm::query(query_id),
|
at: 2u32.into()
|
||||||
Some(QueryStatus::Ready {
|
}),
|
||||||
response: VersionedResponse::V2(Response::ExecutionResult(None)),
|
)
|
||||||
at: 2u32.into()
|
});
|
||||||
}),
|
|
||||||
)
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -193,17 +184,14 @@ fn query_response_elicits_handler() {
|
|||||||
.expect("imports the block");
|
.expect("imports the block");
|
||||||
|
|
||||||
let mut query_id = None;
|
let mut query_id = None;
|
||||||
client
|
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
|
||||||
.state_at(&BlockId::Hash(block_hash))
|
for r in polkadot_test_runtime::System::events().iter() {
|
||||||
.expect("state should exist")
|
match r.event {
|
||||||
.inspect_state(|| {
|
TestNotifier(NotifyQueryPrepared(q)) => query_id = Some(q),
|
||||||
for r in polkadot_test_runtime::System::events().iter() {
|
_ => (),
|
||||||
match r.event {
|
|
||||||
TestNotifier(NotifyQueryPrepared(q)) => query_id = Some(q),
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
});
|
||||||
let query_id = query_id.unwrap();
|
let query_id = query_id.unwrap();
|
||||||
|
|
||||||
let mut block_builder = client.init_polkadot_block_builder();
|
let mut block_builder = client.init_polkadot_block_builder();
|
||||||
@@ -230,17 +218,14 @@ fn query_response_elicits_handler() {
|
|||||||
futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block))
|
futures::executor::block_on(client.import(sp_consensus::BlockOrigin::Own, block))
|
||||||
.expect("imports the block");
|
.expect("imports the block");
|
||||||
|
|
||||||
client
|
client.state_at(&block_hash).expect("state should exist").inspect_state(|| {
|
||||||
.state_at(&BlockId::Hash(block_hash))
|
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
|
||||||
.expect("state should exist")
|
r.event,
|
||||||
.inspect_state(|| {
|
TestNotifier(ResponseReceived(
|
||||||
assert!(polkadot_test_runtime::System::events().iter().any(|r| matches!(
|
MultiLocation { parents: 0, interior: X1(Junction::AccountId32 { .. }) },
|
||||||
r.event,
|
q,
|
||||||
TestNotifier(ResponseReceived(
|
Response::ExecutionResult(None),
|
||||||
MultiLocation { parents: 0, interior: X1(Junction::AccountId32 { .. }) },
|
)) if q == query_id,
|
||||||
q,
|
)));
|
||||||
Response::ExecutionResult(None),
|
});
|
||||||
)) if q == query_id,
|
|
||||||
)));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user