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
e536bb52
Unverified
Commit
e536bb52
authored
May 10, 2021
by
Felix Lange
Committed by
GitHub
May 10, 2021
Browse files
Options
Downloads
Patches
Plain Diff
eth/protocols/snap: adapt to uint256 API changes (#22851)
parent
c0e201b6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
eth/protocols/snap/range.go
+9
-8
9 additions, 8 deletions
eth/protocols/snap/range.go
with
9 additions
and
8 deletions
eth/protocols/snap/range.go
+
9
−
8
View file @
e536bb52
...
@@ -42,15 +42,15 @@ func newHashRange(start common.Hash, num uint64) *hashRange {
...
@@ -42,15 +42,15 @@ func newHashRange(start common.Hash, num uint64) *hashRange {
step256
.
SetFromBig
(
step
)
step256
.
SetFromBig
(
step
)
return
&
hashRange
{
return
&
hashRange
{
current
:
uint256
.
New
Int
(
)
.
SetBytes32
(
start
[
:
]),
current
:
new
(
uint256
.
Int
)
.
SetBytes32
(
start
[
:
]),
step
:
step256
,
step
:
step256
,
}
}
}
}
// Next pushes the hash range to the next interval.
// Next pushes the hash range to the next interval.
func
(
r
*
hashRange
)
Next
()
bool
{
func
(
r
*
hashRange
)
Next
()
bool
{
next
:=
new
(
uint256
.
Int
)
next
,
overflow
:=
new
(
uint256
.
Int
)
.
AddOverflow
(
r
.
current
,
r
.
step
)
if
overflow
:=
next
.
AddOverflow
(
r
.
current
,
r
.
step
);
overflow
{
if
overflow
{
return
false
return
false
}
}
r
.
current
=
next
r
.
current
=
next
...
@@ -65,16 +65,17 @@ func (r *hashRange) Start() common.Hash {
...
@@ -65,16 +65,17 @@ func (r *hashRange) Start() common.Hash {
// End returns the last hash in the current interval.
// End returns the last hash in the current interval.
func
(
r
*
hashRange
)
End
()
common
.
Hash
{
func
(
r
*
hashRange
)
End
()
common
.
Hash
{
// If the end overflows (non divisible range), return a shorter interval
// If the end overflows (non divisible range), return a shorter interval
next
:=
new
(
uint256
.
Int
)
next
,
overflow
:=
new
(
uint256
.
Int
)
.
AddOverflow
(
r
.
current
,
r
.
step
)
if
overflow
:=
next
.
AddOverflow
(
r
.
current
,
r
.
step
);
overflow
{
if
overflow
{
return
common
.
HexToHash
(
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
)
return
common
.
HexToHash
(
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
)
}
}
return
ne
w
(
uint256
.
Int
)
.
Sub
(
next
,
uint256
.
NewInt
()
.
SetOne
()
)
.
Bytes32
()
return
ne
xt
.
SubUint64
(
next
,
1
)
.
Bytes32
()
}
}
// incHash returns the next hash, in lexicographical order (a.k.a plus one)
// incHash returns the next hash, in lexicographical order (a.k.a plus one)
func
incHash
(
h
common
.
Hash
)
common
.
Hash
{
func
incHash
(
h
common
.
Hash
)
common
.
Hash
{
a
:=
uint256
.
NewInt
()
.
SetBytes32
(
h
[
:
])
var
a
uint256
.
Int
a
.
Add
(
a
,
uint256
.
NewInt
()
.
SetOne
())
a
.
SetBytes32
(
h
[
:
])
a
.
AddUint64
(
&
a
,
1
)
return
common
.
Hash
(
a
.
Bytes32
())
return
common
.
Hash
(
a
.
Bytes32
())
}
}
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