Skip to content

Commit

Permalink
blob too big check was off by x32
Browse files Browse the repository at this point in the history
  • Loading branch information
jagdeep sidhu committed Aug 26, 2022
1 parent 5f0ee47 commit 19b4b95
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/types/data_blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ func (n *NEVMBlob) FromWire(NEVMBlobWire *wire.NEVMBlob) error {
return errors.New("invalid proof")
}
lenBlob := len(NEVMBlobWire.Blob)
if lenBlob > params.FieldElementsPerBlob {
return errors.New("Blob too big")
}
if lenBlob < 1024 {
return errors.New("Blob too small")
}
Expand All @@ -124,6 +121,9 @@ func (n *NEVMBlob) FromWire(NEVMBlobWire *wire.NEVMBlob) error {
}
n.Blob = make([]bls.Fr, params.FieldElementsPerBlob)
numElements := lenBlob / 32
if numElements > params.FieldElementsPerBlob {
return errors.New("Blob too big")
}
var inputPoint [32]byte
for i := 0; i < numElements; i++ {
copy(inputPoint[:32], NEVMBlobWire.Blob[i*32:(i+1)*32])
Expand All @@ -139,9 +139,6 @@ func (n *NEVMBlob) FromBytes(blob []byte) error {
if lenBlob == 0 {
return errors.New("empty blob")
}
if lenBlob > params.FieldElementsPerBlob {
return errors.New("Blob too big")
}
if lenBlob < 1024 {
return errors.New("Blob too small")
}
Expand All @@ -150,6 +147,9 @@ func (n *NEVMBlob) FromBytes(blob []byte) error {
}
n.Blob = make([]bls.Fr, params.FieldElementsPerBlob)
numElements := lenBlob / 32
if numElements > params.FieldElementsPerBlob {
return errors.New("Blob too big")
}
var inputPoint [32]byte
for i := 0; i < numElements; i++ {
copy(inputPoint[:32], blob[i*32:(i+1)*32])
Expand Down

0 comments on commit 19b4b95

Please sign in to comment.