You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a minor but confusing bug in the ssz/tests/consensus_specs_test.go:fuzzConsensusSpecType function line:835. Specifically, in the buffer leftover path, we store the re-encoded bytes in a variable named bin, but the error message references a variable named blob (used in the stream leftover path). This leads to incorrect or misleading data being shown in the error logs.
bin:=make([]byte, ssz.SizeOnFork(obj, ssz.ForkFuture))
iferr:=ssz.EncodeToBytesOnFork(bin, obj, ssz.ForkFuture); err!=nil {
t.Fatalf("failed to re-encode buffer from used object: %v", err)
}
if!bytes.Equal(bin, inSSZ) {
prefix:=commonPrefix(bin, inSSZ)
t.Fatalf("re-encoded buffer from used object mismatch: have %x, want %x, common prefix %d, have left %x, want left %x",
blob, inSSZ, len(prefix), bin[len(prefix):], inSSZ[len(prefix):])
}
Suggested Fix
Simply replace blob with bin in that error message. Here's a minimal patch:
if!bytes.Equal(bin, inSSZ) {
prefix:=commonPrefix(bin, inSSZ)
t.Fatalf("re-encoded buffer from used object mismatch: have %x, want %x, common prefix %d, have left %x, want left %x",
-blob, inSSZ, len(prefix), bin[len(prefix):], inSSZ[len(prefix):])
+bin, inSSZ, len(prefix), bin[len(prefix):], inSSZ[len(prefix):])
}
This ensures the error message accurately shows the content of bin (the actual buffer re-encode), instead of the variable from the stream leftover path.
The text was updated successfully, but these errors were encountered:
Description
There's a minor but confusing bug in the
ssz/tests/consensus_specs_test.go:fuzzConsensusSpecType
functionline:835
. Specifically, in the buffer leftover path, we store the re-encoded bytes in a variable named bin, but the error message references a variable named blob (used in the stream leftover path). This leads to incorrect or misleading data being shown in the error logs.Reference
File: tests/consensus_specs_test.go
Suggested Fix
Simply replace
blob
withbin
in that error message. Here's a minimal patch:This ensures the error message accurately shows the content of
bin
(the actual buffer re-encode), instead of the variable from the stream leftover path.The text was updated successfully, but these errors were encountered: