@@ -318,6 +318,9 @@ func ReadCanonicalRawReceipt(db ethdb.Reader, blockHash common.Hash, blockNumber
318
318
// https://eips.ethereum.org/EIPS/eip-7745#hash-tree-structure
319
319
func ReadFilterMapExtRow (db ethdb.KeyValueReader , mapRowIndex uint64 , bitLength uint ) ([]uint32 , error ) {
320
320
byteLength := int (bitLength ) / 8
321
+ if int (bitLength ) != byteLength * 8 {
322
+ panic ("invalid bit length" )
323
+ }
321
324
key := filterMapRowKey (mapRowIndex , false )
322
325
has , err := db .Has (key )
323
326
if err != nil {
@@ -344,6 +347,9 @@ func ReadFilterMapExtRow(db ethdb.KeyValueReader, mapRowIndex uint64, bitLength
344
347
345
348
func ReadFilterMapBaseRows (db ethdb.KeyValueReader , mapRowIndex uint64 , rowCount uint32 , bitLength uint ) ([][]uint32 , error ) {
346
349
byteLength := int (bitLength ) / 8
350
+ if int (bitLength ) != byteLength * 8 {
351
+ panic ("invalid bit length" )
352
+ }
347
353
key := filterMapRowKey (mapRowIndex , true )
348
354
has , err := db .Has (key )
349
355
if err != nil {
@@ -403,6 +409,9 @@ func ReadFilterMapBaseRows(db ethdb.KeyValueReader, mapRowIndex uint64, rowCount
403
409
// or deletes any existing entry if the row is empty.
404
410
func WriteFilterMapExtRow (db ethdb.KeyValueWriter , mapRowIndex uint64 , row []uint32 , bitLength uint ) {
405
411
byteLength := int (bitLength ) / 8
412
+ if int (bitLength ) != byteLength * 8 {
413
+ panic ("invalid bit length" )
414
+ }
406
415
var err error
407
416
if len (row ) > 0 {
408
417
encRow := make ([]byte , len (row )* byteLength )
@@ -422,6 +431,9 @@ func WriteFilterMapExtRow(db ethdb.KeyValueWriter, mapRowIndex uint64, row []uin
422
431
423
432
func WriteFilterMapBaseRows (db ethdb.KeyValueWriter , mapRowIndex uint64 , rows [][]uint32 , bitLength uint ) {
424
433
byteLength := int (bitLength ) / 8
434
+ if int (bitLength ) != byteLength * 8 {
435
+ panic ("invalid bit length" )
436
+ }
425
437
var entryCount , zeroBits int
426
438
for i , row := range rows {
427
439
if len (row ) > 0 {
0 commit comments