Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
5cdc2dff
Unverified
Commit
5cdc2dff
authored
May 06, 2020
by
gary rong
Committed by
GitHub
May 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trie: fix TestBadRangeProof unit test (#21034)
parent
c2147ee1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
proof_test.go
trie/proof_test.go
+14
-3
No files found.
trie/proof_test.go
View file @
5cdc2dff
...
@@ -177,12 +177,23 @@ func TestBadRangeProof(t *testing.T) {
...
@@ -177,12 +177,23 @@ func TestBadRangeProof(t *testing.T) {
vals
[
index
]
=
randBytes
(
20
)
// In theory it can't be same
vals
[
index
]
=
randBytes
(
20
)
// In theory it can't be same
case
2
:
case
2
:
// Gapped entry slice
// Gapped entry slice
// There are only two elements, skip it. Dropped any element
// will lead to single edge proof which is always correct.
if
end
-
start
<=
2
{
continue
}
// If the dropped element is the first or last one and it's a
// batch of small size elements. In this special case, it can
// happen that the proof for the edge element is exactly same
// with the first/last second element(since small values are
// embedded in the parent). Avoid this case.
index
=
mrand
.
Intn
(
end
-
start
)
index
=
mrand
.
Intn
(
end
-
start
)
keys
=
append
(
keys
[
:
index
],
keys
[
index
+
1
:
]
...
)
if
(
index
==
end
-
start
-
1
||
index
==
0
)
&&
end
<=
100
{
vals
=
append
(
vals
[
:
index
],
vals
[
index
+
1
:
]
...
)
if
len
(
keys
)
<=
1
{
continue
continue
}
}
keys
=
append
(
keys
[
:
index
],
keys
[
index
+
1
:
]
...
)
vals
=
append
(
vals
[
:
index
],
vals
[
index
+
1
:
]
...
)
case
3
:
case
3
:
// Switched entry slice, same effect with gapped
// Switched entry slice, same effect with gapped
index
=
mrand
.
Intn
(
end
-
start
)
index
=
mrand
.
Intn
(
end
-
start
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment