Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
parity
Mirrored projects
polkadot-sdk
Commits
29c127a0
Commit
29c127a0
authored
4 years ago
by
André Silva
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
babe: fix overflow in check_equivocation (#5818)
parent
8b696093
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/client/consensus/slots/src/aux_schema.rs
+8
-3
8 additions, 3 deletions
substrate/client/consensus/slots/src/aux_schema.rs
with
8 additions
and
3 deletions
substrate/client/consensus/slots/src/aux_schema.rs
+
8
−
3
View file @
29c127a0
...
...
@@ -85,8 +85,8 @@ pub fn check_equivocation<C, H, P>(
P
:
Clone
+
Encode
+
Decode
+
PartialEq
,
{
// We don't check equivocations for old headers out of our capacity.
if
slot_now
-
slot
>
MAX_SLOT_CAPACITY
{
return
Ok
(
None
)
if
slot_now
.saturating_sub
(
slot
)
>
MAX_SLOT_CAPACITY
{
return
Ok
(
None
)
;
}
// Key for this slot.
...
...
@@ -102,6 +102,11 @@ pub fn check_equivocation<C, H, P>(
let
first_saved_slot
=
load_decode
::
<
_
,
u64
>
(
backend
,
&
slot_header_start
[
..
])
?
.unwrap_or
(
slot
);
if
slot_now
<
first_saved_slot
{
// The code below assumes that slots will be visited sequentially.
return
Ok
(
None
);
}
for
(
prev_header
,
prev_signer
)
in
headers_with_sig
.iter
()
{
// A proof of equivocation consists of two headers:
// 1) signed by the same voter,
...
...
@@ -114,7 +119,7 @@ pub fn check_equivocation<C, H, P>(
snd_header
:
header
.clone
(),
}));
}
else
{
//
We don't need to continue in case of duplicated header,
// We don't need to continue in case of duplicated header,
// since it's already saved and a possible equivocation
// would have been detected before.
return
Ok
(
None
)
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment