Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
open-runtime-module-library
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Noxim
open-runtime-module-library
Commits
6f4768cf
Unverified
Commit
6f4768cf
authored
4 years ago
by
Xiliang Chen
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix EnsureDelayed generic type (#275)
parent
432ebafe
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
authority/src/lib.rs
+11
-7
11 additions, 7 deletions
authority/src/lib.rs
with
11 additions
and
7 deletions
authority/src/lib.rs
+
11
−
7
View file @
6f4768cf
...
...
@@ -40,30 +40,34 @@ mod tests;
/// A delayed origin. Can only be dispatched via `dispatch_as` with a delay.
#[derive(PartialEq,
Eq,
Clone,
RuntimeDebug,
Encode,
Decode)]
pub
struct
DelayedOrigin
<
BlockNumber
,
Origin
>
{
pub
struct
DelayedOrigin
<
BlockNumber
,
Pallets
Origin
>
{
/// Number of blocks that this call have been delayed.
pub
delay
:
BlockNumber
,
/// The initial origin.
pub
origin
:
Box
<
Origin
>
,
pub
origin
:
Box
<
Pallets
Origin
>
,
}
/// Ensure the origin have a minimum amount of delay.
pub
struct
EnsureDelayed
<
Delay
,
Inner
,
BlockNumber
>
(
sp_std
::
marker
::
PhantomData
<
(
Delay
,
Inner
,
BlockNumber
)
>
);
pub
struct
EnsureDelayed
<
Delay
,
Inner
,
BlockNumber
,
PalletsOrigin
>
(
sp_std
::
marker
::
PhantomData
<
(
Delay
,
Inner
,
BlockNumber
,
PalletsOrigin
)
>
,
);
impl
<
O
:
Into
<
Result
<
DelayedOrigin
<
BlockNumber
,
O
>
,
O
>>
+
From
<
DelayedOrigin
<
BlockNumber
,
O
>>
,
PalletsOrigin
:
Into
<
O
>
,
O
:
Into
<
Result
<
DelayedOrigin
<
BlockNumber
,
PalletsOrigin
>
,
O
>>
+
From
<
DelayedOrigin
<
BlockNumber
,
PalletsOrigin
>>
,
Delay
:
Get
<
BlockNumber
>
,
Inner
:
EnsureOrigin
<
O
>
,
BlockNumber
:
PartialOrd
,
>
EnsureOrigin
<
O
>
for
EnsureDelayed
<
Delay
,
Inner
,
BlockNumber
>
>
EnsureOrigin
<
O
>
for
EnsureDelayed
<
Delay
,
Inner
,
BlockNumber
,
PalletsOrigin
>
{
type
Success
=
Inner
::
Success
;
fn
try_origin
(
o
:
O
)
->
Result
<
Self
::
Success
,
O
>
{
o
.into
()
.and_then
(|
delayed_origin
|
{
if
delayed_origin
.delay
>=
Delay
::
get
()
{
Inner
::
try_origin
(
*
delayed_origin
.origin
)
let
pallets_origin
=
*
delayed_origin
.origin
;
Inner
::
try_origin
(
pallets_origin
.into
())
}
else
{
Err
(
*
delayed_origin
.
origin
)
Err
(
delayed_origin
.
into
()
)
}
})
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment