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
32c1ed8a
Unverified
Commit
32c1ed8a
authored
May 18, 2021
by
Shane Bammel
Committed by
GitHub
May 18, 2021
Browse files
Options
Downloads
Patches
Plain Diff
core/forkid: fix off-by-one bug (#22879)
* forkid: added failing test * forkid: fixed off-by-one bug
parent
b7a91663
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/forkid/forkid.go
+1
-1
1 addition, 1 deletion
core/forkid/forkid.go
core/forkid/forkid_test.go
+4
-0
4 additions, 0 deletions
core/forkid/forkid_test.go
with
5 additions
and
1 deletion
core/forkid/forkid.go
+
1
−
1
View file @
32c1ed8a
...
@@ -155,7 +155,7 @@ func newFilter(config *params.ChainConfig, genesis common.Hash, headfn func() ui
...
@@ -155,7 +155,7 @@ func newFilter(config *params.ChainConfig, genesis common.Hash, headfn func() ui
for
i
,
fork
:=
range
forks
{
for
i
,
fork
:=
range
forks
{
// If our head is beyond this fork, continue to the next (we have a dummy
// If our head is beyond this fork, continue to the next (we have a dummy
// fork of maxuint64 as the last item to always fail this check eventually).
// fork of maxuint64 as the last item to always fail this check eventually).
if
head
>
fork
{
if
head
>
=
fork
{
continue
continue
}
}
// Found the first unpassed fork block, check if our current state matches
// Found the first unpassed fork block, check if our current state matches
...
...
This diff is collapsed.
Click to expand it.
core/forkid/forkid_test.go
+
4
−
0
View file @
32c1ed8a
...
@@ -163,6 +163,10 @@ func TestValidation(t *testing.T) {
...
@@ -163,6 +163,10 @@ func TestValidation(t *testing.T) {
// neither forks passed at neither nodes, they may mismatch, but we still connect for now.
// neither forks passed at neither nodes, they may mismatch, but we still connect for now.
{
7279999
,
ID
{
Hash
:
checksumToBytes
(
0xa00bc324
),
Next
:
math
.
MaxUint64
},
nil
},
{
7279999
,
ID
{
Hash
:
checksumToBytes
(
0xa00bc324
),
Next
:
math
.
MaxUint64
},
nil
},
// Local is mainnet exactly on Petersburg, remote announces Byzantium + knowledge about Petersburg. Remote
// is simply out of sync, accept.
{
7280000
,
ID
{
Hash
:
checksumToBytes
(
0xa00bc324
),
Next
:
7280000
},
nil
},
// Local is mainnet Petersburg, remote announces Byzantium + knowledge about Petersburg. Remote
// Local is mainnet Petersburg, remote announces Byzantium + knowledge about Petersburg. Remote
// is simply out of sync, accept.
// is simply out of sync, accept.
{
7987396
,
ID
{
Hash
:
checksumToBytes
(
0xa00bc324
),
Next
:
7280000
},
nil
},
{
7987396
,
ID
{
Hash
:
checksumToBytes
(
0xa00bc324
),
Next
:
7280000
},
nil
},
...
...
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