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
5847020f
Commit
5847020f
authored
4 years ago
by
Hernando Castano
Committed by
Bastian Köcher
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Explain why we defer signature verification (#668)
parent
0f56f187
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bridges/primitives/header-chain/src/justification.rs
+6
-4
6 additions, 4 deletions
bridges/primitives/header-chain/src/justification.rs
with
6 additions
and
4 deletions
bridges/primitives/header-chain/src/justification.rs
+
6
−
4
View file @
5847020f
...
...
@@ -63,23 +63,25 @@ pub fn verify_justification<Header: HeaderT>(
where
Header
::
Number
:
finality_grandpa
::
BlockNumberOps
,
{
//
d
ecode justification first
//
D
ecode justification first
let
justification
=
GrandpaJustification
::
<
Header
>
::
decode
(
&
mut
&
raw_justification
[
..
])
.map_err
(|
_
|
Error
::
JustificationDecode
)
?
;
//
e
nsure that it is justification for the expected header
//
E
nsure that it is justification for the expected header
if
(
justification
.commit.target_hash
,
justification
.commit.target_number
)
!=
finalized_target
{
return
Err
(
Error
::
InvalidJustificationTarget
);
}
// validate commit of the justification (it just assumes all signatures are valid)
// Validate commit of the justification. Note that `validate_commit()` assumes that all
// signatures are valid. We'll check the validity of the signatures later since they're more
// resource intensive to verify.
let
ancestry_chain
=
AncestryChain
::
new
(
&
justification
.votes_ancestries
);
match
finality_grandpa
::
validate_commit
(
&
justification
.commit
,
&
authorities_set
,
&
ancestry_chain
)
{
Ok
(
ref
result
)
if
result
.ghost
()
.is_some
()
=>
{}
_
=>
return
Err
(
Error
::
InvalidJustificationCommit
),
}
//
n
ow that we know that the commit is correct, check authorities signatures
//
N
ow that we know that the commit is correct, check authorities signatures
let
mut
buf
=
Vec
::
new
();
let
mut
visited_hashes
=
BTreeSet
::
new
();
for
signed
in
&
justification
.commit.precommits
{
...
...
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