Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
polkadot
Commits
1a2b95b8
Unverified
Commit
1a2b95b8
authored
Apr 07, 2021
by
Shawn Tabrizi
Committed by
GitHub
Apr 07, 2021
Browse files
Add Root Functions to HRMP (#2785)
* Update hrmp.rs * add root functions
parent
7ace3b77
Pipeline
#133141
failed with stages
in 19 minutes and 51 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
runtime/parachains/src/hrmp.rs
View file @
1a2b95b8
...
...
@@ -24,6 +24,7 @@ use frame_support::{
decl_storage
,
decl_module
,
decl_error
,
decl_event
,
ensure
,
traits
::{
Get
,
ReservableCurrency
},
weights
::
Weight
,
StorageMap
,
StorageValue
,
dispatch
::
DispatchResult
,
};
use
frame_system
::
ensure_root
;
use
primitives
::
v1
::{
Balance
,
Hash
,
HrmpChannelId
,
Id
as
ParaId
,
InboundHrmpMessage
,
OutboundHrmpMessage
,
SessionIndex
,
...
...
@@ -409,6 +410,41 @@ decl_module! {
Self
::
deposit_event
(
Event
::
ChannelClosed
(
origin
,
channel_id
));
Ok
(())
}
/// This extrinsic triggers the cleanup of all the HRMP storage items that
/// a para may have. Normally this happens once per session, but this allows
/// you to trigger the cleanup immediately for a specific parachain.
///
/// Origin must be Root.
#[weight
=
0
]
pub
fn
force_clean_hrmp
(
origin
,
para
:
ParaId
)
->
DispatchResult
{
ensure_root
(
origin
)
?
;
Self
::
clean_hrmp_after_outgoing
(
&
para
);
Ok
(())
}
/// Force process hrmp open channel requests.
///
/// If there are pending HRMP open channel requests, you can use this
/// function process all of those requests immediately.
#[weight
=
0
]
pub
fn
force_process_hrmp_open
(
origin
)
->
DispatchResult
{
ensure_root
(
origin
)
?
;
let
host_config
=
configuration
::
Module
::
<
T
>
::
config
();
Self
::
process_hrmp_open_channel_requests
(
&
host_config
);
Ok
(())
}
/// Force process hrmp close channel requests.
///
/// If there are pending HRMP close channel requests, you can use this
/// function process all of those requests immediately.
#[weight
=
0
]
pub
fn
force_process_hrmp_close
(
origin
)
->
DispatchResult
{
ensure_root
(
origin
)
?
;
Self
::
process_hrmp_close_channel_requests
();
Ok
(())
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment