Skip to content

Commit

Permalink
Expose some const value and type (paritytech#1186)
Browse files Browse the repository at this point in the history
* change const value visable

* Add docs

* Update docs

* Update docs 2

* Fix ci

* Fix spell check
  • Loading branch information
boundless-forest authored and serban300 committed Apr 9, 2024
1 parent a5bf6fb commit 813f093
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
43 changes: 27 additions & 16 deletions bridges/bin/runtime-common/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,24 @@ pub trait BridgedChainWithMessages: ChainWithMessages {
fn transaction_payment(transaction: MessageTransaction<WeightOf<Self>>) -> BalanceOf<Self>;
}

pub(crate) type ThisChain<B> = <B as MessageBridge>::ThisChain;
pub(crate) type BridgedChain<B> = <B as MessageBridge>::BridgedChain;
pub(crate) type HashOf<C> = <C as ChainWithMessages>::Hash;
pub(crate) type AccountIdOf<C> = <C as ChainWithMessages>::AccountId;
pub(crate) type SignerOf<C> = <C as ChainWithMessages>::Signer;
pub(crate) type SignatureOf<C> = <C as ChainWithMessages>::Signature;
pub(crate) type WeightOf<C> = <C as ChainWithMessages>::Weight;
pub(crate) type BalanceOf<C> = <C as ChainWithMessages>::Balance;

pub(crate) type CallOf<C> = <C as ThisChainWithMessages>::Call;
/// This chain in context of message bridge.
pub type ThisChain<B> = <B as MessageBridge>::ThisChain;
/// Bridged chain in context of message bridge.
pub type BridgedChain<B> = <B as MessageBridge>::BridgedChain;
/// Hash used on the chain.
pub type HashOf<C> = <C as ChainWithMessages>::Hash;
/// Account id used on the chain.
pub type AccountIdOf<C> = <C as ChainWithMessages>::AccountId;
/// Public key of the chain account that may be used to verify signature.
pub type SignerOf<C> = <C as ChainWithMessages>::Signer;
/// Signature type used on the chain.
pub type SignatureOf<C> = <C as ChainWithMessages>::Signature;
/// Type of weight that used on the chain.
pub type WeightOf<C> = <C as ChainWithMessages>::Weight;
/// Type of balances that is used on the chain.
pub type BalanceOf<C> = <C as ChainWithMessages>::Balance;
/// Type of call that is used on this chain.
pub type CallOf<C> = <C as ThisChainWithMessages>::Call;

/// Raw storage proof type (just raw trie nodes).
type RawStorageProof = Vec<Vec<u8>>;
Expand Down Expand Up @@ -260,12 +268,15 @@ pub mod source {
#[derive(RuntimeDebug)]
pub struct FromThisChainMessageVerifier<B>(PhantomData<B>);

pub(crate) const OUTBOUND_LANE_DISABLED: &str = "The outbound message lane is disabled.";
pub(crate) const TOO_MANY_PENDING_MESSAGES: &str = "Too many pending messages at the lane.";
pub(crate) const BAD_ORIGIN: &str =
"Unable to match the source origin to expected target origin.";
pub(crate) const TOO_LOW_FEE: &str =
"Provided fee is below minimal threshold required by the lane.";
/// The error message returned from LaneMessageVerifier when outbound lane is disabled.
pub const OUTBOUND_LANE_DISABLED: &str = "The outbound message lane is disabled.";
/// The error message returned from LaneMessageVerifier when too many pending messages at the
/// lane.
pub const TOO_MANY_PENDING_MESSAGES: &str = "Too many pending messages at the lane.";
/// The error message returned from LaneMessageVerifier when call origin is mismatch.
pub const BAD_ORIGIN: &str = "Unable to match the source origin to expected target origin.";
/// The error message returned from LaneMessageVerifier when the message fee is too low.
pub const TOO_LOW_FEE: &str = "Provided fee is below minimal threshold required by the lane.";

impl<B>
LaneMessageVerifier<
Expand Down
2 changes: 1 addition & 1 deletion bridges/relays/utils/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub enum Error {
/// Failed to parse the response from HTTP service.
#[error("Failed to parse HTTP service response: {0:?}. Response: {1:?}")]
ParseHttp(serde_json::Error, String),
/// Failed to select response value from the JSON response.
/// Failed to select response value from the Json response.
#[error("Failed to select value from response: {0:?}. Response: {1:?}")]
SelectResponseValue(jsonpath_lib::JsonPathError, String),
/// Failed to parse float value from the selected value.
Expand Down

0 comments on commit 813f093

Please sign in to comment.