Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
f4f23dfd
Commit
f4f23dfd
authored
6 months ago
by
bgallois
Committed by
Hugo Trentesaux
6 months ago
Browse files
Options
Downloads
Patches
Plain Diff
remove unused errors
parent
a0afb078
No related branches found
No related tags found
1 merge request
!294
Fix #264: Distance inherent data provider should not fail
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
primitives/distance/src/lib.rs
+9
-27
9 additions, 27 deletions
primitives/distance/src/lib.rs
with
9 additions
and
27 deletions
primitives/distance/src/lib.rs
+
9
−
27
View file @
f4f23dfd
...
@@ -35,29 +35,14 @@ pub struct ComputationResult {
...
@@ -35,29 +35,14 @@ pub struct ComputationResult {
pub
distances
:
scale_info
::
prelude
::
vec
::
Vec
<
Perbill
>
,
pub
distances
:
scale_info
::
prelude
::
vec
::
Vec
<
Perbill
>
,
}
}
/// Errors that can occur while checking the inherent data in `ProvideInherent::check_inherent` from pallet-distance.
#[derive(Encode,
sp_runtime::RuntimeDebug)]
#[derive(Encode,
sp_runtime::RuntimeDebug)]
#[cfg_attr(feature
=
"std"
,
derive(Decode,
thiserror::Error))]
#[cfg_attr(feature
=
"std"
,
derive(Decode,
thiserror::Error))]
pub
enum
InherentError
{
pub
enum
InherentError
{}
#[cfg_attr(feature
=
"std"
,
error(
"InvalidComputationResultFile"
))]
InvalidComputationResultFile
,
}
impl
IsFatalError
for
InherentError
{
impl
IsFatalError
for
InherentError
{
fn
is_fatal_error
(
&
self
)
->
bool
{
fn
is_fatal_error
(
&
self
)
->
bool
{
match
self
{
false
InherentError
::
InvalidComputationResultFile
=>
false
,
}
}
}
impl
InherentError
{
#[cfg(feature
=
"std"
)]
pub
fn
try_from
(
id
:
&
InherentIdentifier
,
mut
data
:
&
[
u8
])
->
Option
<
Self
>
{
if
id
==
&
INHERENT_IDENTIFIER
{
<
InherentError
as
codec
::
Decode
>
::
decode
(
&
mut
data
)
.ok
()
}
else
{
None
}
}
}
}
}
...
@@ -94,15 +79,12 @@ impl<IdtyIndex: Decode + Encode + PartialEq + TypeInfo + Send + Sync>
...
@@ -94,15 +79,12 @@ impl<IdtyIndex: Decode + Encode + PartialEq + TypeInfo + Send + Sync>
async
fn
try_handle_error
(
async
fn
try_handle_error
(
&
self
,
&
self
,
identifier
:
&
InherentIdentifier
,
_
identifier
:
&
InherentIdentifier
,
error
:
&
[
u8
],
_
error
:
&
[
u8
],
)
->
Option
<
Result
<
(),
sp_inherents
::
Error
>>
{
)
->
Option
<
Result
<
(),
sp_inherents
::
Error
>>
{
if
*
identifier
!=
INHERENT_IDENTIFIER
{
// No errors occur here.
return
None
;
// Errors handled here are emitted in the `ProvideInherent::check_inherent`
}
// (from pallet-distance) which is not implemented.
None
Some
(
Err
(
sp_inherents
::
Error
::
Application
(
Box
::
from
(
InherentError
::
try_from
(
&
INHERENT_IDENTIFIER
,
error
)
?
,
))))
}
}
}
}
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