mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Move some associated types from relay_substrate_client::Chain to bp_runtime::Chain (#1087)
* move some associated types from relay_substrate_client::Chain to bp_runtime::Chain * dummy commit * Revert "dummy commit" This reverts commit 81bc64aa092df115a7c68e7bb7ca5e83ec31fd20.
This commit is contained in:
committed by
Bastian Köcher
parent
1df7076c4f
commit
7369ff9d70
@@ -149,6 +149,9 @@ pub type AccountSigner = MultiSigner;
|
||||
/// Balance of an account.
|
||||
pub type Balance = u64;
|
||||
|
||||
/// Index of a transaction in the chain.
|
||||
pub type Index = u32;
|
||||
|
||||
/// Weight-to-Fee type used by Millau.
|
||||
pub type WeightToFee = IdentityFee<Balance>;
|
||||
|
||||
@@ -161,6 +164,11 @@ impl Chain for Millau {
|
||||
type Hash = Hash;
|
||||
type Hasher = Hasher;
|
||||
type Header = Header;
|
||||
|
||||
type AccountId = AccountId;
|
||||
type Balance = Balance;
|
||||
type Index = Index;
|
||||
type Signature = Signature;
|
||||
}
|
||||
|
||||
/// Millau Hasher (Blake2-256 ++ Keccak-256) implementation.
|
||||
|
||||
@@ -148,6 +148,9 @@ pub type Balance = u128;
|
||||
/// An instant or duration in time.
|
||||
pub type Moment = u64;
|
||||
|
||||
/// Index of a transaction in the chain.
|
||||
pub type Index = u32;
|
||||
|
||||
/// Weight-to-Fee type used by Rialto.
|
||||
pub type WeightToFee = IdentityFee<Balance>;
|
||||
|
||||
@@ -160,6 +163,11 @@ impl Chain for Rialto {
|
||||
type Hash = Hash;
|
||||
type Hasher = Hasher;
|
||||
type Header = Header;
|
||||
|
||||
type AccountId = AccountId;
|
||||
type Balance = Balance;
|
||||
type Index = Index;
|
||||
type Signature = Signature;
|
||||
}
|
||||
|
||||
/// Convert a 256-bit hash into an AccountId.
|
||||
|
||||
@@ -342,6 +342,11 @@ impl Chain for PolkadotLike {
|
||||
type Hash = Hash;
|
||||
type Hasher = Hasher;
|
||||
type Header = Header;
|
||||
|
||||
type AccountId = AccountId;
|
||||
type Balance = Balance;
|
||||
type Index = Index;
|
||||
type Signature = Signature;
|
||||
}
|
||||
|
||||
/// Convert a 256-bit hash into an AccountId.
|
||||
|
||||
@@ -15,12 +15,15 @@
|
||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use frame_support::Parameter;
|
||||
use num_traits::AsPrimitive;
|
||||
use sp_runtime::traits::{
|
||||
AtLeast32BitUnsigned, Hash as HashT, Header as HeaderT, MaybeDisplay, MaybeMallocSizeOf, MaybeSerializeDeserialize,
|
||||
Member, SimpleBitOps,
|
||||
use num_traits::{AsPrimitive, Bounded, CheckedSub, SaturatingAdd, Zero};
|
||||
use sp_runtime::{
|
||||
traits::{
|
||||
AtLeast32Bit, AtLeast32BitUnsigned, Hash as HashT, Header as HeaderT, MaybeDisplay, MaybeMallocSizeOf,
|
||||
MaybeSerialize, MaybeSerializeDeserialize, Member, SimpleBitOps, Verify,
|
||||
},
|
||||
FixedPointOperand,
|
||||
};
|
||||
use sp_std::str::FromStr;
|
||||
use sp_std::{convert::TryFrom, fmt::Debug, hash::Hash, str::FromStr};
|
||||
|
||||
/// Minimal Substrate-based chain representation that may be used from no_std environment.
|
||||
pub trait Chain: Send + Sync + 'static {
|
||||
@@ -34,7 +37,7 @@ pub trait Chain: Send + Sync + 'static {
|
||||
type BlockNumber: Parameter
|
||||
+ Member
|
||||
+ MaybeSerializeDeserialize
|
||||
+ sp_std::hash::Hash
|
||||
+ Hash
|
||||
+ Copy
|
||||
+ Default
|
||||
+ MaybeDisplay
|
||||
@@ -54,7 +57,7 @@ pub trait Chain: Send + Sync + 'static {
|
||||
type Hash: Parameter
|
||||
+ Member
|
||||
+ MaybeSerializeDeserialize
|
||||
+ sp_std::hash::Hash
|
||||
+ Hash
|
||||
+ Ord
|
||||
+ Copy
|
||||
+ MaybeDisplay
|
||||
@@ -75,6 +78,39 @@ pub trait Chain: Send + Sync + 'static {
|
||||
// See here for more info:
|
||||
// https://crates.parity.io/sp_runtime/traits/trait.Header.html
|
||||
type Header: Parameter + HeaderT<Number = Self::BlockNumber, Hash = Self::Hash> + MaybeSerializeDeserialize;
|
||||
|
||||
/// The user account identifier type for the runtime.
|
||||
type AccountId: Parameter + Member + MaybeSerializeDeserialize + Debug + MaybeDisplay + Ord + Default;
|
||||
/// Balance of an account in native tokens.
|
||||
///
|
||||
/// The chain may support multiple tokens, but this particular type is for token that is used
|
||||
/// to pay for transaction dispatch, to reward different relayers (headers, messages), etc.
|
||||
type Balance: AtLeast32BitUnsigned
|
||||
+ FixedPointOperand
|
||||
+ Parameter
|
||||
+ Parameter
|
||||
+ Member
|
||||
+ MaybeSerializeDeserialize
|
||||
+ Clone
|
||||
+ Copy
|
||||
+ Bounded
|
||||
+ CheckedSub
|
||||
+ PartialOrd
|
||||
+ SaturatingAdd
|
||||
+ Zero
|
||||
+ TryFrom<sp_core::U256>;
|
||||
/// Index of a transaction used by the chain.
|
||||
type Index: Parameter
|
||||
+ Member
|
||||
+ MaybeSerialize
|
||||
+ Debug
|
||||
+ Default
|
||||
+ MaybeDisplay
|
||||
+ MaybeSerializeDeserialize
|
||||
+ AtLeast32Bit
|
||||
+ Copy;
|
||||
/// Signature type, used on this chain.
|
||||
type Signature: Parameter + Verify;
|
||||
}
|
||||
|
||||
/// Block number used by the chain.
|
||||
@@ -89,5 +125,20 @@ pub type HasherOf<C> = <C as Chain>::Hasher;
|
||||
/// Header type used by the chain.
|
||||
pub type HeaderOf<C> = <C as Chain>::Header;
|
||||
|
||||
/// Account id type used by the chain.
|
||||
pub type AccountIdOf<C> = <C as Chain>::AccountId;
|
||||
|
||||
/// Balance type used by the chain.
|
||||
pub type BalanceOf<C> = <C as Chain>::Balance;
|
||||
|
||||
/// Transaction index type used by the chain.
|
||||
pub type IndexOf<C> = <C as Chain>::Index;
|
||||
|
||||
/// Signature type used by the chain.
|
||||
pub type SignatureOf<C> = <C as Chain>::Signature;
|
||||
|
||||
/// Account public type used by the chain.
|
||||
pub type AccountPublicOf<C> = <SignatureOf<C> as Verify>::Signer;
|
||||
|
||||
/// Transaction era used by the chain.
|
||||
pub type TransactionEraOf<C> = crate::TransactionEra<BlockNumberOf<C>, HashOf<C>>;
|
||||
|
||||
@@ -24,7 +24,10 @@ use sp_core::hash::H256;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use sp_std::convert::TryFrom;
|
||||
|
||||
pub use chain::{BlockNumberOf, Chain, HashOf, HasherOf, HeaderOf, TransactionEraOf};
|
||||
pub use chain::{
|
||||
AccountIdOf, AccountPublicOf, BalanceOf, BlockNumberOf, Chain, HashOf, HasherOf, HeaderOf, IndexOf, SignatureOf,
|
||||
TransactionEraOf,
|
||||
};
|
||||
pub use storage_proof::{Error as StorageProofError, StorageProofChecker};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
|
||||
Reference in New Issue
Block a user