Skip to content

test/fuzz: add crypto/merkle.FuzzProofsFromByteSlices - #8470

Closed
odeke-em wants to merge 1 commit into
tendermint:masterfrom
orijtech:fuzz-add-crypto_merkle-FuzzProofsFromByteSlices
Closed

odeke-em wants to merge 1 commit into
tendermint:masterfrom
orijtech:fuzz-add-crypto_merkle-FuzzProofsFromByteSlices

Conversation

@odeke-em

@odeke-em odeke-em commented May 6, 2022

Copy link
Copy Markdown
Contributor

Adds a fuzzer to exorcise merkle.ProofsFromByteSlices.

Adds a fuzzer to exorcise merkle.ProofsFromByteSlices.

@creachadair creachadair left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple nits.

var fakeSeparator = []byte("***FAKE_MARKER***")

for i := 0; i < 10; i++ {
total := 100

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
total := 100
const total = 100

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of pedantic :-)

}

// [][]byte isn't supported as an input hence add []byte values.
var fakeSeparator = []byte("***FAKE_MARKER***")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var fakeSeparator = []byte("***FAKE_MARKER***")
fakeSeparator := []byte("***FAKE_MARKER***")

Comment on lines +9 to +11
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/crypto/tmhash"
tmrand "github.com/tendermint/tendermint/libs/rand"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/crypto/tmhash"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmcrypto "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/merkle"
tmrand "github.com/tendermint/tendermint/libs/rand"

func FuzzProofsFromByteSlices(f *testing.F) {
seeds := [][]byte{
nil,
[]byte{},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[]byte{},
{},

total := 100
seed := make([][]byte, total)
for j := 0; j < total; j++ {
seed[j] = tmrand.Bytes(tmhash.Size)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
seed[j] = tmrand.Bytes(tmhash.Size)
seed[j] = tmrand.Bytes(tmcrypto.HashSize)

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions Bot added the stale for use by stalebot label May 21, 2022
@github-actions github-actions Bot closed this May 25, 2022
@odeke-em

odeke-em commented Jun 3, 2022

Copy link
Copy Markdown
Contributor Author

@creachadair @marbar3778 could y'all please help me reopen this PR? I was on vacation and github-actions bot closed this PR. Thank you.

mergify Bot pushed a commit that referenced this pull request Aug 3, 2022
This is a port of #8470 and #8501 from the former mainline branch, in
support of #2600 and #9076. 

No additional changes other than checking out the code have been
implemented in this PR. A subsequent PR will incorporate this code.
samricotta pushed a commit that referenced this pull request Aug 9, 2022
This is a port of #8470 and #8501 from the former mainline branch, in
support of #2600 and #9076. 

No additional changes other than checking out the code have been
implemented in this PR. A subsequent PR will incorporate this code.
samricotta pushed a commit that referenced this pull request Aug 12, 2022
This is a port of #8470 and #8501 from the former mainline branch, in
support of #2600 and #9076. 

No additional changes other than checking out the code have been
implemented in this PR. A subsequent PR will incorporate this code.
samricotta pushed a commit that referenced this pull request Aug 16, 2022
This is a port of #8470 and #8501 from the former mainline branch, in
support of #2600 and #9076. 

No additional changes other than checking out the code have been
implemented in this PR. A subsequent PR will incorporate this code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale for use by stalebot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants