mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
Make the tests pass
This commit is contained in:
Generated
+359
-700
File diff suppressed because it is too large
Load Diff
@@ -13,9 +13,9 @@ substrate-primitives = { git = "https://github.com/paritytech/substrate", branch
|
|||||||
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "bkchr-validate_block" }
|
sr-primitives = { git = "https://github.com/paritytech/substrate", branch = "bkchr-validate_block" }
|
||||||
|
|
||||||
# polkadot deps
|
# polkadot deps
|
||||||
polkadot-service = { git = "https://github.com/paritytech/polkadot" }
|
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-validate_block" }
|
||||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot" }
|
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-validate_block" }
|
||||||
polkadot-runtime = { git = "https://github.com/paritytech/polkadot" }
|
polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "bkchr-validate_block" }
|
||||||
|
|
||||||
# other deps
|
# other deps
|
||||||
futures = "0.1.21"
|
futures = "0.1.21"
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ pub enum Error<P> {
|
|||||||
/// A parachain head update.
|
/// A parachain head update.
|
||||||
pub struct HeadUpdate {
|
pub struct HeadUpdate {
|
||||||
/// The relay-chain's block hash where the parachain head updated.
|
/// The relay-chain's block hash where the parachain head updated.
|
||||||
pub relay_hash: PHash,
|
pub relay_hash: PHash,
|
||||||
/// The parachain head-data.
|
/// The parachain head-data.
|
||||||
pub head_data: Vec<u8>,
|
pub head_data: Vec<u8>,
|
||||||
}
|
}
|
||||||
@@ -80,9 +80,9 @@ pub trait PolkadotClient: Clone {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Spawns a future that follows the Polkadot relay chain for the given parachain.
|
/// Spawns a future that follows the Polkadot relay chain for the given parachain.
|
||||||
pub fn follow_polkadot<'a, L: 'a, P: 'a>(para_id: ParaId, local: Arc<L>, polkadot: P)
|
pub fn follow_polkadot<'a, L: 'a, P: 'a>(para_id: ParaId, local: Arc<L>, polkadot: P)
|
||||||
-> impl Future<Item=(),Error=()> + Send + 'a
|
-> impl Future<Item=(),Error=()> + Send + 'a
|
||||||
where
|
where
|
||||||
L: LocalClient + Send + Sync,
|
L: LocalClient + Send + Sync,
|
||||||
P: PolkadotClient + Send + Sync,
|
P: PolkadotClient + Send + Sync,
|
||||||
{
|
{
|
||||||
@@ -169,23 +169,23 @@ impl<B, E, RA> PolkadotClient for Arc<Client<B, E, PBlock, RA>> where
|
|||||||
{
|
{
|
||||||
type Error = ClientError;
|
type Error = ClientError;
|
||||||
|
|
||||||
type HeadUpdates = Box<Stream<Item=HeadUpdate,Error=Self::Error> + Send>;
|
type HeadUpdates = Box<Stream<Item=HeadUpdate, Error=Self::Error> + Send>;
|
||||||
type Finalized = Box<Stream<Item=Vec<u8>,Error=Self::Error> + Send>;
|
type Finalized = Box<Stream<Item=Vec<u8>, Error=Self::Error> + Send>;
|
||||||
|
|
||||||
fn head_updates(&self, para_id: ParaId) -> Self::HeadUpdates {
|
fn head_updates(&self, para_id: ParaId) -> Self::HeadUpdates {
|
||||||
let parachain_key = parachain_key(para_id);
|
let parachain_key = parachain_key(para_id);
|
||||||
let stream = stream::once(self.storage_changes_notification_stream(Some(&[parachain_key.clone()])))
|
let stream = stream::once(self.storage_changes_notification_stream(Some(&[parachain_key.clone()])))
|
||||||
.map(|s| s.map_err(|()| panic!("unbounded receivers never yield errors; qed")))
|
.map(|s| s.map_err(|()| panic!("unbounded receivers never yield errors; qed")))
|
||||||
.flatten();
|
.flatten();
|
||||||
|
|
||||||
let s = stream.filter_map(move |(hash, changes)| {
|
let s = stream.filter_map(move |(hash, changes)| {
|
||||||
let head_data = changes.iter()
|
let head_data = changes.iter()
|
||||||
.filter_map(|(k, v)| if k == ¶chain_key { Some(v) } else { None })
|
.filter_map(|(k, v)| if k == ¶chain_key { Some(v) } else { None })
|
||||||
.next();
|
.next();
|
||||||
|
|
||||||
match head_data {
|
match head_data {
|
||||||
Some(Some(head_data)) => Some(HeadUpdate {
|
Some(Some(head_data)) => Some(HeadUpdate {
|
||||||
relay_hash: hash,
|
relay_hash: hash,
|
||||||
head_data: head_data.0.clone(),
|
head_data: head_data.0.clone(),
|
||||||
}),
|
}),
|
||||||
Some(None) | None => None,
|
Some(None) | None => None,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ mod tests;
|
|||||||
/// struct Block;
|
/// struct Block;
|
||||||
/// struct BlockExecutor;
|
/// struct BlockExecutor;
|
||||||
///
|
///
|
||||||
/// srml_parachain::register_validate_block!(Block, BlockExecutor);
|
/// cumulus_runtime::register_validate_block!(Block, BlockExecutor);
|
||||||
///
|
///
|
||||||
/// # fn main() {}
|
/// # fn main() {}
|
||||||
/// ```
|
/// ```
|
||||||
|
|||||||
+402
-351
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user