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
github
maticnetwork
bor
Commits
392151e2
Commit
392151e2
authored
7 years ago
by
Egon Elbre
Browse files
Options
Downloads
Patches
Plain Diff
common: fix megacheck warnings
parent
b159cdd8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/bitutil/compress_test.go
+4
-4
4 additions, 4 deletions
common/bitutil/compress_test.go
common/hexutil/json.go
+4
-5
4 additions, 5 deletions
common/hexutil/json.go
with
8 additions
and
9 deletions
common/bitutil/compress_test.go
+
4
−
4
View file @
392151e2
...
...
@@ -121,20 +121,20 @@ func TestCompression(t *testing.T) {
in
:=
hexutil
.
MustDecode
(
"0x4912385c0e7b64000000"
)
out
:=
hexutil
.
MustDecode
(
"0x80fe4912385c0e7b64"
)
if
data
:=
CompressBytes
(
in
);
bytes
.
Compare
(
data
,
out
)
!=
0
{
if
data
:=
CompressBytes
(
in
);
!
bytes
.
Equal
(
data
,
out
)
{
t
.
Errorf
(
"encoding mismatch for sparse data: have %x, want %x"
,
data
,
out
)
}
if
data
,
err
:=
DecompressBytes
(
out
,
len
(
in
));
err
!=
nil
||
bytes
.
Compare
(
data
,
in
)
!=
0
{
if
data
,
err
:=
DecompressBytes
(
out
,
len
(
in
));
err
!=
nil
||
!
bytes
.
Equal
(
data
,
in
)
{
t
.
Errorf
(
"decoding mismatch for sparse data: have %x, want %x, error %v"
,
data
,
in
,
err
)
}
// Check the the compression returns the input if the bitset encoding is longer
in
=
hexutil
.
MustDecode
(
"0xdf7070533534333636313639343638373532313536346c1bc33339343837313070706336343035336336346c65fefb3930393233383838ac2f65fefb"
)
out
=
hexutil
.
MustDecode
(
"0xdf7070533534333636313639343638373532313536346c1bc33339343837313070706336343035336336346c65fefb3930393233383838ac2f65fefb"
)
if
data
:=
CompressBytes
(
in
);
bytes
.
Compare
(
data
,
out
)
!=
0
{
if
data
:=
CompressBytes
(
in
);
!
bytes
.
Equal
(
data
,
out
)
{
t
.
Errorf
(
"encoding mismatch for dense data: have %x, want %x"
,
data
,
out
)
}
if
data
,
err
:=
DecompressBytes
(
out
,
len
(
in
));
err
!=
nil
||
bytes
.
Compare
(
data
,
in
)
!=
0
{
if
data
,
err
:=
DecompressBytes
(
out
,
len
(
in
));
err
!=
nil
||
!
bytes
.
Equal
(
data
,
in
)
{
t
.
Errorf
(
"decoding mismatch for dense data: have %x, want %x, error %v"
,
data
,
in
,
err
)
}
// Check that decompressing a longer input than the target fails
...
...
This diff is collapsed.
Click to expand it.
common/hexutil/json.go
+
4
−
5
View file @
392151e2
...
...
@@ -26,11 +26,10 @@ import (
)
var
(
textZero
=
[]
byte
(
`0x0`
)
bytesT
=
reflect
.
TypeOf
(
Bytes
(
nil
))
bigT
=
reflect
.
TypeOf
((
*
Big
)(
nil
))
uintT
=
reflect
.
TypeOf
(
Uint
(
0
))
uint64T
=
reflect
.
TypeOf
(
Uint64
(
0
))
bytesT
=
reflect
.
TypeOf
(
Bytes
(
nil
))
bigT
=
reflect
.
TypeOf
((
*
Big
)(
nil
))
uintT
=
reflect
.
TypeOf
(
Uint
(
0
))
uint64T
=
reflect
.
TypeOf
(
Uint64
(
0
))
)
// Bytes marshals/unmarshals as a JSON string with 0x prefix.
...
...
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