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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
5cdc2dff
Unverified
Commit
5cdc2dff
authored
4 years ago
by
Gary Rong
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
trie: fix TestBadRangeProof unit test (#21034)
parent
c2147ee1
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
trie/proof_test.go
+14
-3
14 additions, 3 deletions
trie/proof_test.go
with
14 additions
and
3 deletions
trie/proof_test.go
+
14
−
3
View file @
5cdc2dff
...
...
@@ -177,12 +177,23 @@ func TestBadRangeProof(t *testing.T) {
vals
[
index
]
=
randBytes
(
20
)
// In theory it can't be same
case
2
:
// 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
)
keys
=
append
(
keys
[
:
index
],
keys
[
index
+
1
:
]
...
)
vals
=
append
(
vals
[
:
index
],
vals
[
index
+
1
:
]
...
)
if
len
(
keys
)
<=
1
{
if
(
index
==
end
-
start
-
1
||
index
==
0
)
&&
end
<=
100
{
continue
}
keys
=
append
(
keys
[
:
index
],
keys
[
index
+
1
:
]
...
)
vals
=
append
(
vals
[
:
index
],
vals
[
index
+
1
:
]
...
)
case
3
:
// Switched entry slice, same effect with gapped
index
=
mrand
.
Intn
(
end
-
start
)
...
...
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