mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Fix SubmitPoolSyncCommitteeSignatures API endpoint (#9646)
* Fix `SubmitPoolSyncCommitteeSignatures` API endpoint * fix test * fix another test Co-authored-by: Raul Jordan <raul@prysmaticlabs.com> Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -366,14 +366,3 @@ func IsHex(b []byte) bool {
|
||||
}
|
||||
return hexRegex.Match(b)
|
||||
}
|
||||
|
||||
// IsHexOfLen checks whether the byte array is a hex number prefixed with '0x' and containing the required number of digits.
|
||||
func IsHexOfLen(b []byte, length uint64) bool {
|
||||
if b == nil {
|
||||
return false
|
||||
}
|
||||
matches := hexRegex.Match(b)
|
||||
// Add 2 to account for '0x'
|
||||
expectedLen := int(length) + 2
|
||||
return matches && len(b) == expectedLen
|
||||
}
|
||||
|
||||
@@ -398,28 +398,6 @@ func TestIsHex(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsHexOfLen(t *testing.T) {
|
||||
tests := []struct {
|
||||
b []byte
|
||||
l uint64
|
||||
result bool
|
||||
}{
|
||||
{nil, 0, false},
|
||||
{[]byte(""), 0, false},
|
||||
{[]byte("0x"), 2, false},
|
||||
{[]byte("0x0"), 2, false},
|
||||
{[]byte("foo"), 3, false},
|
||||
{[]byte("1234567890abcDEF"), 16, false},
|
||||
{[]byte("XYZ4567890abcDEF1234567890abcDEF1234567890abcDEF1234567890abcDEF"), 64, false},
|
||||
{[]byte("0x1234567890abcDEF1234567890abcDEF1234567890abcDEF1234567890abcDEF"), 64, true},
|
||||
{[]byte("1234567890abcDEF1234567890abcDEF1234567890abcDEF1234567890abcDEF"), 64, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
isHex := bytesutil.IsHexOfLen(tt.b, tt.l)
|
||||
assert.Equal(t, tt.result, isHex)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSafeCopyRootAtIndex(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user