-
Notifications
You must be signed in to change notification settings - Fork 268
chore: minor changes from audit tool #3165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
fc7bdc8
minor changes from audit tool
tac0turtle 5fa641d
Merge branch 'main' into marko/audit-bits
tac0turtle 494234f
just deps
tac0turtle 910d299
revert
tac0turtle 9d42c81
revert++
tac0turtle 46e8b30
Merge branch 'main' into marko/audit-bits
julienrbrt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| package types | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "google.golang.org/protobuf/proto" | ||
|
|
||
| pb "github.com/evstack/ev-node/types/pb/evnode/v1" | ||
| ) | ||
|
|
||
| func FuzzHeaderUnmarshalBinary(f *testing.F) { | ||
| // Seed with a valid marshalled header | ||
| h := Header{} | ||
| h.BaseHeader.Height = 1 | ||
| h.BaseHeader.ChainID = "test" | ||
| h.BaseHeader.Time = 1000 | ||
| if data, err := h.MarshalBinary(); err == nil { | ||
| f.Add(data) | ||
| } | ||
| f.Add([]byte{}) | ||
| f.Add([]byte{0xff, 0xff, 0xff}) | ||
|
|
||
| f.Fuzz(func(t *testing.T, data []byte) { | ||
| var h Header | ||
| if err := h.UnmarshalBinary(data); err != nil { | ||
| return | ||
| } | ||
| // Round-trip: if unmarshal succeeds, marshal should not panic | ||
| _, _ = h.MarshalBinary() | ||
| }) | ||
| } | ||
|
|
||
| func FuzzDataUnmarshalBinary(f *testing.F) { | ||
| d := Data{Txs: Txs{[]byte("tx1"), []byte("tx2")}} | ||
| if data, err := d.MarshalBinary(); err == nil { | ||
| f.Add(data) | ||
| } | ||
| f.Add([]byte{}) | ||
|
|
||
| f.Fuzz(func(t *testing.T, data []byte) { | ||
| var d Data | ||
| if err := d.UnmarshalBinary(data); err != nil { | ||
| return | ||
| } | ||
| _, _ = d.MarshalBinary() | ||
| }) | ||
| } | ||
|
|
||
| func FuzzSignedHeaderUnmarshalBinary(f *testing.F) { | ||
| f.Add([]byte{}) | ||
| f.Add([]byte{0x0a, 0x00}) | ||
|
|
||
| f.Fuzz(func(t *testing.T, data []byte) { | ||
| var sh SignedHeader | ||
| if err := sh.UnmarshalBinary(data); err != nil { | ||
| return | ||
| } | ||
| _, _ = sh.MarshalBinary() | ||
| }) | ||
| } | ||
|
|
||
| func FuzzSignedDataUnmarshalBinary(f *testing.F) { | ||
| f.Add([]byte{}) | ||
| f.Add([]byte{0x0a, 0x00}) | ||
|
|
||
| f.Fuzz(func(t *testing.T, data []byte) { | ||
| var sd SignedData | ||
| if err := sd.UnmarshalBinary(data); err != nil { | ||
| return | ||
| } | ||
| _, _ = sd.MarshalBinary() | ||
| }) | ||
| } | ||
|
|
||
| func FuzzDAEnvelopeUnmarshalBinary(f *testing.F) { | ||
| f.Add([]byte{}) | ||
|
|
||
| f.Fuzz(func(t *testing.T, data []byte) { | ||
| var sh SignedHeader | ||
| if _, err := sh.UnmarshalDAEnvelope(data); err != nil { | ||
| return | ||
| } | ||
| _, _ = sh.MarshalDAEnvelope(nil) | ||
| }) | ||
| } | ||
|
|
||
| func FuzzStateFromProto(f *testing.F) { | ||
| s := State{ChainID: "test", LastBlockHeight: 1} | ||
| if p, err := s.ToProto(); err == nil { | ||
| if data, err := proto.Marshal(p); err == nil { | ||
| f.Add(data) | ||
| } | ||
| } | ||
| f.Add([]byte{}) | ||
|
|
||
| f.Fuzz(func(t *testing.T, data []byte) { | ||
| var ps pb.State | ||
| if err := proto.Unmarshal(data, &ps); err != nil { | ||
| return | ||
| } | ||
| var s State | ||
| _ = s.FromProto(&ps) | ||
| }) | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.