@@ -30,9 +30,9 @@ use sp_api::impl_runtime_apis;
3030use sp_core:: { crypto:: KeyTypeId , OpaqueMetadata } ;
3131use sp_runtime:: {
3232 create_runtime_str, generic, impl_opaque_keys,
33- traits:: { AccountIdLookup , BlakeTwo256 , Block as BlockT , IdentifyAccount , Verify } ,
33+ traits:: { AccountIdLookup , Block as BlockT } ,
3434 transaction_validity:: { TransactionSource , TransactionValidity } ,
35- ApplyExtrinsicResult , MultiSignature ,
35+ ApplyExtrinsicResult ,
3636} ;
3737
3838use sp_std:: prelude:: * ;
@@ -50,14 +50,19 @@ pub use frame_support::{
5050 } ,
5151 StorageValue ,
5252} ;
53- use frame_system:: limits :: { BlockLength , BlockWeights } ;
53+ pub use frame_system:: Call as SystemCall ;
5454pub use pallet_balances:: Call as BalancesCall ;
5555pub use pallet_timestamp:: Call as TimestampCall ;
5656pub use sp_consensus_aura:: sr25519:: AuthorityId as AuraId ;
5757#[ cfg( any( feature = "std" , test) ) ]
5858pub use sp_runtime:: BuildStorage ;
5959pub use sp_runtime:: { MultiAddress , Perbill , Permill } ;
6060
61+ pub use bp_rialto_parachain:: {
62+ AccountId , Balance , BlockLength , BlockNumber , BlockWeights , Hash , Hasher as Hashing , Header ,
63+ Index , Signature , MAXIMUM_BLOCK_WEIGHT ,
64+ } ;
65+
6166// Polkadot & XCM imports
6267use pallet_xcm:: XcmPassthrough ;
6368use polkadot_parachain:: primitives:: Sibling ;
@@ -71,26 +76,8 @@ use xcm_builder::{
7176} ;
7277use xcm_executor:: { Config , XcmExecutor } ;
7378
74- // /// Import the template pallet.
75- // pub use template;
76-
77- /// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
78- pub type Signature = MultiSignature ;
79- /// Some way of identifying an account on the chain. We intentionally make it equivalent
80- /// to the public key of our transaction signing scheme.
81- pub type AccountId = <<Signature as Verify >:: Signer as IdentifyAccount >:: AccountId ;
82- /// Balance of an account.
83- pub type Balance = u128 ;
84- /// Index of a transaction in the chain.
85- pub type Index = u32 ;
86- /// A hash of some data used by the chain.
87- pub type Hash = sp_core:: H256 ;
88- /// An index to a block.
89- pub type BlockNumber = u32 ;
9079/// The address format for describing accounts.
9180pub type Address = MultiAddress < AccountId , ( ) > ;
92- /// Block header type as expected by this runtime.
93- pub type Header = generic:: Header < BlockNumber , BlakeTwo256 > ;
9481/// Block type as expected by this runtime.
9582pub type Block = generic:: Block < Header , UncheckedExtrinsic > ;
9683/// A Block signed with a Justification
@@ -168,38 +155,9 @@ pub fn native_version() -> NativeVersion {
168155 NativeVersion { runtime_version : VERSION , can_author_with : Default :: default ( ) }
169156}
170157
171- /// We assume that approximately 10 percent of the block weight is consumed by `on_initalize`
172- /// handlers. This is used to limit the maximal weight of a single extrinsic.
173- const AVERAGE_ON_INITIALIZE_RATIO : Perbill = Perbill :: from_percent ( 10 ) ;
174- /// We allow `Normal` extrinsics to fill up the block up to 75 percent, the rest can be used
175- /// by Operational extrinsics.
176- const NORMAL_DISPATCH_RATIO : Perbill = Perbill :: from_percent ( 75 ) ;
177- /// We allow for 2 seconds of compute with a 12 second average block time.
178- const MAXIMUM_BLOCK_WEIGHT : Weight = WEIGHT_PER_SECOND * 2 ;
179-
180158parameter_types ! {
181159 pub const BlockHashCount : BlockNumber = 250 ;
182160 pub const Version : RuntimeVersion = VERSION ;
183- pub RuntimeBlockLength : BlockLength =
184- BlockLength :: max_with_normal_ratio( 5 * 1024 * 1024 , NORMAL_DISPATCH_RATIO ) ;
185- pub RuntimeBlockWeights : BlockWeights = BlockWeights :: builder( )
186- . base_block( BlockExecutionWeight :: get( ) )
187- . for_class( DispatchClass :: all( ) , |weights| {
188- weights. base_extrinsic = ExtrinsicBaseWeight :: get( ) ;
189- } )
190- . for_class( DispatchClass :: Normal , |weights| {
191- weights. max_total = Some ( NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT ) ;
192- } )
193- . for_class( DispatchClass :: Operational , |weights| {
194- weights. max_total = Some ( MAXIMUM_BLOCK_WEIGHT ) ;
195- // Operational transactions have some extra reserved space, so that they
196- // are included even if block reached `MAXIMUM_BLOCK_WEIGHT`.
197- weights. reserved = Some (
198- MAXIMUM_BLOCK_WEIGHT - NORMAL_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT
199- ) ;
200- } )
201- . avg_block_initialization( AVERAGE_ON_INITIALIZE_RATIO )
202- . build_or_panic( ) ;
203161 pub const SS58Prefix : u8 = 48 ;
204162}
205163
@@ -219,9 +177,9 @@ impl frame_system::Config for Runtime {
219177 /// The type for hashing blocks and tries.
220178 type Hash = Hash ;
221179 /// The hashing algorithm used.
222- type Hashing = BlakeTwo256 ;
180+ type Hashing = Hashing ;
223181 /// The header type.
224- type Header = generic:: Header < BlockNumber , BlakeTwo256 > ;
182+ type Header = generic:: Header < BlockNumber , Hashing > ;
225183 /// The ubiquitous event type.
226184 type Event = Event ;
227185 /// The ubiquitous origin type.
@@ -244,9 +202,9 @@ impl frame_system::Config for Runtime {
244202 /// Weight information for the extrinsics of this pallet.
245203 type SystemWeightInfo = ( ) ;
246204 /// Block & extrinsics weights: base values and limits.
247- type BlockWeights = RuntimeBlockWeights ;
205+ type BlockWeights = BlockWeights ;
248206 /// The maximum length of a block (in bytes).
249- type BlockLength = RuntimeBlockLength ;
207+ type BlockLength = BlockLength ;
250208 /// This is used as an identifier of the chain. 42 is the generic substrate prefix.
251209 type SS58Prefix = SS58Prefix ;
252210 /// The action to take on a Runtime Upgrade
0 commit comments