Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Guantong committed Apr 23, 2023
1 parent eb26684 commit 373b8ab
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions modules/grandpa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,13 @@ pub mod pallet {
}
pub use pallet::*;

impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Get the best finalized block number.
pub fn best_finalized_number() -> Option<BridgedBlockNumber<T, I>> {
BestFinalized::<T, I>::get().map(|id| id.number())
}
}

/// Bridge GRANDPA pallet as header chain.
pub type GrandpaChainHeaders<T, I> = Pallet<T, I>;

Expand Down
9 changes: 7 additions & 2 deletions modules/messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ pub mod pallet {
}

/// Shortcut to messages proof type for Config.
type MessagesProofOf<T, I> =
pub type MessagesProofOf<T, I> =
<<T as Config<I>>::SourceHeaderChain as SourceHeaderChain>::MessagesProof;
/// Shortcut to messages delivery proof type for Config.
type MessagesDeliveryProofOf<T, I> =
pub type MessagesDeliveryProofOf<T, I> =
<<T as Config<I>>::TargetHeaderChain as TargetHeaderChain<
<T as Config<I>>::OutboundPayload,
<T as frame_system::Config>::AccountId,
Expand Down Expand Up @@ -643,6 +643,11 @@ pub mod pallet {
dispatch_weight: T::MessageDispatch::dispatch_weight(&mut dispatch_message),
}
}

/// Return inbound lane data.
pub fn inbound_lane_data(lane: LaneId) -> InboundLaneData<T::InboundRelayer> {
InboundLanes::<T, I>::get(lane).0
}
}
}
pub use pallet::*;
Expand Down
5 changes: 5 additions & 0 deletions modules/parachains/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ pub mod pallet {
}

impl<T: Config<I>, I: 'static> Pallet<T, I> {
/// Get stored parachain info.
pub fn best_parachain_info(parachain: ParaId) -> Option<ParaInfo> {
ParasInfo::<T, I>::get(parachain)
}

/// Get best finalized header of the given parachain.
pub fn best_parachain_head(parachain: ParaId) -> Option<ParaHead> {
let best_para_head_hash = ParasInfo::<T, I>::get(parachain)?.best_head_hash.head_hash;
Expand Down

0 comments on commit 373b8ab

Please sign in to comment.