mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 05:38:00 +00:00
chain_head: Rename runtimeUpdates flag to withRuntime (#14244)
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -34,7 +34,7 @@ pub trait ChainHeadApi<Hash> {
|
||||
unsubscribe = "chainHead_unstable_unfollow",
|
||||
item = FollowEvent<Hash>,
|
||||
)]
|
||||
fn chain_head_unstable_follow(&self, runtime_updates: bool);
|
||||
fn chain_head_unstable_follow(&self, with_runtime: bool);
|
||||
|
||||
/// Retrieves the body (list of transactions) of a pinned block.
|
||||
///
|
||||
|
||||
@@ -152,7 +152,7 @@ where
|
||||
fn chain_head_unstable_follow(
|
||||
&self,
|
||||
mut sink: SubscriptionSink,
|
||||
runtime_updates: bool,
|
||||
with_runtime: bool,
|
||||
) -> SubscriptionResult {
|
||||
let sub_id = match self.accept_subscription(&mut sink) {
|
||||
Ok(sub_id) => sub_id,
|
||||
@@ -162,7 +162,7 @@ where
|
||||
},
|
||||
};
|
||||
// Keep track of the subscription.
|
||||
let Some(rx_stop) = self.subscriptions.insert_subscription(sub_id.clone(), runtime_updates) else {
|
||||
let Some(rx_stop) = self.subscriptions.insert_subscription(sub_id.clone(), with_runtime) else {
|
||||
// Inserting the subscription can only fail if the JsonRPSee
|
||||
// generated a duplicate subscription ID.
|
||||
debug!(target: LOG_TARGET, "[follow][id={:?}] Subscription already accepted", sub_id);
|
||||
@@ -179,7 +179,7 @@ where
|
||||
client,
|
||||
backend,
|
||||
subscriptions.clone(),
|
||||
runtime_updates,
|
||||
with_runtime,
|
||||
sub_id.clone(),
|
||||
);
|
||||
|
||||
@@ -410,8 +410,8 @@ where
|
||||
};
|
||||
|
||||
let fut = async move {
|
||||
// Reject subscription if runtime_updates is false.
|
||||
if !block_guard.has_runtime_updates() {
|
||||
// Reject subscription if with_runtime is false.
|
||||
if !block_guard.has_runtime() {
|
||||
let _ = sink.reject(ChainHeadRpcError::InvalidParam(
|
||||
"The runtime updates flag must be set".into(),
|
||||
));
|
||||
|
||||
@@ -52,7 +52,7 @@ pub struct ChainHeadFollower<BE: Backend<Block>, Block: BlockT, Client> {
|
||||
/// Subscriptions handle.
|
||||
sub_handle: Arc<SubscriptionManagement<Block, BE>>,
|
||||
/// Subscription was started with the runtime updates flag.
|
||||
runtime_updates: bool,
|
||||
with_runtime: bool,
|
||||
/// Subscription ID.
|
||||
sub_id: String,
|
||||
/// The best reported block by this subscription.
|
||||
@@ -65,10 +65,10 @@ impl<BE: Backend<Block>, Block: BlockT, Client> ChainHeadFollower<BE, Block, Cli
|
||||
client: Arc<Client>,
|
||||
backend: Arc<BE>,
|
||||
sub_handle: Arc<SubscriptionManagement<Block, BE>>,
|
||||
runtime_updates: bool,
|
||||
with_runtime: bool,
|
||||
sub_id: String,
|
||||
) -> Self {
|
||||
Self { client, backend, sub_handle, runtime_updates, sub_id, best_block_cache: None }
|
||||
Self { client, backend, sub_handle, with_runtime, sub_id, best_block_cache: None }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ where
|
||||
parent: Option<Block::Hash>,
|
||||
) -> Option<RuntimeEvent> {
|
||||
// No runtime versions should be reported.
|
||||
if !self.runtime_updates {
|
||||
if !self.with_runtime {
|
||||
return None
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ where
|
||||
let initialized_event = FollowEvent::Initialized(Initialized {
|
||||
finalized_block_hash,
|
||||
finalized_block_runtime,
|
||||
runtime_updates: self.runtime_updates,
|
||||
with_runtime: self.with_runtime,
|
||||
});
|
||||
|
||||
let mut finalized_block_descendants = Vec::with_capacity(initial_blocks.len() + 1);
|
||||
@@ -243,7 +243,7 @@ where
|
||||
block_hash: child,
|
||||
parent_block_hash: parent,
|
||||
new_runtime,
|
||||
runtime_updates: self.runtime_updates,
|
||||
with_runtime: self.with_runtime,
|
||||
});
|
||||
|
||||
finalized_block_descendants.push(event);
|
||||
@@ -274,7 +274,7 @@ where
|
||||
block_hash,
|
||||
parent_block_hash,
|
||||
new_runtime,
|
||||
runtime_updates: self.runtime_updates,
|
||||
with_runtime: self.with_runtime,
|
||||
});
|
||||
|
||||
if !is_best_block {
|
||||
|
||||
@@ -64,7 +64,7 @@ pub struct RuntimeVersionEvent {
|
||||
}
|
||||
|
||||
/// The runtime event generated if the `follow` subscription
|
||||
/// has set the `runtime_updates` flag.
|
||||
/// has set the `with_runtime` flag.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[serde(tag = "type")]
|
||||
@@ -88,7 +88,7 @@ impl From<ApiError> for RuntimeEvent {
|
||||
/// This is the first event generated by the `follow` subscription
|
||||
/// and is submitted only once.
|
||||
///
|
||||
/// If the `runtime_updates` flag is set, then this event contains
|
||||
/// If the `with_runtime` flag is set, then this event contains
|
||||
/// the `RuntimeEvent`, otherwise the `RuntimeEvent` is not present.
|
||||
#[derive(Debug, Clone, PartialEq, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -99,23 +99,23 @@ pub struct Initialized<Hash> {
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// This is present only if the `runtime_updates` flag is set for
|
||||
/// This is present only if the `with_runtime` flag is set for
|
||||
/// the `follow` subscription.
|
||||
pub finalized_block_runtime: Option<RuntimeEvent>,
|
||||
/// Privately keep track if the `finalized_block_runtime` should be
|
||||
/// serialized.
|
||||
#[serde(default)]
|
||||
pub(crate) runtime_updates: bool,
|
||||
pub(crate) with_runtime: bool,
|
||||
}
|
||||
|
||||
impl<Hash: Serialize> Serialize for Initialized<Hash> {
|
||||
/// Custom serialize implementation to include the `RuntimeEvent` depending
|
||||
/// on the internal `runtime_updates` flag.
|
||||
/// on the internal `with_runtime` flag.
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
if self.runtime_updates {
|
||||
if self.with_runtime {
|
||||
let mut state = serializer.serialize_struct("Initialized", 2)?;
|
||||
state.serialize_field("finalizedBlockHash", &self.finalized_block_hash)?;
|
||||
state.serialize_field("finalizedBlockRuntime", &self.finalized_block_runtime)?;
|
||||
@@ -140,23 +140,23 @@ pub struct NewBlock<Hash> {
|
||||
///
|
||||
/// # Note
|
||||
///
|
||||
/// This is present only if the `runtime_updates` flag is set for
|
||||
/// This is present only if the `with_runtime` flag is set for
|
||||
/// the `follow` subscription.
|
||||
pub new_runtime: Option<RuntimeEvent>,
|
||||
/// Privately keep track if the `finalized_block_runtime` should be
|
||||
/// serialized.
|
||||
#[serde(default)]
|
||||
pub(crate) runtime_updates: bool,
|
||||
pub(crate) with_runtime: bool,
|
||||
}
|
||||
|
||||
impl<Hash: Serialize> Serialize for NewBlock<Hash> {
|
||||
/// Custom serialize implementation to include the `RuntimeEvent` depending
|
||||
/// on the internal `runtime_updates` flag.
|
||||
/// on the internal `with_runtime` flag.
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
if self.runtime_updates {
|
||||
if self.with_runtime {
|
||||
let mut state = serializer.serialize_struct("NewBlock", 3)?;
|
||||
state.serialize_field("blockHash", &self.block_hash)?;
|
||||
state.serialize_field("parentBlockHash", &self.parent_block_hash)?;
|
||||
@@ -253,7 +253,7 @@ mod tests {
|
||||
let event: FollowEvent<String> = FollowEvent::Initialized(Initialized {
|
||||
finalized_block_hash: "0x1".into(),
|
||||
finalized_block_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
|
||||
let ser = serde_json::to_string(&event).unwrap();
|
||||
@@ -278,7 +278,7 @@ mod tests {
|
||||
let mut initialized = Initialized {
|
||||
finalized_block_hash: "0x1".into(),
|
||||
finalized_block_runtime: Some(runtime_event),
|
||||
runtime_updates: true,
|
||||
with_runtime: true,
|
||||
};
|
||||
let event: FollowEvent<String> = FollowEvent::Initialized(initialized.clone());
|
||||
|
||||
@@ -291,8 +291,8 @@ mod tests {
|
||||
assert_eq!(ser, exp);
|
||||
|
||||
let event_dec: FollowEvent<String> = serde_json::from_str(exp).unwrap();
|
||||
// The `runtime_updates` field is used for serialization purposes.
|
||||
initialized.runtime_updates = false;
|
||||
// The `with_runtime` field is used for serialization purposes.
|
||||
initialized.with_runtime = false;
|
||||
assert!(matches!(
|
||||
event_dec, FollowEvent::Initialized(ref dec) if dec == &initialized
|
||||
));
|
||||
@@ -305,7 +305,7 @@ mod tests {
|
||||
block_hash: "0x1".into(),
|
||||
parent_block_hash: "0x2".into(),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
|
||||
let ser = serde_json::to_string(&event).unwrap();
|
||||
@@ -331,7 +331,7 @@ mod tests {
|
||||
block_hash: "0x1".into(),
|
||||
parent_block_hash: "0x2".into(),
|
||||
new_runtime: Some(runtime_event),
|
||||
runtime_updates: true,
|
||||
with_runtime: true,
|
||||
};
|
||||
|
||||
let event: FollowEvent<String> = FollowEvent::NewBlock(new_block.clone());
|
||||
@@ -345,8 +345,8 @@ mod tests {
|
||||
assert_eq!(ser, exp);
|
||||
|
||||
let event_dec: FollowEvent<String> = serde_json::from_str(exp).unwrap();
|
||||
// The `runtime_updates` field is used for serialization purposes.
|
||||
new_block.runtime_updates = false;
|
||||
// The `with_runtime` field is used for serialization purposes.
|
||||
new_block.with_runtime = false;
|
||||
assert!(matches!(
|
||||
event_dec, FollowEvent::NewBlock(ref dec) if dec == &new_block
|
||||
));
|
||||
@@ -356,7 +356,7 @@ mod tests {
|
||||
block_hash: "0x1".into(),
|
||||
parent_block_hash: "0x2".into(),
|
||||
new_runtime: None,
|
||||
runtime_updates: true,
|
||||
with_runtime: true,
|
||||
};
|
||||
let event: FollowEvent<String> = FollowEvent::NewBlock(new_block.clone());
|
||||
|
||||
@@ -364,7 +364,7 @@ mod tests {
|
||||
let exp =
|
||||
r#"{"event":"newBlock","blockHash":"0x1","parentBlockHash":"0x2","newRuntime":null}"#;
|
||||
assert_eq!(ser, exp);
|
||||
new_block.runtime_updates = false;
|
||||
new_block.with_runtime = false;
|
||||
let event_dec: FollowEvent<String> = serde_json::from_str(exp).unwrap();
|
||||
assert!(matches!(
|
||||
event_dec, FollowEvent::NewBlock(ref dec) if dec == &new_block
|
||||
|
||||
@@ -112,8 +112,8 @@ struct BlockState {
|
||||
|
||||
/// The state of a single subscription ID.
|
||||
struct SubscriptionState<Block: BlockT> {
|
||||
/// The `runtime_updates` parameter flag of the subscription.
|
||||
runtime_updates: bool,
|
||||
/// The `with_runtime` parameter flag of the subscription.
|
||||
with_runtime: bool,
|
||||
/// Signals the "Stop" event.
|
||||
tx_stop: Option<oneshot::Sender<()>>,
|
||||
/// Track the block hashes available for this subscription.
|
||||
@@ -234,7 +234,7 @@ impl<Block: BlockT> SubscriptionState<Block> {
|
||||
/// executing an RPC method call.
|
||||
pub struct BlockGuard<Block: BlockT, BE: Backend<Block>> {
|
||||
hash: Block::Hash,
|
||||
runtime_updates: bool,
|
||||
with_runtime: bool,
|
||||
backend: Arc<BE>,
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ pub struct BlockGuard<Block: BlockT, BE: Backend<Block>> {
|
||||
// testing.
|
||||
impl<Block: BlockT, BE: Backend<Block>> std::fmt::Debug for BlockGuard<Block, BE> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "BlockGuard hash {:?} runtime_updates {:?}", self.hash, self.runtime_updates)
|
||||
write!(f, "BlockGuard hash {:?} with_runtime {:?}", self.hash, self.with_runtime)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,19 +250,19 @@ impl<Block: BlockT, BE: Backend<Block>> BlockGuard<Block, BE> {
|
||||
/// Construct a new [`BlockGuard`] .
|
||||
fn new(
|
||||
hash: Block::Hash,
|
||||
runtime_updates: bool,
|
||||
with_runtime: bool,
|
||||
backend: Arc<BE>,
|
||||
) -> Result<Self, SubscriptionManagementError> {
|
||||
backend
|
||||
.pin_block(hash)
|
||||
.map_err(|err| SubscriptionManagementError::Custom(err.to_string()))?;
|
||||
|
||||
Ok(Self { hash, runtime_updates, backend })
|
||||
Ok(Self { hash, with_runtime, backend })
|
||||
}
|
||||
|
||||
/// The `runtime_updates` flag of the subscription.
|
||||
pub fn has_runtime_updates(&self) -> bool {
|
||||
self.runtime_updates
|
||||
/// The `with_runtime` flag of the subscription.
|
||||
pub fn has_runtime(&self) -> bool {
|
||||
self.with_runtime
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,12 +310,12 @@ impl<Block: BlockT, BE: Backend<Block>> SubscriptionsInner<Block, BE> {
|
||||
pub fn insert_subscription(
|
||||
&mut self,
|
||||
sub_id: String,
|
||||
runtime_updates: bool,
|
||||
with_runtime: bool,
|
||||
) -> Option<oneshot::Receiver<()>> {
|
||||
if let Entry::Vacant(entry) = self.subs.entry(sub_id) {
|
||||
let (tx_stop, rx_stop) = oneshot::channel();
|
||||
let state = SubscriptionState::<Block> {
|
||||
runtime_updates,
|
||||
with_runtime,
|
||||
tx_stop: Some(tx_stop),
|
||||
blocks: Default::default(),
|
||||
};
|
||||
@@ -501,7 +501,7 @@ impl<Block: BlockT, BE: Backend<Block>> SubscriptionsInner<Block, BE> {
|
||||
return Err(SubscriptionManagementError::BlockHashAbsent)
|
||||
}
|
||||
|
||||
BlockGuard::new(hash, sub.runtime_updates, self.backend.clone())
|
||||
BlockGuard::new(hash, sub.with_runtime, self.backend.clone())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ mod tests {
|
||||
#[test]
|
||||
fn sub_state_register_twice() {
|
||||
let mut sub_state = SubscriptionState::<Block> {
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
tx_stop: None,
|
||||
blocks: Default::default(),
|
||||
};
|
||||
@@ -633,7 +633,7 @@ mod tests {
|
||||
#[test]
|
||||
fn sub_state_register_unregister() {
|
||||
let mut sub_state = SubscriptionState::<Block> {
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
tx_stop: None,
|
||||
blocks: Default::default(),
|
||||
};
|
||||
@@ -709,7 +709,7 @@ mod tests {
|
||||
|
||||
let block = subs.lock_block(&id, hash).unwrap();
|
||||
// Subscription started with runtime updates
|
||||
assert_eq!(block.has_runtime_updates(), true);
|
||||
assert_eq!(block.has_runtime(), true);
|
||||
|
||||
let invalid_id = "abc-invalid".to_string();
|
||||
let err = subs.unpin_block(&invalid_id, hash).unwrap_err();
|
||||
|
||||
@@ -128,7 +128,7 @@ async fn follow_subscription_produces_blocks() {
|
||||
let expected = FollowEvent::Initialized(Initialized {
|
||||
finalized_block_hash: format!("{:?}", finalized_hash),
|
||||
finalized_block_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -142,7 +142,7 @@ async fn follow_subscription_produces_blocks() {
|
||||
block_hash: format!("{:?}", best_hash),
|
||||
parent_block_hash: format!("{:?}", finalized_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -199,7 +199,7 @@ async fn follow_with_runtime() {
|
||||
let expected = FollowEvent::Initialized(Initialized {
|
||||
finalized_block_hash: format!("{:?}", finalized_hash),
|
||||
finalized_block_runtime,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -214,7 +214,7 @@ async fn follow_with_runtime() {
|
||||
block_hash: format!("{:?}", best_hash),
|
||||
parent_block_hash: format!("{:?}", finalized_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -264,7 +264,7 @@ async fn follow_with_runtime() {
|
||||
block_hash: format!("{:?}", best_hash),
|
||||
parent_block_hash: format!("{:?}", finalized_hash),
|
||||
new_runtime,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
}
|
||||
@@ -492,7 +492,7 @@ async fn call_runtime_without_flag() {
|
||||
FollowEvent::BestBlockChanged(_)
|
||||
);
|
||||
|
||||
// Valid runtime call on a subscription started with `runtime_updates` false.
|
||||
// Valid runtime call on a subscription started with `with_runtime` false.
|
||||
let alice_id = AccountKeyring::Alice.to_account_id();
|
||||
let call_parameters = format!("0x{:?}", HexDisplay::from(&alice_id.encode()));
|
||||
let err = api
|
||||
@@ -681,7 +681,7 @@ async fn follow_generates_initial_blocks() {
|
||||
let expected = FollowEvent::Initialized(Initialized {
|
||||
finalized_block_hash: format!("{:?}", finalized_hash),
|
||||
finalized_block_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -691,7 +691,7 @@ async fn follow_generates_initial_blocks() {
|
||||
block_hash: format!("{:?}", block_1_hash),
|
||||
parent_block_hash: format!("{:?}", finalized_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -701,7 +701,7 @@ async fn follow_generates_initial_blocks() {
|
||||
block_hash: format!("{:?}", block_2_hash),
|
||||
parent_block_hash: format!("{:?}", block_1_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
// Check block 3.
|
||||
@@ -710,7 +710,7 @@ async fn follow_generates_initial_blocks() {
|
||||
block_hash: format!("{:?}", block_3_hash),
|
||||
parent_block_hash: format!("{:?}", block_1_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -730,7 +730,7 @@ async fn follow_generates_initial_blocks() {
|
||||
block_hash: format!("{:?}", block_4_hash),
|
||||
parent_block_hash: format!("{:?}", block_2_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -913,7 +913,7 @@ async fn follow_prune_best_block() {
|
||||
let expected = FollowEvent::Initialized(Initialized {
|
||||
finalized_block_hash: format!("{:?}", finalized_hash),
|
||||
finalized_block_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -963,7 +963,7 @@ async fn follow_prune_best_block() {
|
||||
block_hash: format!("{:?}", block_1_hash),
|
||||
parent_block_hash: format!("{:?}", finalized_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
let event: FollowEvent<String> = get_next_event(&mut sub).await;
|
||||
@@ -978,7 +978,7 @@ async fn follow_prune_best_block() {
|
||||
block_hash: format!("{:?}", block_3_hash),
|
||||
parent_block_hash: format!("{:?}", block_1_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
let event: FollowEvent<String> = get_next_event(&mut sub).await;
|
||||
@@ -993,7 +993,7 @@ async fn follow_prune_best_block() {
|
||||
block_hash: format!("{:?}", block_4_hash),
|
||||
parent_block_hash: format!("{:?}", block_3_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
let event: FollowEvent<String> = get_next_event(&mut sub).await;
|
||||
@@ -1008,7 +1008,7 @@ async fn follow_prune_best_block() {
|
||||
block_hash: format!("{:?}", block_2_hash),
|
||||
parent_block_hash: format!("{:?}", block_1_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
let event: FollowEvent<String> = get_next_event(&mut sub).await;
|
||||
@@ -1118,7 +1118,7 @@ async fn follow_forks_pruned_block() {
|
||||
let expected = FollowEvent::Initialized(Initialized {
|
||||
finalized_block_hash: format!("{:?}", block_3_hash),
|
||||
finalized_block_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -1142,7 +1142,7 @@ async fn follow_forks_pruned_block() {
|
||||
block_hash: format!("{:?}", block_6_hash),
|
||||
parent_block_hash: format!("{:?}", block_3_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
let event: FollowEvent<String> = get_next_event(&mut sub).await;
|
||||
@@ -1233,7 +1233,7 @@ async fn follow_report_multiple_pruned_block() {
|
||||
let expected = FollowEvent::Initialized(Initialized {
|
||||
finalized_block_hash: format!("{:?}", finalized_hash),
|
||||
finalized_block_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -1242,7 +1242,7 @@ async fn follow_report_multiple_pruned_block() {
|
||||
block_hash: format!("{:?}", block_1_hash),
|
||||
parent_block_hash: format!("{:?}", finalized_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -1251,7 +1251,7 @@ async fn follow_report_multiple_pruned_block() {
|
||||
block_hash: format!("{:?}", block_2_hash),
|
||||
parent_block_hash: format!("{:?}", block_1_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -1260,7 +1260,7 @@ async fn follow_report_multiple_pruned_block() {
|
||||
block_hash: format!("{:?}", block_3_hash),
|
||||
parent_block_hash: format!("{:?}", block_2_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -1270,7 +1270,7 @@ async fn follow_report_multiple_pruned_block() {
|
||||
block_hash: format!("{:?}", block_4_hash),
|
||||
parent_block_hash: format!("{:?}", block_1_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -1279,7 +1279,7 @@ async fn follow_report_multiple_pruned_block() {
|
||||
block_hash: format!("{:?}", block_5_hash),
|
||||
parent_block_hash: format!("{:?}", block_4_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -1325,7 +1325,7 @@ async fn follow_report_multiple_pruned_block() {
|
||||
block_hash: format!("{:?}", block_6_hash),
|
||||
parent_block_hash: format!("{:?}", block_3_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
let event: FollowEvent<String> = get_next_event(&mut sub).await;
|
||||
@@ -1511,7 +1511,7 @@ async fn follow_finalized_before_new_block() {
|
||||
let expected = FollowEvent::Initialized(Initialized {
|
||||
finalized_block_hash: format!("{:?}", finalized_hash),
|
||||
finalized_block_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -1521,7 +1521,7 @@ async fn follow_finalized_before_new_block() {
|
||||
block_hash: format!("{:?}", block_1_hash),
|
||||
parent_block_hash: format!("{:?}", finalized_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
@@ -1556,7 +1556,7 @@ async fn follow_finalized_before_new_block() {
|
||||
block_hash: format!("{:?}", block_2_hash),
|
||||
parent_block_hash: format!("{:?}", block_1_hash),
|
||||
new_runtime: None,
|
||||
runtime_updates: false,
|
||||
with_runtime: false,
|
||||
});
|
||||
assert_eq!(event, expected);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user