@@ -65,7 +65,8 @@ use bp_messages::{
6565 OutboundMessageDetails , UnrewardedRelayersState , VerificationError ,
6666} ;
6767use bp_runtime:: {
68- BasicOperatingMode , HashOf , OwnedBridgeModule , PreComputedSize , RangeInclusiveExt , Size ,
68+ AccountIdOf , BasicOperatingMode , HashOf , OwnedBridgeModule , PreComputedSize , RangeInclusiveExt ,
69+ Size ,
6970} ;
7071use codec:: { Decode , Encode , MaxEncodedLen } ;
7172use frame_support:: { dispatch:: PostDispatchInfo , ensure, fail, traits:: Get , DefaultNoBound } ;
@@ -120,26 +121,19 @@ pub mod pallet {
120121
121122 /// Payload type of outbound messages. This payload is dispatched on the bridged chain.
122123 type OutboundPayload : Parameter + Size ;
123-
124124 /// Payload type of inbound messages. This payload is dispatched on this chain.
125125 type InboundPayload : Decode ;
126- /// Identifier of relayer that deliver messages to this chain. Relayer reward is paid on the
127- /// bridged chain.
128- type InboundRelayer : Parameter + MaxEncodedLen ;
129-
130- // Types that are used by outbound_lane (on source chain).
131126
132- /// Delivery confirmation payments.
127+ /// Handler for relayer payments that happen during message delivery transaction.
128+ type DeliveryPayments : DeliveryPayments < Self :: AccountId > ;
129+ /// Handler for relayer payments that happen during message delivery confirmation
130+ /// transaction.
133131 type DeliveryConfirmationPayments : DeliveryConfirmationPayments < Self :: AccountId > ;
134132 /// Delivery confirmation callback.
135133 type OnMessagesDelivered : OnMessagesDelivered ;
136134
137- // Types that are used by inbound_lane (on target chain).
138-
139- /// Message dispatch.
135+ /// Message dispatch handler.
140136 type MessageDispatch : MessageDispatch < DispatchPayload = Self :: InboundPayload > ;
141- /// Delivery payments.
142- type DeliveryPayments : DeliveryPayments < Self :: AccountId > ;
143137 }
144138
145139 /// Shortcut to this chain type for Config.
@@ -241,7 +235,7 @@ pub mod pallet {
241235 #[ pallet:: weight( T :: WeightInfo :: receive_messages_proof_weight( proof, * messages_count, * dispatch_weight) ) ]
242236 pub fn receive_messages_proof (
243237 origin : OriginFor < T > ,
244- relayer_id_at_bridged_chain : T :: InboundRelayer ,
238+ relayer_id_at_bridged_chain : AccountIdOf < BridgedChainOf < T , I > > ,
245239 proof : FromBridgedChainMessagesProof < HashOf < BridgedChainOf < T , I > > > ,
246240 messages_count : u32 ,
247241 dispatch_weight : Weight ,
@@ -645,7 +639,9 @@ pub mod pallet {
645639 }
646640
647641 /// Return inbound lane data.
648- pub fn inbound_lane_data ( lane : LaneId ) -> InboundLaneData < T :: InboundRelayer > {
642+ pub fn inbound_lane_data (
643+ lane : LaneId ,
644+ ) -> InboundLaneData < AccountIdOf < BridgedChainOf < T , I > > > {
649645 InboundLanes :: < T , I > :: get ( lane) . 0
650646 }
651647 }
@@ -744,7 +740,7 @@ fn outbound_lane<T: Config<I>, I: 'static>(
744740/// Runtime inbound lane storage.
745741struct RuntimeInboundLaneStorage < T : Config < I > , I : ' static = ( ) > {
746742 lane_id : LaneId ,
747- cached_data : Option < InboundLaneData < T :: InboundRelayer > > ,
743+ cached_data : Option < InboundLaneData < AccountIdOf < BridgedChainOf < T , I > > > > ,
748744 _phantom : PhantomData < I > ,
749745}
750746
@@ -768,14 +764,14 @@ impl<T: Config<I>, I: 'static> RuntimeInboundLaneStorage<T, I> {
768764 let max_encoded_len = StoredInboundLaneData :: < T , I > :: max_encoded_len ( ) ;
769765 let relayers_count = self . get_or_init_data ( ) . relayers . len ( ) ;
770766 let actual_encoded_len =
771- InboundLaneData :: < T :: InboundRelayer > :: encoded_size_hint ( relayers_count)
767+ InboundLaneData :: < AccountIdOf < BridgedChainOf < T , I > > > :: encoded_size_hint ( relayers_count)
772768 . unwrap_or ( usize:: MAX ) ;
773769 max_encoded_len. saturating_sub ( actual_encoded_len) as _
774770 }
775771}
776772
777773impl < T : Config < I > , I : ' static > InboundLaneStorage for RuntimeInboundLaneStorage < T , I > {
778- type Relayer = T :: InboundRelayer ;
774+ type Relayer = AccountIdOf < BridgedChainOf < T , I > > ;
779775
780776 fn id ( & self ) -> LaneId {
781777 self . lane_id
@@ -789,19 +785,19 @@ impl<T: Config<I>, I: 'static> InboundLaneStorage for RuntimeInboundLaneStorage<
789785 BridgedChainOf :: < T , I > :: MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX
790786 }
791787
792- fn get_or_init_data ( & mut self ) -> InboundLaneData < T :: InboundRelayer > {
788+ fn get_or_init_data ( & mut self ) -> InboundLaneData < AccountIdOf < BridgedChainOf < T , I > > > {
793789 match self . cached_data {
794790 Some ( ref data) => data. clone ( ) ,
795791 None => {
796- let data: InboundLaneData < T :: InboundRelayer > =
792+ let data: InboundLaneData < AccountIdOf < BridgedChainOf < T , I > > > =
797793 InboundLanes :: < T , I > :: get ( self . lane_id ) . into ( ) ;
798794 self . cached_data = Some ( data. clone ( ) ) ;
799795 data
800796 } ,
801797 }
802798 }
803799
804- fn set_data ( & mut self , data : InboundLaneData < T :: InboundRelayer > ) {
800+ fn set_data ( & mut self , data : InboundLaneData < AccountIdOf < BridgedChainOf < T , I > > > ) {
805801 self . cached_data = Some ( data. clone ( ) ) ;
806802 InboundLanes :: < T , I > :: insert ( self . lane_id , StoredInboundLaneData :: < T , I > ( data) )
807803 }
0 commit comments