Commit e87e5ef2 authored by Sebastian Stammler's avatar Sebastian Stammler Committed by GitHub

op-service/eth: Optimize ssz decoding (#10362)

parent 8fe77960
......@@ -319,6 +319,9 @@ func (payload *ExecutionPayload) UnmarshalSSZ(version BlockVersion, scope uint32
if withdrawalsOffset < transactionsOffset {
return ErrBadWithdrawalsOffset
}
if withdrawalsOffset > scope {
return fmt.Errorf("withdrawals offset is too large: %d", withdrawalsOffset)
}
}
if version == BlockV3 {
......@@ -345,10 +348,6 @@ func (payload *ExecutionPayload) UnmarshalSSZ(version BlockVersion, scope uint32
payload.Transactions = txs
if version.HasWithdrawals() {
if withdrawalsOffset > scope {
return fmt.Errorf("withdrawals offset is too large: %d", withdrawalsOffset)
}
withdrawals, err := unmarshalWithdrawals(buf[withdrawalsOffset:])
if err != nil {
return fmt.Errorf("failed to unmarshal withdrawals list: %w", err)
......
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