Skip to content
Snippets Groups Projects
  • Branislav Kontur's avatar
    Add support for versioned notification for HRMP pallet (#4281) · b709dccd
    Branislav Kontur authored
    
    Closes: https://github.com/paritytech/polkadot-sdk/issues/4003 (please
    see for the problem description)
    
    ## TODO
    - [x] add more tests covering `WrapVersion` corner cases (e.g. para has
    lower version, ...)
    - [x] regenerate benchmarks `runtime_parachains::hrmp` (fix for Rococo
    is here: https://github.com/paritytech/polkadot-sdk/pull/4332)
    
    ## Questions / possible improvements
    - [ ] A `WrapVersion` implementation for `pallet_xcm` initiates version
    discovery with
    [note_unknown_version](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/pallet-xcm/src/lib.rs#L2527C5-L2527C25),
    there is possibility to avoid this overhead in this HRMP case to create
    new `WrapVersion` adapter for `pallet_xcm` which would not use
    `note_unknown_version`. Is it worth to do it or not?
    - [ ] There's a possibility to decouple XCM functionality from the HRMP
    pallet, allowing any relay chain to generate its own notifications. This
    approach wouldn't restrict notifications solely to the XCM. However,
    it's uncertain whether it's worthwhile or desirable to do so? It means
    making HRMP pallet more generic. E.g. hiding HRMP notifications behind
    some trait:
    	```
    	trait HrmpNotifications {
    
    		fn on_channel_open_request(
    			sender: ParaId,
    			proposed_max_capacity: u32,
    			proposed_max_message_size: u32) -> primitives::DownwardMessage;
    
    fn on_channel_accepted(recipient: ParaId) ->
    primitives::DownwardMessage;
    
    fn on_channel_closing(initiator: ParaId, sender: ParaId, recipient:
    ParaId) -> primitives::DownwardMessage;
    	}
    	```
    and then we could have whatever adapter, `impl HrmpNotifications for
    VersionedXcmHrmpNotifications {...}`,
    	```
    	impl parachains_hrmp::Config for Runtime {
    	..
    		type HrmpNotifications = VersionedXcmHrmpNotifications;
    	..
    	}
    	```
    
    ---------
    
    Co-authored-by: command-bot <>
    Co-authored-by: default avatarBastian Köcher <git@kchr.de>
    Unverified
    b709dccd
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
pr_4281.prdoc 785 B