Commit af72fd09 authored by Maurelian's avatar Maurelian

op-node: Fillbytes size check in l1 block info

parent 57b7e708
...@@ -40,6 +40,10 @@ func (info *L1BlockInfo) MarshalBinary() ([]byte, error) { ...@@ -40,6 +40,10 @@ func (info *L1BlockInfo) MarshalBinary() ([]byte, error) {
offset += 32 offset += 32
binary.BigEndian.PutUint64(data[offset+24:offset+32], info.Time) binary.BigEndian.PutUint64(data[offset+24:offset+32], info.Time)
offset += 32 offset += 32
// Ensure that the baseFee is not too large.
if info.BaseFee.BitLen() > 256 {
return nil, fmt.Errorf("base fee exceeds 256 bits: %d", info.BaseFee)
}
info.BaseFee.FillBytes(data[offset : offset+32]) info.BaseFee.FillBytes(data[offset : offset+32])
offset += 32 offset += 32
copy(data[offset:offset+32], info.BlockHash.Bytes()) copy(data[offset:offset+32], info.BlockHash.Bytes())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment