good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor 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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
18266b0d
Commit
18266b0d
authored
Apr 22, 2020
by
atvanguard
Browse files
Options
Downloads
Patches
Plain Diff
minor: Throw error if proposer/signer are not in the validator set (2.28)
parent
bfab1d93
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
consensus/bor/errors.go
+27
-0
27 additions, 0 deletions
consensus/bor/errors.go
consensus/bor/snapshot.go
+6
-0
6 additions, 0 deletions
consensus/bor/snapshot.go
with
33 additions
and
0 deletions
consensus/bor/errors.go
0 → 100644
+
27
−
0
View file @
18266b0d
package
bor
import
(
"fmt"
"github.com/maticnetwork/bor/common"
)
// Will include any new bor consensus errors here in an attempt to make error messages more descriptive
// ProposerNotFoundError is returned if the given proposer address is not present in the validator set
type
ProposerNotFoundError
struct
{
Address
common
.
Address
}
func
(
e
*
ProposerNotFoundError
)
Error
()
string
{
return
fmt
.
Sprintf
(
"Proposer: %s not found"
,
e
.
Address
.
Hex
())
}
// SignerNotFoundError is returned when the signer address is not present in the validator set
type
SignerNotFoundError
struct
{
Address
common
.
Address
}
func
(
e
*
SignerNotFoundError
)
Error
()
string
{
return
fmt
.
Sprintf
(
"Signer: %s not found"
,
e
.
Address
.
Hex
())
}
This diff is collapsed.
Click to expand it.
consensus/bor/snapshot.go
+
6
−
0
View file @
18266b0d
...
...
@@ -164,7 +164,13 @@ func (s *Snapshot) apply(headers []*types.Header) (*Snapshot, error) {
// proposer will be the last signer if block is not epoch block
proposer
:=
snap
.
ValidatorSet
.
GetProposer
()
.
Address
proposerIndex
,
_
:=
snap
.
ValidatorSet
.
GetByAddress
(
proposer
)
if
proposerIndex
==
-
1
{
return
nil
,
&
ProposerNotFoundError
{
proposer
}
}
signerIndex
,
_
:=
snap
.
ValidatorSet
.
GetByAddress
(
signer
)
if
signerIndex
==
-
1
{
return
nil
,
&
SignerNotFoundError
{
signer
}
}
limit
:=
len
(
validators
)
/
2
+
1
// temp index
...
...
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