@@ -33,8 +33,8 @@ pub mod rialto_parachain_messages;
33
33
pub mod xcm_config;
34
34
35
35
use beefy_primitives:: { crypto:: AuthorityId as BeefyId , mmr:: MmrLeafVersion , ValidatorSet } ;
36
- use bp_runtime :: { HeaderId , HeaderIdProvider } ;
37
- use codec :: Decode ;
36
+ use bp_parachains :: SingleParaStoredHeaderDataBuilder ;
37
+ use bp_runtime :: HeaderId ;
38
38
use pallet_grandpa:: {
39
39
fg_primitives, AuthorityId as GrandpaId , AuthorityList as GrandpaAuthorityList ,
40
40
} ;
@@ -522,8 +522,8 @@ parameter_types! {
522
522
pub const RialtoParachainId : u32 = bp_rialto_parachain:: RIALTO_PARACHAIN_ID ;
523
523
pub const RialtoParasPalletName : & ' static str = bp_rialto:: PARAS_PALLET_NAME ;
524
524
pub const WestendParasPalletName : & ' static str = bp_westend:: PARAS_PALLET_NAME ;
525
- pub const MaxRialtoParaHeadSize : u32 = bp_rialto:: MAX_NESTED_PARACHAIN_HEAD_SIZE ;
526
- pub const MaxWestendParaHeadSize : u32 = bp_westend:: MAX_NESTED_PARACHAIN_HEAD_SIZE ;
525
+ pub const MaxRialtoParaHeadDataSize : u32 = bp_rialto:: MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE ;
526
+ pub const MaxWestendParaHeadDataSize : u32 = bp_westend:: MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE ;
527
527
}
528
528
529
529
/// Instance of the with-Rialto parachains pallet.
@@ -534,9 +534,10 @@ impl pallet_bridge_parachains::Config<WithRialtoParachainsInstance> for Runtime
534
534
type WeightInfo = pallet_bridge_parachains:: weights:: BridgeWeight < Runtime > ;
535
535
type BridgesGrandpaPalletInstance = RialtoGrandpaInstance ;
536
536
type ParasPalletName = RialtoParasPalletName ;
537
- type TrackedParachains = frame_support:: traits:: Everything ;
537
+ type ParaStoredHeaderDataBuilder =
538
+ SingleParaStoredHeaderDataBuilder < bp_rialto_parachain:: RialtoParachain > ;
538
539
type HeadsToKeep = HeadersToKeep ;
539
- type MaxParaHeadSize = MaxRialtoParaHeadSize ;
540
+ type MaxParaHeadDataSize = MaxRialtoParaHeadDataSize ;
540
541
}
541
542
542
543
/// Instance of the with-Westend parachains pallet.
@@ -547,9 +548,9 @@ impl pallet_bridge_parachains::Config<WithWestendParachainsInstance> for Runtime
547
548
type WeightInfo = pallet_bridge_parachains:: weights:: BridgeWeight < Runtime > ;
548
549
type BridgesGrandpaPalletInstance = WestendGrandpaInstance ;
549
550
type ParasPalletName = WestendParasPalletName ;
550
- type TrackedParachains = frame_support :: traits :: Everything ;
551
+ type ParaStoredHeaderDataBuilder = SingleParaStoredHeaderDataBuilder < bp_westend :: Westmint > ;
551
552
type HeadsToKeep = HeadersToKeep ;
552
- type MaxParaHeadSize = MaxWestendParaHeadSize ;
553
+ type MaxParaHeadDataSize = MaxWestendParaHeadDataSize ;
553
554
}
554
555
555
556
impl pallet_utility:: Config for Runtime {
@@ -902,28 +903,19 @@ impl_runtime_apis! {
902
903
903
904
impl bp_westend:: WestmintFinalityApi <Block > for Runtime {
904
905
fn best_finalized( ) -> Option <HeaderId <bp_westend:: Hash , bp_westend:: BlockNumber >> {
905
- // the parachains finality pallet is never decoding parachain heads, so it is
906
- // only done in the integration code
907
- use bp_westend:: WESTMINT_PARACHAIN_ID ;
908
- let encoded_head = pallet_bridge_parachains:: Pallet :: <
906
+ pallet_bridge_parachains:: Pallet :: <
909
907
Runtime ,
910
908
WithWestendParachainsInstance ,
911
- >:: best_parachain_head( WESTMINT_PARACHAIN_ID . into( ) ) ?;
912
- let head = bp_westend:: Header :: decode( & mut & encoded_head. 0 [ ..] ) . ok( ) ?;
913
- Some ( head. id( ) )
909
+ >:: best_parachain_head_id:: <bp_westend:: Westmint >( ) . unwrap_or( None )
914
910
}
915
911
}
916
912
917
913
impl bp_rialto_parachain:: RialtoParachainFinalityApi <Block > for Runtime {
918
914
fn best_finalized( ) -> Option <HeaderId <bp_rialto:: Hash , bp_rialto:: BlockNumber >> {
919
- // the parachains finality pallet is never decoding parachain heads, so it is
920
- // only done in the integration code
921
- let encoded_head = pallet_bridge_parachains:: Pallet :: <
915
+ pallet_bridge_parachains:: Pallet :: <
922
916
Runtime ,
923
917
WithRialtoParachainsInstance ,
924
- >:: best_parachain_head( bp_rialto_parachain:: RIALTO_PARACHAIN_ID . into( ) ) ?;
925
- let head = bp_rialto_parachain:: Header :: decode( & mut & encoded_head. 0 [ ..] ) . ok( ) ?;
926
- Some ( head. id( ) )
918
+ >:: best_parachain_head_id:: <bp_rialto_parachain:: RialtoParachain >( ) . unwrap_or( None )
927
919
}
928
920
}
929
921
0 commit comments